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

wine update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.