Changeset 6710


Ignore:
Timestamp:
Sep 15, 2001, 11:28:23 AM (24 years ago)
Author:
sandervl
Message:

wine update

Location:
trunk/src/quartz
Files:
25 added
26 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/quartz/amerror.c

    r6649 r6710  
    1 /* $Id: amerror.c,v 1.2 2001-09-05 13:36:34 bird Exp $ */
    21
    32#include "config.h"
     
    2019LPWSTR QUARTZ_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen )
    2120{
    22     INT len;
    23 
    24     len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen );
    25     if ( len == 0 )
    26         *lpwstr = 0;
    27     return lpwstr;
     21        INT     len;
     22
     23        len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen );
     24        if ( len == 0 )
     25                *lpwstr = 0;
     26        return lpwstr;
    2827}
    2928
     
    3130static LPCSTR hresult_to_string( HRESULT hr )
    3231{
    33     switch ( hr )
    34     {
    35     #define ENTRY(x)    case x: return (const char*)#x;
    36     /* some known codes */
    37     ENTRY(S_OK)
    38     ENTRY(S_FALSE)
    39     ENTRY(E_FAIL)
    40     ENTRY(E_POINTER)
    41     ENTRY(E_NOTIMPL)
    42     ENTRY(E_NOINTERFACE)
    43     ENTRY(E_OUTOFMEMORY)
    44     ENTRY(CLASS_E_CLASSNOTAVAILABLE)
    45     ENTRY(CLASS_E_NOAGGREGATION)
    46 
    47     /* vfwmsgs.h */
    48     ENTRY(VFW_S_NO_MORE_ITEMS)
    49     ENTRY(VFW_E_BAD_KEY)
    50     ENTRY(VFW_E_INVALIDMEDIATYPE)
    51     ENTRY(VFW_E_INVALIDSUBTYPE)
    52     ENTRY(VFW_E_NEED_OWNER)
    53     ENTRY(VFW_E_ENUM_OUT_OF_SYNC)
    54     ENTRY(VFW_E_ALREADY_CONNECTED)
    55     ENTRY(VFW_E_FILTER_ACTIVE)
    56     ENTRY(VFW_E_NO_TYPES)
    57     ENTRY(VFW_E_NO_ACCEPTABLE_TYPES)
    58     ENTRY(VFW_E_INVALID_DIRECTION)
    59     ENTRY(VFW_E_NOT_CONNECTED)
    60     ENTRY(VFW_E_NO_ALLOCATOR)
    61     ENTRY(VFW_E_RUNTIME_ERROR)
    62     ENTRY(VFW_E_BUFFER_NOTSET)
    63     ENTRY(VFW_E_BUFFER_OVERFLOW)
    64     ENTRY(VFW_E_BADALIGN)
    65     ENTRY(VFW_E_ALREADY_COMMITTED)
    66     ENTRY(VFW_E_BUFFERS_OUTSTANDING)
    67     ENTRY(VFW_E_NOT_COMMITTED)
    68     ENTRY(VFW_E_SIZENOTSET)
    69     ENTRY(VFW_E_NO_CLOCK)
    70     ENTRY(VFW_E_NO_SINK)
    71     ENTRY(VFW_E_NO_INTERFACE)
    72     ENTRY(VFW_E_NOT_FOUND)
    73     ENTRY(VFW_E_CANNOT_CONNECT)
    74     ENTRY(VFW_E_CANNOT_RENDER)
    75     ENTRY(VFW_E_CHANGING_FORMAT)
    76     ENTRY(VFW_E_NO_COLOR_KEY_SET)
    77     ENTRY(VFW_E_NOT_OVERLAY_CONNECTION)
    78     ENTRY(VFW_E_NOT_SAMPLE_CONNECTION)
    79     ENTRY(VFW_E_PALETTE_SET)
    80     ENTRY(VFW_E_COLOR_KEY_SET)
    81     ENTRY(VFW_E_NO_COLOR_KEY_FOUND)
    82     ENTRY(VFW_E_NO_PALETTE_AVAILABLE)
    83     ENTRY(VFW_E_NO_DISPLAY_PALETTE)
    84     ENTRY(VFW_E_TOO_MANY_COLORS)
    85     ENTRY(VFW_E_STATE_CHANGED)
    86     ENTRY(VFW_E_NOT_STOPPED)
    87     ENTRY(VFW_E_NOT_PAUSED)
    88     ENTRY(VFW_E_NOT_RUNNING)
    89     ENTRY(VFW_E_WRONG_STATE)
    90     ENTRY(VFW_E_START_TIME_AFTER_END)
    91     ENTRY(VFW_E_INVALID_RECT)
    92     ENTRY(VFW_E_TYPE_NOT_ACCEPTED)
    93     ENTRY(VFW_E_SAMPLE_REJECTED)
    94     ENTRY(VFW_E_SAMPLE_REJECTED_EOS)
    95     ENTRY(VFW_S_DUPLICATE_NAME)
    96     ENTRY(VFW_E_DUPLICATE_NAME)
    97     ENTRY(VFW_E_TIMEOUT)
    98     ENTRY(VFW_E_INVALID_FILE_FORMAT)
    99     ENTRY(VFW_E_ENUM_OUT_OF_RANGE)
    100     ENTRY(VFW_E_CIRCULAR_GRAPH)
    101     ENTRY(VFW_E_NOT_ALLOWED_TO_SAVE)
    102     ENTRY(VFW_E_TIME_ALREADY_PASSED)
    103     ENTRY(VFW_E_ALREADY_CANCELLED)
    104     ENTRY(VFW_E_CORRUPT_GRAPH_FILE)
    105     ENTRY(VFW_E_ADVISE_ALREADY_SET)
    106     ENTRY(VFW_S_STATE_INTERMEDIATE)
    107     ENTRY(VFW_E_NO_MODEX_AVAILABLE)
    108     ENTRY(VFW_E_NO_ADVISE_SET)
    109     ENTRY(VFW_E_NO_FULLSCREEN)
    110     ENTRY(VFW_E_IN_FULLSCREEN_MODE)
    111     ENTRY(VFW_E_UNKNOWN_FILE_TYPE)
    112     ENTRY(VFW_E_CANNOT_LOAD_SOURCE_FILTER)
    113     ENTRY(VFW_S_PARTIAL_RENDER)
    114     ENTRY(VFW_E_FILE_TOO_SHORT)
    115     ENTRY(VFW_E_INVALID_FILE_VERSION)
    116     ENTRY(VFW_S_SOME_DATA_IGNORED)
    117     ENTRY(VFW_S_CONNECTIONS_DEFERRED)
    118     ENTRY(VFW_E_INVALID_CLSID)
    119     ENTRY(VFW_E_INVALID_MEDIA_TYPE)
    120     ENTRY(VFW_E_SAMPLE_TIME_NOT_SET)
    121     ENTRY(VFW_S_RESOURCE_NOT_NEEDED)
    122     ENTRY(VFW_E_MEDIA_TIME_NOT_SET)
    123     ENTRY(VFW_E_NO_TIME_FORMAT_SET)
    124     ENTRY(VFW_E_MONO_AUDIO_HW)
    125     ENTRY(VFW_S_MEDIA_TYPE_IGNORED)
    126     ENTRY(VFW_E_NO_DECOMPRESSOR)
    127     ENTRY(VFW_E_NO_AUDIO_HARDWARE)
    128     ENTRY(VFW_S_VIDEO_NOT_RENDERED)
    129     ENTRY(VFW_S_AUDIO_NOT_RENDERED)
    130     ENTRY(VFW_E_RPZA)
    131     ENTRY(VFW_S_RPZA)
    132     ENTRY(VFW_E_PROCESSOR_NOT_SUITABLE)
    133     ENTRY(VFW_E_UNSUPPORTED_AUDIO)
    134     ENTRY(VFW_E_UNSUPPORTED_VIDEO)
    135     ENTRY(VFW_E_MPEG_NOT_CONSTRAINED)
    136     ENTRY(VFW_E_NOT_IN_GRAPH)
    137     ENTRY(VFW_S_ESTIMATED)
    138     ENTRY(VFW_E_NO_TIME_FORMAT)
    139     ENTRY(VFW_E_READ_ONLY)
    140     ENTRY(VFW_S_RESERVED)
    141     ENTRY(VFW_E_BUFFER_UNDERFLOW)
    142     ENTRY(VFW_E_UNSUPPORTED_STREAM)
    143     ENTRY(VFW_E_NO_TRANSPORT)
    144     ENTRY(VFW_S_STREAM_OFF)
    145     ENTRY(VFW_S_CANT_CUE)
    146     ENTRY(VFW_E_BAD_VIDEOCD)
    147     ENTRY(VFW_S_NO_STOP_TIME)
    148     ENTRY(VFW_E_OUT_OF_VIDEO_MEMORY)
    149     ENTRY(VFW_E_VP_NEGOTIATION_FAILED)
    150     ENTRY(VFW_E_DDRAW_CAPS_NOT_SUITABLE)
    151     ENTRY(VFW_E_NO_VP_HARDWARE)
    152     ENTRY(VFW_E_NO_CAPTURE_HARDWARE)
    153     ENTRY(VFW_E_DVD_OPERATION_INHIBITED)
    154     ENTRY(VFW_E_DVD_INVALIDDOMAIN)
    155     ENTRY(VFW_E_DVD_NO_BUTTON)
    156     ENTRY(VFW_E_DVD_GRAPHNOTREADY)
    157     ENTRY(VFW_E_DVD_RENDERFAIL)
    158     ENTRY(VFW_E_DVD_DECNOTENOUGH)
    159     ENTRY(VFW_E_DDRAW_VERSION_NOT_SUITABLE)
    160     ENTRY(VFW_E_COPYPROT_FAILED)
    161     ENTRY(VFW_S_NOPREVIEWPIN)
    162     ENTRY(VFW_E_TIME_EXPIRED)
    163     ENTRY(VFW_S_DVD_NON_ONE_SEQUENTIAL)
    164     ENTRY(VFW_E_DVD_WRONG_SPEED)
    165     ENTRY(VFW_E_DVD_MENU_DOES_NOT_EXIST)
    166     ENTRY(VFW_E_DVD_CMD_CANCELLED)
    167     ENTRY(VFW_E_DVD_STATE_WRONG_VERSION)
    168     ENTRY(VFW_E_DVD_STATE_CORRUPT)
    169     ENTRY(VFW_E_DVD_STATE_WRONG_DISC)
    170     ENTRY(VFW_E_DVD_INCOMPATIBLE_REGION)
    171     ENTRY(VFW_E_DVD_NO_ATTRIBUTES)
    172     ENTRY(VFW_E_DVD_NO_GOUP_PGC)
    173     ENTRY(VFW_E_DVD_LOW_PARENTAL_LEVEL)
    174     ENTRY(VFW_E_DVD_NOT_IN_KARAOKE_MODE)
    175     ENTRY(VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE)
    176     ENTRY(VFW_S_DVD_NOT_ACCURATE)
    177     ENTRY(VFW_E_FRAME_STEP_UNSUPPORTED)
    178     ENTRY(VFW_E_DVD_STREAM_DISABLED)
    179     ENTRY(VFW_E_DVD_TITLE_UNKNOWN)
    180     ENTRY(VFW_E_DVD_INVALID_DISC)
    181     ENTRY(VFW_E_DVD_NO_RESUME_INFORMATION)
    182     ENTRY(VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD)
    183     ENTRY(VFW_E_PIN_ALREADY_BLOCKED)
    184     ENTRY(VFW_E_CERTIFICATION_FAILURE)
    185     #undef  ENTRY
    186     }
    187 
    188     return NULL;
     32        switch ( hr )
     33        {
     34        #define ENTRY(x)        case x: return (const char*)#x
     35        /* some known codes */
     36        ENTRY(S_OK);
     37        ENTRY(S_FALSE);
     38        ENTRY(E_FAIL);
     39        ENTRY(E_POINTER);
     40        ENTRY(E_NOTIMPL);
     41        ENTRY(E_NOINTERFACE);
     42        ENTRY(E_OUTOFMEMORY);
     43        ENTRY(CLASS_E_CLASSNOTAVAILABLE);
     44        ENTRY(CLASS_E_NOAGGREGATION);
     45
     46        /* vfwmsgs.h */
     47        ENTRY(VFW_S_NO_MORE_ITEMS);
     48        ENTRY(VFW_E_BAD_KEY);
     49        ENTRY(VFW_E_INVALIDMEDIATYPE);
     50        ENTRY(VFW_E_INVALIDSUBTYPE);
     51        ENTRY(VFW_E_NEED_OWNER);
     52        ENTRY(VFW_E_ENUM_OUT_OF_SYNC);
     53        ENTRY(VFW_E_ALREADY_CONNECTED);
     54        ENTRY(VFW_E_FILTER_ACTIVE);
     55        ENTRY(VFW_E_NO_TYPES);
     56        ENTRY(VFW_E_NO_ACCEPTABLE_TYPES);
     57        ENTRY(VFW_E_INVALID_DIRECTION);
     58        ENTRY(VFW_E_NOT_CONNECTED);
     59        ENTRY(VFW_E_NO_ALLOCATOR);
     60        ENTRY(VFW_E_RUNTIME_ERROR);
     61        ENTRY(VFW_E_BUFFER_NOTSET);
     62        ENTRY(VFW_E_BUFFER_OVERFLOW);
     63        ENTRY(VFW_E_BADALIGN);
     64        ENTRY(VFW_E_ALREADY_COMMITTED);
     65        ENTRY(VFW_E_BUFFERS_OUTSTANDING);
     66        ENTRY(VFW_E_NOT_COMMITTED);
     67        ENTRY(VFW_E_SIZENOTSET);
     68        ENTRY(VFW_E_NO_CLOCK);
     69        ENTRY(VFW_E_NO_SINK);
     70        ENTRY(VFW_E_NO_INTERFACE);
     71        ENTRY(VFW_E_NOT_FOUND);
     72        ENTRY(VFW_E_CANNOT_CONNECT);
     73        ENTRY(VFW_E_CANNOT_RENDER);
     74        ENTRY(VFW_E_CHANGING_FORMAT);
     75        ENTRY(VFW_E_NO_COLOR_KEY_SET);
     76        ENTRY(VFW_E_NOT_OVERLAY_CONNECTION);
     77        ENTRY(VFW_E_NOT_SAMPLE_CONNECTION);
     78        ENTRY(VFW_E_PALETTE_SET);
     79        ENTRY(VFW_E_COLOR_KEY_SET);
     80        ENTRY(VFW_E_NO_COLOR_KEY_FOUND);
     81        ENTRY(VFW_E_NO_PALETTE_AVAILABLE);
     82        ENTRY(VFW_E_NO_DISPLAY_PALETTE);
     83        ENTRY(VFW_E_TOO_MANY_COLORS);
     84        ENTRY(VFW_E_STATE_CHANGED);
     85        ENTRY(VFW_E_NOT_STOPPED);
     86        ENTRY(VFW_E_NOT_PAUSED);
     87        ENTRY(VFW_E_NOT_RUNNING);
     88        ENTRY(VFW_E_WRONG_STATE);
     89        ENTRY(VFW_E_START_TIME_AFTER_END);
     90        ENTRY(VFW_E_INVALID_RECT);
     91        ENTRY(VFW_E_TYPE_NOT_ACCEPTED);
     92        ENTRY(VFW_E_SAMPLE_REJECTED);
     93        ENTRY(VFW_E_SAMPLE_REJECTED_EOS);
     94        ENTRY(VFW_S_DUPLICATE_NAME);
     95        ENTRY(VFW_E_DUPLICATE_NAME);
     96        ENTRY(VFW_E_TIMEOUT);
     97        ENTRY(VFW_E_INVALID_FILE_FORMAT);
     98        ENTRY(VFW_E_ENUM_OUT_OF_RANGE);
     99        ENTRY(VFW_E_CIRCULAR_GRAPH);
     100        ENTRY(VFW_E_NOT_ALLOWED_TO_SAVE);
     101        ENTRY(VFW_E_TIME_ALREADY_PASSED);
     102        ENTRY(VFW_E_ALREADY_CANCELLED);
     103        ENTRY(VFW_E_CORRUPT_GRAPH_FILE);
     104        ENTRY(VFW_E_ADVISE_ALREADY_SET);
     105        ENTRY(VFW_S_STATE_INTERMEDIATE);
     106        ENTRY(VFW_E_NO_MODEX_AVAILABLE);
     107        ENTRY(VFW_E_NO_ADVISE_SET);
     108        ENTRY(VFW_E_NO_FULLSCREEN);
     109        ENTRY(VFW_E_IN_FULLSCREEN_MODE);
     110        ENTRY(VFW_E_UNKNOWN_FILE_TYPE);
     111        ENTRY(VFW_E_CANNOT_LOAD_SOURCE_FILTER);
     112        ENTRY(VFW_S_PARTIAL_RENDER);
     113        ENTRY(VFW_E_FILE_TOO_SHORT);
     114        ENTRY(VFW_E_INVALID_FILE_VERSION);
     115        ENTRY(VFW_S_SOME_DATA_IGNORED);
     116        ENTRY(VFW_S_CONNECTIONS_DEFERRED);
     117        ENTRY(VFW_E_INVALID_CLSID);
     118        ENTRY(VFW_E_INVALID_MEDIA_TYPE);
     119        ENTRY(VFW_E_SAMPLE_TIME_NOT_SET);
     120        ENTRY(VFW_S_RESOURCE_NOT_NEEDED);
     121        ENTRY(VFW_E_MEDIA_TIME_NOT_SET);
     122        ENTRY(VFW_E_NO_TIME_FORMAT_SET);
     123        ENTRY(VFW_E_MONO_AUDIO_HW);
     124        ENTRY(VFW_S_MEDIA_TYPE_IGNORED);
     125        ENTRY(VFW_E_NO_DECOMPRESSOR);
     126        ENTRY(VFW_E_NO_AUDIO_HARDWARE);
     127        ENTRY(VFW_S_VIDEO_NOT_RENDERED);
     128        ENTRY(VFW_S_AUDIO_NOT_RENDERED);
     129        ENTRY(VFW_E_RPZA);
     130        ENTRY(VFW_S_RPZA);
     131        ENTRY(VFW_E_PROCESSOR_NOT_SUITABLE);
     132        ENTRY(VFW_E_UNSUPPORTED_AUDIO);
     133        ENTRY(VFW_E_UNSUPPORTED_VIDEO);
     134        ENTRY(VFW_E_MPEG_NOT_CONSTRAINED);
     135        ENTRY(VFW_E_NOT_IN_GRAPH);
     136        ENTRY(VFW_S_ESTIMATED);
     137        ENTRY(VFW_E_NO_TIME_FORMAT);
     138        ENTRY(VFW_E_READ_ONLY);
     139        ENTRY(VFW_S_RESERVED);
     140        ENTRY(VFW_E_BUFFER_UNDERFLOW);
     141        ENTRY(VFW_E_UNSUPPORTED_STREAM);
     142        ENTRY(VFW_E_NO_TRANSPORT);
     143        ENTRY(VFW_S_STREAM_OFF);
     144        ENTRY(VFW_S_CANT_CUE);
     145        ENTRY(VFW_E_BAD_VIDEOCD);
     146        ENTRY(VFW_S_NO_STOP_TIME);
     147        ENTRY(VFW_E_OUT_OF_VIDEO_MEMORY);
     148        ENTRY(VFW_E_VP_NEGOTIATION_FAILED);
     149        ENTRY(VFW_E_DDRAW_CAPS_NOT_SUITABLE);
     150        ENTRY(VFW_E_NO_VP_HARDWARE);
     151        ENTRY(VFW_E_NO_CAPTURE_HARDWARE);
     152        ENTRY(VFW_E_DVD_OPERATION_INHIBITED);
     153        ENTRY(VFW_E_DVD_INVALIDDOMAIN);
     154        ENTRY(VFW_E_DVD_NO_BUTTON);
     155        ENTRY(VFW_E_DVD_GRAPHNOTREADY);
     156        ENTRY(VFW_E_DVD_RENDERFAIL);
     157        ENTRY(VFW_E_DVD_DECNOTENOUGH);
     158        ENTRY(VFW_E_DDRAW_VERSION_NOT_SUITABLE);
     159        ENTRY(VFW_E_COPYPROT_FAILED);
     160        ENTRY(VFW_S_NOPREVIEWPIN);
     161        ENTRY(VFW_E_TIME_EXPIRED);
     162        ENTRY(VFW_S_DVD_NON_ONE_SEQUENTIAL);
     163        ENTRY(VFW_E_DVD_WRONG_SPEED);
     164        ENTRY(VFW_E_DVD_MENU_DOES_NOT_EXIST);
     165        ENTRY(VFW_E_DVD_CMD_CANCELLED);
     166        ENTRY(VFW_E_DVD_STATE_WRONG_VERSION);
     167        ENTRY(VFW_E_DVD_STATE_CORRUPT);
     168        ENTRY(VFW_E_DVD_STATE_WRONG_DISC);
     169        ENTRY(VFW_E_DVD_INCOMPATIBLE_REGION);
     170        ENTRY(VFW_E_DVD_NO_ATTRIBUTES);
     171        ENTRY(VFW_E_DVD_NO_GOUP_PGC);
     172        ENTRY(VFW_E_DVD_LOW_PARENTAL_LEVEL);
     173        ENTRY(VFW_E_DVD_NOT_IN_KARAOKE_MODE);
     174        ENTRY(VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE);
     175        ENTRY(VFW_S_DVD_NOT_ACCURATE);
     176        ENTRY(VFW_E_FRAME_STEP_UNSUPPORTED);
     177        ENTRY(VFW_E_DVD_STREAM_DISABLED);
     178        ENTRY(VFW_E_DVD_TITLE_UNKNOWN);
     179        ENTRY(VFW_E_DVD_INVALID_DISC);
     180        ENTRY(VFW_E_DVD_NO_RESUME_INFORMATION);
     181        ENTRY(VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD);
     182        ENTRY(VFW_E_PIN_ALREADY_BLOCKED);
     183        ENTRY(VFW_E_CERTIFICATION_FAILURE);
     184        #undef  ENTRY
     185        }
     186
     187        return NULL;
    189188}
    190189
    191190/***********************************************************************
    192  *  AMGetErrorTextA (quartz.@)
     191 *      AMGetErrorTextA (quartz.@)
    193192 */
    194193DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR pszbuf, DWORD dwBufLen)
    195194{
    196     LPCSTR  lpszRes;
    197     DWORD len;
    198 
    199     lpszRes = hresult_to_string( hr );
    200     if ( lpszRes == NULL )
    201         return 0;
    202     len = (DWORD)(strlen(lpszRes)+1);
    203     if ( len > dwBufLen )
    204         return 0;
    205 
    206     memcpy( pszbuf, lpszRes, len );
    207     return len;
     195        LPCSTR  lpszRes;
     196        DWORD len;
     197
     198        lpszRes = hresult_to_string( hr );
     199        if ( lpszRes == NULL )
     200                return 0;
     201        len = (DWORD)(strlen(lpszRes)+1);
     202        if ( len > dwBufLen )
     203                return 0;
     204
     205        memcpy( pszbuf, lpszRes, len );
     206        return len;
    208207}
    209208
    210209/***********************************************************************
    211  *  AMGetErrorTextW (quartz.@)
     210 *      AMGetErrorTextW (quartz.@)
    212211 */
    213212DWORD WINAPI AMGetErrorTextW(HRESULT hr, LPWSTR pwszbuf, DWORD dwBufLen)
    214213{
    215     CHAR    szBuf[MAX_ERROR_TEXT_LEN+1];
    216     DWORD   dwLen;
    217 
    218     dwLen = AMGetErrorTextA(hr,szBuf,MAX_ERROR_TEXT_LEN);
    219     if ( dwLen == 0 )
    220         return 0;
    221     szBuf[dwLen] = 0;
    222 
    223     QUARTZ_strncpyAtoW( pwszbuf, szBuf, dwBufLen );
    224 
    225     return lstrlenW( pwszbuf );
    226 }
     214        CHAR    szBuf[MAX_ERROR_TEXT_LEN+1];
     215        DWORD   dwLen;
     216
     217        dwLen = AMGetErrorTextA(hr,szBuf,MAX_ERROR_TEXT_LEN);
     218        if ( dwLen == 0 )
     219                return 0;
     220        szBuf[dwLen] = 0;
     221
     222        QUARTZ_strncpyAtoW( pwszbuf, szBuf, dwBufLen );
     223
     224        return lstrlenW( pwszbuf );
     225}
  • TabularUnified trunk/src/quartz/complist.c

    r6649 r6710  
    1 /* $Id: complist.c,v 1.2 2001-09-05 13:36:34 bird Exp $ */
    21/*
    32 * List of components. (for internal use)
     
    2524struct QUARTZ_CompList
    2625{
    27     QUARTZ_CompListItem*    pFirst;
    28     QUARTZ_CompListItem*    pLast;
     26        QUARTZ_CompListItem*    pFirst;
     27        QUARTZ_CompListItem*    pLast;
     28        CRITICAL_SECTION                csList;
    2929};
    3030
    3131struct QUARTZ_CompListItem
    3232{
    33     IUnknown*   punk;
    34     QUARTZ_CompListItem*    pNext;
    35     QUARTZ_CompListItem*    pPrev;
     33        IUnknown*       punk;
     34        QUARTZ_CompListItem*    pNext;
     35        QUARTZ_CompListItem*    pPrev;
     36        void*   pvData;
     37        DWORD   dwDataLen;
    3638};
    3739
     
    3941QUARTZ_CompList* QUARTZ_CompList_Alloc( void )
    4042{
    41     QUARTZ_CompList*    pList;
    42 
    43     pList = (QUARTZ_CompList*)QUARTZ_AllocMem( sizeof(QUARTZ_CompList) );
    44     if ( pList != NULL )
    45     {
    46         /* construct. */
    47         pList->pFirst = NULL;
    48         pList->pLast = NULL;
    49     }
    50 
    51     return pList;
     43        QUARTZ_CompList*        pList;
     44
     45        pList = (QUARTZ_CompList*)QUARTZ_AllocMem( sizeof(QUARTZ_CompList) );
     46        if ( pList != NULL )
     47        {
     48                /* construct. */
     49                pList->pFirst = NULL;
     50                pList->pLast = NULL;
     51
     52                InitializeCriticalSection( &pList->csList );
     53        }
     54
     55        return pList;
    5256}
    5357
    5458void QUARTZ_CompList_Free( QUARTZ_CompList* pList )
    5559{
    56     QUARTZ_CompListItem*    pCur;
    57     QUARTZ_CompListItem*    pNext;
    58 
    59     if ( pList != NULL )
    60     {
    61         pCur = pList->pFirst;
    62         while ( pCur != NULL )
    63         {
    64             pNext = pCur->pNext;
    65             if ( pCur->punk != NULL )
    66                 IUnknown_Release( pCur->punk );
    67             QUARTZ_FreeMem( pCur );
    68             pCur = pNext;
    69         }
    70         QUARTZ_FreeMem( pList );
    71     }
    72 }
    73 
    74 QUARTZ_CompList* QUARTZ_CompList_Dup( QUARTZ_CompList* pList )
    75 {
    76     QUARTZ_CompList*    pNewList;
    77     QUARTZ_CompListItem*    pCur;
    78     HRESULT hr;
    79 
    80     pNewList = QUARTZ_CompList_Alloc();
    81     if ( pNewList == NULL )
    82         return NULL;
    83 
    84     pCur = pList->pFirst;
    85     while ( pCur != NULL )
    86     {
    87         if ( pCur->punk != NULL )
    88         {
    89             hr = QUARTZ_CompList_AddComp( pNewList, pCur->punk );
    90             if ( FAILED(hr) )
    91             {
    92                 QUARTZ_CompList_Free( pNewList );
    93                 return NULL;
    94             }
    95         }
    96         pCur = pCur->pNext;
    97     }
    98 
    99     return pNewList;
    100 }
    101 
    102 HRESULT QUARTZ_CompList_AddComp( QUARTZ_CompList* pList, IUnknown* punk )
    103 {
    104     QUARTZ_CompListItem*    pItem;
    105 
    106     pItem = (QUARTZ_CompListItem*)QUARTZ_AllocMem( sizeof(QUARTZ_CompListItem) );
    107     if ( pItem == NULL )
    108         return E_OUTOFMEMORY; /* out of memory. */
    109     pItem->punk = punk; IUnknown_AddRef(punk);
    110 
    111     if ( pList->pFirst != NULL )
    112         pList->pFirst->pPrev = pItem;
    113     else
    114         pList->pLast = pItem;
    115     pList->pFirst = pItem;
    116     pItem->pNext = pList->pFirst;
    117     pItem->pPrev = NULL;
    118 
    119     return S_OK;
     60        QUARTZ_CompListItem*    pCur;
     61        QUARTZ_CompListItem*    pNext;
     62
     63        if ( pList != NULL )
     64        {
     65                pCur = pList->pFirst;
     66                while ( pCur != NULL )
     67                {
     68                        pNext = pCur->pNext;
     69                        if ( pCur->punk != NULL )
     70                                IUnknown_Release( pCur->punk );
     71                        if ( pCur->pvData != NULL )
     72                                QUARTZ_FreeMem( pCur->pvData );
     73                        QUARTZ_FreeMem( pCur );
     74                        pCur = pNext;
     75                }
     76
     77                DeleteCriticalSection( &pList->csList );
     78
     79                QUARTZ_FreeMem( pList );
     80        }
     81}
     82
     83void QUARTZ_CompList_Lock( QUARTZ_CompList* pList )
     84{
     85        EnterCriticalSection( &pList->csList );
     86}
     87
     88void QUARTZ_CompList_Unlock( QUARTZ_CompList* pList )
     89{
     90        LeaveCriticalSection( &pList->csList );
     91}
     92
     93QUARTZ_CompList* QUARTZ_CompList_Dup(
     94        const QUARTZ_CompList* pList, BOOL fDupData )
     95{
     96        QUARTZ_CompList*        pNewList;
     97        const QUARTZ_CompListItem*      pCur;
     98        HRESULT hr;
     99
     100        pNewList = QUARTZ_CompList_Alloc();
     101        if ( pNewList == NULL )
     102                return NULL;
     103
     104        pCur = pList->pFirst;
     105        while ( pCur != NULL )
     106        {
     107                if ( pCur->punk != NULL )
     108                {
     109                        if ( fDupData )
     110                                hr = QUARTZ_CompList_AddComp(
     111                                        pNewList, pCur->punk,
     112                                        pCur->pvData, pCur->dwDataLen );
     113                        else
     114                                hr = QUARTZ_CompList_AddComp(
     115                                        pNewList, pCur->punk, NULL, 0 );
     116                        if ( FAILED(hr) )
     117                        {
     118                                QUARTZ_CompList_Free( pNewList );
     119                                return NULL;
     120                        }
     121                }
     122                pCur = pCur->pNext;
     123        }
     124
     125        return pNewList;
     126}
     127
     128HRESULT QUARTZ_CompList_AddComp(
     129        QUARTZ_CompList* pList, IUnknown* punk,
     130        const void* pvData, DWORD dwDataLen )
     131{
     132        QUARTZ_CompListItem*    pItem;
     133
     134        pItem = (QUARTZ_CompListItem*)QUARTZ_AllocMem( sizeof(QUARTZ_CompListItem) );
     135        if ( pItem == NULL )
     136                return E_OUTOFMEMORY; /* out of memory. */
     137
     138        pItem->pvData = NULL;
     139        pItem->dwDataLen = 0;
     140        if ( pvData != NULL )
     141        {
     142                pItem->pvData = (void*)QUARTZ_AllocMem( dwDataLen );
     143                if ( pItem->pvData == NULL )
     144                {
     145                        QUARTZ_FreeMem( pItem );
     146                        return E_OUTOFMEMORY;
     147                }
     148                memcpy( pItem->pvData, pvData, dwDataLen );
     149                pItem->dwDataLen = dwDataLen;
     150        }
     151
     152        pItem->punk = punk; IUnknown_AddRef(punk);
     153
     154        if ( pList->pFirst != NULL )
     155                pList->pFirst->pPrev = pItem;
     156        else
     157                pList->pLast = pItem;
     158        pItem->pNext = pList->pFirst;
     159        pList->pFirst = pItem;
     160        pItem->pPrev = NULL;
     161
     162        return S_OK;
    120163}
    121164
    122165HRESULT QUARTZ_CompList_RemoveComp( QUARTZ_CompList* pList, IUnknown* punk )
    123166{
    124     QUARTZ_CompListItem*    pCur;
    125 
    126     pCur = QUARTZ_CompList_SearchComp( pList, punk );
    127     if ( pCur == NULL )
    128         return S_FALSE; /* already removed. */
    129 
    130     /* remove from list. */
    131     if ( pCur->pNext != NULL )
    132         pCur->pNext->pPrev = pCur->pPrev;
    133     else
    134         pList->pLast = pCur->pPrev;
    135     if ( pCur->pPrev != NULL )
    136         pCur->pPrev->pNext = pCur->pNext;
    137     else
    138         pList->pFirst = pCur->pNext;
    139 
    140     /* release this item. */
    141     if ( pCur->punk != NULL )
    142         IUnknown_Release( pCur->punk );
    143     QUARTZ_FreeMem( pCur );
    144 
    145     return S_OK;
     167        QUARTZ_CompListItem*    pCur;
     168
     169        pCur = QUARTZ_CompList_SearchComp( pList, punk );
     170        if ( pCur == NULL )
     171                return S_FALSE; /* already removed. */
     172
     173        /* remove from list. */
     174        if ( pCur->pNext != NULL )
     175                pCur->pNext->pPrev = pCur->pPrev;
     176        else
     177                pList->pLast = pCur->pPrev;
     178        if ( pCur->pPrev != NULL )
     179                pCur->pPrev->pNext = pCur->pNext;
     180        else
     181                pList->pFirst = pCur->pNext;
     182
     183        /* release this item. */
     184        if ( pCur->punk != NULL )
     185                IUnknown_Release( pCur->punk );
     186        if ( pCur->pvData != NULL )
     187                QUARTZ_FreeMem( pCur->pvData );
     188        QUARTZ_FreeMem( pCur );
     189
     190        return S_OK;
    146191}
    147192
    148193QUARTZ_CompListItem* QUARTZ_CompList_SearchComp(
    149     QUARTZ_CompList* pList, IUnknown* punk )
    150 {
    151     QUARTZ_CompListItem*    pCur;
    152 
    153     pCur = pList->pFirst;
    154     while ( pCur != NULL )
    155     {
    156         if ( pCur->punk == punk )
    157             return pCur;
    158         pCur = pCur->pNext;
    159     }
    160 
    161     return NULL;
     194        QUARTZ_CompList* pList, IUnknown* punk )
     195{
     196        QUARTZ_CompListItem*    pCur;
     197
     198        pCur = pList->pFirst;
     199        while ( pCur != NULL )
     200        {
     201                if ( pCur->punk == punk )
     202                        return pCur;
     203                pCur = pCur->pNext;
     204        }
     205
     206        return NULL;
     207}
     208
     209QUARTZ_CompListItem* QUARTZ_CompList_SearchData(
     210        QUARTZ_CompList* pList, const void* pvData, DWORD dwDataLen )
     211{
     212        QUARTZ_CompListItem*    pCur;
     213
     214        pCur = pList->pFirst;
     215        while ( pCur != NULL )
     216        {
     217                if ( pCur->dwDataLen == dwDataLen &&
     218                     !memcmp( pCur->pvData, pvData, dwDataLen ) )
     219                        return pCur;
     220                pCur = pCur->pNext;
     221        }
     222
     223        return NULL;
    162224}
    163225
    164226QUARTZ_CompListItem* QUARTZ_CompList_GetFirst(
    165     QUARTZ_CompList* pList )
    166 {
    167     return pList->pFirst;
     227        QUARTZ_CompList* pList )
     228{
     229        return pList->pFirst;
    168230}
    169231
    170232QUARTZ_CompListItem* QUARTZ_CompList_GetNext(
    171     QUARTZ_CompList* pList, QUARTZ_CompListItem* pPrev )
    172 {
    173     return pPrev->pNext;
     233        QUARTZ_CompList* pList, QUARTZ_CompListItem* pPrev )
     234{
     235        return pPrev->pNext;
    174236}
    175237
    176238IUnknown* QUARTZ_CompList_GetItemPtr( QUARTZ_CompListItem* pItem )
    177239{
    178     return pItem->punk;
    179 }
     240        return pItem->punk;
     241}
     242
     243const void* QUARTZ_CompList_GetDataPtr( QUARTZ_CompListItem* pItem )
     244{
     245        return pItem->pvData;
     246}
     247
     248DWORD QUARTZ_CompList_GetDataLength( QUARTZ_CompListItem* pItem )
     249{
     250        return pItem->dwDataLen;
     251}
  • TabularUnified trunk/src/quartz/complist.h

    r6578 r6710  
    1313QUARTZ_CompList* QUARTZ_CompList_Alloc( void );
    1414void QUARTZ_CompList_Free( QUARTZ_CompList* pList );
    15 QUARTZ_CompList* QUARTZ_CompList_Dup( QUARTZ_CompList* pList );
    16 HRESULT QUARTZ_CompList_AddComp( QUARTZ_CompList* pList, IUnknown* punk );
     15void QUARTZ_CompList_Lock( QUARTZ_CompList* pList );
     16void QUARTZ_CompList_Unlock( QUARTZ_CompList* pList );
     17
     18QUARTZ_CompList* QUARTZ_CompList_Dup(
     19        const QUARTZ_CompList* pList, BOOL fDupData );
     20HRESULT QUARTZ_CompList_AddComp(
     21        QUARTZ_CompList* pList, IUnknown* punk,
     22        const void* pvData, DWORD dwDataLen );
    1723HRESULT QUARTZ_CompList_RemoveComp( QUARTZ_CompList* pList, IUnknown* punk );
    1824QUARTZ_CompListItem* QUARTZ_CompList_SearchComp(
    1925        QUARTZ_CompList* pList, IUnknown* punk );
     26QUARTZ_CompListItem* QUARTZ_CompList_SearchData(
     27        QUARTZ_CompList* pList, const void* pvData, DWORD dwDataLen );
    2028QUARTZ_CompListItem* QUARTZ_CompList_GetFirst(
    2129        QUARTZ_CompList* pList );
     
    2331        QUARTZ_CompList* pList, QUARTZ_CompListItem* pPrev );
    2432IUnknown* QUARTZ_CompList_GetItemPtr( QUARTZ_CompListItem* pItem );
     33const void* QUARTZ_CompList_GetDataPtr( QUARTZ_CompListItem* pItem );
     34DWORD QUARTZ_CompList_GetDataLength( QUARTZ_CompListItem* pItem );
    2535
    2636
  • TabularUnified trunk/src/quartz/fgraph.c

    r6649 r6710  
    1 /* $Id: fgraph.c,v 1.3 2001-09-05 13:36:34 bird Exp $ */
    21/*
    32 * Implementation of CLSID_FilterGraph.
    4  *
    5  * FIXME - stub.
    63 *
    74 * hidenori@a2.ctktv.ne.jp
     
    2926static QUARTZ_IFEntry IFEntries[] =
    3027{
     28  { &IID_IPersist, offsetof(CFilterGraph,persist)-offsetof(CFilterGraph,unk) },
     29  { &IID_IDispatch, offsetof(CFilterGraph,disp)-offsetof(CFilterGraph,unk) },
    3130  { &IID_IFilterGraph, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
    3231  { &IID_IGraphBuilder, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
    3332  { &IID_IFilterGraph2, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
     33  { &IID_IGraphVersion, offsetof(CFilterGraph,graphversion)-offsetof(CFilterGraph,unk) },
    3434  { &IID_IMediaControl, offsetof(CFilterGraph,mediacontrol)-offsetof(CFilterGraph,unk) },
     35  { &IID_IMediaFilter, offsetof(CFilterGraph,mediafilter)-offsetof(CFilterGraph,unk) },
    3536  { &IID_IMediaEvent, offsetof(CFilterGraph,mediaevent)-offsetof(CFilterGraph,unk) },
    3637  { &IID_IMediaEventEx, offsetof(CFilterGraph,mediaevent)-offsetof(CFilterGraph,unk) },
     38  { &IID_IMediaEventSink, offsetof(CFilterGraph,mediaeventsink)-offsetof(CFilterGraph,unk) },
    3739  { &IID_IMediaPosition, offsetof(CFilterGraph,mediaposition)-offsetof(CFilterGraph,unk) },
    3840  { &IID_IMediaSeeking, offsetof(CFilterGraph,mediaseeking)-offsetof(CFilterGraph,unk) },
    3941  { &IID_IBasicVideo, offsetof(CFilterGraph,basvid)-offsetof(CFilterGraph,unk) },
     42  { &IID_IBasicVideo2, offsetof(CFilterGraph,basvid)-offsetof(CFilterGraph,unk) },
    4043  { &IID_IBasicAudio, offsetof(CFilterGraph,basaud)-offsetof(CFilterGraph,unk) },
    4144  { &IID_IVideoWindow, offsetof(CFilterGraph,vidwin)-offsetof(CFilterGraph,unk) },
    4245};
    4346
     47
     48struct FGInitEntry
     49{
     50        HRESULT (*pInit)(CFilterGraph*);
     51        void (*pUninit)(CFilterGraph*);
     52};
     53
     54static const struct FGInitEntry FGRAPH_Init[] =
     55{
     56        #define FGENT(a)        {&CFilterGraph_Init##a,&CFilterGraph_Uninit##a},
     57
     58        FGENT(IPersist)
     59        FGENT(IDispatch)
     60        FGENT(IFilterGraph2)
     61        FGENT(IGraphVersion)
     62        FGENT(IMediaControl)
     63        FGENT(IMediaFilter)
     64        FGENT(IMediaEventEx)
     65        FGENT(IMediaEventSink)
     66        FGENT(IMediaPosition)
     67        FGENT(IMediaSeeking)
     68        FGENT(IBasicVideo2)
     69        FGENT(IBasicAudio)
     70        FGENT(IVideoWindow)
     71
     72        #undef  FGENT
     73        { NULL, NULL },
     74};
     75
     76
     77static void QUARTZ_DestroyFilterGraph(IUnknown* punk)
     78{
     79        CFilterGraph_THIS(punk,unk);
     80        int     i;
     81
     82        /* At first, call Stop. */
     83        IMediaControl_Stop( CFilterGraph_IMediaControl(This) );
     84        IMediaFilter_Stop( CFilterGraph_IMediaFilter(This) );
     85
     86        i = 0;
     87        while ( FGRAPH_Init[i].pInit != NULL )
     88        {
     89                FGRAPH_Init[i].pUninit( This );
     90                i++;
     91        }
     92
     93        TRACE( "succeeded.\n" );
     94}
     95
    4496HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj)
    4597{
    46     CFilterGraph*   pfg;
     98        CFilterGraph*   pfg;
     99        HRESULT hr;
     100        int     i;
    47101
    48     TRACE("(%p,%p)\n",punkOuter,ppobj);
     102        TRACE("(%p,%p)\n",punkOuter,ppobj);
    49103
    50     pfg = (CFilterGraph*)QUARTZ_AllocObj( sizeof(CFilterGraph) );
    51     if ( pfg == NULL )
    52         return E_OUTOFMEMORY;
     104        pfg = (CFilterGraph*)QUARTZ_AllocObj( sizeof(CFilterGraph) );
     105        if ( pfg == NULL )
     106                return E_OUTOFMEMORY;
    53107
    54     QUARTZ_IUnkInit( &pfg->unk, punkOuter );
    55     CFilterGraph_InitIFilterGraph2( pfg );
    56     CFilterGraph_InitIMediaControl( pfg );
    57     CFilterGraph_InitIMediaEventEx( pfg );
    58     CFilterGraph_InitIMediaPosition( pfg );
    59     CFilterGraph_InitIMediaSeeking( pfg );
    60     CFilterGraph_InitIBasicVideo2( pfg );
    61     CFilterGraph_InitIBasicAudio( pfg );
    62     CFilterGraph_InitIVideoWindow( pfg );
     108        QUARTZ_IUnkInit( &pfg->unk, punkOuter );
    63109
    64     pfg->unk.pEntries = IFEntries;
    65     pfg->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
     110        i = 0;
     111        hr = NOERROR;
     112        while ( FGRAPH_Init[i].pInit != NULL )
     113        {
     114                hr = FGRAPH_Init[i].pInit( pfg );
     115                if ( FAILED(hr) )
     116                        break;
     117                i++;
     118        }
    66119
    67     *ppobj = (void*)(&pfg->unk);
     120        if ( FAILED(hr) )
     121        {
     122                while ( --i >= 0 )
     123                        FGRAPH_Init[i].pUninit( pfg );
     124                QUARTZ_FreeObj( pfg );
     125                return hr;
     126        }
    68127
    69     return S_OK;
     128        pfg->unk.pEntries = IFEntries;
     129        pfg->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
     130        pfg->unk.pOnFinalRelease = QUARTZ_DestroyFilterGraph;
     131
     132        *ppobj = (void*)(&pfg->unk);
     133
     134        return S_OK;
    70135}
     136
     137
  • TabularUnified trunk/src/quartz/fgraph.h

    r6578 r6710  
    88
    99        IUnknown
     10                + IPersist
     11                + IDispatch
    1012                + IFilterGraph - IGraphBuilder - IFilterGraph2
     13                + IGraphVersion
    1114                + IDispatch - IMediaControl
     15                + IPersist - IMediaFilter
    1216                + IDispatch - IMediaEvent - IMediaEventEx
     17                + IMediaEventSink
    1318                + IDispatch - IMediaPosition
    1419                + IMediaSeeking
    15                 + IDispatch - IBasicVideo (pass to a renderer)
     20                + IDispatch - IBasicVideo[2] (pass to a renderer)
    1621                + IDispatch - IBasicAudio (pass to a renderer)
    1722                + IDispatch - IVideoWindow  (pass to a renderer)
     23        (following interfaces are not implemented)
     24                + IMarshal
     25                + IFilterMapper2 - IFilterMapper3
     26                FIXME - Are there any missing interfaces???
    1827 */
    1928
    2029#include "iunk.h"
     30#include "complist.h"
     31
     32
     33typedef struct FG_IPersistImpl
     34{
     35        ICOM_VFIELD(IPersist);
     36} FG_IPersistImpl;
     37
     38typedef struct FG_IDispatchImpl
     39{
     40        ICOM_VFIELD(IDispatch);
     41} FG_IDispatchImpl;
    2142
    2243typedef struct FG_IFilterGraph2Impl
     
    2546} FG_IFilterGraph2Impl;
    2647
     48typedef struct FG_IGraphVersionImpl
     49{
     50        ICOM_VFIELD(IGraphVersion);
     51} FG_IGraphVersionImpl;
     52
    2753typedef struct FG_IMediaControlImpl
    2854{
     
    3056} FG_IMediaControlImpl;
    3157
     58typedef struct FG_IMediaFilterImpl
     59{
     60        ICOM_VFIELD(IMediaFilter);
     61} FG_IMediaFilterImpl;
     62
    3263typedef struct FG_IMediaEventImpl
    3364{
    3465        ICOM_VFIELD(IMediaEventEx);
    3566} FG_IMediaEventImpl;
     67
     68typedef struct FG_IMediaEventSinkImpl
     69{
     70        ICOM_VFIELD(IMediaEventSink);
     71} FG_IMediaEventSinkImpl;
    3672
    3773typedef struct FG_IMediaPositionImpl
     
    64100{
    65101        QUARTZ_IUnkImpl unk;
     102        FG_IPersistImpl persist;
     103        FG_IDispatchImpl        disp;
    66104        FG_IFilterGraph2Impl    fgraph;
     105        FG_IGraphVersionImpl    graphversion;
    67106        FG_IMediaControlImpl    mediacontrol;
     107        FG_IMediaFilterImpl     mediafilter;
    68108        FG_IMediaEventImpl      mediaevent;
     109        FG_IMediaEventSinkImpl  mediaeventsink;
    69110        FG_IMediaPositionImpl   mediaposition;
    70111        FG_IMediaSeekingImpl    mediaseeking;
     
    73114        FG_IVideoWindowImpl     vidwin;
    74115
     116        /* IDispatch fields. */
    75117        /* IFilterGraph2 fields. */
     118        QUARTZ_CompList*        m_pFilterList;
     119        /* IGraphVersion fields. */
     120        CRITICAL_SECTION        m_csGraphVersion;
     121        LONG    m_lGraphVersion;
    76122        /* IMediaControl fields. */
     123        /* IMediaFilter fields. */
     124        CRITICAL_SECTION        m_csGraphState;
     125        FILTER_STATE    m_stateGraph; /* must NOT accessed directly! */
    77126        /* IMediaEvent fields. */
     127        HANDLE  m_hMediaEvent;
     128        /* IMediaEventSink fields. */
    78129        /* IMediaPosition fields. */
    79130        /* IMediaSeeking fields. */
    80         /* IBasicVideo fields. */
     131        /* IBasicVideo2 fields. */
    81132        /* IBasicAudio fields. */
    82133        /* IVideoWindow fields. */
     
    84135
    85136#define CFilterGraph_THIS(iface,member)         CFilterGraph*   This = ((CFilterGraph*)(((char*)iface)-offsetof(CFilterGraph,member)))
     137#define CFilterGraph_IPersist(th)               ((IPersist*)&((th)->persist))
     138#define CFilterGraph_IDispatch(th)              ((IDispatch*)&((th)->disp))
     139#define CFilterGraph_IFilterGraph2(th)          ((IFilterGraph2*)&((th)->fgraph))
     140#define CFilterGraph_IMediaFilter(th)           ((IMediaFilter*)&((th)->mediafilter))
     141#define CFilterGraph_IMediaControl(th)          ((IMediaControl*)&((th)->mediacontrol))
    86142
    87143HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj);
    88144
    89 void CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg );
    90 void CFilterGraph_InitIMediaControl( CFilterGraph* pfg );
    91 void CFilterGraph_InitIMediaEventEx( CFilterGraph* pfg );
    92 void CFilterGraph_InitIMediaPosition( CFilterGraph* pfg );
    93 void CFilterGraph_InitIMediaSeeking( CFilterGraph* pfg );
    94 void CFilterGraph_InitIBasicVideo2( CFilterGraph* pfg );
    95 void CFilterGraph_InitIBasicAudio( CFilterGraph* pfg );
    96 void CFilterGraph_InitIVideoWindow( CFilterGraph* pfg );
     145HRESULT CFilterGraph_InitIPersist( CFilterGraph* pfg );
     146void CFilterGraph_UninitIPersist( CFilterGraph* pfg );
     147HRESULT CFilterGraph_InitIDispatch( CFilterGraph* pfg );
     148void CFilterGraph_UninitIDispatch( CFilterGraph* pfg );
     149HRESULT CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg );
     150void CFilterGraph_UninitIFilterGraph2( CFilterGraph* pfg );
     151HRESULT CFilterGraph_InitIGraphVersion( CFilterGraph* pfg );
     152void CFilterGraph_UninitIGraphVersion( CFilterGraph* pfg );
     153HRESULT CFilterGraph_InitIMediaControl( CFilterGraph* pfg );
     154void CFilterGraph_UninitIMediaControl( CFilterGraph* pfg );
     155HRESULT CFilterGraph_InitIMediaFilter( CFilterGraph* pfg );
     156void CFilterGraph_UninitIMediaFilter( CFilterGraph* pfg );
     157HRESULT CFilterGraph_InitIMediaEventEx( CFilterGraph* pfg );
     158void CFilterGraph_UninitIMediaEventEx( CFilterGraph* pfg );
     159HRESULT CFilterGraph_InitIMediaEventSink( CFilterGraph* pfg );
     160void CFilterGraph_UninitIMediaEventSink( CFilterGraph* pfg );
     161HRESULT CFilterGraph_InitIMediaPosition( CFilterGraph* pfg );
     162void CFilterGraph_UninitIMediaPosition( CFilterGraph* pfg );
     163HRESULT CFilterGraph_InitIMediaSeeking( CFilterGraph* pfg );
     164void CFilterGraph_UninitIMediaSeeking( CFilterGraph* pfg );
     165HRESULT CFilterGraph_InitIBasicVideo2( CFilterGraph* pfg );
     166void CFilterGraph_UninitIBasicVideo2( CFilterGraph* pfg );
     167HRESULT CFilterGraph_InitIBasicAudio( CFilterGraph* pfg );
     168void CFilterGraph_UninitIBasicAudio( CFilterGraph* pfg );
     169HRESULT CFilterGraph_InitIVideoWindow( CFilterGraph* pfg );
     170void CFilterGraph_UninitIVideoWindow( CFilterGraph* pfg );
    97171
    98172
  • TabularUnified trunk/src/quartz/guid.c

    r6649 r6710  
    1 /* $Id: guid.c,v 1.3 2001-09-05 13:36:35 bird Exp $ */
    21// This causes all the DEFINE_GUID macros to instantiate their GUID's
    32#define INITGUID
     
    1413#include "uuids.h"
    1514#include "control.h"
     15#include "wine/obj_property.h"
     16#include "wine/obj_propertystorage.h"
  • TabularUnified trunk/src/quartz/ibasaud.c

    r6649 r6710  
    1 /* $Id: ibasaud.c,v 1.2 2001-09-05 13:36:35 bird Exp $ */
    21/*
    32 * Implementation of IBasicAudio for FilterGraph.
     
    3130IBasicAudio_fnQueryInterface(IBasicAudio* iface,REFIID riid,void** ppobj)
    3231{
    33     CFilterGraph_THIS(iface,basaud);
     32        CFilterGraph_THIS(iface,basaud);
    3433
    35     TRACE("(%p)->()\n",This);
     34        TRACE("(%p)->()\n",This);
    3635
    37     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     36        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3837}
    3938
     
    4140IBasicAudio_fnAddRef(IBasicAudio* iface)
    4241{
    43     CFilterGraph_THIS(iface,basaud);
     42        CFilterGraph_THIS(iface,basaud);
    4443
    45     TRACE("(%p)->()\n",This);
     44        TRACE("(%p)->()\n",This);
    4645
    47     return IUnknown_AddRef(This->unk.punkControl);
     46        return IUnknown_AddRef(This->unk.punkControl);
    4847}
    4948
     
    5150IBasicAudio_fnRelease(IBasicAudio* iface)
    5251{
    53     CFilterGraph_THIS(iface,basaud);
     52        CFilterGraph_THIS(iface,basaud);
    5453
    55     TRACE("(%p)->()\n",This);
     54        TRACE("(%p)->()\n",This);
    5655
    57     return IUnknown_Release(This->unk.punkControl);
     56        return IUnknown_Release(This->unk.punkControl);
    5857}
    5958
     
    6160IBasicAudio_fnGetTypeInfoCount(IBasicAudio* iface,UINT* pcTypeInfo)
    6261{
    63     CFilterGraph_THIS(iface,basaud);
     62        CFilterGraph_THIS(iface,basaud);
    6463
    65     FIXME("(%p)->()\n",This);
     64        FIXME("(%p)->()\n",This);
    6665
    67     return E_NOTIMPL;
     66        return E_NOTIMPL;
    6867}
    6968
     
    7170IBasicAudio_fnGetTypeInfo(IBasicAudio* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
    7271{
    73     CFilterGraph_THIS(iface,basaud);
     72        CFilterGraph_THIS(iface,basaud);
    7473
    75     FIXME("(%p)->()\n",This);
     74        FIXME("(%p)->()\n",This);
    7675
    77     return E_NOTIMPL;
     76        return E_NOTIMPL;
    7877}
    7978
     
    8180IBasicAudio_fnGetIDsOfNames(IBasicAudio* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
    8281{
    83     CFilterGraph_THIS(iface,basaud);
     82        CFilterGraph_THIS(iface,basaud);
    8483
    85     FIXME("(%p)->()\n",This);
     84        FIXME("(%p)->()\n",This);
    8685
    87     return E_NOTIMPL;
     86        return E_NOTIMPL;
    8887}
    8988
     
    9190IBasicAudio_fnInvoke(IBasicAudio* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
    9291{
    93     CFilterGraph_THIS(iface,basaud);
     92        CFilterGraph_THIS(iface,basaud);
    9493
    95     FIXME("(%p)->()\n",This);
     94        FIXME("(%p)->()\n",This);
    9695
    97     return E_NOTIMPL;
     96        return E_NOTIMPL;
    9897}
    9998
     
    102101IBasicAudio_fnput_Volume(IBasicAudio* iface,long lVol)
    103102{
    104     CFilterGraph_THIS(iface,basaud);
     103        CFilterGraph_THIS(iface,basaud);
    105104
    106     FIXME("(%p)->()\n",This);
     105        FIXME("(%p)->()\n",This);
    107106
    108     return E_NOTIMPL;
     107        return E_NOTIMPL;
    109108}
    110109
     
    112111IBasicAudio_fnget_Volume(IBasicAudio* iface,long* plVol)
    113112{
    114     CFilterGraph_THIS(iface,basaud);
     113        CFilterGraph_THIS(iface,basaud);
    115114
    116     FIXME("(%p)->()\n",This);
     115        FIXME("(%p)->()\n",This);
    117116
    118     return E_NOTIMPL;
     117        return E_NOTIMPL;
    119118}
    120119
     
    122121IBasicAudio_fnput_Balance(IBasicAudio* iface,long lBalance)
    123122{
    124     CFilterGraph_THIS(iface,basaud);
     123        CFilterGraph_THIS(iface,basaud);
    125124
    126     FIXME("(%p)->()\n",This);
     125        FIXME("(%p)->()\n",This);
    127126
    128     return E_NOTIMPL;
     127        return E_NOTIMPL;
    129128}
    130129
     
    132131IBasicAudio_fnget_Balance(IBasicAudio* iface,long* plBalance)
    133132{
    134     CFilterGraph_THIS(iface,basaud);
     133        CFilterGraph_THIS(iface,basaud);
    135134
    136     FIXME("(%p)->()\n",This);
     135        FIXME("(%p)->()\n",This);
    137136
    138     return E_NOTIMPL;
     137        return E_NOTIMPL;
    139138}
    140139
     
    142141static ICOM_VTABLE(IBasicAudio) ibasicaudio =
    143142{
    144     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    145     /* IUnknown fields */
    146     IBasicAudio_fnQueryInterface,
    147     IBasicAudio_fnAddRef,
    148     IBasicAudio_fnRelease,
    149     /* IDispatch fields */
    150     IBasicAudio_fnGetTypeInfoCount,
    151     IBasicAudio_fnGetTypeInfo,
    152     IBasicAudio_fnGetIDsOfNames,
    153     IBasicAudio_fnInvoke,
    154     /* IBasicAudio fields */
    155     IBasicAudio_fnput_Volume,
    156     IBasicAudio_fnget_Volume,
    157     IBasicAudio_fnput_Balance,
    158     IBasicAudio_fnget_Balance,
     143        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     144        /* IUnknown fields */
     145        IBasicAudio_fnQueryInterface,
     146        IBasicAudio_fnAddRef,
     147        IBasicAudio_fnRelease,
     148        /* IDispatch fields */
     149        IBasicAudio_fnGetTypeInfoCount,
     150        IBasicAudio_fnGetTypeInfo,
     151        IBasicAudio_fnGetIDsOfNames,
     152        IBasicAudio_fnInvoke,
     153        /* IBasicAudio fields */
     154        IBasicAudio_fnput_Volume,
     155        IBasicAudio_fnget_Volume,
     156        IBasicAudio_fnput_Balance,
     157        IBasicAudio_fnget_Balance,
    159158};
    160159
    161160
    162 void CFilterGraph_InitIBasicAudio( CFilterGraph* pfg )
     161HRESULT CFilterGraph_InitIBasicAudio( CFilterGraph* pfg )
    163162{
    164     TRACE("(%p)\n",pfg);
    165     ICOM_VTBL(&pfg->basaud) = &ibasicaudio;
     163        TRACE("(%p)\n",pfg);
     164        ICOM_VTBL(&pfg->basaud) = &ibasicaudio;
     165
     166        return NOERROR;
    166167}
    167168
     169void CFilterGraph_UninitIBasicAudio( CFilterGraph* pfg )
     170{
     171        TRACE("(%p)\n",pfg);
     172}
     173
  • TabularUnified trunk/src/quartz/ibasvid.c

    r6649 r6710  
    1 /* $Id: ibasvid.c,v 1.2 2001-09-05 13:36:35 bird Exp $ */
    21/*
    32 * Implementation of IBasicVideo2 for FilterGraph.
     
    3029IBasicVideo2_fnQueryInterface(IBasicVideo2* iface,REFIID riid,void** ppobj)
    3130{
    32     CFilterGraph_THIS(iface,basvid);
    33 
    34     TRACE("(%p)->()\n",This);
    35 
    36     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     31        CFilterGraph_THIS(iface,basvid);
     32
     33        TRACE("(%p)->()\n",This);
     34
     35        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3736}
    3837
     
    4039IBasicVideo2_fnAddRef(IBasicVideo2* iface)
    4140{
    42     CFilterGraph_THIS(iface,basvid);
    43 
    44     TRACE("(%p)->()\n",This);
    45 
    46     return IUnknown_AddRef(This->unk.punkControl);
     41        CFilterGraph_THIS(iface,basvid);
     42
     43        TRACE("(%p)->()\n",This);
     44
     45        return IUnknown_AddRef(This->unk.punkControl);
    4746}
    4847
     
    5049IBasicVideo2_fnRelease(IBasicVideo2* iface)
    5150{
    52     CFilterGraph_THIS(iface,basvid);
    53 
    54     TRACE("(%p)->()\n",This);
    55 
    56     return IUnknown_Release(This->unk.punkControl);
     51        CFilterGraph_THIS(iface,basvid);
     52
     53        TRACE("(%p)->()\n",This);
     54
     55        return IUnknown_Release(This->unk.punkControl);
    5756}
    5857
     
    6059IBasicVideo2_fnGetTypeInfoCount(IBasicVideo2* iface,UINT* pcTypeInfo)
    6160{
    62     CFilterGraph_THIS(iface,basvid);
    63 
    64     FIXME("(%p)->()\n",This);
    65 
    66     return E_NOTIMPL;
     61        CFilterGraph_THIS(iface,basvid);
     62
     63        FIXME("(%p)->()\n",This);
     64
     65        return E_NOTIMPL;
    6766}
    6867
     
    7069IBasicVideo2_fnGetTypeInfo(IBasicVideo2* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
    7170{
    72     CFilterGraph_THIS(iface,basvid);
    73 
    74     FIXME("(%p)->()\n",This);
    75 
    76     return E_NOTIMPL;
     71        CFilterGraph_THIS(iface,basvid);
     72
     73        FIXME("(%p)->()\n",This);
     74
     75        return E_NOTIMPL;
    7776}
    7877
     
    8079IBasicVideo2_fnGetIDsOfNames(IBasicVideo2* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
    8180{
    82     CFilterGraph_THIS(iface,basvid);
    83 
    84     FIXME("(%p)->()\n",This);
    85 
    86     return E_NOTIMPL;
     81        CFilterGraph_THIS(iface,basvid);
     82
     83        FIXME("(%p)->()\n",This);
     84
     85        return E_NOTIMPL;
    8786}
    8887
     
    9089IBasicVideo2_fnInvoke(IBasicVideo2* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
    9190{
    92     CFilterGraph_THIS(iface,basvid);
    93 
    94     FIXME("(%p)->()\n",This);
    95 
    96     return E_NOTIMPL;
     91        CFilterGraph_THIS(iface,basvid);
     92
     93        FIXME("(%p)->()\n",This);
     94
     95        return E_NOTIMPL;
    9796}
    9897
     
    101100IBasicVideo2_fnget_AvgTimePerFrame(IBasicVideo2* iface,REFTIME* prefTime)
    102101{
    103     CFilterGraph_THIS(iface,basvid);
    104 
    105     FIXME("(%p)->()\n",This);
    106 
    107     return E_NOTIMPL;
     102        CFilterGraph_THIS(iface,basvid);
     103
     104        FIXME("(%p)->()\n",This);
     105
     106        return E_NOTIMPL;
    108107}
    109108
     
    111110IBasicVideo2_fnget_BitRate(IBasicVideo2* iface,long* plRate)
    112111{
    113     CFilterGraph_THIS(iface,basvid);
    114 
    115     FIXME("(%p)->()\n",This);
    116 
    117     return E_NOTIMPL;
     112        CFilterGraph_THIS(iface,basvid);
     113
     114        FIXME("(%p)->()\n",This);
     115
     116        return E_NOTIMPL;
    118117}
    119118
     
    121120IBasicVideo2_fnget_BitErrorRate(IBasicVideo2* iface,long* plRate)
    122121{
    123     CFilterGraph_THIS(iface,basvid);
    124 
    125     FIXME("(%p)->()\n",This);
    126 
    127     return E_NOTIMPL;
     122        CFilterGraph_THIS(iface,basvid);
     123
     124        FIXME("(%p)->()\n",This);
     125
     126        return E_NOTIMPL;
    128127}
    129128
     
    131130IBasicVideo2_fnget_VideoWidth(IBasicVideo2* iface,long* plWidth)
    132131{
    133     CFilterGraph_THIS(iface,basvid);
    134 
    135     FIXME("(%p)->()\n",This);
    136 
    137     return E_NOTIMPL;
     132        CFilterGraph_THIS(iface,basvid);
     133
     134        FIXME("(%p)->()\n",This);
     135
     136        return E_NOTIMPL;
    138137}
    139138
     
    141140IBasicVideo2_fnget_VideoHeight(IBasicVideo2* iface,long* plHeight)
    142141{
    143     CFilterGraph_THIS(iface,basvid);
    144 
    145     FIXME("(%p)->()\n",This);
    146 
    147     return E_NOTIMPL;
     142        CFilterGraph_THIS(iface,basvid);
     143
     144        FIXME("(%p)->()\n",This);
     145
     146        return E_NOTIMPL;
    148147}
    149148
     
    151150IBasicVideo2_fnput_SourceLeft(IBasicVideo2* iface,long lLeft)
    152151{
    153     CFilterGraph_THIS(iface,basvid);
    154 
    155     FIXME("(%p)->()\n",This);
    156 
    157     return E_NOTIMPL;
     152        CFilterGraph_THIS(iface,basvid);
     153
     154        FIXME("(%p)->()\n",This);
     155
     156        return E_NOTIMPL;
    158157}
    159158
     
    161160IBasicVideo2_fnget_SourceLeft(IBasicVideo2* iface,long* plLeft)
    162161{
    163     CFilterGraph_THIS(iface,basvid);
    164 
    165     FIXME("(%p)->()\n",This);
    166 
    167     return E_NOTIMPL;
     162        CFilterGraph_THIS(iface,basvid);
     163
     164        FIXME("(%p)->()\n",This);
     165
     166        return E_NOTIMPL;
    168167}
    169168
     
    171170IBasicVideo2_fnput_SourceWidth(IBasicVideo2* iface,long lWidth)
    172171{
    173     CFilterGraph_THIS(iface,basvid);
    174 
    175     FIXME("(%p)->()\n",This);
    176 
    177     return E_NOTIMPL;
     172        CFilterGraph_THIS(iface,basvid);
     173
     174        FIXME("(%p)->()\n",This);
     175
     176        return E_NOTIMPL;
    178177}
    179178
     
    181180IBasicVideo2_fnget_SourceWidth(IBasicVideo2* iface,long* plWidth)
    182181{
    183     CFilterGraph_THIS(iface,basvid);
    184 
    185     FIXME("(%p)->()\n",This);
    186 
    187     return E_NOTIMPL;
     182        CFilterGraph_THIS(iface,basvid);
     183
     184        FIXME("(%p)->()\n",This);
     185
     186        return E_NOTIMPL;
    188187}
    189188
     
    191190IBasicVideo2_fnput_SourceTop(IBasicVideo2* iface,long lTop)
    192191{
    193     CFilterGraph_THIS(iface,basvid);
    194 
    195     FIXME("(%p)->()\n",This);
    196 
    197     return E_NOTIMPL;
     192        CFilterGraph_THIS(iface,basvid);
     193
     194        FIXME("(%p)->()\n",This);
     195
     196        return E_NOTIMPL;
    198197}
    199198
     
    201200IBasicVideo2_fnget_SourceTop(IBasicVideo2* iface,long* plTop)
    202201{
    203     CFilterGraph_THIS(iface,basvid);
    204 
    205     FIXME("(%p)->()\n",This);
    206 
    207     return E_NOTIMPL;
     202        CFilterGraph_THIS(iface,basvid);
     203
     204        FIXME("(%p)->()\n",This);
     205
     206        return E_NOTIMPL;
    208207}
    209208
     
    211210IBasicVideo2_fnput_SourceHeight(IBasicVideo2* iface,long lHeight)
    212211{
    213     CFilterGraph_THIS(iface,basvid);
    214 
    215     FIXME("(%p)->()\n",This);
    216 
    217     return E_NOTIMPL;
     212        CFilterGraph_THIS(iface,basvid);
     213
     214        FIXME("(%p)->()\n",This);
     215
     216        return E_NOTIMPL;
    218217}
    219218
     
    221220IBasicVideo2_fnget_SourceHeight(IBasicVideo2* iface,long* plHeight)
    222221{
    223     CFilterGraph_THIS(iface,basvid);
    224 
    225     FIXME("(%p)->()\n",This);
    226 
    227     return E_NOTIMPL;
     222        CFilterGraph_THIS(iface,basvid);
     223
     224        FIXME("(%p)->()\n",This);
     225
     226        return E_NOTIMPL;
    228227}
    229228
     
    231230IBasicVideo2_fnput_DestinationLeft(IBasicVideo2* iface,long lLeft)
    232231{
    233     CFilterGraph_THIS(iface,basvid);
    234 
    235     FIXME("(%p)->()\n",This);
    236 
    237     return E_NOTIMPL;
     232        CFilterGraph_THIS(iface,basvid);
     233
     234        FIXME("(%p)->()\n",This);
     235
     236        return E_NOTIMPL;
    238237}
    239238
     
    241240IBasicVideo2_fnget_DestinationLeft(IBasicVideo2* iface,long* plLeft)
    242241{
    243     CFilterGraph_THIS(iface,basvid);
    244 
    245     FIXME("(%p)->()\n",This);
    246 
    247     return E_NOTIMPL;
     242        CFilterGraph_THIS(iface,basvid);
     243
     244        FIXME("(%p)->()\n",This);
     245
     246        return E_NOTIMPL;
    248247}
    249248
     
    251250IBasicVideo2_fnput_DestinationWidth(IBasicVideo2* iface,long lWidth)
    252251{
    253     CFilterGraph_THIS(iface,basvid);
    254 
    255     FIXME("(%p)->()\n",This);
    256 
    257     return E_NOTIMPL;
     252        CFilterGraph_THIS(iface,basvid);
     253
     254        FIXME("(%p)->()\n",This);
     255
     256        return E_NOTIMPL;
    258257}
    259258
     
    261260IBasicVideo2_fnget_DestinationWidth(IBasicVideo2* iface,long* plWidth)
    262261{
    263     CFilterGraph_THIS(iface,basvid);
    264 
    265     FIXME("(%p)->()\n",This);
    266 
    267     return E_NOTIMPL;
     262        CFilterGraph_THIS(iface,basvid);
     263
     264        FIXME("(%p)->()\n",This);
     265
     266        return E_NOTIMPL;
    268267}
    269268
     
    271270IBasicVideo2_fnput_DestinationTop(IBasicVideo2* iface,long lTop)
    272271{
    273     CFilterGraph_THIS(iface,basvid);
    274 
    275     FIXME("(%p)->()\n",This);
    276 
    277     return E_NOTIMPL;
     272        CFilterGraph_THIS(iface,basvid);
     273
     274        FIXME("(%p)->()\n",This);
     275
     276        return E_NOTIMPL;
    278277}
    279278
     
    281280IBasicVideo2_fnget_DestinationTop(IBasicVideo2* iface,long* plTop)
    282281{
    283     CFilterGraph_THIS(iface,basvid);
    284 
    285     FIXME("(%p)->()\n",This);
    286 
    287     return E_NOTIMPL;
     282        CFilterGraph_THIS(iface,basvid);
     283
     284        FIXME("(%p)->()\n",This);
     285
     286        return E_NOTIMPL;
    288287}
    289288
     
    291290IBasicVideo2_fnput_DestinationHeight(IBasicVideo2* iface,long lHeight)
    292291{
    293     CFilterGraph_THIS(iface,basvid);
    294 
    295     FIXME("(%p)->()\n",This);
    296 
    297     return E_NOTIMPL;
     292        CFilterGraph_THIS(iface,basvid);
     293
     294        FIXME("(%p)->()\n",This);
     295
     296        return E_NOTIMPL;
    298297}
    299298
     
    301300IBasicVideo2_fnget_DestinationHeight(IBasicVideo2* iface,long* plHeight)
    302301{
    303     CFilterGraph_THIS(iface,basvid);
    304 
    305     FIXME("(%p)->()\n",This);
    306 
    307     return E_NOTIMPL;
     302        CFilterGraph_THIS(iface,basvid);
     303
     304        FIXME("(%p)->()\n",This);
     305
     306        return E_NOTIMPL;
    308307}
    309308
     
    311310IBasicVideo2_fnSetSourcePosition(IBasicVideo2* iface,long lLeft,long lTop,long lWidth,long lHeight)
    312311{
    313     CFilterGraph_THIS(iface,basvid);
    314 
    315     FIXME("(%p)->()\n",This);
    316 
    317     return E_NOTIMPL;
     312        CFilterGraph_THIS(iface,basvid);
     313
     314        FIXME("(%p)->()\n",This);
     315
     316        return E_NOTIMPL;
    318317}
    319318
     
    321320IBasicVideo2_fnGetSourcePosition(IBasicVideo2* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight)
    322321{
    323     CFilterGraph_THIS(iface,basvid);
    324 
    325     FIXME("(%p)->()\n",This);
    326 
    327     return E_NOTIMPL;
     322        CFilterGraph_THIS(iface,basvid);
     323
     324        FIXME("(%p)->()\n",This);
     325
     326        return E_NOTIMPL;
    328327}
    329328
     
    331330IBasicVideo2_fnSetDefaultSourcePosition(IBasicVideo2* iface)
    332331{
    333     CFilterGraph_THIS(iface,basvid);
    334 
    335     FIXME("(%p)->()\n",This);
    336 
    337     return E_NOTIMPL;
     332        CFilterGraph_THIS(iface,basvid);
     333
     334        FIXME("(%p)->()\n",This);
     335
     336        return E_NOTIMPL;
    338337}
    339338
     
    341340IBasicVideo2_fnSetDestinationPosition(IBasicVideo2* iface,long lLeft,long lTop,long lWidth,long lHeight)
    342341{
    343     CFilterGraph_THIS(iface,basvid);
    344 
    345     FIXME("(%p)->()\n",This);
    346 
    347     return E_NOTIMPL;
     342        CFilterGraph_THIS(iface,basvid);
     343
     344        FIXME("(%p)->()\n",This);
     345
     346        return E_NOTIMPL;
    348347}
    349348
     
    351350IBasicVideo2_fnGetDestinationPosition(IBasicVideo2* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight)
    352351{
    353     CFilterGraph_THIS(iface,basvid);
    354 
    355     FIXME("(%p)->()\n",This);
    356 
    357     return E_NOTIMPL;
     352        CFilterGraph_THIS(iface,basvid);
     353
     354        FIXME("(%p)->()\n",This);
     355
     356        return E_NOTIMPL;
    358357}
    359358
     
    361360IBasicVideo2_fnSetDefaultDestinationPosition(IBasicVideo2* iface)
    362361{
    363     CFilterGraph_THIS(iface,basvid);
    364 
    365     FIXME("(%p)->()\n",This);
    366 
    367     return E_NOTIMPL;
     362        CFilterGraph_THIS(iface,basvid);
     363
     364        FIXME("(%p)->()\n",This);
     365
     366        return E_NOTIMPL;
    368367}
    369368
     
    371370IBasicVideo2_fnGetVideoSize(IBasicVideo2* iface,long* plWidth,long* plHeight)
    372371{
    373     CFilterGraph_THIS(iface,basvid);
    374 
    375     FIXME("(%p)->()\n",This);
    376 
    377     return E_NOTIMPL;
     372        CFilterGraph_THIS(iface,basvid);
     373
     374        FIXME("(%p)->()\n",This);
     375
     376        return E_NOTIMPL;
    378377}
    379378
     
    381380IBasicVideo2_fnGetVideoPaletteEntries(IBasicVideo2* iface,long lStart,long lCount,long* plRet,long* plPaletteEntry)
    382381{
    383     CFilterGraph_THIS(iface,basvid);
    384 
    385     FIXME("(%p)->()\n",This);
    386 
    387     return E_NOTIMPL;
     382        CFilterGraph_THIS(iface,basvid);
     383
     384        FIXME("(%p)->()\n",This);
     385
     386        return E_NOTIMPL;
    388387}
    389388
     
    391390IBasicVideo2_fnGetCurrentImage(IBasicVideo2* iface,long* plBufferSize,long* plDIBBuffer)
    392391{
    393     CFilterGraph_THIS(iface,basvid);
    394 
    395     FIXME("(%p)->()\n",This);
    396 
    397     return E_NOTIMPL;
     392        CFilterGraph_THIS(iface,basvid);
     393
     394        FIXME("(%p)->()\n",This);
     395
     396        return E_NOTIMPL;
    398397}
    399398
     
    401400IBasicVideo2_fnIsUsingDefaultSource(IBasicVideo2* iface)
    402401{
    403     CFilterGraph_THIS(iface,basvid);
    404 
    405     FIXME("(%p)->()\n",This);
    406 
    407     return E_NOTIMPL;
     402        CFilterGraph_THIS(iface,basvid);
     403
     404        FIXME("(%p)->()\n",This);
     405
     406        return E_NOTIMPL;
    408407}
    409408
     
    411410IBasicVideo2_fnIsUsingDefaultDestination(IBasicVideo2* iface)
    412411{
    413     CFilterGraph_THIS(iface,basvid);
    414 
    415     FIXME("(%p)->()\n",This);
    416 
    417     return E_NOTIMPL;
     412        CFilterGraph_THIS(iface,basvid);
     413
     414        FIXME("(%p)->()\n",This);
     415
     416        return E_NOTIMPL;
    418417}
    419418
     
    421420IBasicVideo2_fnGetPreferredAspectRatio(IBasicVideo2* iface,long* plRateX,long* plRateY)
    422421{
    423     CFilterGraph_THIS(iface,basvid);
    424 
    425     FIXME("(%p)->()\n",This);
    426 
    427     return E_NOTIMPL;
     422        CFilterGraph_THIS(iface,basvid);
     423
     424        FIXME("(%p)->()\n",This);
     425
     426        return E_NOTIMPL;
    428427}
    429428
     
    433432static ICOM_VTABLE(IBasicVideo2) ibasicvideo =
    434433{
    435     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    436     /* IUnknown fields */
    437     IBasicVideo2_fnQueryInterface,
    438     IBasicVideo2_fnAddRef,
    439     IBasicVideo2_fnRelease,
    440     /* IDispatch fields */
    441     IBasicVideo2_fnGetTypeInfoCount,
    442     IBasicVideo2_fnGetTypeInfo,
    443     IBasicVideo2_fnGetIDsOfNames,
    444     IBasicVideo2_fnInvoke,
    445     /* IBasicVideo fields */
    446     IBasicVideo2_fnget_AvgTimePerFrame,
    447     IBasicVideo2_fnget_BitRate,
    448     IBasicVideo2_fnget_BitErrorRate,
    449     IBasicVideo2_fnget_VideoWidth,
    450     IBasicVideo2_fnget_VideoHeight,
    451     IBasicVideo2_fnput_SourceLeft,
    452     IBasicVideo2_fnget_SourceLeft,
    453     IBasicVideo2_fnput_SourceWidth,
    454     IBasicVideo2_fnget_SourceWidth,
    455     IBasicVideo2_fnput_SourceTop,
    456     IBasicVideo2_fnget_SourceTop,
    457     IBasicVideo2_fnput_SourceHeight,
    458     IBasicVideo2_fnget_SourceHeight,
    459     IBasicVideo2_fnput_DestinationLeft,
    460     IBasicVideo2_fnget_DestinationLeft,
    461     IBasicVideo2_fnput_DestinationWidth,
    462     IBasicVideo2_fnget_DestinationWidth,
    463     IBasicVideo2_fnput_DestinationTop,
    464     IBasicVideo2_fnget_DestinationTop,
    465     IBasicVideo2_fnput_DestinationHeight,
    466     IBasicVideo2_fnget_DestinationHeight,
    467     IBasicVideo2_fnSetSourcePosition,
    468     IBasicVideo2_fnGetSourcePosition,
    469     IBasicVideo2_fnSetDefaultSourcePosition,
    470     IBasicVideo2_fnSetDestinationPosition,
    471     IBasicVideo2_fnGetDestinationPosition,
    472     IBasicVideo2_fnSetDefaultDestinationPosition,
    473     IBasicVideo2_fnGetVideoSize,
    474     IBasicVideo2_fnGetVideoPaletteEntries,
    475     IBasicVideo2_fnGetCurrentImage,
    476     IBasicVideo2_fnIsUsingDefaultSource,
    477     IBasicVideo2_fnIsUsingDefaultDestination,
    478     /* IBasicVideo2 fields */
    479     IBasicVideo2_fnGetPreferredAspectRatio,
     434        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     435        /* IUnknown fields */
     436        IBasicVideo2_fnQueryInterface,
     437        IBasicVideo2_fnAddRef,
     438        IBasicVideo2_fnRelease,
     439        /* IDispatch fields */
     440        IBasicVideo2_fnGetTypeInfoCount,
     441        IBasicVideo2_fnGetTypeInfo,
     442        IBasicVideo2_fnGetIDsOfNames,
     443        IBasicVideo2_fnInvoke,
     444        /* IBasicVideo fields */
     445        IBasicVideo2_fnget_AvgTimePerFrame,
     446        IBasicVideo2_fnget_BitRate,
     447        IBasicVideo2_fnget_BitErrorRate,
     448        IBasicVideo2_fnget_VideoWidth,
     449        IBasicVideo2_fnget_VideoHeight,
     450        IBasicVideo2_fnput_SourceLeft,
     451        IBasicVideo2_fnget_SourceLeft,
     452        IBasicVideo2_fnput_SourceWidth,
     453        IBasicVideo2_fnget_SourceWidth,
     454        IBasicVideo2_fnput_SourceTop,
     455        IBasicVideo2_fnget_SourceTop,
     456        IBasicVideo2_fnput_SourceHeight,
     457        IBasicVideo2_fnget_SourceHeight,
     458        IBasicVideo2_fnput_DestinationLeft,
     459        IBasicVideo2_fnget_DestinationLeft,
     460        IBasicVideo2_fnput_DestinationWidth,
     461        IBasicVideo2_fnget_DestinationWidth,
     462        IBasicVideo2_fnput_DestinationTop,
     463        IBasicVideo2_fnget_DestinationTop,
     464        IBasicVideo2_fnput_DestinationHeight,
     465        IBasicVideo2_fnget_DestinationHeight,
     466        IBasicVideo2_fnSetSourcePosition,
     467        IBasicVideo2_fnGetSourcePosition,
     468        IBasicVideo2_fnSetDefaultSourcePosition,
     469        IBasicVideo2_fnSetDestinationPosition,
     470        IBasicVideo2_fnGetDestinationPosition,
     471        IBasicVideo2_fnSetDefaultDestinationPosition,
     472        IBasicVideo2_fnGetVideoSize,
     473        IBasicVideo2_fnGetVideoPaletteEntries,
     474        IBasicVideo2_fnGetCurrentImage,
     475        IBasicVideo2_fnIsUsingDefaultSource,
     476        IBasicVideo2_fnIsUsingDefaultDestination,
     477        /* IBasicVideo2 fields */
     478        IBasicVideo2_fnGetPreferredAspectRatio,
    480479};
    481480
    482481
    483 void CFilterGraph_InitIBasicVideo2( CFilterGraph* pfg )
    484 {
    485     TRACE("(%p)\n",pfg);
    486     ICOM_VTBL(&pfg->basvid) = &ibasicvideo;
    487 }
    488 
     482HRESULT CFilterGraph_InitIBasicVideo2( CFilterGraph* pfg )
     483{
     484        TRACE("(%p)\n",pfg);
     485        ICOM_VTBL(&pfg->basvid) = &ibasicvideo;
     486
     487        return NOERROR;
     488}
     489
     490void CFilterGraph_UninitIBasicVideo2( CFilterGraph* pfg )
     491{
     492        TRACE("(%p)\n",pfg);
     493}
  • TabularUnified trunk/src/quartz/ifgraph.c

    r6649 r6710  
    1 /* $Id: ifgraph.c,v 1.3 2001-09-05 13:36:35 bird Exp $ */
    21/*
    32 * Implementation of IFilterGraph.
     
    2019#include "control.h"
    2120#include "uuids.h"
     21#include "vfwmsgs.h"
     22#include "wine/unicode.h"
    2223
    2324#include "debugtools.h"
     
    2627#include "quartz_private.h"
    2728#include "fgraph.h"
     29#include "enumunk.h"
     30
     31
     32static HRESULT CFilterGraph_DisconnectAllPins( IBaseFilter* pFilter )
     33{
     34        IEnumPins*      pEnum = NULL;
     35        IPin*   pPin;
     36        IPin*   pConnTo;
     37        ULONG   cFetched;
     38        HRESULT hr;
     39
     40        hr = IBaseFilter_EnumPins( pFilter, &pEnum );
     41        if ( FAILED(hr) )
     42                return hr;
     43        if ( pEnum == NULL )
     44                return E_FAIL;
     45
     46        while ( 1 )
     47        {
     48                pPin = NULL;
     49                cFetched = 0;
     50                hr = IEnumPins_Next( pEnum, 1, &pPin, &cFetched );
     51                if ( FAILED(hr) )
     52                        break;
     53                if ( hr != NOERROR || pPin == NULL || cFetched != 1 )
     54                {
     55                        hr = NOERROR;
     56                        break;
     57                }
     58
     59                pConnTo = NULL;
     60                hr = IPin_ConnectedTo(pPin,&pConnTo);
     61                if ( hr == NOERROR && pConnTo != NULL )
     62                {
     63                        IPin_Disconnect(pPin);
     64                        IPin_Disconnect(pConnTo);
     65                        IPin_Release(pConnTo);
     66                }
     67
     68                IPin_Release( pPin );
     69        }
     70
     71        IEnumPins_Release( pEnum );
     72
     73        return hr;
     74}
     75
     76
     77/****************************************************************************/
    2878
    2979static HRESULT WINAPI
    3080IFilterGraph2_fnQueryInterface(IFilterGraph2* iface,REFIID riid,void** ppobj)
    3181{
    32     CFilterGraph_THIS(iface,fgraph);
    33 
    34     TRACE("(%p)->()\n",This);
    35 
    36     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     82        CFilterGraph_THIS(iface,fgraph);
     83
     84        TRACE("(%p)->()\n",This);
     85
     86        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3787}
    3888
     
    4090IFilterGraph2_fnAddRef(IFilterGraph2* iface)
    4191{
    42     CFilterGraph_THIS(iface,fgraph);
    43 
    44     TRACE("(%p)->()\n",This);
    45 
    46     return IUnknown_AddRef(This->unk.punkControl);
     92        CFilterGraph_THIS(iface,fgraph);
     93
     94        TRACE("(%p)->()\n",This);
     95
     96        return IUnknown_AddRef(This->unk.punkControl);
    4797}
    4898
     
    50100IFilterGraph2_fnRelease(IFilterGraph2* iface)
    51101{
    52     CFilterGraph_THIS(iface,fgraph);
    53 
    54     TRACE("(%p)->()\n",This);
    55 
    56     return IUnknown_Release(This->unk.punkControl);
     102        CFilterGraph_THIS(iface,fgraph);
     103
     104        TRACE("(%p)->()\n",This);
     105
     106        return IUnknown_Release(This->unk.punkControl);
    57107}
    58108
     
    60110IFilterGraph2_fnAddFilter(IFilterGraph2* iface,IBaseFilter* pFilter, LPCWSTR pName)
    61111{
    62     CFilterGraph_THIS(iface,fgraph);
    63 
    64     FIXME( "(%p)->() stub!\n", This );
    65     return E_NOTIMPL;
     112        CFilterGraph_THIS(iface,fgraph);
     113        FILTER_INFO     info;
     114        HRESULT hr;
     115        HRESULT hrSucceeded = S_OK;
     116        QUARTZ_CompListItem*    pItem;
     117        int i,iLen;
     118
     119        TRACE( "(%p)->(%p,%s)\n",This,pFilter,debugstr_w(pName) );
     120
     121        QUARTZ_CompList_Lock( This->m_pFilterList );
     122
     123        if ( pName != NULL )
     124        {
     125                pItem = QUARTZ_CompList_SearchData(
     126                        This->m_pFilterList,
     127                        pName, sizeof(WCHAR)*(strlenW(pName)+1) );
     128                if ( pItem == NULL )
     129                        goto name_ok;
     130
     131                hrSucceeded = VFW_S_DUPLICATE_NAME;
     132
     133                iLen = strlenW(pName);
     134                if ( iLen > 32 )
     135                        iLen = 32;
     136                memcpy( info.achName, pName, sizeof(WCHAR)*iLen );
     137                info.achName[iLen] = 0;
     138        }
     139        else
     140        {
     141                ZeroMemory( &info, sizeof(info) );
     142                hr = IBaseFilter_QueryFilterInfo( pFilter, &info );
     143                if ( FAILED(hr) )
     144                        goto end;
     145
     146                iLen = strlenW(info.achName);
     147                pItem = QUARTZ_CompList_SearchData(
     148                        This->m_pFilterList,
     149                        info.achName, sizeof(WCHAR)*(iLen+1) );
     150                if ( pItem == NULL )
     151                {
     152                        pName = info.achName;
     153                        goto name_ok;
     154                }
     155        }
     156
     157        /* generate modified names for this filter.. */
     158        iLen = strlenW(info.achName);
     159        if ( iLen > 32 )
     160                iLen = 32;
     161        info.achName[iLen++] = ' ';
     162
     163        for ( i = 0; i <= 99; i++ )
     164        {
     165                info.achName[iLen+0] = (i%10) + '0';
     166                info.achName[iLen+1] = ((i/10)%10) + '0';
     167                info.achName[iLen+2] = 0;
     168                pItem = QUARTZ_CompList_SearchData(
     169                        This->m_pFilterList,
     170                        info.achName, sizeof(WCHAR)*(iLen+3) );
     171                if ( pItem == NULL )
     172                {
     173                        pName = info.achName;
     174                        goto name_ok;
     175                }
     176        }
     177
     178        hr = ( pName == NULL ) ? E_FAIL : VFW_E_DUPLICATE_NAME;
     179        goto end;
     180
     181name_ok:
     182        /* register this filter. */
     183        hr = QUARTZ_CompList_AddComp(
     184                This->m_pFilterList, (IUnknown*)pFilter,
     185                pName, sizeof(WCHAR)*(strlenW(pName)+1) );
     186        if ( FAILED(hr) )
     187                goto end;
     188
     189        hr = IBaseFilter_JoinFilterGraph(pFilter,(IFilterGraph*)iface,pName);
     190        if ( FAILED(hr) )
     191        {
     192                QUARTZ_CompList_RemoveComp(
     193                        This->m_pFilterList,(IUnknown*)pFilter);
     194                goto end;
     195        }
     196
     197        EnterCriticalSection( &This->m_csGraphVersion );
     198        This->m_lGraphVersion ++;
     199        LeaveCriticalSection( &This->m_csGraphVersion );
     200
     201        hr = hrSucceeded;
     202end:
     203        QUARTZ_CompList_Unlock( This->m_pFilterList );
     204
     205        return hr;
    66206}
    67207
     
    69209IFilterGraph2_fnRemoveFilter(IFilterGraph2* iface,IBaseFilter* pFilter)
    70210{
    71     CFilterGraph_THIS(iface,fgraph);
    72 
    73     FIXME( "(%p)->() stub!\n", This );
    74     return E_NOTIMPL;
     211        CFilterGraph_THIS(iface,fgraph);
     212        QUARTZ_CompListItem*    pItem;
     213        HRESULT hr = NOERROR;
     214
     215        TRACE( "(%p)->(%p)\n",This,pFilter );
     216
     217        QUARTZ_CompList_Lock( This->m_pFilterList );
     218
     219        pItem = QUARTZ_CompList_SearchComp(
     220                This->m_pFilterList, (IUnknown*)pFilter );
     221        if ( pItem != NULL )
     222        {
     223                CFilterGraph_DisconnectAllPins(pFilter);
     224                hr = IBaseFilter_JoinFilterGraph(
     225                        pFilter, NULL, QUARTZ_CompList_GetDataPtr(pItem) );
     226                QUARTZ_CompList_RemoveComp(
     227                        This->m_pFilterList, (IUnknown*)pFilter );
     228        }
     229
     230        EnterCriticalSection( &This->m_csGraphVersion );
     231        This->m_lGraphVersion ++;
     232        LeaveCriticalSection( &This->m_csGraphVersion );
     233
     234        QUARTZ_CompList_Unlock( This->m_pFilterList );
     235
     236        return hr;
    75237}
    76238
     
    78240IFilterGraph2_fnEnumFilters(IFilterGraph2* iface,IEnumFilters** ppEnum)
    79241{
    80     CFilterGraph_THIS(iface,fgraph);
    81 
    82     FIXME( "(%p)->() stub!\n", This );
    83     return E_NOTIMPL;
     242        CFilterGraph_THIS(iface,fgraph);
     243        HRESULT hr;
     244
     245        TRACE( "(%p)->(%p)\n",This,ppEnum );
     246
     247        QUARTZ_CompList_Lock( This->m_pFilterList );
     248
     249        hr = QUARTZ_CreateEnumUnknown(
     250                &IID_IEnumFilters, (void**)ppEnum, This->m_pFilterList );
     251
     252        QUARTZ_CompList_Unlock( This->m_pFilterList );
     253
     254        return hr;
    84255}
    85256
     
    87258IFilterGraph2_fnFindFilterByName(IFilterGraph2* iface,LPCWSTR pName,IBaseFilter** ppFilter)
    88259{
    89     CFilterGraph_THIS(iface,fgraph);
    90 
    91     FIXME( "(%p)->() stub!\n", This );
    92     return E_NOTIMPL;
     260        CFilterGraph_THIS(iface,fgraph);
     261        QUARTZ_CompListItem*    pItem;
     262        HRESULT hr = E_FAIL;
     263
     264        TRACE( "(%p)->(%s,%p)\n",This,debugstr_w(pName),ppFilter );
     265
     266        if ( ppFilter == NULL )
     267                return E_POINTER;
     268        *ppFilter = NULL;
     269
     270        QUARTZ_CompList_Lock( This->m_pFilterList );
     271
     272        pItem = QUARTZ_CompList_SearchData(
     273                This->m_pFilterList,
     274                pName, sizeof(WCHAR)*(strlenW(pName)+1) );
     275        if ( pItem != NULL )
     276        {
     277                *ppFilter = (IBaseFilter*)QUARTZ_CompList_GetItemPtr(pItem);
     278                hr = NOERROR;
     279        }
     280
     281        QUARTZ_CompList_Unlock( This->m_pFilterList );
     282
     283        return hr;
    93284}
    94285
     
    96287IFilterGraph2_fnConnectDirect(IFilterGraph2* iface,IPin* pOut,IPin* pIn,const AM_MEDIA_TYPE* pmt)
    97288{
    98     CFilterGraph_THIS(iface,fgraph);
    99 
    100     FIXME( "(%p)->() stub!\n", This );
    101     return E_NOTIMPL;
     289        CFilterGraph_THIS(iface,fgraph);
     290        IPin*   pConnTo;
     291        PIN_INFO        infoIn;
     292        PIN_INFO        infoOut;
     293        FILTER_INFO     finfoIn;
     294        FILTER_INFO     finfoOut;
     295        HRESULT hr;
     296
     297        TRACE( "(%p)->(%p,%p,%p)\n",This,pOut,pIn,pmt );
     298
     299        infoIn.pFilter = NULL;
     300        infoOut.pFilter = NULL;
     301        finfoIn.pGraph = NULL;
     302        finfoOut.pGraph = NULL;
     303
     304        QUARTZ_CompList_Lock( This->m_pFilterList );
     305
     306        hr = IPin_QueryPinInfo(pIn,&infoIn);
     307        if ( FAILED(hr) )
     308                goto end;
     309        hr = IPin_QueryPinInfo(pOut,&infoOut);
     310        if ( FAILED(hr) )
     311                goto end;
     312        if ( infoIn.pFilter == NULL || infoOut.pFilter == NULL ||
     313                 infoIn.dir != PINDIR_INPUT || infoOut.dir != PINDIR_OUTPUT )
     314        {
     315                hr = E_FAIL;
     316                goto end;
     317        }
     318
     319        hr = IBaseFilter_QueryFilterInfo(infoIn.pFilter,&finfoIn);
     320        if ( FAILED(hr) )
     321                goto end;
     322        hr = IBaseFilter_QueryFilterInfo(infoOut.pFilter,&finfoOut);
     323        if ( FAILED(hr) )
     324                goto end;
     325        if ( finfoIn.pGraph != ((IFilterGraph*)iface) ||
     326                 finfoOut.pGraph != ((IFilterGraph*)iface) )
     327        {
     328                hr = E_FAIL;
     329                goto end;
     330        }
     331
     332        pConnTo = NULL;
     333        hr = IPin_ConnectedTo(pIn,&pConnTo);
     334        if ( FAILED(hr) )
     335                goto end;
     336        if ( pConnTo != NULL )
     337        {
     338                IPin_Release(pConnTo);
     339                goto end;
     340        }
     341
     342        pConnTo = NULL;
     343        hr = IPin_ConnectedTo(pOut,&pConnTo);
     344        if ( FAILED(hr) )
     345                goto end;
     346        if ( pConnTo != NULL )
     347        {
     348                IPin_Release(pConnTo);
     349                goto end;
     350        }
     351
     352        hr = IPin_Connect(pIn,pOut,pmt);
     353        if ( FAILED(hr) )
     354                goto end;
     355        hr = IPin_Connect(pOut,pIn,pmt);
     356        if ( FAILED(hr) )
     357        {
     358                IPin_Disconnect(pIn);
     359                goto end;
     360        }
     361
     362        EnterCriticalSection( &This->m_csGraphVersion );
     363        This->m_lGraphVersion ++;
     364        LeaveCriticalSection( &This->m_csGraphVersion );
     365
     366end:
     367        QUARTZ_CompList_Unlock( This->m_pFilterList );
     368
     369        if ( infoIn.pFilter != NULL )
     370                IBaseFilter_Release(infoIn.pFilter);
     371        if ( infoOut.pFilter != NULL )
     372                IBaseFilter_Release(infoOut.pFilter);
     373        if ( finfoIn.pGraph != NULL )
     374                IFilterGraph_Release(finfoIn.pGraph);
     375        if ( finfoOut.pGraph != NULL )
     376                IFilterGraph_Release(finfoOut.pGraph);
     377
     378        return hr;
    102379}
    103380
     
    105382IFilterGraph2_fnReconnect(IFilterGraph2* iface,IPin* pPin)
    106383{
    107     CFilterGraph_THIS(iface,fgraph);
    108 
    109     FIXME( "(%p)->() stub!\n", This );
    110     return E_NOTIMPL;
     384        CFilterGraph_THIS(iface,fgraph);
     385
     386        FIXME( "(%p)->(%p) stub!\n",This,pPin );
     387
     388        EnterCriticalSection( &This->m_csGraphVersion );
     389        This->m_lGraphVersion ++;
     390        LeaveCriticalSection( &This->m_csGraphVersion );
     391
     392        return E_NOTIMPL;
    111393}
    112394
     
    114396IFilterGraph2_fnDisconnect(IFilterGraph2* iface,IPin* pPin)
    115397{
    116     CFilterGraph_THIS(iface,fgraph);
    117 
    118     FIXME( "(%p)->() stub!\n", This );
    119     return E_NOTIMPL;
     398        CFilterGraph_THIS(iface,fgraph);
     399
     400        FIXME( "(%p)->(%p) stub!\n",This,pPin );
     401
     402        EnterCriticalSection( &This->m_csGraphVersion );
     403        This->m_lGraphVersion ++;
     404        LeaveCriticalSection( &This->m_csGraphVersion );
     405
     406        return E_NOTIMPL;
    120407}
    121408
     
    123410IFilterGraph2_fnSetDefaultSyncSource(IFilterGraph2* iface)
    124411{
    125     CFilterGraph_THIS(iface,fgraph);
    126 
    127     FIXME( "(%p)->() stub!\n", This );
    128     return E_NOTIMPL;
     412        CFilterGraph_THIS(iface,fgraph);
     413
     414        FIXME( "(%p)->() stub!\n", This );
     415        return E_NOTIMPL;
    129416}
    130417
     
    132419IFilterGraph2_fnConnect(IFilterGraph2* iface,IPin* pOut,IPin* pIn)
    133420{
    134     CFilterGraph_THIS(iface,fgraph);
    135 
    136     FIXME( "(%p)->() stub!\n", This );
    137     return E_NOTIMPL;
     421        CFilterGraph_THIS(iface,fgraph);
     422        HRESULT hr;
     423
     424        TRACE( "(%p)->(%p,%p)\n",This,pOut,pIn );
     425
     426        /* At first, try to connect directly. */
     427        hr = IFilterGraph_ConnectDirect(iface,pOut,pIn,NULL);
     428        if ( hr == NOERROR )
     429                return NOERROR;
     430
     431        /* FIXME - try to connect indirectly. */
     432        FIXME( "(%p)->(%p,%p) stub!\n",This,pOut,pIn );
     433
     434
     435        return E_NOTIMPL;
    138436}
    139437
     
    141439IFilterGraph2_fnRender(IFilterGraph2* iface,IPin* pOut)
    142440{
    143     CFilterGraph_THIS(iface,fgraph);
    144 
    145     FIXME( "(%p)->() stub!\n", This );
    146     return E_NOTIMPL;
     441        CFilterGraph_THIS(iface,fgraph);
     442
     443        FIXME( "(%p)->(%p) stub!\n",This,pOut );
     444        return E_NOTIMPL;
    147445}
    148446
     
    150448IFilterGraph2_fnRenderFile(IFilterGraph2* iface,LPCWSTR lpFileName,LPCWSTR lpPlayList)
    151449{
    152     CFilterGraph_THIS(iface,fgraph);
    153 
    154     FIXME( "(%p)->() stub!\n", This );
    155     return E_NOTIMPL;
     450        CFilterGraph_THIS(iface,fgraph);
     451        HRESULT hr;
     452        IBaseFilter*    pFilter = NULL;
     453        IEnumPins*      pEnum = NULL;
     454        IPin*   pPin;
     455        ULONG   cFetched;
     456        PIN_DIRECTION   dir;
     457        ULONG   cTryToRender;
     458        ULONG   cActRender;
     459
     460        TRACE( "(%p)->(%s,%s)\n",This,
     461                debugstr_w(lpFileName),debugstr_w(lpPlayList) );
     462
     463        if ( lpPlayList != NULL )
     464                return E_INVALIDARG;
     465
     466        pFilter = NULL;
     467        hr = IFilterGraph2_AddSourceFilter(iface,lpFileName,NULL,&pFilter);
     468        if ( FAILED(hr) )
     469                goto end;
     470        if ( pFilter == NULL )
     471        {
     472                hr = E_FAIL;
     473                goto end;
     474        }
     475        pEnum = NULL;
     476        hr = IBaseFilter_EnumPins( pFilter, &pEnum );
     477        if ( FAILED(hr) )
     478                goto end;
     479        if ( pEnum == NULL )
     480        {
     481                hr = E_FAIL;
     482                goto end;
     483        }
     484
     485        cTryToRender = 0;
     486        cActRender = 0;
     487
     488        while ( 1 )
     489        {
     490                pPin = NULL;
     491                cFetched = 0;
     492                hr = IEnumPins_Next( pEnum, 1, &pPin, &cFetched );
     493                if ( FAILED(hr) )
     494                        goto end;
     495                if ( hr != NOERROR || pPin == NULL || cFetched != 1 )
     496                {
     497                        hr = NOERROR;
     498                        break;
     499                }
     500                hr = IPin_QueryDirection( pPin, &dir );
     501                if ( hr == NOERROR && dir == PINDIR_OUTPUT )
     502                {
     503                        cTryToRender ++;
     504                        hr = IFilterGraph2_Render( iface, pPin );
     505                        if ( hr == NOERROR )
     506                                cActRender ++;
     507                }
     508                IPin_Release( pPin );
     509        }
     510
     511        if ( hr == NOERROR )
     512        {
     513                if ( cTryToRender > cActRender )
     514                        hr = VFW_S_PARTIAL_RENDER;
     515                if ( cActRender == 0 )
     516                        hr = E_FAIL;
     517        }
     518
     519end:
     520        if ( pEnum != NULL )
     521                IEnumPins_Release( pEnum );
     522        if ( pFilter != NULL )
     523                IBaseFilter_Release( pFilter );
     524
     525        return hr;
    156526}
    157527
     
    159529IFilterGraph2_fnAddSourceFilter(IFilterGraph2* iface,LPCWSTR lpFileName,LPCWSTR lpFilterName,IBaseFilter** ppBaseFilter)
    160530{
    161     CFilterGraph_THIS(iface,fgraph);
    162 
    163     FIXME( "(%p)->() stub!\n", This );
    164     return E_NOTIMPL;
     531        CFilterGraph_THIS(iface,fgraph);
     532
     533        FIXME( "(%p)->(%s,%s,%p) stub!\n",This,
     534                debugstr_w(lpFileName),debugstr_w(lpFilterName),ppBaseFilter );
     535        return E_NOTIMPL;
    165536}
    166537
     
    168539IFilterGraph2_fnSetLogFile(IFilterGraph2* iface,DWORD_PTR hFile)
    169540{
    170     CFilterGraph_THIS(iface,fgraph);
    171 
    172     FIXME( "(%p)->() stub!\n", This );
    173     return E_NOTIMPL;
     541        CFilterGraph_THIS(iface,fgraph);
     542
     543        FIXME( "(%p)->() stub!\n", This );
     544        return E_NOTIMPL;
    174545}
    175546
     
    177548IFilterGraph2_fnAbort(IFilterGraph2* iface)
    178549{
    179     CFilterGraph_THIS(iface,fgraph);
    180 
    181     /* undoc. */
    182 
    183     FIXME( "(%p)->() stub!\n", This );
    184     return E_NOTIMPL;
     550        CFilterGraph_THIS(iface,fgraph);
     551
     552        /* undoc. */
     553
     554        FIXME( "(%p)->() stub!\n", This );
     555        return E_NOTIMPL;
    185556}
    186557
     
    188559IFilterGraph2_fnShouldOperationContinue(IFilterGraph2* iface)
    189560{
    190     CFilterGraph_THIS(iface,fgraph);
    191 
    192     /* undoc. */
    193 
    194     FIXME( "(%p)->() stub!\n", This );
    195     return E_NOTIMPL;
     561        CFilterGraph_THIS(iface,fgraph);
     562
     563        /* undoc. */
     564
     565        FIXME( "(%p)->() stub!\n", This );
     566        return E_NOTIMPL;
    196567}
    197568
     
    199570IFilterGraph2_fnAddSourceFilterForMoniker(IFilterGraph2* iface,IMoniker* pMon,IBindCtx* pCtx,LPCWSTR pFilterName,IBaseFilter** ppFilter)
    200571{
    201     CFilterGraph_THIS(iface,fgraph);
    202 
    203     FIXME( "(%p)->() stub!\n", This );
    204     return E_NOTIMPL;
     572        CFilterGraph_THIS(iface,fgraph);
     573
     574        FIXME( "(%p)->() stub!\n", This );
     575        return E_NOTIMPL;
    205576}
    206577
     
    208579IFilterGraph2_fnReconnectEx(IFilterGraph2* iface,IPin* pPin,const AM_MEDIA_TYPE* pmt)
    209580{
    210     CFilterGraph_THIS(iface,fgraph);
    211 
    212     FIXME( "(%p)->() stub!\n", This );
    213     return E_NOTIMPL;
     581        CFilterGraph_THIS(iface,fgraph);
     582
     583        FIXME( "(%p)->(%p,%p) stub!\n",This,pPin,pmt );
     584
     585        EnterCriticalSection( &This->m_csGraphVersion );
     586        This->m_lGraphVersion ++;
     587        LeaveCriticalSection( &This->m_csGraphVersion );
     588
     589        return E_NOTIMPL;
    214590}
    215591
     
    217593IFilterGraph2_fnRenderEx(IFilterGraph2* iface,IPin* pPin,DWORD dwParam1,DWORD* pdwParam2)
    218594{
    219     CFilterGraph_THIS(iface,fgraph);
    220 
    221     /* undoc. */
    222     FIXME( "(%p)->() stub!\n", This );
    223     return E_NOTIMPL;
     595        CFilterGraph_THIS(iface,fgraph);
     596
     597        /* undoc. */
     598        FIXME( "(%p)->(%p,%08lx,%p) stub!\n",This,pPin,dwParam1,pdwParam2);
     599        return E_NOTIMPL;
    224600}
    225601
     
    229605static ICOM_VTABLE(IFilterGraph2) ifgraph =
    230606{
    231     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    232     /* IUnknown fields */
    233     IFilterGraph2_fnQueryInterface,
    234     IFilterGraph2_fnAddRef,
    235     IFilterGraph2_fnRelease,
    236     /* IFilterGraph fields */
    237     IFilterGraph2_fnAddFilter,
    238     IFilterGraph2_fnRemoveFilter,
    239     IFilterGraph2_fnEnumFilters,
    240     IFilterGraph2_fnFindFilterByName,
    241     IFilterGraph2_fnConnectDirect,
    242     IFilterGraph2_fnReconnect,
    243     IFilterGraph2_fnDisconnect,
    244     IFilterGraph2_fnSetDefaultSyncSource,
    245     /* IGraphBuilder fields */
    246     IFilterGraph2_fnConnect,
    247     IFilterGraph2_fnRender,
    248     IFilterGraph2_fnRenderFile,
    249     IFilterGraph2_fnAddSourceFilter,
    250     IFilterGraph2_fnSetLogFile,
    251     IFilterGraph2_fnAbort,
    252     IFilterGraph2_fnShouldOperationContinue,
    253     /* IFilterGraph2 fields */
    254     IFilterGraph2_fnAddSourceFilterForMoniker,
    255     IFilterGraph2_fnReconnectEx,
    256     IFilterGraph2_fnRenderEx,
     607        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     608        /* IUnknown fields */
     609        IFilterGraph2_fnQueryInterface,
     610        IFilterGraph2_fnAddRef,
     611        IFilterGraph2_fnRelease,
     612        /* IFilterGraph fields */
     613        IFilterGraph2_fnAddFilter,
     614        IFilterGraph2_fnRemoveFilter,
     615        IFilterGraph2_fnEnumFilters,
     616        IFilterGraph2_fnFindFilterByName,
     617        IFilterGraph2_fnConnectDirect,
     618        IFilterGraph2_fnReconnect,
     619        IFilterGraph2_fnDisconnect,
     620        IFilterGraph2_fnSetDefaultSyncSource,
     621        /* IGraphBuilder fields */
     622        IFilterGraph2_fnConnect,
     623        IFilterGraph2_fnRender,
     624        IFilterGraph2_fnRenderFile,
     625        IFilterGraph2_fnAddSourceFilter,
     626        IFilterGraph2_fnSetLogFile,
     627        IFilterGraph2_fnAbort,
     628        IFilterGraph2_fnShouldOperationContinue,
     629        /* IFilterGraph2 fields */
     630        IFilterGraph2_fnAddSourceFilterForMoniker,
     631        IFilterGraph2_fnReconnectEx,
     632        IFilterGraph2_fnRenderEx,
    257633};
    258634
    259 void CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg )
    260 {
    261     TRACE("(%p)\n",pfg);
    262     ICOM_VTBL(&pfg->fgraph) = &ifgraph;
    263 }
     635HRESULT CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg )
     636{
     637        TRACE("(%p)\n",pfg);
     638        ICOM_VTBL(&pfg->fgraph) = &ifgraph;
     639
     640        pfg->m_pFilterList = QUARTZ_CompList_Alloc();
     641        if ( pfg->m_pFilterList == NULL )
     642                return E_OUTOFMEMORY;
     643
     644        return NOERROR;
     645}
     646
     647void CFilterGraph_UninitIFilterGraph2( CFilterGraph* pfg )
     648{
     649        QUARTZ_CompListItem*    pItem;
     650
     651        TRACE("(%p)\n",pfg);
     652
     653        /* remove all filters... */
     654        while ( 1 )
     655        {
     656                pItem = QUARTZ_CompList_GetFirst( pfg->m_pFilterList );
     657                if ( pItem == NULL )
     658                        break;
     659                IFilterGraph2_fnRemoveFilter(
     660                        (IFilterGraph2*)(&pfg->fgraph),
     661                        (IBaseFilter*)QUARTZ_CompList_GetItemPtr(pItem) );
     662        }
     663
     664        QUARTZ_CompList_Free( pfg->m_pFilterList );
     665}
  • TabularUnified trunk/src/quartz/imcntl.c

    r6649 r6710  
    1 /* $Id: imcntl.c,v 1.2 2001-09-05 13:36:35 bird Exp $ */
    21/*
    32 * Implementation of IMediaControl for FilterGraph.
     
    1615#include "wine/obj_base.h"
    1716#include "wine/obj_oleaut.h"
     17#include "oleauto.h"
    1818#include "strmif.h"
    1919#include "control.h"
     
    3131IMediaControl_fnQueryInterface(IMediaControl* iface,REFIID riid,void** ppobj)
    3232{
    33     CFilterGraph_THIS(iface,mediacontrol);
    34 
    35     TRACE("(%p)->()\n",This);
    36 
    37     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     33        CFilterGraph_THIS(iface,mediacontrol);
     34
     35        TRACE("(%p)->()\n",This);
     36
     37        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3838}
    3939
     
    4141IMediaControl_fnAddRef(IMediaControl* iface)
    4242{
    43     CFilterGraph_THIS(iface,mediacontrol);
    44 
    45     TRACE("(%p)->()\n",This);
    46 
    47     return IUnknown_AddRef(This->unk.punkControl);
     43        CFilterGraph_THIS(iface,mediacontrol);
     44
     45        TRACE("(%p)->()\n",This);
     46
     47        return IUnknown_AddRef(This->unk.punkControl);
    4848}
    4949
     
    5151IMediaControl_fnRelease(IMediaControl* iface)
    5252{
    53     CFilterGraph_THIS(iface,mediacontrol);
    54 
    55     TRACE("(%p)->()\n",This);
    56 
    57     return IUnknown_Release(This->unk.punkControl);
     53        CFilterGraph_THIS(iface,mediacontrol);
     54
     55        TRACE("(%p)->()\n",This);
     56
     57        return IUnknown_Release(This->unk.punkControl);
    5858}
    5959
     
    6161IMediaControl_fnGetTypeInfoCount(IMediaControl* iface,UINT* pcTypeInfo)
    6262{
    63     CFilterGraph_THIS(iface,mediacontrol);
    64 
    65     FIXME("(%p)->()\n",This);
    66 
    67     return E_NOTIMPL;
     63        CFilterGraph_THIS(iface,mediacontrol);
     64
     65        FIXME("(%p)->()\n",This);
     66
     67        return E_NOTIMPL;
    6868}
    6969
     
    7171IMediaControl_fnGetTypeInfo(IMediaControl* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
    7272{
    73     CFilterGraph_THIS(iface,mediacontrol);
    74 
    75     FIXME("(%p)->()\n",This);
    76 
    77     return E_NOTIMPL;
     73        CFilterGraph_THIS(iface,mediacontrol);
     74
     75        FIXME("(%p)->()\n",This);
     76
     77        return E_NOTIMPL;
    7878}
    7979
     
    8181IMediaControl_fnGetIDsOfNames(IMediaControl* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
    8282{
    83     CFilterGraph_THIS(iface,mediacontrol);
    84 
    85     FIXME("(%p)->()\n",This);
    86 
    87     return E_NOTIMPL;
     83        CFilterGraph_THIS(iface,mediacontrol);
     84
     85        FIXME("(%p)->()\n",This);
     86
     87        return E_NOTIMPL;
    8888}
    8989
     
    9191IMediaControl_fnInvoke(IMediaControl* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
    9292{
    93     CFilterGraph_THIS(iface,mediacontrol);
    94 
    95     FIXME("(%p)->()\n",This);
    96 
    97     return E_NOTIMPL;
     93        CFilterGraph_THIS(iface,mediacontrol);
     94
     95        FIXME("(%p)->()\n",This);
     96
     97        return E_NOTIMPL;
    9898}
    9999
     
    102102IMediaControl_fnRun(IMediaControl* iface)
    103103{
    104     CFilterGraph_THIS(iface,mediacontrol);
    105 
    106     FIXME("(%p)->()\n",This);
    107 
    108     return E_NOTIMPL;
     104        CFilterGraph_THIS(iface,mediacontrol);
     105
     106        TRACE("(%p)->()\n",This);
     107
     108        return IMediaFilter_Run( CFilterGraph_IMediaFilter(This),
     109                        (REFERENCE_TIME)0 );
    109110}
    110111
     
    112113IMediaControl_fnPause(IMediaControl* iface)
    113114{
    114     CFilterGraph_THIS(iface,mediacontrol);
    115 
    116     FIXME("(%p)->()\n",This);
    117 
    118     return E_NOTIMPL;
     115        CFilterGraph_THIS(iface,mediacontrol);
     116
     117        TRACE("(%p)->()\n",This);
     118
     119        return IMediaFilter_Pause( CFilterGraph_IMediaFilter(This) );
    119120}
    120121
     
    122123IMediaControl_fnStop(IMediaControl* iface)
    123124{
    124     CFilterGraph_THIS(iface,mediacontrol);
    125 
    126     FIXME("(%p)->()\n",This);
    127 
    128     return E_NOTIMPL;
     125        CFilterGraph_THIS(iface,mediacontrol);
     126        HRESULT hr;
     127        FILTER_STATE    fs;
     128
     129        TRACE("(%p)->()\n",This);
     130
     131        hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
     132        if ( SUCCEEDED(hr) && fs == State_Running )
     133        {
     134                hr = IMediaControl_Pause(iface);
     135                if ( SUCCEEDED(hr) )
     136                        hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
     137        }
     138
     139        if ( SUCCEEDED(hr) && fs == State_Paused )
     140        {
     141                hr = IMediaFilter_Stop(CFilterGraph_IMediaFilter(This));
     142                if ( SUCCEEDED(hr) )
     143                        hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
     144        }
     145
     146        return hr;
    129147}
    130148
     
    132150IMediaControl_fnGetState(IMediaControl* iface,LONG lTimeOut,OAFilterState* pFilterState)
    133151{
    134     CFilterGraph_THIS(iface,mediacontrol);
    135 
    136     FIXME("(%p)->()\n",This);
    137 
    138     return E_NOTIMPL;
     152        CFilterGraph_THIS(iface,mediacontrol);
     153
     154        TRACE("(%p)->()\n",This);
     155
     156        return IMediaFilter_GetState( CFilterGraph_IMediaFilter(This), (DWORD)lTimeOut, (FILTER_STATE*)pFilterState );
    139157}
    140158
     
    142160IMediaControl_fnRenderFile(IMediaControl* iface,BSTR bstrFileName)
    143161{
    144     CFilterGraph_THIS(iface,mediacontrol);
    145 
    146     FIXME("(%p)->()\n",This);
    147 
    148     return E_NOTIMPL;
     162        CFilterGraph_THIS(iface,mediacontrol);
     163        UINT    uLen;
     164        WCHAR*  pwszName;
     165        HRESULT hr;
     166
     167        TRACE("(%p)->()\n",This);
     168
     169        uLen = SysStringLen(bstrFileName);
     170        pwszName = (WCHAR*)QUARTZ_AllocMem( sizeof(WCHAR) * (uLen+1) );
     171        if ( pwszName == NULL )
     172                return E_OUTOFMEMORY;
     173        memcpy( pwszName, bstrFileName, sizeof(WCHAR)*uLen );
     174        pwszName[uLen] = (WCHAR)0;
     175
     176        hr = IFilterGraph2_RenderFile(
     177                CFilterGraph_IFilterGraph2(This), pwszName, NULL );
     178
     179        QUARTZ_FreeMem( pwszName );
     180
     181        return hr;
    149182}
    150183
     
    152185IMediaControl_fnAddSourceFilter(IMediaControl* iface,BSTR bstrFileName,IDispatch** ppobj)
    153186{
    154     CFilterGraph_THIS(iface,mediacontrol);
    155 
    156     FIXME("(%p)->()\n",This);
    157 
    158     return E_NOTIMPL;
     187        CFilterGraph_THIS(iface,mediacontrol);
     188
     189        FIXME("(%p)->()\n",This);
     190
     191        return E_NOTIMPL;
    159192}
    160193
     
    162195IMediaControl_fnget_FilterCollection(IMediaControl* iface,IDispatch** ppobj)
    163196{
    164     CFilterGraph_THIS(iface,mediacontrol);
    165 
    166     FIXME("(%p)->()\n",This);
    167 
    168     return E_NOTIMPL;
     197        CFilterGraph_THIS(iface,mediacontrol);
     198
     199        FIXME("(%p)->()\n",This);
     200
     201        return E_NOTIMPL;
    169202}
    170203
     
    172205IMediaControl_fnget_RegFilterCollection(IMediaControl* iface,IDispatch** ppobj)
    173206{
    174     CFilterGraph_THIS(iface,mediacontrol);
    175 
    176     FIXME("(%p)->()\n",This);
    177 
    178     return E_NOTIMPL;
     207        CFilterGraph_THIS(iface,mediacontrol);
     208
     209        FIXME("(%p)->()\n",This);
     210
     211        return E_NOTIMPL;
    179212}
    180213
     
    182215IMediaControl_fnStopWhenReady(IMediaControl* iface)
    183216{
    184     CFilterGraph_THIS(iface,mediacontrol);
    185 
    186     FIXME("(%p)->()\n",This);
    187 
    188     return E_NOTIMPL;
     217        CFilterGraph_THIS(iface,mediacontrol);
     218
     219        TRACE("(%p)->()\n",This);
     220
     221        return IMediaFilter_Stop( CFilterGraph_IMediaFilter(This) );
    189222}
    190223
     
    192225static ICOM_VTABLE(IMediaControl) imediacontrol =
    193226{
    194     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    195     /* IUnknown fields */
    196     IMediaControl_fnQueryInterface,
    197     IMediaControl_fnAddRef,
    198     IMediaControl_fnRelease,
    199     /* IDispatch fields */
    200     IMediaControl_fnGetTypeInfoCount,
    201     IMediaControl_fnGetTypeInfo,
    202     IMediaControl_fnGetIDsOfNames,
    203     IMediaControl_fnInvoke,
    204     /* IMediaControl fields */
    205     IMediaControl_fnRun,
    206     IMediaControl_fnPause,
    207     IMediaControl_fnStop,
    208     IMediaControl_fnGetState,
    209     IMediaControl_fnRenderFile,
    210     IMediaControl_fnAddSourceFilter,
    211     IMediaControl_fnget_FilterCollection,
    212     IMediaControl_fnget_RegFilterCollection,
    213     IMediaControl_fnStopWhenReady,
     227        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     228        /* IUnknown fields */
     229        IMediaControl_fnQueryInterface,
     230        IMediaControl_fnAddRef,
     231        IMediaControl_fnRelease,
     232        /* IDispatch fields */
     233        IMediaControl_fnGetTypeInfoCount,
     234        IMediaControl_fnGetTypeInfo,
     235        IMediaControl_fnGetIDsOfNames,
     236        IMediaControl_fnInvoke,
     237        /* IMediaControl fields */
     238        IMediaControl_fnRun,
     239        IMediaControl_fnPause,
     240        IMediaControl_fnStop,
     241        IMediaControl_fnGetState,
     242        IMediaControl_fnRenderFile,
     243        IMediaControl_fnAddSourceFilter,
     244        IMediaControl_fnget_FilterCollection,
     245        IMediaControl_fnget_RegFilterCollection,
     246        IMediaControl_fnStopWhenReady,
    214247};
    215248
    216249
    217 void CFilterGraph_InitIMediaControl( CFilterGraph* pfg )
    218 {
    219     TRACE("(%p)\n",pfg);
    220     ICOM_VTBL(&pfg->mediacontrol) = &imediacontrol;
    221 }
     250HRESULT CFilterGraph_InitIMediaControl( CFilterGraph* pfg )
     251{
     252        TRACE("(%p)\n",pfg);
     253        ICOM_VTBL(&pfg->mediacontrol) = &imediacontrol;
     254
     255        return NOERROR;
     256}
     257
     258void CFilterGraph_UninitIMediaControl( CFilterGraph* pfg )
     259{
     260        TRACE("(%p)\n",pfg);
     261}
  • TabularUnified trunk/src/quartz/imem.c

    r6649 r6710  
    1 /* $Id: imem.c,v 1.3 2001-09-05 13:36:35 bird Exp $ */
    21/*
    32 * Implementation of CLSID_MemoryAllocator.
     
    2827IMemAllocator_fnQueryInterface(IMemAllocator* iface,REFIID riid,void** ppobj)
    2928{
    30     CMemoryAllocator_THIS(iface,memalloc);
     29        CMemoryAllocator_THIS(iface,memalloc);
    3130
    32     TRACE("(%p)->()\n",This);
     31        TRACE("(%p)->()\n",This);
    3332
    34     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     33        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3534}
    3635
     
    3837IMemAllocator_fnAddRef(IMemAllocator* iface)
    3938{
    40     CMemoryAllocator_THIS(iface,memalloc);
     39        CMemoryAllocator_THIS(iface,memalloc);
    4140
    42     TRACE("(%p)->()\n",This);
     41        TRACE("(%p)->()\n",This);
    4342
    44     return IUnknown_AddRef(This->unk.punkControl);
     43        return IUnknown_AddRef(This->unk.punkControl);
    4544}
    4645
     
    4847IMemAllocator_fnRelease(IMemAllocator* iface)
    4948{
    50     CMemoryAllocator_THIS(iface,memalloc);
     49        CMemoryAllocator_THIS(iface,memalloc);
    5150
    52     TRACE("(%p)->()\n",This);
     51        TRACE("(%p)->()\n",This);
    5352
    54     return IUnknown_Release(This->unk.punkControl);
     53        return IUnknown_Release(This->unk.punkControl);
    5554}
    5655
     
    5857IMemAllocator_fnSetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pPropReq,ALLOCATOR_PROPERTIES* pPropActual)
    5958{
    60     CMemoryAllocator_THIS(iface,memalloc);
     59        CMemoryAllocator_THIS(iface,memalloc);
     60        long    padding;
    6161
    62     FIXME( "(%p)->() stub!\n", This );
    63     return E_NOTIMPL;
     62        TRACE( "(%p)->(%p,%p)\n", This, pPropReq, pPropActual );
     63
     64        if ( pPropReq == NULL || pPropActual == NULL )
     65                return E_POINTER;
     66        if ( pPropReq->cBuffers < 0 ||
     67             pPropReq->cbBuffer < 0 ||
     68             pPropReq->cbAlign < 0 ||
     69             pPropReq->cbPrefix < 0 )
     70                return E_INVALIDARG;
     71
     72        if ( ( pPropReq->cbAlign & (pPropReq->cbAlign-1) ) != 0 )
     73                return E_INVALIDARG;
     74
     75        EnterCriticalSection( &This->csMem );
     76
     77        This->prop.cBuffers = pPropReq->cBuffers;
     78        This->prop.cbBuffer = pPropReq->cbBuffer;
     79        This->prop.cbAlign = pPropReq->cbAlign;
     80        This->prop.cbPrefix = pPropReq->cbPrefix;
     81
     82        if ( This->prop.cbAlign == 0 )
     83                This->prop.cbAlign = 1;
     84        padding = This->prop.cbAlign -
     85                ( (This->prop.cbBuffer+This->prop.cbPrefix) % This->prop.cbAlign );
     86
     87        This->prop.cbBuffer += padding;
     88
     89        memcpy( pPropActual, &This->prop, sizeof(ALLOCATOR_PROPERTIES) );
     90
     91        LeaveCriticalSection( &This->csMem );
     92
     93        return NOERROR;
    6494}
    6595
     
    6797IMemAllocator_fnGetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pProp)
    6898{
    69     CMemoryAllocator_THIS(iface,memalloc);
     99        CMemoryAllocator_THIS(iface,memalloc);
    70100
    71     FIXME( "(%p)->() stub!\n", This );
    72     return E_NOTIMPL;
     101        TRACE( "(%p)->(%p)\n", This, pProp );
     102
     103        if ( pProp == NULL )
     104                return E_POINTER;
     105
     106        EnterCriticalSection( &This->csMem );
     107
     108        memcpy( pProp, &This->prop, sizeof(ALLOCATOR_PROPERTIES) );
     109
     110        LeaveCriticalSection( &This->csMem );
     111
     112        return NOERROR;
    73113}
    74114
     
    76116IMemAllocator_fnCommit(IMemAllocator* iface)
    77117{
    78     CMemoryAllocator_THIS(iface,memalloc);
     118        CMemoryAllocator_THIS(iface,memalloc);
    79119
    80     FIXME( "(%p)->() stub!\n", This );
    81     return E_NOTIMPL;
     120        FIXME( "(%p)->() stub!\n", This );
     121        return E_NOTIMPL;
    82122}
    83123
     
    85125IMemAllocator_fnDecommit(IMemAllocator* iface)
    86126{
    87     CMemoryAllocator_THIS(iface,memalloc);
     127        CMemoryAllocator_THIS(iface,memalloc);
    88128
    89     FIXME( "(%p)->() stub!\n", This );
    90     return E_NOTIMPL;
     129        FIXME( "(%p)->() stub!\n", This );
     130        return E_NOTIMPL;
    91131}
    92132
     
    94134IMemAllocator_fnGetBuffer(IMemAllocator* iface,IMediaSample** ppSample,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd,DWORD dwFlags)
    95135{
    96     CMemoryAllocator_THIS(iface,memalloc);
     136        CMemoryAllocator_THIS(iface,memalloc);
    97137
    98     FIXME( "(%p)->() stub!\n", This );
    99     return E_NOTIMPL;
     138        FIXME( "(%p)->() stub!\n", This );
     139        return E_NOTIMPL;
    100140}
    101141
     
    103143IMemAllocator_fnReleaseBuffer(IMemAllocator* iface,IMediaSample* pSample)
    104144{
    105     CMemoryAllocator_THIS(iface,memalloc);
     145        CMemoryAllocator_THIS(iface,memalloc);
    106146
    107     FIXME( "(%p)->() stub!\n", This );
    108     return E_NOTIMPL;
     147        FIXME( "(%p)->() stub!\n", This );
     148        return E_NOTIMPL;
    109149}
    110150
     
    113153static ICOM_VTABLE(IMemAllocator) imemalloc =
    114154{
    115     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    116     /* IUnknown fields */
    117     IMemAllocator_fnQueryInterface,
    118     IMemAllocator_fnAddRef,
    119     IMemAllocator_fnRelease,
    120     /* IMemAllocator fields */
    121     IMemAllocator_fnSetProperties,
    122     IMemAllocator_fnGetProperties,
    123     IMemAllocator_fnCommit,
    124     IMemAllocator_fnDecommit,
    125     IMemAllocator_fnGetBuffer,
    126     IMemAllocator_fnReleaseBuffer,
     155        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     156        /* IUnknown fields */
     157        IMemAllocator_fnQueryInterface,
     158        IMemAllocator_fnAddRef,
     159        IMemAllocator_fnRelease,
     160        /* IMemAllocator fields */
     161        IMemAllocator_fnSetProperties,
     162        IMemAllocator_fnGetProperties,
     163        IMemAllocator_fnCommit,
     164        IMemAllocator_fnDecommit,
     165        IMemAllocator_fnGetBuffer,
     166        IMemAllocator_fnReleaseBuffer,
    127167};
    128168
    129169
    130 void CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma )
     170HRESULT CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma )
    131171{
    132     TRACE("(%p)\n",pma);
    133     ICOM_VTBL(&pma->memalloc) = &imemalloc;
     172        TRACE("(%p)\n",pma);
     173
     174        ICOM_VTBL(&pma->memalloc) = &imemalloc;
     175
     176        ZeroMemory( &pma->prop, sizeof(pma->prop) );
     177
     178        InitializeCriticalSection( &pma->csMem );
     179
     180        return NOERROR;
    134181}
     182
     183void CMemoryAllocator_UninitIMemAllocator( CMemoryAllocator* pma )
     184{
     185        TRACE("(%p)\n",pma);
     186
     187        IMemAllocator_Decommit( (IMemAllocator*)(&pma->memalloc) );
     188
     189        DeleteCriticalSection( &pma->csMem );
     190}
  • TabularUnified trunk/src/quartz/imevent.c

    r6649 r6710  
    1 /* $Id: imevent.c,v 1.2 2001-09-05 13:36:36 bird Exp $ */
    21/*
    32 * Implementation of IMediaEvent[Ex] for FilterGraph.
     
    3130IMediaEventEx_fnQueryInterface(IMediaEventEx* iface,REFIID riid,void** ppobj)
    3231{
    33     CFilterGraph_THIS(iface,mediaevent);
    34 
    35     TRACE("(%p)->()\n",This);
    36 
    37     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     32        CFilterGraph_THIS(iface,mediaevent);
     33
     34        TRACE("(%p)->()\n",This);
     35
     36        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3837}
    3938
     
    4140IMediaEventEx_fnAddRef(IMediaEventEx* iface)
    4241{
    43     CFilterGraph_THIS(iface,mediaevent);
    44 
    45     TRACE("(%p)->()\n",This);
    46 
    47     return IUnknown_AddRef(This->unk.punkControl);
     42        CFilterGraph_THIS(iface,mediaevent);
     43
     44        TRACE("(%p)->()\n",This);
     45
     46        return IUnknown_AddRef(This->unk.punkControl);
    4847}
    4948
     
    5150IMediaEventEx_fnRelease(IMediaEventEx* iface)
    5251{
    53     CFilterGraph_THIS(iface,mediaevent);
    54 
    55     TRACE("(%p)->()\n",This);
    56 
    57     return IUnknown_Release(This->unk.punkControl);
     52        CFilterGraph_THIS(iface,mediaevent);
     53
     54        TRACE("(%p)->()\n",This);
     55
     56        return IUnknown_Release(This->unk.punkControl);
    5857}
    5958
     
    6160IMediaEventEx_fnGetTypeInfoCount(IMediaEventEx* iface,UINT* pcTypeInfo)
    6261{
    63     CFilterGraph_THIS(iface,mediaevent);
    64 
    65     FIXME("(%p)->()\n",This);
    66 
    67     return E_NOTIMPL;
     62        CFilterGraph_THIS(iface,mediaevent);
     63
     64        FIXME("(%p)->()\n",This);
     65
     66        return E_NOTIMPL;
    6867}
    6968
     
    7170IMediaEventEx_fnGetTypeInfo(IMediaEventEx* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
    7271{
    73     CFilterGraph_THIS(iface,mediaevent);
    74 
    75     FIXME("(%p)->()\n",This);
    76 
    77     return E_NOTIMPL;
     72        CFilterGraph_THIS(iface,mediaevent);
     73
     74        FIXME("(%p)->()\n",This);
     75
     76        return E_NOTIMPL;
    7877}
    7978
     
    8180IMediaEventEx_fnGetIDsOfNames(IMediaEventEx* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
    8281{
    83     CFilterGraph_THIS(iface,mediaevent);
    84 
    85     FIXME("(%p)->()\n",This);
    86 
    87     return E_NOTIMPL;
     82        CFilterGraph_THIS(iface,mediaevent);
     83
     84        FIXME("(%p)->()\n",This);
     85
     86        return E_NOTIMPL;
    8887}
    8988
     
    9190IMediaEventEx_fnInvoke(IMediaEventEx* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
    9291{
    93     CFilterGraph_THIS(iface,mediaevent);
    94 
    95     FIXME("(%p)->()\n",This);
    96 
    97     return E_NOTIMPL;
     92        CFilterGraph_THIS(iface,mediaevent);
     93
     94        FIXME("(%p)->()\n",This);
     95
     96        return E_NOTIMPL;
    9897}
    9998
     
    102101IMediaEventEx_fnGetEventHandle(IMediaEventEx* iface,OAEVENT* hEvent)
    103102{
    104     CFilterGraph_THIS(iface,mediaevent);
    105 
    106     FIXME("(%p)->() stub!\n",This);
    107 
    108     return E_NOTIMPL;
     103        CFilterGraph_THIS(iface,mediaevent);
     104
     105        TRACE("(%p)->()\n",This);
     106
     107        *hEvent = (OAEVENT)This->m_hMediaEvent;
     108
     109        return NOERROR;
    109110}
    110111
     
    112113IMediaEventEx_fnGetEvent(IMediaEventEx* iface,long* lEventCode,LONG_PTR* plParam1,LONG_PTR* plParam2,long lTimeOut)
    113114{
    114     CFilterGraph_THIS(iface,mediaevent);
    115 
    116     FIXME("(%p)->() stub!\n",This);
    117 
    118     return E_NOTIMPL;
     115        CFilterGraph_THIS(iface,mediaevent);
     116
     117        FIXME("(%p)->() stub!\n",This);
     118
     119        return E_NOTIMPL;
    119120}
    120121
     
    122123IMediaEventEx_fnWaitForCompletion(IMediaEventEx* iface,long lTimeOut,long* plEventCode)
    123124{
    124     CFilterGraph_THIS(iface,mediaevent);
    125 
    126     FIXME("(%p)->() stub!\n",This);
    127 
    128     return E_NOTIMPL;
     125        CFilterGraph_THIS(iface,mediaevent);
     126
     127        FIXME("(%p)->() stub!\n",This);
     128
     129        return E_NOTIMPL;
    129130}
    130131
     
    132133IMediaEventEx_fnCancelDefaultHandling(IMediaEventEx* iface,long lEventCode)
    133134{
    134     CFilterGraph_THIS(iface,mediaevent);
    135 
    136     FIXME("(%p)->() stub!\n",This);
    137 
    138     return E_NOTIMPL;
     135        CFilterGraph_THIS(iface,mediaevent);
     136
     137        FIXME("(%p)->() stub!\n",This);
     138
     139        return E_NOTIMPL;
    139140}
    140141
     
    142143IMediaEventEx_fnRestoreDefaultHandling(IMediaEventEx* iface,long lEventCode)
    143144{
    144     CFilterGraph_THIS(iface,mediaevent);
    145 
    146     FIXME("(%p)->() stub!\n",This);
    147 
    148     return E_NOTIMPL;
     145        CFilterGraph_THIS(iface,mediaevent);
     146
     147        FIXME("(%p)->() stub!\n",This);
     148
     149        return E_NOTIMPL;
    149150}
    150151
     
    152153IMediaEventEx_fnFreeEventParams(IMediaEventEx* iface,long lEventCode,LONG_PTR lParam1,LONG_PTR lParam2)
    153154{
    154     CFilterGraph_THIS(iface,mediaevent);
    155 
    156     FIXME("(%p)->() stub!\n",This);
    157 
    158     return E_NOTIMPL;
     155        CFilterGraph_THIS(iface,mediaevent);
     156
     157        FIXME("(%p)->() stub!\n",This);
     158
     159        return E_NOTIMPL;
    159160}
    160161
     
    162163IMediaEventEx_fnSetNotifyWindow(IMediaEventEx* iface,OAHWND hwnd,long message,LONG_PTR lParam)
    163164{
    164     CFilterGraph_THIS(iface,mediaevent);
    165 
    166     FIXME("(%p)->() stub!\n",This);
    167 
    168     return E_NOTIMPL;
     165        CFilterGraph_THIS(iface,mediaevent);
     166
     167        FIXME("(%p)->() stub!\n",This);
     168
     169        return E_NOTIMPL;
    169170}
    170171
     
    172173IMediaEventEx_fnSetNotifyFlags(IMediaEventEx* iface,long lNotifyFlags)
    173174{
    174     CFilterGraph_THIS(iface,mediaevent);
    175 
    176     FIXME("(%p)->() stub!\n",This);
    177 
    178     return E_NOTIMPL;
     175        CFilterGraph_THIS(iface,mediaevent);
     176
     177        FIXME("(%p)->() stub!\n",This);
     178
     179        return E_NOTIMPL;
    179180}
    180181
     
    182183IMediaEventEx_fnGetNotifyFlags(IMediaEventEx* iface,long* plNotifyFlags)
    183184{
    184     CFilterGraph_THIS(iface,mediaevent);
    185 
    186     FIXME("(%p)->() stub!\n",This);
    187 
    188     return E_NOTIMPL;
     185        CFilterGraph_THIS(iface,mediaevent);
     186
     187        FIXME("(%p)->() stub!\n",This);
     188
     189        return E_NOTIMPL;
    189190}
    190191
     
    193194static ICOM_VTABLE(IMediaEventEx) imediaevent =
    194195{
    195     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    196     /* IUnknown fields */
    197     IMediaEventEx_fnQueryInterface,
    198     IMediaEventEx_fnAddRef,
    199     IMediaEventEx_fnRelease,
    200     /* IDispatch fields */
    201     IMediaEventEx_fnGetTypeInfoCount,
    202     IMediaEventEx_fnGetTypeInfo,
    203     IMediaEventEx_fnGetIDsOfNames,
    204     IMediaEventEx_fnInvoke,
    205     /* IMediaEvent fields */
    206     IMediaEventEx_fnGetEventHandle,
    207     IMediaEventEx_fnGetEvent,
    208     IMediaEventEx_fnWaitForCompletion,
    209     IMediaEventEx_fnCancelDefaultHandling,
    210     IMediaEventEx_fnRestoreDefaultHandling,
    211     IMediaEventEx_fnFreeEventParams,
    212     /* IMediaEventEx fields */
    213     IMediaEventEx_fnSetNotifyWindow,
    214     IMediaEventEx_fnSetNotifyFlags,
    215     IMediaEventEx_fnGetNotifyFlags,
     196        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     197        /* IUnknown fields */
     198        IMediaEventEx_fnQueryInterface,
     199        IMediaEventEx_fnAddRef,
     200        IMediaEventEx_fnRelease,
     201        /* IDispatch fields */
     202        IMediaEventEx_fnGetTypeInfoCount,
     203        IMediaEventEx_fnGetTypeInfo,
     204        IMediaEventEx_fnGetIDsOfNames,
     205        IMediaEventEx_fnInvoke,
     206        /* IMediaEvent fields */
     207        IMediaEventEx_fnGetEventHandle,
     208        IMediaEventEx_fnGetEvent,
     209        IMediaEventEx_fnWaitForCompletion,
     210        IMediaEventEx_fnCancelDefaultHandling,
     211        IMediaEventEx_fnRestoreDefaultHandling,
     212        IMediaEventEx_fnFreeEventParams,
     213        /* IMediaEventEx fields */
     214        IMediaEventEx_fnSetNotifyWindow,
     215        IMediaEventEx_fnSetNotifyFlags,
     216        IMediaEventEx_fnGetNotifyFlags,
    216217};
    217218
    218219
    219 void CFilterGraph_InitIMediaEventEx( CFilterGraph* pfg )
    220 {
    221     TRACE("(%p)\n",pfg);
    222     ICOM_VTBL(&pfg->mediaevent) = &imediaevent;
    223 }
     220HRESULT CFilterGraph_InitIMediaEventEx( CFilterGraph* pfg )
     221{
     222        TRACE("(%p)\n",pfg);
     223        ICOM_VTBL(&pfg->mediaevent) = &imediaevent;
     224
     225        pfg->m_hMediaEvent = CreateEventA( NULL, TRUE, FALSE, NULL );
     226        if ( pfg->m_hMediaEvent == (HANDLE)NULL )
     227                return E_OUTOFMEMORY;
     228
     229        return NOERROR;
     230}
     231
     232void CFilterGraph_UninitIMediaEventEx( CFilterGraph* pfg )
     233{
     234        TRACE("(%p)\n",pfg);
     235
     236        CloseHandle( pfg->m_hMediaEvent );
     237}
  • TabularUnified trunk/src/quartz/impos.c

    r6649 r6710  
    1 /* $Id: impos.c,v 1.2 2001-09-05 13:36:36 bird Exp $ */
    21/*
    32 * Implementation of IMediaPosition for FilterGraph.
     
    3029IMediaPosition_fnQueryInterface(IMediaPosition* iface,REFIID riid,void** ppobj)
    3130{
    32     CFilterGraph_THIS(iface,mediaposition);
    33 
    34     TRACE("(%p)->()\n",This);
    35 
    36     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     31        CFilterGraph_THIS(iface,mediaposition);
     32
     33        TRACE("(%p)->()\n",This);
     34
     35        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3736}
    3837
     
    4039IMediaPosition_fnAddRef(IMediaPosition* iface)
    4140{
    42     CFilterGraph_THIS(iface,mediaposition);
    43 
    44     TRACE("(%p)->()\n",This);
    45 
    46     return IUnknown_AddRef(This->unk.punkControl);
     41        CFilterGraph_THIS(iface,mediaposition);
     42
     43        TRACE("(%p)->()\n",This);
     44
     45        return IUnknown_AddRef(This->unk.punkControl);
    4746}
    4847
     
    5049IMediaPosition_fnRelease(IMediaPosition* iface)
    5150{
    52     CFilterGraph_THIS(iface,mediaposition);
    53 
    54     TRACE("(%p)->()\n",This);
    55 
    56     return IUnknown_Release(This->unk.punkControl);
     51        CFilterGraph_THIS(iface,mediaposition);
     52
     53        TRACE("(%p)->()\n",This);
     54
     55        return IUnknown_Release(This->unk.punkControl);
    5756}
    5857
     
    6059IMediaPosition_fnGetTypeInfoCount(IMediaPosition* iface,UINT* pcTypeInfo)
    6160{
    62     CFilterGraph_THIS(iface,mediaposition);
    63 
    64     FIXME("(%p)->()\n",This);
    65 
    66     return E_NOTIMPL;
     61        CFilterGraph_THIS(iface,mediaposition);
     62
     63        TRACE("(%p)->()\n",This);
     64
     65        return IDispatch_GetTypeInfoCount(
     66                CFilterGraph_IDispatch(This),pcTypeInfo);
    6767}
    6868
     
    7070IMediaPosition_fnGetTypeInfo(IMediaPosition* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
    7171{
    72     CFilterGraph_THIS(iface,mediaposition);
    73 
    74     FIXME("(%p)->()\n",This);
    75 
    76     return E_NOTIMPL;
     72        CFilterGraph_THIS(iface,mediaposition);
     73
     74        TRACE("(%p)->()\n",This);
     75
     76        return IDispatch_GetTypeInfo(
     77                CFilterGraph_IDispatch(This),iTypeInfo,lcid,ppobj);
    7778}
    7879
     
    8081IMediaPosition_fnGetIDsOfNames(IMediaPosition* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
    8182{
    82     CFilterGraph_THIS(iface,mediaposition);
    83 
    84     FIXME("(%p)->()\n",This);
    85 
    86     return E_NOTIMPL;
     83        CFilterGraph_THIS(iface,mediaposition);
     84
     85        TRACE("(%p)->()\n",This);
     86
     87        return IDispatch_GetIDsOfNames(
     88                CFilterGraph_IDispatch(This),riid,ppwszName,cNames,lcid,pDispId);
    8789}
    8890
     
    9092IMediaPosition_fnInvoke(IMediaPosition* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
    9193{
    92     CFilterGraph_THIS(iface,mediaposition);
    93 
    94     FIXME("(%p)->()\n",This);
    95 
    96     return E_NOTIMPL;
     94        CFilterGraph_THIS(iface,mediaposition);
     95
     96        TRACE("(%p)->()\n",This);
     97
     98        return IDispatch_Invoke(
     99                CFilterGraph_IDispatch(This),
     100                DispId,riid,lcid,wFlags,pDispParams,pVarRes,pExcepInfo,puArgErr);
    97101}
    98102
     
    101105IMediaPosition_fnget_Duration(IMediaPosition* iface,REFTIME* prefTime)
    102106{
    103     CFilterGraph_THIS(iface,mediaposition);
    104 
    105     FIXME("(%p)->() stub!\n",This);
    106 
    107     return E_NOTIMPL;
     107        CFilterGraph_THIS(iface,mediaposition);
     108
     109        FIXME("(%p)->() stub!\n",This);
     110
     111        return E_NOTIMPL;
    108112}
    109113
     
    111115IMediaPosition_fnput_CurrentPosition(IMediaPosition* iface,REFTIME refTime)
    112116{
    113     CFilterGraph_THIS(iface,mediaposition);
    114 
    115     FIXME("(%p)->() stub!\n",This);
    116 
    117     return E_NOTIMPL;
     117        CFilterGraph_THIS(iface,mediaposition);
     118
     119        FIXME("(%p)->() stub!\n",This);
     120
     121        return E_NOTIMPL;
    118122}
    119123
     
    121125IMediaPosition_fnget_CurrentPosition(IMediaPosition* iface,REFTIME* prefTime)
    122126{
    123     CFilterGraph_THIS(iface,mediaposition);
    124 
    125     FIXME("(%p)->() stub!\n",This);
    126 
    127     return E_NOTIMPL;
     127        CFilterGraph_THIS(iface,mediaposition);
     128
     129        FIXME("(%p)->() stub!\n",This);
     130
     131        return E_NOTIMPL;
    128132}
    129133
     
    131135IMediaPosition_fnget_StopTime(IMediaPosition* iface,REFTIME* prefTime)
    132136{
    133     CFilterGraph_THIS(iface,mediaposition);
    134 
    135     FIXME("(%p)->() stub!\n",This);
    136 
    137     return E_NOTIMPL;
     137        CFilterGraph_THIS(iface,mediaposition);
     138
     139        FIXME("(%p)->() stub!\n",This);
     140
     141        return E_NOTIMPL;
    138142}
    139143
     
    141145IMediaPosition_fnput_StopTime(IMediaPosition* iface,REFTIME refTime)
    142146{
    143     CFilterGraph_THIS(iface,mediaposition);
    144 
    145     FIXME("(%p)->() stub!\n",This);
    146 
    147     return E_NOTIMPL;
     147        CFilterGraph_THIS(iface,mediaposition);
     148
     149        FIXME("(%p)->() stub!\n",This);
     150
     151        return E_NOTIMPL;
    148152}
    149153
     
    151155IMediaPosition_fnget_PrerollTime(IMediaPosition* iface,REFTIME* prefTime)
    152156{
    153     CFilterGraph_THIS(iface,mediaposition);
    154 
    155     FIXME("(%p)->() stub!\n",This);
    156 
    157     return E_NOTIMPL;
     157        CFilterGraph_THIS(iface,mediaposition);
     158
     159        FIXME("(%p)->() stub!\n",This);
     160
     161        return E_NOTIMPL;
    158162}
    159163
     
    161165IMediaPosition_fnput_PrerollTime(IMediaPosition* iface,REFTIME refTime)
    162166{
    163     CFilterGraph_THIS(iface,mediaposition);
    164 
    165     FIXME("(%p)->() stub!\n",This);
    166 
    167     return E_NOTIMPL;
     167        CFilterGraph_THIS(iface,mediaposition);
     168
     169        FIXME("(%p)->() stub!\n",This);
     170
     171        return E_NOTIMPL;
    168172}
    169173
     
    171175IMediaPosition_fnput_Rate(IMediaPosition* iface,double dblRate)
    172176{
    173     CFilterGraph_THIS(iface,mediaposition);
    174 
    175     FIXME("(%p)->() stub!\n",This);
    176 
    177     return E_NOTIMPL;
     177        CFilterGraph_THIS(iface,mediaposition);
     178
     179        FIXME("(%p)->() stub!\n",This);
     180
     181        return E_NOTIMPL;
    178182}
    179183
     
    181185IMediaPosition_fnget_Rate(IMediaPosition* iface,double* pdblRate)
    182186{
    183     CFilterGraph_THIS(iface,mediaposition);
    184 
    185     FIXME("(%p)->() stub!\n",This);
    186 
    187     return E_NOTIMPL;
     187        CFilterGraph_THIS(iface,mediaposition);
     188
     189        FIXME("(%p)->() stub!\n",This);
     190
     191        return E_NOTIMPL;
    188192}
    189193
     
    191195IMediaPosition_fnCanSeekForward(IMediaPosition* iface,LONG* pCanSeek)
    192196{
    193     CFilterGraph_THIS(iface,mediaposition);
    194 
    195     FIXME("(%p)->() stub!\n",This);
    196 
    197     return E_NOTIMPL;
     197        CFilterGraph_THIS(iface,mediaposition);
     198
     199        FIXME("(%p)->() stub!\n",This);
     200
     201        return E_NOTIMPL;
    198202}
    199203
     
    201205IMediaPosition_fnCanSeekBackward(IMediaPosition* iface,LONG* pCanSeek)
    202206{
    203     CFilterGraph_THIS(iface,mediaposition);
    204 
    205     FIXME("(%p)->() stub!\n",This);
    206 
    207     return E_NOTIMPL;
     207        CFilterGraph_THIS(iface,mediaposition);
     208
     209        FIXME("(%p)->() stub!\n",This);
     210
     211        return E_NOTIMPL;
    208212}
    209213
     
    211215static ICOM_VTABLE(IMediaPosition) imediaposition =
    212216{
    213     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    214     /* IUnknown fields */
    215     IMediaPosition_fnQueryInterface,
    216     IMediaPosition_fnAddRef,
    217     IMediaPosition_fnRelease,
    218     /* IDispatch fields */
    219     IMediaPosition_fnGetTypeInfoCount,
    220     IMediaPosition_fnGetTypeInfo,
    221     IMediaPosition_fnGetIDsOfNames,
    222     IMediaPosition_fnInvoke,
    223     /* IMediaPosition fields */
    224     IMediaPosition_fnget_Duration,
    225     IMediaPosition_fnput_CurrentPosition,
    226     IMediaPosition_fnget_CurrentPosition,
    227     IMediaPosition_fnget_StopTime,
    228     IMediaPosition_fnput_StopTime,
    229     IMediaPosition_fnget_PrerollTime,
    230     IMediaPosition_fnput_PrerollTime,
    231     IMediaPosition_fnput_Rate,
    232     IMediaPosition_fnget_Rate,
    233     IMediaPosition_fnCanSeekForward,
    234     IMediaPosition_fnCanSeekBackward,
     217        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     218        /* IUnknown fields */
     219        IMediaPosition_fnQueryInterface,
     220        IMediaPosition_fnAddRef,
     221        IMediaPosition_fnRelease,
     222        /* IDispatch fields */
     223        IMediaPosition_fnGetTypeInfoCount,
     224        IMediaPosition_fnGetTypeInfo,
     225        IMediaPosition_fnGetIDsOfNames,
     226        IMediaPosition_fnInvoke,
     227        /* IMediaPosition fields */
     228        IMediaPosition_fnget_Duration,
     229        IMediaPosition_fnput_CurrentPosition,
     230        IMediaPosition_fnget_CurrentPosition,
     231        IMediaPosition_fnget_StopTime,
     232        IMediaPosition_fnput_StopTime,
     233        IMediaPosition_fnget_PrerollTime,
     234        IMediaPosition_fnput_PrerollTime,
     235        IMediaPosition_fnput_Rate,
     236        IMediaPosition_fnget_Rate,
     237        IMediaPosition_fnCanSeekForward,
     238        IMediaPosition_fnCanSeekBackward,
    235239};
    236240
    237241
    238 void CFilterGraph_InitIMediaPosition( CFilterGraph* pfg )
    239 {
    240     TRACE("(%p)\n",pfg);
    241     ICOM_VTBL(&pfg->mediaposition) = &imediaposition;
    242 }
     242HRESULT CFilterGraph_InitIMediaPosition( CFilterGraph* pfg )
     243{
     244        TRACE("(%p)\n",pfg);
     245        ICOM_VTBL(&pfg->mediaposition) = &imediaposition;
     246
     247        return NOERROR;
     248}
     249
     250void CFilterGraph_UninitIMediaPosition( CFilterGraph* pfg )
     251{
     252        TRACE("(%p)\n",pfg);
     253}
  • TabularUnified trunk/src/quartz/imseek.c

    r6649 r6710  
    1 /* $Id: imseek.c,v 1.2 2001-09-05 13:36:36 bird Exp $ */
    21/*
    32 * Implementation of IMediaSeeking for FilterGraph.
     
    3130IMediaSeeking_fnQueryInterface(IMediaSeeking* iface,REFIID riid,void** ppobj)
    3231{
    33     CFilterGraph_THIS(iface,mediaseeking);
    34 
    35     TRACE("(%p)->()\n",This);
    36 
    37     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     32        CFilterGraph_THIS(iface,mediaseeking);
     33
     34        TRACE("(%p)->()\n",This);
     35
     36        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3837}
    3938
     
    4140IMediaSeeking_fnAddRef(IMediaSeeking* iface)
    4241{
    43     CFilterGraph_THIS(iface,mediaseeking);
    44 
    45     TRACE("(%p)->()\n",This);
    46 
    47     return IUnknown_AddRef(This->unk.punkControl);
     42        CFilterGraph_THIS(iface,mediaseeking);
     43
     44        TRACE("(%p)->()\n",This);
     45
     46        return IUnknown_AddRef(This->unk.punkControl);
    4847}
    4948
     
    5150IMediaSeeking_fnRelease(IMediaSeeking* iface)
    5251{
    53     CFilterGraph_THIS(iface,mediaseeking);
    54 
    55     TRACE("(%p)->()\n",This);
    56 
    57     return IUnknown_Release(This->unk.punkControl);
     52        CFilterGraph_THIS(iface,mediaseeking);
     53
     54        TRACE("(%p)->()\n",This);
     55
     56        return IUnknown_Release(This->unk.punkControl);
    5857}
    5958
     
    6261IMediaSeeking_fnGetCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
    6362{
    64     CFilterGraph_THIS(iface,mediaseeking);
    65 
    66     FIXME("(%p)->() stub!\n",This);
    67 
    68     return E_NOTIMPL;
     63        CFilterGraph_THIS(iface,mediaseeking);
     64
     65        FIXME("(%p)->() stub!\n",This);
     66
     67        return E_NOTIMPL;
    6968}
    7069
     
    7271IMediaSeeking_fnCheckCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
    7372{
    74     CFilterGraph_THIS(iface,mediaseeking);
    75 
    76     FIXME("(%p)->() stub!\n",This);
    77 
    78     return E_NOTIMPL;
     73        CFilterGraph_THIS(iface,mediaseeking);
     74
     75        FIXME("(%p)->() stub!\n",This);
     76
     77        return E_NOTIMPL;
    7978}
    8079
     
    8281IMediaSeeking_fnIsFormatSupported(IMediaSeeking* iface,const GUID* pidFormat)
    8382{
    84     CFilterGraph_THIS(iface,mediaseeking);
    85 
    86     FIXME("(%p)->() stub!\n",This);
    87 
    88     return E_NOTIMPL;
     83        CFilterGraph_THIS(iface,mediaseeking);
     84
     85        FIXME("(%p)->() stub!\n",This);
     86
     87        return E_NOTIMPL;
    8988}
    9089
     
    9291IMediaSeeking_fnQueryPreferredFormat(IMediaSeeking* iface,GUID* pidFormat)
    9392{
    94     CFilterGraph_THIS(iface,mediaseeking);
    95 
    96     FIXME("(%p)->() stub!\n",This);
    97 
    98     return E_NOTIMPL;
     93        CFilterGraph_THIS(iface,mediaseeking);
     94
     95        FIXME("(%p)->() stub!\n",This);
     96
     97        return E_NOTIMPL;
    9998}
    10099
     
    102101IMediaSeeking_fnGetTimeFormat(IMediaSeeking* iface,GUID* pidFormat)
    103102{
    104     CFilterGraph_THIS(iface,mediaseeking);
    105 
    106     FIXME("(%p)->() stub!\n",This);
    107 
    108     return E_NOTIMPL;
     103        CFilterGraph_THIS(iface,mediaseeking);
     104
     105        FIXME("(%p)->() stub!\n",This);
     106
     107        return E_NOTIMPL;
    109108}
    110109
     
    112111IMediaSeeking_fnIsUsingTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
    113112{
    114     CFilterGraph_THIS(iface,mediaseeking);
    115 
    116     FIXME("(%p)->() stub!\n",This);
    117 
    118     return E_NOTIMPL;
     113        CFilterGraph_THIS(iface,mediaseeking);
     114
     115        FIXME("(%p)->() stub!\n",This);
     116
     117        return E_NOTIMPL;
    119118}
    120119
     
    122121IMediaSeeking_fnSetTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
    123122{
    124     CFilterGraph_THIS(iface,mediaseeking);
    125 
    126     FIXME("(%p)->() stub!\n",This);
    127 
    128     return E_NOTIMPL;
     123        CFilterGraph_THIS(iface,mediaseeking);
     124
     125        FIXME("(%p)->() stub!\n",This);
     126
     127        return E_NOTIMPL;
    129128}
    130129
     
    132131IMediaSeeking_fnGetDuration(IMediaSeeking* iface,LONGLONG* pllDuration)
    133132{
    134     CFilterGraph_THIS(iface,mediaseeking);
    135 
    136     FIXME("(%p)->() stub!\n",This);
    137 
    138     return E_NOTIMPL;
     133        CFilterGraph_THIS(iface,mediaseeking);
     134
     135        FIXME("(%p)->() stub!\n",This);
     136
     137        return E_NOTIMPL;
    139138}
    140139
     
    142141IMediaSeeking_fnGetStopPosition(IMediaSeeking* iface,LONGLONG* pllPos)
    143142{
    144     CFilterGraph_THIS(iface,mediaseeking);
    145 
    146     FIXME("(%p)->() stub!\n",This);
    147 
    148     return E_NOTIMPL;
     143        CFilterGraph_THIS(iface,mediaseeking);
     144
     145        FIXME("(%p)->() stub!\n",This);
     146
     147        return E_NOTIMPL;
    149148}
    150149
     
    152151IMediaSeeking_fnGetCurrentPosition(IMediaSeeking* iface,LONGLONG* pllPos)
    153152{
    154     CFilterGraph_THIS(iface,mediaseeking);
    155 
    156     FIXME("(%p)->() stub!\n",This);
    157 
    158     return E_NOTIMPL;
     153        CFilterGraph_THIS(iface,mediaseeking);
     154
     155        FIXME("(%p)->() stub!\n",This);
     156
     157        return E_NOTIMPL;
    159158}
    160159
     
    162161IMediaSeeking_fnConvertTimeFormat(IMediaSeeking* iface,LONGLONG* pllOut,const GUID* pidFmtOut,LONGLONG llIn,const GUID* pidFmtIn)
    163162{
    164     CFilterGraph_THIS(iface,mediaseeking);
    165 
    166     FIXME("(%p)->() stub!\n",This);
    167 
    168     return E_NOTIMPL;
     163        CFilterGraph_THIS(iface,mediaseeking);
     164
     165        FIXME("(%p)->() stub!\n",This);
     166
     167        return E_NOTIMPL;
    169168}
    170169
     
    172171IMediaSeeking_fnSetPositions(IMediaSeeking* iface,LONGLONG* pllCur,DWORD dwCurFlags,LONGLONG* pllStop,DWORD dwStopFlags)
    173172{
    174     CFilterGraph_THIS(iface,mediaseeking);
    175 
    176     FIXME("(%p)->() stub!\n",This);
    177 
    178     return E_NOTIMPL;
     173        CFilterGraph_THIS(iface,mediaseeking);
     174
     175        FIXME("(%p)->() stub!\n",This);
     176
     177        return E_NOTIMPL;
    179178}
    180179
     
    182181IMediaSeeking_fnGetPositions(IMediaSeeking* iface,LONGLONG* pllCur,LONGLONG* pllStop)
    183182{
    184     CFilterGraph_THIS(iface,mediaseeking);
    185 
    186     FIXME("(%p)->() stub!\n",This);
    187 
    188     return E_NOTIMPL;
     183        CFilterGraph_THIS(iface,mediaseeking);
     184
     185        FIXME("(%p)->() stub!\n",This);
     186
     187        return E_NOTIMPL;
    189188}
    190189
     
    192191IMediaSeeking_fnGetAvailable(IMediaSeeking* iface,LONGLONG* pllFirst,LONGLONG* pllLast)
    193192{
    194     CFilterGraph_THIS(iface,mediaseeking);
    195 
    196     FIXME("(%p)->() stub!\n",This);
    197 
    198     return E_NOTIMPL;
     193        CFilterGraph_THIS(iface,mediaseeking);
     194
     195        FIXME("(%p)->() stub!\n",This);
     196
     197        return E_NOTIMPL;
    199198}
    200199
     
    202201IMediaSeeking_fnSetRate(IMediaSeeking* iface,double dblRate)
    203202{
    204     CFilterGraph_THIS(iface,mediaseeking);
    205 
    206     FIXME("(%p)->() stub!\n",This);
    207 
    208     return E_NOTIMPL;
     203        CFilterGraph_THIS(iface,mediaseeking);
     204
     205        FIXME("(%p)->() stub!\n",This);
     206
     207        return E_NOTIMPL;
    209208}
    210209
     
    212211IMediaSeeking_fnGetRate(IMediaSeeking* iface,double* pdblRate)
    213212{
    214     CFilterGraph_THIS(iface,mediaseeking);
    215 
    216     FIXME("(%p)->() stub!\n",This);
    217 
    218     return E_NOTIMPL;
     213        CFilterGraph_THIS(iface,mediaseeking);
     214
     215        FIXME("(%p)->() stub!\n",This);
     216
     217        return E_NOTIMPL;
    219218}
    220219
     
    222221IMediaSeeking_fnGetPreroll(IMediaSeeking* iface,LONGLONG* pllPreroll)
    223222{
    224     CFilterGraph_THIS(iface,mediaseeking);
    225 
    226     FIXME("(%p)->() stub!\n",This);
    227 
    228     return E_NOTIMPL;
     223        CFilterGraph_THIS(iface,mediaseeking);
     224
     225        FIXME("(%p)->() stub!\n",This);
     226
     227        return E_NOTIMPL;
    229228}
    230229
     
    234233static ICOM_VTABLE(IMediaSeeking) imediaseeking =
    235234{
    236     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    237     /* IUnknown fields */
    238     IMediaSeeking_fnQueryInterface,
    239     IMediaSeeking_fnAddRef,
    240     IMediaSeeking_fnRelease,
    241     /* IMediaSeeking fields */
    242     IMediaSeeking_fnGetCapabilities,
    243     IMediaSeeking_fnCheckCapabilities,
    244     IMediaSeeking_fnIsFormatSupported,
    245     IMediaSeeking_fnQueryPreferredFormat,
    246     IMediaSeeking_fnGetTimeFormat,
    247     IMediaSeeking_fnIsUsingTimeFormat,
    248     IMediaSeeking_fnSetTimeFormat,
    249     IMediaSeeking_fnGetDuration,
    250     IMediaSeeking_fnGetStopPosition,
    251     IMediaSeeking_fnGetCurrentPosition,
    252     IMediaSeeking_fnConvertTimeFormat,
    253     IMediaSeeking_fnSetPositions,
    254     IMediaSeeking_fnGetPositions,
    255     IMediaSeeking_fnGetAvailable,
    256     IMediaSeeking_fnSetRate,
    257     IMediaSeeking_fnGetRate,
    258     IMediaSeeking_fnGetPreroll,
     235        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     236        /* IUnknown fields */
     237        IMediaSeeking_fnQueryInterface,
     238        IMediaSeeking_fnAddRef,
     239        IMediaSeeking_fnRelease,
     240        /* IMediaSeeking fields */
     241        IMediaSeeking_fnGetCapabilities,
     242        IMediaSeeking_fnCheckCapabilities,
     243        IMediaSeeking_fnIsFormatSupported,
     244        IMediaSeeking_fnQueryPreferredFormat,
     245        IMediaSeeking_fnGetTimeFormat,
     246        IMediaSeeking_fnIsUsingTimeFormat,
     247        IMediaSeeking_fnSetTimeFormat,
     248        IMediaSeeking_fnGetDuration,
     249        IMediaSeeking_fnGetStopPosition,
     250        IMediaSeeking_fnGetCurrentPosition,
     251        IMediaSeeking_fnConvertTimeFormat,
     252        IMediaSeeking_fnSetPositions,
     253        IMediaSeeking_fnGetPositions,
     254        IMediaSeeking_fnGetAvailable,
     255        IMediaSeeking_fnSetRate,
     256        IMediaSeeking_fnGetRate,
     257        IMediaSeeking_fnGetPreroll,
    259258};
    260259
    261 void CFilterGraph_InitIMediaSeeking( CFilterGraph* pfg )
    262 {
    263     TRACE("(%p)\n",pfg);
    264     ICOM_VTBL(&pfg->mediaseeking) = &imediaseeking;
    265 }
     260HRESULT CFilterGraph_InitIMediaSeeking( CFilterGraph* pfg )
     261{
     262        TRACE("(%p)\n",pfg);
     263        ICOM_VTBL(&pfg->mediaseeking) = &imediaseeking;
     264
     265        return NOERROR;
     266}
     267
     268void CFilterGraph_UninitIMediaSeeking( CFilterGraph* pfg )
     269{
     270        TRACE("(%p)\n",pfg);
     271}
  • TabularUnified trunk/src/quartz/initquartz.cpp

    r6649 r6710  
    1 /* $Id: initquartz.cpp,v 1.2 2001-09-05 13:36:36 bird Exp $ */
    21/*
    32 * DLL entry point
     
    5655   case DLL_THREAD_ATTACH:
    5756   case DLL_THREAD_DETACH:
    58     return QUARTZ_DllMain(hinstDLL, fdwReason, fImpLoad);
     57        return QUARTZ_DllMain(hinstDLL, fdwReason, fImpLoad);
    5958
    6059   case DLL_PROCESS_DETACH:
    6160        ret = QUARTZ_DllMain(hinstDLL, fdwReason, fImpLoad);
    62     ctordtorTerm();
    63     return ret;
     61        ctordtorTerm();
     62        return ret;
    6463   }
    6564   return FALSE;
     
    8887         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8988         dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab);
    90          if(dllHandle == 0)
    91         return 0UL;
     89         if(dllHandle == 0) 
     90                return 0UL;
    9291
    9392         break;
    9493      case 1 :
    9594         if(dllHandle) {
    96         UnregisterLxDll(dllHandle);
     95                UnregisterLxDll(dllHandle);
    9796         }
    9897         break;
  • TabularUnified trunk/src/quartz/initterm.cpp

    r6649 r6710  
    1 /* $Id: initterm.cpp,v 1.2 2001-09-05 13:36:37 bird Exp $ */
    21/*
    32 * DLL entry point
  • TabularUnified trunk/src/quartz/irclock.c

    r6649 r6710  
    1 /* $Id: irclock.c,v 1.3 2001-09-05 13:36:37 bird Exp $ */
    21/*
    32 * Implementation of CLSID_SystemClock.
    43 *
    5  * FIXME - stub.
     4 * FIXME - not tested yet.
    65 *
    76 * hidenori@a2.ctktv.ne.jp
     
    1312#include "winbase.h"
    1413#include "wingdi.h"
     14#include "winuser.h"
    1515#include "winerror.h"
    1616#include "wine/obj_base.h"
     
    2525
    2626
     27#define QUARTZ_MSG_ADDTIMER                     (WM_APP+0)
     28#define QUARTZ_MSG_REMOVETIMER          (WM_APP+1)
     29#define QUARTZ_MSG_EXITTHREAD           (WM_APP+2)
     30
     31
     32/****************************************************************************/
     33
     34static QUARTZ_TimerEntry* IReferenceClock_AllocTimerEntry(CSystemClock* This)
     35{
     36        QUARTZ_TimerEntry*      pEntry;
     37        DWORD   dw;
     38
     39        pEntry = &This->m_timerEntries[0];
     40        for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ )
     41        {
     42                if ( pEntry->hEvent == (HANDLE)NULL )
     43                        return pEntry;
     44                pEntry ++;
     45        }
     46
     47        return NULL;
     48}
     49
     50static QUARTZ_TimerEntry* IReferenceClock_SearchTimer(CSystemClock* This, DWORD dwAdvCookie)
     51{
     52        QUARTZ_TimerEntry*      pEntry;
     53        DWORD   dw;
     54
     55        pEntry = &This->m_timerEntries[0];
     56        for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ )
     57        {
     58                if ( pEntry->hEvent != (HANDLE)NULL &&
     59                         pEntry->dwAdvCookie == dwAdvCookie )
     60                        return pEntry;
     61                pEntry ++;
     62        }
     63
     64        return NULL;
     65}
     66
     67static void IReferenceClock_OnTimerUpdated(CSystemClock* This)
     68{
     69        QUARTZ_TimerEntry*      pEntry;
     70        REFERENCE_TIME  rtCur;
     71        REFERENCE_TIME  rtSignal;
     72        REFERENCE_TIME  rtCount;
     73        HRESULT hr;
     74        LONG    lCount;
     75        DWORD   dw;
     76
     77        hr = IReferenceClock_GetTime((IReferenceClock*)(&This->refclk),&rtCur);
     78        if ( hr != NOERROR )
     79                return;
     80
     81        pEntry = &This->m_timerEntries[0];
     82        for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ )
     83        {
     84                if ( pEntry->hEvent != (HANDLE)NULL )
     85                {
     86                        rtSignal = pEntry->rtStart + pEntry->rtInterval;
     87                        if ( rtCur >= rtSignal )
     88                        {
     89                                if ( pEntry->fPeriodic )
     90                                {
     91                                        rtCount = ((rtCur - pEntry->rtStart) / pEntry->rtInterval);
     92                                        lCount = ( rtCount > (REFERENCE_TIME)0x7fffffff ) ?
     93                                                (LONG)0x7fffffff : (LONG)rtCount;
     94                                        if ( !ReleaseSemaphore( pEntry->hEvent, lCount, NULL ) )
     95                                        {
     96                                                while ( lCount > 0 )
     97                                                {
     98                                                        if ( !ReleaseSemaphore( pEntry->hEvent, 1, NULL ) )
     99                                                                break;
     100                                                }
     101                                        }
     102                                }
     103                                else
     104                                {
     105                                        SetEvent( pEntry->hEvent );
     106                                        pEntry->hEvent = (HANDLE)NULL;
     107                                }
     108                        }
     109                }
     110                pEntry ++;
     111        }
     112}
     113
     114static
     115DWORD WINAPI IReferenceClock_TimerEntry( LPVOID lpvParam )
     116{
     117        CSystemClock*   This = (CSystemClock*)lpvParam;
     118        MSG     msg;
     119        DWORD   dwRes;
     120
     121        /* initialize the message queue. */
     122        PeekMessageA( &msg, (HWND)NULL, 0, 0, PM_NOREMOVE );
     123        /* resume the owner thread. */
     124        SetEvent( This->m_hEventInit );
     125
     126        /* message loop. */
     127        while ( 1 )
     128        {
     129                dwRes = MsgWaitForMultipleObjects(
     130                        0, NULL, FALSE,
     131                        INFINITE, /* FIXME */
     132                        QS_ALLEVENTS );
     133
     134                EnterCriticalSection( &This->m_csClock );
     135                IReferenceClock_OnTimerUpdated(This);
     136                LeaveCriticalSection( &This->m_csClock );
     137
     138                while ( PeekMessageA( &msg, (HWND)NULL, 0, 0, PM_REMOVE ) )
     139                {
     140                        if ( msg.message == WM_QUIT )
     141                                goto quitthread;
     142
     143                        if ( msg.hwnd != (HWND)NULL )
     144                        {
     145                                TranslateMessage( &msg );
     146                                DispatchMessageA( &msg );
     147                        }
     148                        else
     149                        {
     150                                switch ( msg.message )
     151                                {
     152                                case QUARTZ_MSG_ADDTIMER:
     153                                case QUARTZ_MSG_REMOVETIMER:
     154                                        break;
     155                                case QUARTZ_MSG_EXITTHREAD:
     156                                        PostQuitMessage(0);
     157                                        break;
     158                                default:
     159                                        FIXME( "invalid message %04u\n", (unsigned)msg.message );
     160                                        break;
     161                                }
     162                        }
     163                }
     164        }
     165
     166quitthread:
     167        return 0;
     168}
     169
     170/****************************************************************************/
     171
    27172static HRESULT WINAPI
    28173IReferenceClock_fnQueryInterface(IReferenceClock* iface,REFIID riid,void** ppobj)
    29174{
    30     CSystemClock_THIS(iface,refclk);
    31 
    32     TRACE("(%p)->()\n",This);
    33 
    34     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     175        CSystemClock_THIS(iface,refclk);
     176
     177        TRACE("(%p)->()\n",This);
     178
     179        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    35180}
    36181
     
    38183IReferenceClock_fnAddRef(IReferenceClock* iface)
    39184{
    40     CSystemClock_THIS(iface,refclk);
    41 
    42     TRACE("(%p)->()\n",This);
    43 
    44     return IUnknown_AddRef(This->unk.punkControl);
     185        CSystemClock_THIS(iface,refclk);
     186
     187        TRACE("(%p)->()\n",This);
     188
     189        return IUnknown_AddRef(This->unk.punkControl);
    45190}
    46191
     
    48193IReferenceClock_fnRelease(IReferenceClock* iface)
    49194{
    50     CSystemClock_THIS(iface,refclk);
    51 
    52     TRACE("(%p)->()\n",This);
    53 
    54     return IUnknown_Release(This->unk.punkControl);
     195        CSystemClock_THIS(iface,refclk);
     196
     197        TRACE("(%p)->()\n",This);
     198
     199        return IUnknown_Release(This->unk.punkControl);
    55200}
    56201
     
    58203IReferenceClock_fnGetTime(IReferenceClock* iface,REFERENCE_TIME* prtTime)
    59204{
    60     CSystemClock_THIS(iface,refclk);
    61 
    62     FIXME( "(%p)->() stub!\n", This );
    63     return E_NOTIMPL;
     205        CSystemClock_THIS(iface,refclk);
     206        DWORD   dwTimeCur;
     207
     208        TRACE( "(%p)->(%p)\n", This, prtTime );
     209
     210        if ( prtTime == NULL )
     211                return E_POINTER;
     212
     213        EnterCriticalSection( &This->m_csClock );
     214
     215        dwTimeCur = GetTickCount();
     216        This->m_rtLast += (REFERENCE_TIME)(DWORD)(dwTimeCur - This->m_dwTimeLast);
     217
     218        This->m_dwTimeLast = dwTimeCur;
     219
     220        *prtTime = This->m_dwTimeLast;
     221
     222        LeaveCriticalSection( &This->m_csClock );
     223
     224        return NOERROR;
    64225}
    65226
     
    67228IReferenceClock_fnAdviseTime(IReferenceClock* iface,REFERENCE_TIME rtBase,REFERENCE_TIME rtStream,HEVENT hEvent,DWORD_PTR* pdwAdvCookie)
    68229{
    69     CSystemClock_THIS(iface,refclk);
    70 
    71     FIXME( "(%p)->() stub!\n", This );
    72     return E_NOTIMPL;
     230        CSystemClock_THIS(iface,refclk);
     231        QUARTZ_TimerEntry*      pEntry;
     232        HRESULT hr;
     233        REFERENCE_TIME  rtCur;
     234
     235        TRACE( "(%p)->()\n", This );
     236
     237        if ( pdwAdvCookie == NULL )
     238                return E_POINTER;
     239        if ( hEvent == (HANDLE)NULL )
     240                return E_INVALIDARG;
     241
     242        EnterCriticalSection( &This->m_csClock );
     243
     244        *pdwAdvCookie = (DWORD_PTR)(This->m_dwAdvCookieNext ++);
     245
     246        hr = IReferenceClock_GetTime(iface,&rtCur);
     247        if ( hr != NOERROR )
     248                goto err;
     249        if ( rtCur >= (rtBase+rtStream) )
     250        {
     251                SetEvent(hEvent);
     252                hr = NOERROR;
     253                goto err;
     254        }
     255
     256        pEntry = IReferenceClock_AllocTimerEntry(This);
     257        if ( pEntry == NULL )
     258        {
     259                hr = E_FAIL;
     260                goto err;
     261        }
     262
     263        if ( !PostThreadMessageA(
     264                        This->m_idThreadTimer,
     265                        QUARTZ_MSG_ADDTIMER,
     266                        0, 0 ) )
     267        {
     268                hr = E_FAIL;
     269                goto err;
     270        }
     271
     272        pEntry->dwAdvCookie = *pdwAdvCookie;
     273        pEntry->fPeriodic = FALSE;
     274        pEntry->hEvent = hEvent;
     275        pEntry->rtStart = rtBase;
     276        pEntry->rtInterval = rtStream;
     277
     278        hr = NOERROR;
     279err:
     280        LeaveCriticalSection( &This->m_csClock );
     281
     282        return hr;
    73283}
    74284
     
    76286IReferenceClock_fnAdvisePeriodic(IReferenceClock* iface,REFERENCE_TIME rtStart,REFERENCE_TIME rtPeriod,HSEMAPHORE hSemaphore,DWORD_PTR* pdwAdvCookie)
    77287{
    78     CSystemClock_THIS(iface,refclk);
    79 
    80     FIXME( "(%p)->() stub!\n", This );
    81     return E_NOTIMPL;
     288        CSystemClock_THIS(iface,refclk);
     289        QUARTZ_TimerEntry*      pEntry;
     290        HRESULT hr;
     291
     292        TRACE( "(%p)->()\n", This );
     293
     294        if ( pdwAdvCookie == NULL )
     295                return E_POINTER;
     296        if ( hSemaphore == (HSEMAPHORE)NULL )
     297                return E_INVALIDARG;
     298
     299        EnterCriticalSection( &This->m_csClock );
     300
     301        *pdwAdvCookie = (DWORD_PTR)(This->m_dwAdvCookieNext ++);
     302
     303        pEntry = IReferenceClock_AllocTimerEntry(This);
     304        if ( pEntry == NULL )
     305        {
     306                hr = E_FAIL;
     307                goto err;
     308        }
     309
     310        if ( !PostThreadMessageA(
     311                        This->m_idThreadTimer,
     312                        QUARTZ_MSG_ADDTIMER,
     313                        0, 0 ) )
     314        {
     315                hr = E_FAIL;
     316                goto err;
     317        }
     318
     319        pEntry->dwAdvCookie = *pdwAdvCookie;
     320        pEntry->fPeriodic = TRUE;
     321        pEntry->hEvent = (HANDLE)hSemaphore;
     322        pEntry->rtStart = rtStart;
     323        pEntry->rtInterval = rtPeriod;
     324
     325        hr = NOERROR;
     326err:
     327        LeaveCriticalSection( &This->m_csClock );
     328
     329        return hr;
    82330}
    83331
     
    85333IReferenceClock_fnUnadvise(IReferenceClock* iface,DWORD_PTR dwAdvCookie)
    86334{
    87     CSystemClock_THIS(iface,refclk);
    88 
    89     FIXME( "(%p)->() stub!\n", This );
    90     return E_NOTIMPL;
     335        CSystemClock_THIS(iface,refclk);
     336        QUARTZ_TimerEntry*      pEntry;
     337
     338        TRACE( "(%p)->(%lu)\n", This, (DWORD)dwAdvCookie );
     339
     340        EnterCriticalSection( &This->m_csClock );
     341
     342        pEntry = IReferenceClock_SearchTimer(This,(DWORD)dwAdvCookie);
     343        if ( pEntry != NULL )
     344        {
     345                pEntry->hEvent = (HANDLE)NULL;
     346        }
     347
     348        LeaveCriticalSection( &This->m_csClock );
     349
     350        return NOERROR;
    91351}
    92352
    93353static ICOM_VTABLE(IReferenceClock) irefclk =
    94354{
    95     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    96     /* IUnknown fields */
    97     IReferenceClock_fnQueryInterface,
    98     IReferenceClock_fnAddRef,
    99     IReferenceClock_fnRelease,
    100     /* IReferenceClock fields */
    101     IReferenceClock_fnGetTime,
    102     IReferenceClock_fnAdviseTime,
    103     IReferenceClock_fnAdvisePeriodic,
    104     IReferenceClock_fnUnadvise,
     355        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     356        /* IUnknown fields */
     357        IReferenceClock_fnQueryInterface,
     358        IReferenceClock_fnAddRef,
     359        IReferenceClock_fnRelease,
     360        /* IReferenceClock fields */
     361        IReferenceClock_fnGetTime,
     362        IReferenceClock_fnAdviseTime,
     363        IReferenceClock_fnAdvisePeriodic,
     364        IReferenceClock_fnUnadvise,
    105365};
    106366
    107367
    108 void CSystemClock_InitIReferenceClock( CSystemClock* psc )
    109 {
    110     TRACE("(%p)\n",psc);
    111     ICOM_VTBL(&psc->refclk) = &irefclk;
    112 }
     368HRESULT CSystemClock_InitIReferenceClock( CSystemClock* psc )
     369{
     370        HANDLE  hEvents[2];
     371
     372        TRACE("(%p)\n",psc);
     373        ICOM_VTBL(&psc->refclk) = &irefclk;
     374
     375        InitializeCriticalSection( &psc->m_csClock );
     376        psc->m_dwTimeLast = GetTickCount();
     377        psc->m_rtLast = (REFERENCE_TIME)0;
     378        psc->m_hThreadTimer = (HANDLE)NULL;
     379        psc->m_hEventInit = (HANDLE)NULL;
     380        psc->m_idThreadTimer = 0;
     381        psc->m_dwAdvCookieNext = 1;
     382        ZeroMemory( psc->m_timerEntries, sizeof(psc->m_timerEntries) );
     383
     384        psc->m_hEventInit = CreateEventA( NULL, TRUE, FALSE, NULL );
     385        if ( psc->m_hEventInit == (HANDLE)NULL )
     386                goto err;
     387
     388        psc->m_hThreadTimer = CreateThread(
     389                NULL, 0,
     390                IReferenceClock_TimerEntry,
     391                psc, 0, &psc->m_idThreadTimer );
     392
     393        if ( psc->m_hThreadTimer == (HANDLE)NULL )
     394        {
     395                CloseHandle( psc->m_hEventInit );
     396                psc->m_hEventInit = (HANDLE)NULL;
     397                goto err;
     398        }
     399
     400        hEvents[0] = psc->m_hEventInit;
     401        hEvents[1] = psc->m_hThreadTimer;
     402        if ( WaitForMultipleObjects( 2, hEvents, FALSE, INFINITE )
     403                        != WAIT_OBJECT_0 )
     404        {
     405                CloseHandle( psc->m_hEventInit );
     406                psc->m_hEventInit = (HANDLE)NULL;
     407                CloseHandle( psc->m_hThreadTimer );
     408                psc->m_hThreadTimer = (HANDLE)NULL;
     409                goto err;
     410        }
     411
     412        return NOERROR;
     413
     414err:
     415        DeleteCriticalSection( &psc->m_csClock );
     416        return E_FAIL;
     417}
     418
     419void CSystemClock_UninitIReferenceClock( CSystemClock* psc )
     420{
     421        TRACE("(%p)\n",psc);
     422
     423        if ( psc->m_hThreadTimer != (HANDLE)NULL )
     424        {
     425                if ( PostThreadMessageA(
     426                        psc->m_idThreadTimer,
     427                        QUARTZ_MSG_EXITTHREAD,
     428                        0, 0 ) )
     429                {
     430                        WaitForSingleObject( psc->m_hThreadTimer, INFINITE );
     431                }
     432                CloseHandle( psc->m_hThreadTimer );
     433                psc->m_hThreadTimer = (HANDLE)NULL;
     434        }
     435
     436        DeleteCriticalSection( &psc->m_csClock );
     437}
  • TabularUnified trunk/src/quartz/iunk.c

    r6649 r6710  
    1 /* $Id: iunk.c,v 1.3 2001-09-05 13:36:37 bird Exp $ */
    21/*
    32 * An implementation of IUnknown.
     
    109#include "windef.h"
    1110#include "winerror.h"
     11#include "winbase.h"
    1212#include "wine/obj_base.h"
    1313
     
    2222IUnknown_fnQueryInterface(IUnknown* iface,REFIID riid,LPVOID *ppobj)
    2323{
    24     ICOM_THIS(QUARTZ_IUnkImpl,iface);
    25     size_t  ofs;
    26     DWORD   dwIndex;
     24        ICOM_THIS(QUARTZ_IUnkImpl,iface);
     25        size_t  ofs;
     26        DWORD   dwIndex;
     27        QUARTZ_IFDelegation*    pDelegation;
     28        HRESULT hr;
    2729
    28     TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
     30        TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
    2931
    30     if ( ppobj == NULL )
    31         return E_POINTER;
    32     *ppobj = NULL;
     32        if ( ppobj == NULL )
     33                return E_POINTER;
     34        *ppobj = NULL;
    3335
    34     ofs = 0;
     36        ofs = 0;
    3537
    36     if ( IsEqualGUID( &IID_IUnknown, riid ) )
    37     {
    38         TRACE("IID_IUnknown - returns inner object.\n");
    39     }
    40     else
    41     {
    42         for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )
    43         {
    44             if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )
    45             {
    46                 ofs = This->pEntries[dwIndex].ofsVTPtr;
    47                 break;
    48             }
    49         }
    50         if ( dwIndex == This->dwEntries )
    51         {
    52             FIXME("unknown interface: %s\n",debugstr_guid(riid));
    53             return E_NOINTERFACE;
    54         }
    55     }
     38        if ( IsEqualGUID( &IID_IUnknown, riid ) )
     39        {
     40                TRACE("IID_IUnknown - returns inner object.\n");
     41        }
     42        else
     43        {
     44                for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )
     45                {
     46                        if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )
     47                        {
     48                                ofs = This->pEntries[dwIndex].ofsVTPtr;
     49                                break;
     50                        }
     51                }
     52                if ( dwIndex == This->dwEntries )
     53                {
     54                        hr = E_NOINTERFACE;
    5655
    57     *ppobj = (LPVOID)(((char*)This) + ofs);
    58     IUnknown_AddRef((IUnknown*)(*ppobj));
     56                        /* delegation */
     57                        pDelegation = This->pDelegationFirst;
     58                        while ( pDelegation != NULL )
     59                        {
     60                                hr = (*pDelegation->pOnQueryInterface)( iface, riid, ppobj );
     61                                if ( hr != E_NOINTERFACE )
     62                                        break;
     63                                pDelegation = pDelegation->pNext;
     64                        }
    5965
    60     return S_OK;
     66                        if ( hr == E_NOINTERFACE )
     67                        {
     68                                FIXME("unknown interface: %s\n",debugstr_guid(riid));
     69                        }
     70
     71                        return hr;
     72                }
     73        }
     74
     75        *ppobj = (LPVOID)(((char*)This) + ofs);
     76        IUnknown_AddRef((IUnknown*)(*ppobj));
     77
     78        return S_OK;
    6179}
    6280
     
    6482IUnknown_fnAddRef(IUnknown* iface)
    6583{
    66     ICOM_THIS(QUARTZ_IUnkImpl,iface);
     84        ICOM_THIS(QUARTZ_IUnkImpl,iface);
    6785
    68     TRACE("(%p)->()\n",This);
     86        TRACE("(%p)->()\n",This);
    6987
    70     return ++(This->ref);
     88        return InterlockedExchangeAdd(&(This->ref),1) + 1;
    7189}
    7290
     
    7492IUnknown_fnRelease(IUnknown* iface)
    7593{
    76     ICOM_THIS(QUARTZ_IUnkImpl,iface);
     94        ICOM_THIS(QUARTZ_IUnkImpl,iface);
     95        LONG    ref;
    7796
    78     TRACE("(%p)->()\n",This);
    79     if ( (--(This->ref)) > 0 )
    80         return This->ref;
     97        TRACE("(%p)->()\n",This);
     98        ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
     99        if ( ref > 0 )
     100                return (ULONG)ref;
    81101
    82     QUARTZ_FreeObj(This);
     102        if ( This->pOnFinalRelease != NULL )
     103                (*(This->pOnFinalRelease))(iface);
    83104
    84     return 0;
     105        QUARTZ_FreeObj(This);
     106
     107        return 0;
    85108}
    86109
    87110static ICOM_VTABLE(IUnknown) iunknown =
    88111{
    89     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    90     /* IUnknown fields */
    91     IUnknown_fnQueryInterface,
    92     IUnknown_fnAddRef,
    93     IUnknown_fnRelease,
     112        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     113        /* IUnknown fields */
     114        IUnknown_fnQueryInterface,
     115        IUnknown_fnAddRef,
     116        IUnknown_fnRelease,
    94117};
    95118
     
    97120void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter )
    98121{
    99     TRACE("(%p)\n",pImpl);
     122        TRACE("(%p)\n",pImpl);
    100123
    101     ICOM_VTBL(pImpl) = &iunknown;
    102     pImpl->pEntries = NULL;
    103     pImpl->dwEntries = 0;
    104     pImpl->ref = 1;
    105     pImpl->punkControl = (IUnknown*)pImpl;
     124        ICOM_VTBL(pImpl) = &iunknown;
     125        pImpl->pEntries = NULL;
     126        pImpl->dwEntries = 0;
     127        pImpl->pDelegationFirst = NULL;
     128        pImpl->pOnFinalRelease = NULL;
     129        pImpl->ref = 1;
     130        pImpl->punkControl = (IUnknown*)pImpl;
    106131
    107     /* for delegation. */
    108     if ( punkOuter != NULL )
    109         pImpl->punkControl = punkOuter;
     132        /* for implementing aggregation. */
     133        if ( punkOuter != NULL )
     134                pImpl->punkControl = punkOuter;
    110135}
    111136
     137void QUARTZ_IUnkAddDelegation(
     138        QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation )
     139{
     140        pDelegation->pNext = pImpl->pDelegationFirst;
     141        pImpl->pDelegationFirst = pDelegation;
     142}
     143
  • TabularUnified trunk/src/quartz/iunk.h

    r6578 r6710  
    2525 */
    2626
     27/* for InterlockedExchangeAdd. */
     28#include <pshpack4.h>
     29
    2730typedef struct QUARTZ_IFEntry
    2831{
    29         REFIID          piid;           /* interface ID. */
     32        const IID*      piid;           /* interface ID. */
    3033        size_t          ofsVTPtr;       /* offset from IUnknown. */
    3134} QUARTZ_IFEntry;
     35
     36typedef struct QUARTZ_IFDelegation
     37{
     38        struct QUARTZ_IFDelegation*     pNext;
     39        HRESULT (*pOnQueryInterface)(
     40                IUnknown* punk, const IID* piid, void** ppobj );
     41} QUARTZ_IFDelegation;
    3242
    3343typedef struct QUARTZ_IUnkImpl
     
    3949        const QUARTZ_IFEntry*   pEntries;
    4050        DWORD   dwEntries;
     51        /* list of delegation handlers. */
     52        QUARTZ_IFDelegation*    pDelegationFirst;
     53        /* called on final release. */
     54        void (*pOnFinalRelease)(IUnknown* punk);
    4155
    4256        /* IUnknown fields. */
    43         ULONG   ref;
     57        LONG    ref;
    4458        IUnknown*       punkControl;
    4559} QUARTZ_IUnkImpl;
    4660
     61#include <poppack.h>
     62
    4763
    4864void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter );
     65void QUARTZ_IUnkAddDelegation(
     66        QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation );
    4967
    5068
  • TabularUnified trunk/src/quartz/ividwin.c

    r6649 r6710  
    1 /* $Id: ividwin.c,v 1.2 2001-09-05 13:36:37 bird Exp $ */
    21/*
    32 * Implementation of IVideoWindow for FilterGraph.
     
    3130IVideoWindow_fnQueryInterface(IVideoWindow* iface,REFIID riid,void** ppobj)
    3231{
    33     CFilterGraph_THIS(iface,vidwin);
    34 
    35     TRACE("(%p)->()\n",This);
    36 
    37     return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
     32        CFilterGraph_THIS(iface,vidwin);
     33
     34        TRACE("(%p)->()\n",This);
     35
     36        return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
    3837}
    3938
     
    4140IVideoWindow_fnAddRef(IVideoWindow* iface)
    4241{
    43     CFilterGraph_THIS(iface,vidwin);
    44 
    45     TRACE("(%p)->()\n",This);
    46 
    47     return IUnknown_AddRef(This->unk.punkControl);
     42        CFilterGraph_THIS(iface,vidwin);
     43
     44        TRACE("(%p)->()\n",This);
     45
     46        return IUnknown_AddRef(This->unk.punkControl);
    4847}
    4948
     
    5150IVideoWindow_fnRelease(IVideoWindow* iface)
    5251{
    53     CFilterGraph_THIS(iface,vidwin);
    54 
    55     TRACE("(%p)->()\n",This);
    56 
    57     return IUnknown_Release(This->unk.punkControl);
     52        CFilterGraph_THIS(iface,vidwin);
     53
     54        TRACE("(%p)->()\n",This);
     55
     56        return IUnknown_Release(This->unk.punkControl);
    5857}
    5958
     
    6160IVideoWindow_fnGetTypeInfoCount(IVideoWindow* iface,UINT* pcTypeInfo)
    6261{
    63     CFilterGraph_THIS(iface,vidwin);
    64 
    65     FIXME("(%p)->()\n",This);
    66 
    67     return E_NOTIMPL;
     62        CFilterGraph_THIS(iface,vidwin);
     63
     64        FIXME("(%p)->()\n",This);
     65
     66        return E_NOTIMPL;
    6867}
    6968
     
    7170IVideoWindow_fnGetTypeInfo(IVideoWindow* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
    7271{
    73     CFilterGraph_THIS(iface,vidwin);
    74 
    75     FIXME("(%p)->()\n",This);
    76 
    77     return E_NOTIMPL;
     72        CFilterGraph_THIS(iface,vidwin);
     73
     74        FIXME("(%p)->()\n",This);
     75
     76        return E_NOTIMPL;
    7877}
    7978
     
    8180IVideoWindow_fnGetIDsOfNames(IVideoWindow* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
    8281{
    83     CFilterGraph_THIS(iface,vidwin);
    84 
    85     FIXME("(%p)->()\n",This);
    86 
    87     return E_NOTIMPL;
     82        CFilterGraph_THIS(iface,vidwin);
     83
     84        FIXME("(%p)->()\n",This);
     85
     86        return E_NOTIMPL;
    8887}
    8988
     
    9190IVideoWindow_fnInvoke(IVideoWindow* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
    9291{
    93     CFilterGraph_THIS(iface,vidwin);
    94 
    95     FIXME("(%p)->()\n",This);
    96 
    97     return E_NOTIMPL;
     92        CFilterGraph_THIS(iface,vidwin);
     93
     94        FIXME("(%p)->()\n",This);
     95
     96        return E_NOTIMPL;
    9897}
    9998
     
    103102IVideoWindow_fnput_Caption(IVideoWindow* iface,BSTR strCaption)
    104103{
    105     CFilterGraph_THIS(iface,vidwin);
    106 
    107     FIXME("(%p)->() stub!\n",This);
    108 
    109     return E_NOTIMPL;
     104        CFilterGraph_THIS(iface,vidwin);
     105
     106        FIXME("(%p)->() stub!\n",This);
     107
     108        return E_NOTIMPL;
    110109}
    111110
     
    113112IVideoWindow_fnget_Caption(IVideoWindow* iface,BSTR* pstrCaption)
    114113{
    115     CFilterGraph_THIS(iface,vidwin);
    116 
    117     FIXME("(%p)->() stub!\n",This);
    118 
    119     return E_NOTIMPL;
     114        CFilterGraph_THIS(iface,vidwin);
     115
     116        FIXME("(%p)->() stub!\n",This);
     117
     118        return E_NOTIMPL;
    120119}
    121120
     
    123122IVideoWindow_fnput_WindowStyle(IVideoWindow* iface,long lStyle)
    124123{
    125     CFilterGraph_THIS(iface,vidwin);
    126 
    127     FIXME("(%p)->() stub!\n",This);
    128 
    129     return E_NOTIMPL;
     124        CFilterGraph_THIS(iface,vidwin);
     125
     126        FIXME("(%p)->() stub!\n",This);
     127
     128        return E_NOTIMPL;
    130129}
    131130
     
    133132IVideoWindow_fnget_WindowStyle(IVideoWindow* iface,long* plStyle)
    134133{
    135     CFilterGraph_THIS(iface,vidwin);
    136 
    137     FIXME("(%p)->() stub!\n",This);
    138 
    139     return E_NOTIMPL;
     134        CFilterGraph_THIS(iface,vidwin);
     135
     136        FIXME("(%p)->() stub!\n",This);
     137
     138        return E_NOTIMPL;
    140139}
    141140
     
    143142IVideoWindow_fnput_WindowStyleEx(IVideoWindow* iface,long lExStyle)
    144143{
    145     CFilterGraph_THIS(iface,vidwin);
    146 
    147     FIXME("(%p)->() stub!\n",This);
    148 
    149     return E_NOTIMPL;
     144        CFilterGraph_THIS(iface,vidwin);
     145
     146        FIXME("(%p)->() stub!\n",This);
     147
     148        return E_NOTIMPL;
    150149}
    151150
     
    153152IVideoWindow_fnget_WindowStyleEx(IVideoWindow* iface,long* plExStyle)
    154153{
    155     CFilterGraph_THIS(iface,vidwin);
    156 
    157     FIXME("(%p)->() stub!\n",This);
    158 
    159     return E_NOTIMPL;
     154        CFilterGraph_THIS(iface,vidwin);
     155
     156        FIXME("(%p)->() stub!\n",This);
     157
     158        return E_NOTIMPL;
    160159}
    161160
     
    163162IVideoWindow_fnput_AutoShow(IVideoWindow* iface,long lAutoShow)
    164163{
    165     CFilterGraph_THIS(iface,vidwin);
    166 
    167     FIXME("(%p)->() stub!\n",This);
    168 
    169     return E_NOTIMPL;
     164        CFilterGraph_THIS(iface,vidwin);
     165
     166        FIXME("(%p)->() stub!\n",This);
     167
     168        return E_NOTIMPL;
    170169}
    171170
     
    173172IVideoWindow_fnget_AutoShow(IVideoWindow* iface,long* plAutoShow)
    174173{
    175     CFilterGraph_THIS(iface,vidwin);
    176 
    177     FIXME("(%p)->() stub!\n",This);
    178 
    179     return E_NOTIMPL;
     174        CFilterGraph_THIS(iface,vidwin);
     175
     176        FIXME("(%p)->() stub!\n",This);
     177
     178        return E_NOTIMPL;
    180179}
    181180
     
    183182IVideoWindow_fnput_WindowState(IVideoWindow* iface,long lState)
    184183{
    185     CFilterGraph_THIS(iface,vidwin);
    186 
    187     FIXME("(%p)->() stub!\n",This);
    188 
    189     return E_NOTIMPL;
     184        CFilterGraph_THIS(iface,vidwin);
     185
     186        FIXME("(%p)->() stub!\n",This);
     187
     188        return E_NOTIMPL;
    190189}
    191190
     
    193192IVideoWindow_fnget_WindowState(IVideoWindow* iface,long* plState)
    194193{
    195     CFilterGraph_THIS(iface,vidwin);
    196 
    197     FIXME("(%p)->() stub!\n",This);
    198 
    199     return E_NOTIMPL;
     194        CFilterGraph_THIS(iface,vidwin);
     195
     196        FIXME("(%p)->() stub!\n",This);
     197
     198        return E_NOTIMPL;
    200199}
    201200
     
    203202IVideoWindow_fnput_BackgroundPalette(IVideoWindow* iface,long lBackPal)
    204203{
    205     CFilterGraph_THIS(iface,vidwin);
    206 
    207     FIXME("(%p)->() stub!\n",This);
    208 
    209     return E_NOTIMPL;
     204        CFilterGraph_THIS(iface,vidwin);
     205
     206        FIXME("(%p)->() stub!\n",This);
     207
     208        return E_NOTIMPL;
    210209}
    211210
     
    213212IVideoWindow_fnget_BackgroundPalette(IVideoWindow* iface,long* plBackPal)
    214213{
    215     CFilterGraph_THIS(iface,vidwin);
    216 
    217     FIXME("(%p)->() stub!\n",This);
    218 
    219     return E_NOTIMPL;
     214        CFilterGraph_THIS(iface,vidwin);
     215
     216        FIXME("(%p)->() stub!\n",This);
     217
     218        return E_NOTIMPL;
    220219}
    221220
     
    223222IVideoWindow_fnput_Visible(IVideoWindow* iface,long lVisible)
    224223{
    225     CFilterGraph_THIS(iface,vidwin);
    226 
    227     FIXME("(%p)->() stub!\n",This);
    228 
    229     return E_NOTIMPL;
     224        CFilterGraph_THIS(iface,vidwin);
     225
     226        FIXME("(%p)->() stub!\n",This);
     227
     228        return E_NOTIMPL;
    230229}
    231230
     
    233232IVideoWindow_fnget_Visible(IVideoWindow* iface,long* plVisible)
    234233{
    235     CFilterGraph_THIS(iface,vidwin);
    236 
    237     FIXME("(%p)->() stub!\n",This);
    238 
    239     return E_NOTIMPL;
     234        CFilterGraph_THIS(iface,vidwin);
     235
     236        FIXME("(%p)->() stub!\n",This);
     237
     238        return E_NOTIMPL;
    240239}
    241240
     
    243242IVideoWindow_fnput_Left(IVideoWindow* iface,long lLeft)
    244243{
    245     CFilterGraph_THIS(iface,vidwin);
    246 
    247     FIXME("(%p)->() stub!\n",This);
    248 
    249     return E_NOTIMPL;
     244        CFilterGraph_THIS(iface,vidwin);
     245
     246        FIXME("(%p)->() stub!\n",This);
     247
     248        return E_NOTIMPL;
    250249}
    251250
     
    253252IVideoWindow_fnget_Left(IVideoWindow* iface,long* plLeft)
    254253{
    255     CFilterGraph_THIS(iface,vidwin);
    256 
    257     FIXME("(%p)->() stub!\n",This);
    258 
    259     return E_NOTIMPL;
     254        CFilterGraph_THIS(iface,vidwin);
     255
     256        FIXME("(%p)->() stub!\n",This);
     257
     258        return E_NOTIMPL;
    260259}
    261260
     
    263262IVideoWindow_fnput_Width(IVideoWindow* iface,long lWidth)
    264263{
    265     CFilterGraph_THIS(iface,vidwin);
    266 
    267     FIXME("(%p)->() stub!\n",This);
    268 
    269     return E_NOTIMPL;
     264        CFilterGraph_THIS(iface,vidwin);
     265
     266        FIXME("(%p)->() stub!\n",This);
     267
     268        return E_NOTIMPL;
    270269}
    271270
     
    273272IVideoWindow_fnget_Width(IVideoWindow* iface,long* plWidth)
    274273{
    275     CFilterGraph_THIS(iface,vidwin);
    276 
    277     FIXME("(%p)->() stub!\n",This);
    278 
    279     return E_NOTIMPL;
     274        CFilterGraph_THIS(iface,vidwin);
     275
     276        FIXME("(%p)->() stub!\n",This);
     277
     278        return E_NOTIMPL;
    280279}
    281280
     
    283282IVideoWindow_fnput_Top(IVideoWindow* iface,long lTop)
    284283{
    285     CFilterGraph_THIS(iface,vidwin);
    286 
    287     FIXME("(%p)->() stub!\n",This);
    288 
    289     return E_NOTIMPL;
     284        CFilterGraph_THIS(iface,vidwin);
     285
     286        FIXME("(%p)->() stub!\n",This);
     287
     288        return E_NOTIMPL;
    290289}
    291290
     
    293292IVideoWindow_fnget_Top(IVideoWindow* iface,long* plTop)
    294293{
    295     CFilterGraph_THIS(iface,vidwin);
    296 
    297     FIXME("(%p)->() stub!\n",This);
    298 
    299     return E_NOTIMPL;
     294        CFilterGraph_THIS(iface,vidwin);
     295
     296        FIXME("(%p)->() stub!\n",This);
     297
     298        return E_NOTIMPL;
    300299}
    301300
     
    303302IVideoWindow_fnput_Height(IVideoWindow* iface,long lHeight)
    304303{
    305     CFilterGraph_THIS(iface,vidwin);
    306 
    307     FIXME("(%p)->() stub!\n",This);
    308 
    309     return E_NOTIMPL;
     304        CFilterGraph_THIS(iface,vidwin);
     305
     306        FIXME("(%p)->() stub!\n",This);
     307
     308        return E_NOTIMPL;
    310309}
    311310
     
    313312IVideoWindow_fnget_Height(IVideoWindow* iface,long* plHeight)
    314313{
    315     CFilterGraph_THIS(iface,vidwin);
    316 
    317     FIXME("(%p)->() stub!\n",This);
    318 
    319     return E_NOTIMPL;
     314        CFilterGraph_THIS(iface,vidwin);
     315
     316        FIXME("(%p)->() stub!\n",This);
     317
     318        return E_NOTIMPL;
    320319}
    321320
     
    323322IVideoWindow_fnput_Owner(IVideoWindow* iface,OAHWND hwnd)
    324323{
    325     CFilterGraph_THIS(iface,vidwin);
    326 
    327     FIXME("(%p)->() stub!\n",This);
    328 
    329     return E_NOTIMPL;
     324        CFilterGraph_THIS(iface,vidwin);
     325
     326        FIXME("(%p)->() stub!\n",This);
     327
     328        return E_NOTIMPL;
    330329}
    331330
     
    333332IVideoWindow_fnget_Owner(IVideoWindow* iface,OAHWND* phwnd)
    334333{
    335     CFilterGraph_THIS(iface,vidwin);
    336 
    337     FIXME("(%p)->() stub!\n",This);
    338 
    339     return E_NOTIMPL;
     334        CFilterGraph_THIS(iface,vidwin);
     335
     336        FIXME("(%p)->() stub!\n",This);
     337
     338        return E_NOTIMPL;
    340339}
    341340
     
    343342IVideoWindow_fnput_MessageDrain(IVideoWindow* iface,OAHWND hwnd)
    344343{
    345     CFilterGraph_THIS(iface,vidwin);
    346 
    347     FIXME("(%p)->() stub!\n",This);
    348 
    349     return E_NOTIMPL;
     344        CFilterGraph_THIS(iface,vidwin);
     345
     346        FIXME("(%p)->() stub!\n",This);
     347
     348        return E_NOTIMPL;
    350349}
    351350
     
    353352IVideoWindow_fnget_MessageDrain(IVideoWindow* iface,OAHWND* phwnd)
    354353{
    355     CFilterGraph_THIS(iface,vidwin);
    356 
    357     FIXME("(%p)->() stub!\n",This);
    358 
    359     return E_NOTIMPL;
     354        CFilterGraph_THIS(iface,vidwin);
     355
     356        FIXME("(%p)->() stub!\n",This);
     357
     358        return E_NOTIMPL;
    360359}
    361360
     
    363362IVideoWindow_fnget_BorderColor(IVideoWindow* iface,long* plColor)
    364363{
    365     CFilterGraph_THIS(iface,vidwin);
    366 
    367     FIXME("(%p)->() stub!\n",This);
    368 
    369     return E_NOTIMPL;
     364        CFilterGraph_THIS(iface,vidwin);
     365
     366        FIXME("(%p)->() stub!\n",This);
     367
     368        return E_NOTIMPL;
    370369}
    371370
     
    373372IVideoWindow_fnput_BorderColor(IVideoWindow* iface,long lColor)
    374373{
    375     CFilterGraph_THIS(iface,vidwin);
    376 
    377     FIXME("(%p)->() stub!\n",This);
    378 
    379     return E_NOTIMPL;
     374        CFilterGraph_THIS(iface,vidwin);
     375
     376        FIXME("(%p)->() stub!\n",This);
     377
     378        return E_NOTIMPL;
    380379}
    381380
     
    383382IVideoWindow_fnget_FullScreenMode(IVideoWindow* iface,long* plMode)
    384383{
    385     CFilterGraph_THIS(iface,vidwin);
    386 
    387     FIXME("(%p)->() stub!\n",This);
    388 
    389     return E_NOTIMPL;
     384        CFilterGraph_THIS(iface,vidwin);
     385
     386        FIXME("(%p)->() stub!\n",This);
     387
     388        return E_NOTIMPL;
    390389}
    391390
     
    393392IVideoWindow_fnput_FullScreenMode(IVideoWindow* iface,long lMode)
    394393{
    395     CFilterGraph_THIS(iface,vidwin);
    396 
    397     FIXME("(%p)->() stub!\n",This);
    398 
    399     return E_NOTIMPL;
     394        CFilterGraph_THIS(iface,vidwin);
     395
     396        FIXME("(%p)->() stub!\n",This);
     397
     398        return E_NOTIMPL;
    400399}
    401400
     
    403402IVideoWindow_fnSetWindowForeground(IVideoWindow* iface,long lFocus)
    404403{
    405     CFilterGraph_THIS(iface,vidwin);
    406 
    407     FIXME("(%p)->() stub!\n",This);
    408 
    409     return E_NOTIMPL;
     404        CFilterGraph_THIS(iface,vidwin);
     405
     406        FIXME("(%p)->() stub!\n",This);
     407
     408        return E_NOTIMPL;
    410409}
    411410
     
    413412IVideoWindow_fnNotifyOwnerMessage(IVideoWindow* iface,OAHWND hwnd,long message,LONG_PTR wParam,LONG_PTR lParam)
    414413{
    415     CFilterGraph_THIS(iface,vidwin);
    416 
    417     FIXME("(%p)->() stub!\n",This);
    418 
    419     return E_NOTIMPL;
     414        CFilterGraph_THIS(iface,vidwin);
     415
     416        FIXME("(%p)->() stub!\n",This);
     417
     418        return E_NOTIMPL;
    420419}
    421420
     
    423422IVideoWindow_fnSetWindowPosition(IVideoWindow* iface,long lLeft,long lTop,long lWidth,long lHeight)
    424423{
    425     CFilterGraph_THIS(iface,vidwin);
    426 
    427     FIXME("(%p)->() stub!\n",This);
    428 
    429     return E_NOTIMPL;
     424        CFilterGraph_THIS(iface,vidwin);
     425
     426        FIXME("(%p)->() stub!\n",This);
     427
     428        return E_NOTIMPL;
    430429}
    431430
     
    433432IVideoWindow_fnGetWindowPosition(IVideoWindow* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight)
    434433{
    435     CFilterGraph_THIS(iface,vidwin);
    436 
    437     FIXME("(%p)->() stub!\n",This);
    438 
    439     return E_NOTIMPL;
     434        CFilterGraph_THIS(iface,vidwin);
     435
     436        FIXME("(%p)->() stub!\n",This);
     437
     438        return E_NOTIMPL;
    440439}
    441440
     
    443442IVideoWindow_fnGetMinIdealImageSize(IVideoWindow* iface,long* plWidth,long* plHeight)
    444443{
    445     CFilterGraph_THIS(iface,vidwin);
    446 
    447     FIXME("(%p)->() stub!\n",This);
    448 
    449     return E_NOTIMPL;
     444        CFilterGraph_THIS(iface,vidwin);
     445
     446        FIXME("(%p)->() stub!\n",This);
     447
     448        return E_NOTIMPL;
    450449}
    451450
     
    453452IVideoWindow_fnGetMaxIdealImageSize(IVideoWindow* iface,long* plWidth,long* plHeight)
    454453{
    455     CFilterGraph_THIS(iface,vidwin);
    456 
    457     FIXME("(%p)->() stub!\n",This);
    458 
    459     return E_NOTIMPL;
     454        CFilterGraph_THIS(iface,vidwin);
     455
     456        FIXME("(%p)->() stub!\n",This);
     457
     458        return E_NOTIMPL;
    460459}
    461460
     
    463462IVideoWindow_fnGetRestorePosition(IVideoWindow* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight)
    464463{
    465     CFilterGraph_THIS(iface,vidwin);
    466 
    467     FIXME("(%p)->() stub!\n",This);
    468 
    469     return E_NOTIMPL;
     464        CFilterGraph_THIS(iface,vidwin);
     465
     466        FIXME("(%p)->() stub!\n",This);
     467
     468        return E_NOTIMPL;
    470469}
    471470
     
    473472IVideoWindow_fnHideCursor(IVideoWindow* iface,long lHide)
    474473{
    475     CFilterGraph_THIS(iface,vidwin);
    476 
    477     FIXME("(%p)->() stub!\n",This);
    478 
    479     return E_NOTIMPL;
     474        CFilterGraph_THIS(iface,vidwin);
     475
     476        FIXME("(%p)->() stub!\n",This);
     477
     478        return E_NOTIMPL;
    480479}
    481480
     
    483482IVideoWindow_fnIsCursorHidden(IVideoWindow* iface,long* plHide)
    484483{
    485     CFilterGraph_THIS(iface,vidwin);
    486 
    487     FIXME("(%p)->() stub!\n",This);
    488 
    489     return E_NOTIMPL;
     484        CFilterGraph_THIS(iface,vidwin);
     485
     486        FIXME("(%p)->() stub!\n",This);
     487
     488        return E_NOTIMPL;
    490489}
    491490
     
    495494static ICOM_VTABLE(IVideoWindow) ivideowindow =
    496495{
    497     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    498     /* IUnknown fields */
    499     IVideoWindow_fnQueryInterface,
    500     IVideoWindow_fnAddRef,
    501     IVideoWindow_fnRelease,
    502     /* IDispatch fields */
    503     IVideoWindow_fnGetTypeInfoCount,
    504     IVideoWindow_fnGetTypeInfo,
    505     IVideoWindow_fnGetIDsOfNames,
    506     IVideoWindow_fnInvoke,
    507     /* IVideoWindow fields */
    508     IVideoWindow_fnput_Caption,
    509     IVideoWindow_fnget_Caption,
    510     IVideoWindow_fnput_WindowStyle,
    511     IVideoWindow_fnget_WindowStyle,
    512     IVideoWindow_fnput_WindowStyleEx,
    513     IVideoWindow_fnget_WindowStyleEx,
    514     IVideoWindow_fnput_AutoShow,
    515     IVideoWindow_fnget_AutoShow,
    516     IVideoWindow_fnput_WindowState,
    517     IVideoWindow_fnget_WindowState,
    518     IVideoWindow_fnput_BackgroundPalette,
    519     IVideoWindow_fnget_BackgroundPalette,
    520     IVideoWindow_fnput_Visible,
    521     IVideoWindow_fnget_Visible,
    522     IVideoWindow_fnput_Left,
    523     IVideoWindow_fnget_Left,
    524     IVideoWindow_fnput_Width,
    525     IVideoWindow_fnget_Width,
    526     IVideoWindow_fnput_Top,
    527     IVideoWindow_fnget_Top,
    528     IVideoWindow_fnput_Height,
    529     IVideoWindow_fnget_Height,
    530     IVideoWindow_fnput_Owner,
    531     IVideoWindow_fnget_Owner,
    532     IVideoWindow_fnput_MessageDrain,
    533     IVideoWindow_fnget_MessageDrain,
    534     IVideoWindow_fnget_BorderColor,
    535     IVideoWindow_fnput_BorderColor,
    536     IVideoWindow_fnget_FullScreenMode,
    537     IVideoWindow_fnput_FullScreenMode,
    538     IVideoWindow_fnSetWindowForeground,
    539     IVideoWindow_fnNotifyOwnerMessage,
    540     IVideoWindow_fnSetWindowPosition,
    541     IVideoWindow_fnGetWindowPosition,
    542     IVideoWindow_fnGetMinIdealImageSize,
    543     IVideoWindow_fnGetMaxIdealImageSize,
    544     IVideoWindow_fnGetRestorePosition,
    545     IVideoWindow_fnHideCursor,
    546     IVideoWindow_fnIsCursorHidden,
     496        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     497        /* IUnknown fields */
     498        IVideoWindow_fnQueryInterface,
     499        IVideoWindow_fnAddRef,
     500        IVideoWindow_fnRelease,
     501        /* IDispatch fields */
     502        IVideoWindow_fnGetTypeInfoCount,
     503        IVideoWindow_fnGetTypeInfo,
     504        IVideoWindow_fnGetIDsOfNames,
     505        IVideoWindow_fnInvoke,
     506        /* IVideoWindow fields */
     507        IVideoWindow_fnput_Caption,
     508        IVideoWindow_fnget_Caption,
     509        IVideoWindow_fnput_WindowStyle,
     510        IVideoWindow_fnget_WindowStyle,
     511        IVideoWindow_fnput_WindowStyleEx,
     512        IVideoWindow_fnget_WindowStyleEx,
     513        IVideoWindow_fnput_AutoShow,
     514        IVideoWindow_fnget_AutoShow,
     515        IVideoWindow_fnput_WindowState,
     516        IVideoWindow_fnget_WindowState,
     517        IVideoWindow_fnput_BackgroundPalette,
     518        IVideoWindow_fnget_BackgroundPalette,
     519        IVideoWindow_fnput_Visible,
     520        IVideoWindow_fnget_Visible,
     521        IVideoWindow_fnput_Left,
     522        IVideoWindow_fnget_Left,
     523        IVideoWindow_fnput_Width,
     524        IVideoWindow_fnget_Width,
     525        IVideoWindow_fnput_Top,
     526        IVideoWindow_fnget_Top,
     527        IVideoWindow_fnput_Height,
     528        IVideoWindow_fnget_Height,
     529        IVideoWindow_fnput_Owner,
     530        IVideoWindow_fnget_Owner,
     531        IVideoWindow_fnput_MessageDrain,
     532        IVideoWindow_fnget_MessageDrain,
     533        IVideoWindow_fnget_BorderColor,
     534        IVideoWindow_fnput_BorderColor,
     535        IVideoWindow_fnget_FullScreenMode,
     536        IVideoWindow_fnput_FullScreenMode,
     537        IVideoWindow_fnSetWindowForeground,
     538        IVideoWindow_fnNotifyOwnerMessage,
     539        IVideoWindow_fnSetWindowPosition,
     540        IVideoWindow_fnGetWindowPosition,
     541        IVideoWindow_fnGetMinIdealImageSize,
     542        IVideoWindow_fnGetMaxIdealImageSize,
     543        IVideoWindow_fnGetRestorePosition,
     544        IVideoWindow_fnHideCursor,
     545        IVideoWindow_fnIsCursorHidden,
    547546
    548547};
    549548
    550549
    551 void CFilterGraph_InitIVideoWindow( CFilterGraph* pfg )
    552 {
    553     TRACE("(%p)\n",pfg);
    554     ICOM_VTBL(&pfg->vidwin) = &ivideowindow;
    555 }
     550HRESULT CFilterGraph_InitIVideoWindow( CFilterGraph* pfg )
     551{
     552        TRACE("(%p)\n",pfg);
     553        ICOM_VTBL(&pfg->vidwin) = &ivideowindow;
     554
     555        return NOERROR;
     556}
     557
     558void CFilterGraph_UninitIVideoWindow( CFilterGraph* pfg )
     559{
     560        TRACE("(%p)\n",pfg);
     561}
     562
  • TabularUnified trunk/src/quartz/main.c

    r6649 r6710  
    1 /* $Id: main.c,v 1.3 2001-09-05 13:36:37 bird Exp $ */
    2 
    31#include "config.h"
    42
     
    2018#include "sysclock.h"
    2119#include "memalloc.h"
     20#include "devenum.h"
     21#include "fmap.h"
     22#include "fmap2.h"
     23#include "seekpass.h"
    2224
    2325
    2426typedef struct QUARTZ_CLASSENTRY
    2527{
    26     const CLSID*    pclsid;
    27     QUARTZ_pCreateIUnknown  pCreateIUnk;
     28        const CLSID*    pclsid;
     29        QUARTZ_pCreateIUnknown  pCreateIUnk;
    2830} QUARTZ_CLASSENTRY;
    2931
     
    3840static ICOM_VTABLE(IClassFactory) iclassfact =
    3941{
    40     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    41     IClassFactory_fnQueryInterface,
    42     IClassFactory_fnAddRef,
    43     IClassFactory_fnRelease,
    44     IClassFactory_fnCreateInstance,
    45     IClassFactory_fnLockServer
     42        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     43        IClassFactory_fnQueryInterface,
     44        IClassFactory_fnAddRef,
     45        IClassFactory_fnRelease,
     46        IClassFactory_fnCreateInstance,
     47        IClassFactory_fnLockServer
    4648};
    4749
    4850typedef struct
    4951{
    50     /* IUnknown fields */
    51     ICOM_VFIELD(IClassFactory);
    52     DWORD   ref;
    53     /* IClassFactory fields */
    54     const QUARTZ_CLASSENTRY* pEntry;
     52        /* IUnknown fields */
     53        ICOM_VFIELD(IClassFactory);
     54        LONG    ref;
     55        /* IClassFactory fields */
     56        const QUARTZ_CLASSENTRY* pEntry;
    5557} IClassFactoryImpl;
    5658
    5759static const QUARTZ_CLASSENTRY QUARTZ_ClassList[] =
    5860{
    59     { &CLSID_FilterGraph, &QUARTZ_CreateFilterGraph },
    60     { &CLSID_SystemClock, &QUARTZ_CreateSystemClock },
    61     { &CLSID_MemoryAllocator, &QUARTZ_CreateMemoryAllocator },
    62     { NULL, NULL },
     61        { &CLSID_FilterGraph, &QUARTZ_CreateFilterGraph },
     62        { &CLSID_SystemClock, &QUARTZ_CreateSystemClock },
     63        { &CLSID_MemoryAllocator, &QUARTZ_CreateMemoryAllocator },
     64        { &CLSID_SystemDeviceEnum, &QUARTZ_CreateSystemDeviceEnum },
     65        { &CLSID_FilterMapper, &QUARTZ_CreateFilterMapper },
     66        { &CLSID_FilterMapper2, &QUARTZ_CreateFilterMapper2 },
     67        { &CLSID_SeekingPassThru, &QUARTZ_CreateSeekingPassThru },
     68        { NULL, NULL },
    6369};
    6470
     
    7076void* QUARTZ_AllocObj( DWORD dwSize )
    7177{
    72     void*   pv;
    73 
    74     EnterCriticalSection( &csHeap );
    75     dwClassObjRef ++;
    76     pv = HeapAlloc( hDLLHeap, 0, dwSize );
    77     if ( pv == NULL )
    78         dwClassObjRef --;
    79     LeaveCriticalSection( &csHeap );
    80 
    81     return pv;
     78        void*   pv;
     79
     80        EnterCriticalSection( &csHeap );
     81        dwClassObjRef ++;
     82        pv = HeapAlloc( hDLLHeap, 0, dwSize );
     83        if ( pv == NULL )
     84                dwClassObjRef --;
     85        LeaveCriticalSection( &csHeap );
     86
     87        return pv;
    8288}
    8389
    8490void QUARTZ_FreeObj( void* pobj )
    8591{
    86     EnterCriticalSection( &csHeap );
    87     HeapFree( hDLLHeap, 0, pobj );
    88     dwClassObjRef --;
    89     LeaveCriticalSection( &csHeap );
     92        EnterCriticalSection( &csHeap );
     93        HeapFree( hDLLHeap, 0, pobj );
     94        dwClassObjRef --;
     95        LeaveCriticalSection( &csHeap );
    9096}
    9197
    9298void* QUARTZ_AllocMem( DWORD dwSize )
    9399{
    94     return HeapAlloc( hDLLHeap, 0, dwSize );
     100        return HeapAlloc( hDLLHeap, 0, dwSize );
    95101}
    96102
    97103void QUARTZ_FreeMem( void* pMem )
    98104{
    99     HeapFree( hDLLHeap, 0, pMem );
     105        HeapFree( hDLLHeap, 0, pMem );
    100106}
    101107
     
    105111IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
    106112{
    107     ICOM_THIS(IClassFactoryImpl,iface);
    108 
    109     TRACE("(%p)->(%p,%p)\n",This,riid,ppobj);
    110     if ( ( IsEqualGUID( &IID_IUnknown, riid ) ) ||
    111          ( IsEqualGUID( &IID_IClassFactory, riid ) ) )
    112     {
    113         *ppobj = iface;
    114         IClassFactory_AddRef(iface);
    115         return S_OK;
    116     }
    117 
    118     return E_NOINTERFACE;
     113        ICOM_THIS(IClassFactoryImpl,iface);
     114
     115        TRACE("(%p)->(%p,%p)\n",This,riid,ppobj);
     116        if ( ( IsEqualGUID( &IID_IUnknown, riid ) ) ||
     117             ( IsEqualGUID( &IID_IClassFactory, riid ) ) )
     118        {
     119                *ppobj = iface;
     120                IClassFactory_AddRef(iface);
     121                return S_OK;
     122        }
     123
     124        return E_NOINTERFACE;
    119125}
    120126
    121127static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
    122128{
    123     ICOM_THIS(IClassFactoryImpl,iface);
    124 
    125     TRACE("(%p)->()\n",This);
    126 
    127     return ++(This->ref);
     129        ICOM_THIS(IClassFactoryImpl,iface);
     130
     131        TRACE("(%p)->()\n",This);
     132
     133        return InterlockedExchangeAdd(&(This->ref),1) + 1;
    128134}
    129135
    130136static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
    131137{
    132     ICOM_THIS(IClassFactoryImpl,iface);
    133 
    134     TRACE("(%p)->()\n",This);
    135     if ( (--(This->ref)) > 0 )
    136         return This->ref;
    137 
    138     QUARTZ_FreeObj(This);
    139     return 0;
     138        ICOM_THIS(IClassFactoryImpl,iface);
     139        LONG    ref;
     140
     141        TRACE("(%p)->()\n",This);
     142        ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
     143        if ( ref > 0 )
     144                return (ULONG)ref;
     145
     146        QUARTZ_FreeObj(This);
     147        return 0;
    140148}
    141149
    142150static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj)
    143151{
    144     ICOM_THIS(IClassFactoryImpl,iface);
    145     HRESULT hr;
    146     IUnknown*   punk;
    147 
    148     TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
    149 
    150     if ( ppobj == NULL )
    151         return E_POINTER;
    152     if ( pOuter != NULL && !IsEqualGUID( riid, &IID_IUnknown ) )
    153         return CLASS_E_NOAGGREGATION;
    154 
    155     *ppobj = NULL;
    156 
    157     hr = (*This->pEntry->pCreateIUnk)(pOuter,(void**)&punk);
    158     if ( hr != S_OK )
    159         return hr;
    160 
    161     hr = IUnknown_QueryInterface(punk,riid,ppobj);
    162     IUnknown_Release(punk);
    163 
    164     return hr;
     152        ICOM_THIS(IClassFactoryImpl,iface);
     153        HRESULT hr;
     154        IUnknown*       punk;
     155
     156        TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
     157
     158        if ( ppobj == NULL )
     159                return E_POINTER;
     160        if ( pOuter != NULL && !IsEqualGUID( riid, &IID_IUnknown ) )
     161                return CLASS_E_NOAGGREGATION;
     162
     163        *ppobj = NULL;
     164
     165        hr = (*This->pEntry->pCreateIUnk)(pOuter,(void**)&punk);
     166        if ( hr != S_OK )
     167                return hr;
     168
     169        hr = IUnknown_QueryInterface(punk,riid,ppobj);
     170        IUnknown_Release(punk);
     171
     172        return hr;
    165173}
    166174
    167175static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock)
    168176{
    169     ICOM_THIS(IClassFactoryImpl,iface);
    170     HRESULT hr;
    171 
    172     FIXME("(%p)->(%d),stub!\n",This,dolock);
    173     if (dolock)
    174         hr = IClassFactory_AddRef(iface);
    175     else
    176         hr = IClassFactory_Release(iface);
    177 
    178     return hr;
     177        ICOM_THIS(IClassFactoryImpl,iface);
     178        HRESULT hr;
     179
     180        TRACE("(%p)->(%d)\n",This,dolock);
     181        if (dolock)
     182                hr = IClassFactory_AddRef(iface);
     183        else
     184                hr = IClassFactory_Release(iface);
     185
     186        return hr;
    179187}
    180188
     
    183191static HRESULT IClassFactory_Alloc( const CLSID* pclsid, void** ppobj )
    184192{
    185     const QUARTZ_CLASSENTRY*    pEntry;
    186     IClassFactoryImpl*  pImpl;
    187 
    188     TRACE( "(%s,%p)\n", debugstr_guid(pclsid), ppobj );
    189 
    190     pEntry = QUARTZ_ClassList;
    191     while ( pEntry->pclsid != NULL )
    192     {
    193         if ( IsEqualGUID( pclsid, pEntry->pclsid ) )
    194             goto found;
    195     }
    196 
    197     return CLASS_E_CLASSNOTAVAILABLE;
     193        const QUARTZ_CLASSENTRY*        pEntry;
     194        IClassFactoryImpl*      pImpl;
     195
     196        TRACE( "(%s,%p)\n", debugstr_guid(pclsid), ppobj );
     197
     198        pEntry = QUARTZ_ClassList;
     199        while ( pEntry->pclsid != NULL )
     200        {
     201                if ( IsEqualGUID( pclsid, pEntry->pclsid ) )
     202                        goto found;
     203                pEntry ++;
     204        }
     205
     206        return CLASS_E_CLASSNOTAVAILABLE;
    198207found:
    199     pImpl = (IClassFactoryImpl*)QUARTZ_AllocObj( sizeof(IClassFactoryImpl) );
    200     if ( pImpl == NULL )
    201         return E_OUTOFMEMORY;
    202 
    203     ICOM_VTBL(pImpl) = &iclassfact;
    204     pImpl->ref = 1;
    205     pImpl->pEntry = pEntry;
    206 
    207     *ppobj = (void*)pImpl;
    208     return S_OK;
    209 }
    210 
    211 
    212 /***********************************************************************
    213  *      QUARTZ_InitProcess (internal)
     208        pImpl = (IClassFactoryImpl*)QUARTZ_AllocObj( sizeof(IClassFactoryImpl) );
     209        if ( pImpl == NULL )
     210                return E_OUTOFMEMORY;
     211
     212        TRACE( "allocated successfully.\n" );
     213
     214        ICOM_VTBL(pImpl) = &iclassfact;
     215        pImpl->ref = 1;
     216        pImpl->pEntry = pEntry;
     217
     218        *ppobj = (void*)pImpl;
     219        return S_OK;
     220}
     221
     222
     223/***********************************************************************
     224 *              QUARTZ_InitProcess (internal)
    214225 */
    215226static BOOL QUARTZ_InitProcess( void )
    216227{
    217     TRACE("()\n");
    218 
    219     dwClassObjRef = 0;
    220     hDLLHeap = (HANDLE)NULL;
    221     InitializeCriticalSection( &csHeap );
    222 
    223     hDLLHeap = HeapCreate( 0, 0x10000, 0 );
    224     if ( hDLLHeap == (HANDLE)NULL )
    225         return FALSE;
    226 
    227     return TRUE;
    228 }
    229 
    230 /***********************************************************************
    231  *      QUARTZ_UninitProcess (internal)
     228        TRACE("()\n");
     229
     230        dwClassObjRef = 0;
     231        hDLLHeap = (HANDLE)NULL;
     232        InitializeCriticalSection( &csHeap );
     233
     234        hDLLHeap = HeapCreate( 0, 0x10000, 0 );
     235        if ( hDLLHeap == (HANDLE)NULL )
     236                return FALSE;
     237
     238        return TRUE;
     239}
     240
     241/***********************************************************************
     242 *              QUARTZ_UninitProcess (internal)
    232243 */
    233244static void QUARTZ_UninitProcess( void )
    234245{
    235     TRACE("()\n");
    236 
    237     if ( dwClassObjRef != 0 )
    238         ERR( "you must release some objects allocated from quartz.\n" );
    239     if ( hDLLHeap != (HANDLE)NULL )
    240     {
    241         HeapDestroy( hDLLHeap );
    242         hDLLHeap = (HANDLE)NULL;
    243     }
    244     DeleteCriticalSection( &csHeap );
    245 }
    246 
    247 /***********************************************************************
    248  *      QUARTZ_DllMain
     246        TRACE("()\n");
     247
     248        if ( dwClassObjRef != 0 )
     249                ERR( "you must release some objects allocated from quartz.\n" );
     250        if ( hDLLHeap != (HANDLE)NULL )
     251        {
     252                HeapDestroy( hDLLHeap );
     253                hDLLHeap = (HANDLE)NULL;
     254        }
     255        DeleteCriticalSection( &csHeap );
     256}
     257
     258/***********************************************************************
     259 *              QUARTZ_DllMain
    249260 */
    250261BOOL WINAPI QUARTZ_DllMain(
    251     HINSTANCE hInstDLL,
    252     DWORD fdwReason,
    253     LPVOID lpvReserved )
    254 {
    255     switch ( fdwReason )
    256     {
    257     case DLL_PROCESS_ATTACH:
    258         if ( !QUARTZ_InitProcess() )
    259             return FALSE;
    260         break;
    261     case DLL_PROCESS_DETACH:
    262         QUARTZ_UninitProcess();
    263         break;
    264     case DLL_THREAD_ATTACH:
    265         break;
    266     case DLL_THREAD_DETACH:
    267         break;
    268     }
    269 
    270     return TRUE;
    271 }
    272 
    273 
    274 /***********************************************************************
    275  *      DllCanUnloadNow (QUARTZ.@)
     262        HINSTANCE hInstDLL,
     263        DWORD fdwReason,
     264        LPVOID lpvReserved )
     265{
     266        switch ( fdwReason )
     267        {
     268        case DLL_PROCESS_ATTACH:
     269                if ( !QUARTZ_InitProcess() )
     270                        return FALSE;
     271                break;
     272        case DLL_PROCESS_DETACH:
     273                QUARTZ_UninitProcess();
     274                break;
     275        case DLL_THREAD_ATTACH:
     276                break;
     277        case DLL_THREAD_DETACH:
     278                break;
     279        }
     280
     281        return TRUE;
     282}
     283
     284
     285/***********************************************************************
     286 *              DllCanUnloadNow (QUARTZ.@)
    276287 *
    277288 * RETURNS
     
    281292HRESULT WINAPI QUARTZ_DllCanUnloadNow(void)
    282293{
    283     HRESULT hr;
    284 
    285     EnterCriticalSection( &csHeap );
    286     hr = ( dwClassObjRef == 0 ) ? S_OK : S_FALSE;
    287     LeaveCriticalSection( &csHeap );
    288 
    289     return hr;
    290 }
    291 
    292 /***********************************************************************
    293  *      DllGetClassObject (QUARTZ.@)
     294        HRESULT hr;
     295
     296        EnterCriticalSection( &csHeap );
     297        hr = ( dwClassObjRef == 0 ) ? S_OK : S_FALSE;
     298        LeaveCriticalSection( &csHeap );
     299
     300        return hr;
     301}
     302
     303/***********************************************************************
     304 *              DllGetClassObject (QUARTZ.@)
    294305 */
    295306HRESULT WINAPI QUARTZ_DllGetClassObject(
    296         const CLSID* pclsid,const IID* piid,void** ppv)
    297 {
    298     *ppv = NULL;
    299     if ( IsEqualCLSID( &IID_IUnknown, piid ) ||
    300          IsEqualCLSID( &IID_IClassFactory, piid ) )
    301     {
    302         return IClassFactory_Alloc( pclsid, ppv );
    303     }
    304 
    305     return CLASS_E_CLASSNOTAVAILABLE;
    306 }
    307 
    308 /***********************************************************************
    309  *      DllRegisterServer (QUARTZ.@)
     307                const CLSID* pclsid,const IID* piid,void** ppv)
     308{
     309        *ppv = NULL;
     310        if ( IsEqualCLSID( &IID_IUnknown, piid ) ||
     311             IsEqualCLSID( &IID_IClassFactory, piid ) )
     312        {
     313                return IClassFactory_Alloc( pclsid, ppv );
     314        }
     315
     316        return CLASS_E_CLASSNOTAVAILABLE;
     317}
     318
     319/***********************************************************************
     320 *              DllRegisterServer (QUARTZ.@)
    310321 */
    311322
    312323HRESULT WINAPI QUARTZ_DllRegisterServer( void )
    313324{
    314     FIXME( "(): stub\n" );
    315     return E_FAIL;
    316 }
    317 
    318 /***********************************************************************
    319  *      DllUnregisterServer (QUARTZ.@)
     325        FIXME( "(): stub\n" );
     326        return E_FAIL;
     327}
     328
     329/***********************************************************************
     330 *              DllUnregisterServer (QUARTZ.@)
    320331 */
    321332
    322333HRESULT WINAPI QUARTZ_DllUnregisterServer( void )
    323334{
    324     FIXME( "(): stub\n" );
    325     return E_FAIL;
    326 }
    327 
     335        FIXME( "(): stub\n" );
     336        return E_FAIL;
     337}
     338
     339
     340
  • TabularUnified trunk/src/quartz/makefile

    r6578 r6710  
    1 # $Id: makefile,v 1.2 2001-08-23 18:34:22 sandervl Exp $
     1# $Id: makefile,v 1.3 2001-09-15 09:28:22 sandervl Exp $
    22
    33#
     
    2929OBJS = \
    3030$(OBJDIR)\amerror.obj \
     31$(OBJDIR)\amundoc.obj \
    3132$(OBJDIR)\complist.obj \
     33$(OBJDIR)\fgclsid.obj \
     34$(OBJDIR)\fgidisp.obj \
    3235$(OBJDIR)\fgraph.obj \
    33 $(OBJDIR)\ifgraph.obj \
    34 $(OBJDIR)\imem.obj \
     36$(OBJDIR)\fmap.obj \
     37$(OBJDIR)\fmap2.obj \
    3538$(OBJDIR)\ibasaud.obj \
    3639$(OBJDIR)\ibasvid.obj \
     40$(OBJDIR)\ifgraph.obj \
     41$(OBJDIR)\ifmap.obj \
     42$(OBJDIR)\ifmap3.obj \
     43$(OBJDIR)\igrver.obj \
    3744$(OBJDIR)\imcntl.obj \
     45$(OBJDIR)\imem.obj \
     46$(OBJDIR)\imesink.obj \
    3847$(OBJDIR)\imevent.obj \
     48$(OBJDIR)\imfilter.obj \
    3949$(OBJDIR)\impos.obj \
    4050$(OBJDIR)\imseek.obj \
     51$(OBJDIR)\irclock.obj \
     52$(OBJDIR)\iunk.obj \
    4153$(OBJDIR)\ividwin.obj \
     54$(OBJDIR)\main.obj \
     55$(OBJDIR)\memalloc.obj \
     56$(OBJDIR)\monprop.obj \
     57$(OBJDIR)\regsvr.obj \
     58$(OBJDIR)\seekpass.obj \
     59$(OBJDIR)\sysclock.obj \
     60$(OBJDIR)\devenum.obj \
     61$(OBJDIR)\devmon.obj \
     62$(OBJDIR)\enumunk.obj \
     63$(OBJDIR)\idevenum.obj \
    4264$(OBJDIR)\initterm.obj \
    4365$(OBJDIR)\initquartz.obj \
    44 $(OBJDIR)\irclock.obj \
    45 $(OBJDIR)\main.obj \
    4666$(OBJDIR)\guid.obj \
    47 $(OBJDIR)\iunk.obj \
    48 $(OBJDIR)\memalloc.obj \
    49 $(OBJDIR)\sysclock.obj \
    5067$(OBJDIR)\quartzrsrc.obj
    5168
     
    5774$(ODIN32_LIB)/kernel32.lib \
    5875$(ODIN32_LIB)/user32.lib \
     76$(ODIN32_LIB)/ole32.lib \
     77$(ODIN32_LIB)/oleaut32.lib \
    5978$(ODIN32_LIB)/$(ODINCRT).lib \
    6079OS2386.LIB \
  • TabularUnified trunk/src/quartz/memalloc.c

    r6649 r6710  
    1 /* $Id: memalloc.c,v 1.3 2001-09-05 13:36:37 bird Exp $ */
    21/*
    32 * Implementation of CLSID_MemoryAllocator.
     
    3130};
    3231
     32static void QUARTZ_DestroyMemoryAllocator(IUnknown* punk)
     33{
     34        CMemoryAllocator_THIS(punk,unk);
     35
     36        CMemoryAllocator_UninitIMemAllocator( This );
     37}
     38
    3339HRESULT QUARTZ_CreateMemoryAllocator(IUnknown* punkOuter,void** ppobj)
    3440{
    35     CMemoryAllocator*   pma;
     41        CMemoryAllocator*       pma;
     42        HRESULT hr;
    3643
    37     TRACE("(%p,%p)\n",punkOuter,ppobj);
     44        TRACE("(%p,%p)\n",punkOuter,ppobj);
    3845
    39     pma = (CMemoryAllocator*)QUARTZ_AllocObj( sizeof(CMemoryAllocator) );
    40     if ( pma == NULL )
    41         return E_OUTOFMEMORY;
     46        pma = (CMemoryAllocator*)QUARTZ_AllocObj( sizeof(CMemoryAllocator) );
     47        if ( pma == NULL )
     48                return E_OUTOFMEMORY;
    4249
    43     QUARTZ_IUnkInit( &pma->unk, punkOuter );
    44     CMemoryAllocator_InitIMemAllocator( pma );
     50        QUARTZ_IUnkInit( &pma->unk, punkOuter );
     51        hr = CMemoryAllocator_InitIMemAllocator( pma );
     52        if ( FAILED(hr) )
     53        {
     54                QUARTZ_FreeObj( pma );
     55                return hr;
     56        }
    4557
    46     pma->unk.pEntries = IFEntries;
    47     pma->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
     58        pma->unk.pEntries = IFEntries;
     59        pma->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
     60        pma->unk.pOnFinalRelease = QUARTZ_DestroyMemoryAllocator;
    4861
    49     *ppobj = (void*)(&pma->unk);
     62        *ppobj = (void*)(&pma->unk);
    5063
    51     return S_OK;
     64        return S_OK;
    5265}
  • TabularUnified trunk/src/quartz/memalloc.h

    r6563 r6710  
    2525
    2626        /* IMemAllocator fields. */
     27        CRITICAL_SECTION        csMem;
     28        ALLOCATOR_PROPERTIES    prop;
    2729} CMemoryAllocator;
    2830
     
    3133HRESULT QUARTZ_CreateMemoryAllocator(IUnknown* punkOuter,void** ppobj);
    3234
    33 void CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma );
     35HRESULT CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma );
     36void CMemoryAllocator_UninitIMemAllocator( CMemoryAllocator* pma );
    3437
    3538
  • TabularUnified trunk/src/quartz/sysclock.c

    r6649 r6710  
    1 /* $Id: sysclock.c,v 1.3 2001-09-05 13:36:38 bird Exp $ */
    21/*
    32 * Implementation of CLSID_SystemClock.
     
    3130};
    3231
     32
     33static void QUARTZ_DestroySystemClock(IUnknown* punk)
     34{
     35        CSystemClock_THIS(punk,unk);
     36
     37        CSystemClock_UninitIReferenceClock( This );
     38}
     39
    3340HRESULT QUARTZ_CreateSystemClock(IUnknown* punkOuter,void** ppobj)
    3441{
    35     CSystemClock*   psc;
     42        CSystemClock*   psc;
     43        HRESULT hr;
    3644
    37     TRACE("(%p,%p)\n",punkOuter,ppobj);
     45        TRACE("(%p,%p)\n",punkOuter,ppobj);
    3846
    39     psc = (CSystemClock*)QUARTZ_AllocObj( sizeof(CSystemClock) );
    40     if ( psc == NULL )
    41         return E_OUTOFMEMORY;
     47        psc = (CSystemClock*)QUARTZ_AllocObj( sizeof(CSystemClock) );
     48        if ( psc == NULL )
     49                return E_OUTOFMEMORY;
    4250
    43     QUARTZ_IUnkInit( &psc->unk, punkOuter );
    44     CSystemClock_InitIReferenceClock( psc );
     51        QUARTZ_IUnkInit( &psc->unk, punkOuter );
     52        hr = CSystemClock_InitIReferenceClock( psc );
     53        if ( FAILED(hr) )
     54        {
     55                QUARTZ_FreeObj( psc );
     56                return hr;
     57        }
    4558
    46     psc->unk.pEntries = IFEntries;
    47     psc->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
     59        psc->unk.pEntries = IFEntries;
     60        psc->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
     61        psc->unk.pOnFinalRelease = QUARTZ_DestroySystemClock;
    4862
    49     *ppobj = (void*)(&psc->unk);
     63        *ppobj = (void*)(&psc->unk);
    5064
    51     return S_OK;
     65        return S_OK;
    5266}
  • TabularUnified trunk/src/quartz/sysclock.h

    r6563 r6710  
    2020
    2121
     22/* implementation limit */
     23#define WINE_QUARTZ_SYSCLOCK_TIMER_MAX  64
     24
     25typedef struct QUARTZ_TimerEntry
     26{
     27        DWORD                   dwAdvCookie;
     28        BOOL                    fPeriodic;
     29        HANDLE                  hEvent;
     30        REFERENCE_TIME  rtStart;
     31        REFERENCE_TIME  rtInterval;
     32} QUARTZ_TimerEntry;
     33
    2234typedef struct CSystemClock
    2335{
     
    2638
    2739        /* IReferenceClock fields. */
     40        CRITICAL_SECTION        m_csClock;
     41        DWORD   m_dwTimeLast;
     42        REFERENCE_TIME  m_rtLast;
     43        HANDLE  m_hThreadTimer;
     44        HANDLE  m_hEventInit;
     45        DWORD   m_idThreadTimer;
     46
     47        DWORD                   m_dwAdvCookieNext;
     48        QUARTZ_TimerEntry       m_timerEntries[WINE_QUARTZ_SYSCLOCK_TIMER_MAX];
    2849} CSystemClock;
    2950
     
    3253HRESULT QUARTZ_CreateSystemClock(IUnknown* punkOuter,void** ppobj);
    3354
    34 void CSystemClock_InitIReferenceClock( CSystemClock* psc );
     55HRESULT CSystemClock_InitIReferenceClock( CSystemClock* psc );
     56void CSystemClock_UninitIReferenceClock( CSystemClock* psc );
    3557
    3658
Note: See TracChangeset for help on using the changeset viewer.