source: trunk/src/quartz/ifgraph.c@ 6952

Last change on this file since 6952 was 6952, checked in by sandervl, 24 years ago

Wine 20011004 resync

File size: 15.7 KB
Line 
1/*
2 * Implementation of IFilterGraph.
3 *
4 * FIXME - create a thread to process some methods correctly.
5 *
6 * FIXME - ReconnectEx
7 * FIXME - process Pause/Stop asynchronously and notify when completed.
8 *
9 *
10 * hidenori@a2.ctktv.ne.jp
11 */
12
13#include "config.h"
14
15#include "windef.h"
16#include "winbase.h"
17#include "wingdi.h"
18#include "winuser.h"
19#include "winerror.h"
20#include "wine/obj_base.h"
21#include "wine/obj_oleaut.h"
22#include "strmif.h"
23#include "control.h"
24#include "uuids.h"
25#include "vfwmsgs.h"
26#include "wine/unicode.h"
27#include "evcode.h"
28
29#include "debugtools.h"
30DEFAULT_DEBUG_CHANNEL(quartz);
31
32#include "quartz_private.h"
33#include "fgraph.h"
34#include "enumunk.h"
35#include "sysclock.h"
36
37
38static HRESULT CFilterGraph_DisconnectAllPins( IBaseFilter* pFilter )
39{
40 IEnumPins* pEnum = NULL;
41 IPin* pPin;
42 IPin* pConnTo;
43 ULONG cFetched;
44 HRESULT hr;
45
46 hr = IBaseFilter_EnumPins( pFilter, &pEnum );
47 if ( FAILED(hr) )
48 return hr;
49 if ( pEnum == NULL )
50 return E_FAIL;
51
52 while ( 1 )
53 {
54 pPin = NULL;
55 cFetched = 0;
56 hr = IEnumPins_Next( pEnum, 1, &pPin, &cFetched );
57 if ( FAILED(hr) )
58 break;
59 if ( hr != NOERROR || pPin == NULL || cFetched != 1 )
60 {
61 hr = NOERROR;
62 break;
63 }
64
65 pConnTo = NULL;
66 hr = IPin_ConnectedTo(pPin,&pConnTo);
67 if ( hr == NOERROR && pConnTo != NULL )
68 {
69 IPin_Disconnect(pPin);
70 IPin_Disconnect(pConnTo);
71 IPin_Release(pConnTo);
72 }
73
74 IPin_Release( pPin );
75 }
76
77 IEnumPins_Release( pEnum );
78
79 return hr;
80}
81
82
83static HRESULT CFilterGraph_GraphChanged( CFilterGraph* This )
84{
85 /* IDistributorNotify_NotifyGraphChange() */
86
87 IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This),
88 EC_GRAPH_CHANGED, 0, 0);
89 EnterCriticalSection( &This->m_csGraphVersion );
90 This->m_lGraphVersion ++;
91 LeaveCriticalSection( &This->m_csGraphVersion );
92
93 return NOERROR;
94}
95
96
97/****************************************************************************/
98
99static HRESULT WINAPI
100IFilterGraph2_fnQueryInterface(IFilterGraph2* iface,REFIID riid,void** ppobj)
101{
102 CFilterGraph_THIS(iface,fgraph);
103
104 TRACE("(%p)->()\n",This);
105
106 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
107}
108
109static ULONG WINAPI
110IFilterGraph2_fnAddRef(IFilterGraph2* iface)
111{
112 CFilterGraph_THIS(iface,fgraph);
113
114 TRACE("(%p)->()\n",This);
115
116 return IUnknown_AddRef(This->unk.punkControl);
117}
118
119static ULONG WINAPI
120IFilterGraph2_fnRelease(IFilterGraph2* iface)
121{
122 CFilterGraph_THIS(iface,fgraph);
123
124 TRACE("(%p)->()\n",This);
125
126 return IUnknown_Release(This->unk.punkControl);
127}
128
129static HRESULT WINAPI
130IFilterGraph2_fnAddFilter(IFilterGraph2* iface,IBaseFilter* pFilter, LPCWSTR pName)
131{
132 CFilterGraph_THIS(iface,fgraph);
133 FILTER_STATE fs;
134 FILTER_INFO info;
135 HRESULT hr;
136 HRESULT hrSucceeded = S_OK;
137 QUARTZ_CompListItem* pItem;
138 int i,iLen;
139
140 TRACE( "(%p)->(%p,%s)\n",This,pFilter,debugstr_w(pName) );
141
142 QUARTZ_CompList_Lock( This->m_pFilterList );
143
144 hr = IMediaFilter_GetState(CFilterGraph_IMediaFilter(This),0,&fs);
145 if ( hr == VFW_S_STATE_INTERMEDIATE )
146 hr = VFW_E_STATE_CHANGED;
147 if ( fs != State_Stopped )
148 hr = VFW_E_NOT_STOPPED;
149 if ( FAILED(hr) )
150 goto end;
151
152 TRACE( "(%p) search the specified name.\n",This );
153
154 if ( pName != NULL )
155 {
156 pItem = QUARTZ_CompList_SearchData(
157 This->m_pFilterList,
158 pName, sizeof(WCHAR)*(strlenW(pName)+1) );
159 if ( pItem == NULL )
160 goto name_ok;
161
162 hrSucceeded = VFW_S_DUPLICATE_NAME;
163
164 iLen = strlenW(pName);
165 if ( iLen > 32 )
166 iLen = 32;
167 memcpy( info.achName, pName, sizeof(WCHAR)*iLen );
168 info.achName[iLen] = 0;
169 }
170 else
171 {
172 ZeroMemory( &info, sizeof(info) );
173 hr = IBaseFilter_QueryFilterInfo( pFilter, &info );
174 if ( FAILED(hr) )
175 goto end;
176
177 iLen = strlenW(info.achName);
178 pItem = QUARTZ_CompList_SearchData(
179 This->m_pFilterList,
180 info.achName, sizeof(WCHAR)*(iLen+1) );
181 if ( pItem == NULL )
182 {
183 pName = info.achName;
184 goto name_ok;
185 }
186 }
187
188 /* generate modified names for this filter.. */
189 iLen = strlenW(info.achName);
190 if ( iLen > 32 )
191 iLen = 32;
192 info.achName[iLen++] = ' ';
193
194 for ( i = 0; i <= 99; i++ )
195 {
196 info.achName[iLen+0] = (i%10) + '0';
197 info.achName[iLen+1] = ((i/10)%10) + '0';
198 info.achName[iLen+2] = 0;
199 pItem = QUARTZ_CompList_SearchData(
200 This->m_pFilterList,
201 info.achName, sizeof(WCHAR)*(iLen+3) );
202 if ( pItem == NULL )
203 {
204 pName = info.achName;
205 goto name_ok;
206 }
207 }
208
209 hr = ( pName == NULL ) ? E_FAIL : VFW_E_DUPLICATE_NAME;
210 goto end;
211
212name_ok:
213 TRACE( "(%p) add this filter.\n",This );
214
215 /* register this filter. */
216 hr = QUARTZ_CompList_AddComp(
217 This->m_pFilterList, (IUnknown*)pFilter,
218 pName, sizeof(WCHAR)*(strlenW(pName)+1) );
219 if ( FAILED(hr) )
220 goto end;
221
222 hr = IBaseFilter_JoinFilterGraph(pFilter,(IFilterGraph*)iface,pName);
223 if ( SUCCEEDED(hr) )
224 {
225 EnterCriticalSection( &This->m_csClock );
226 hr = IBaseFilter_SetSyncSource( pFilter, This->m_pClock );
227 LeaveCriticalSection( &This->m_csClock );
228 }
229 if ( FAILED(hr) )
230 {
231 IBaseFilter_JoinFilterGraph(pFilter,NULL,pName);
232 QUARTZ_CompList_RemoveComp(
233 This->m_pFilterList,(IUnknown*)pFilter);
234 goto end;
235 }
236
237 hr = CFilterGraph_GraphChanged(This);
238 if ( FAILED(hr) )
239 goto end;
240
241 hr = hrSucceeded;
242end:
243 QUARTZ_CompList_Unlock( This->m_pFilterList );
244
245 TRACE( "(%p) return %08lx\n", This, hr );
246
247 return hr;
248}
249
250static HRESULT WINAPI
251IFilterGraph2_fnRemoveFilter(IFilterGraph2* iface,IBaseFilter* pFilter)
252{
253 CFilterGraph_THIS(iface,fgraph);
254 QUARTZ_CompListItem* pItem;
255 FILTER_STATE fs;
256 HRESULT hr = NOERROR;
257
258 TRACE( "(%p)->(%p)\n",This,pFilter );
259
260 QUARTZ_CompList_Lock( This->m_pFilterList );
261
262 hr = IMediaFilter_GetState(CFilterGraph_IMediaFilter(This),0,&fs);
263 if ( hr == VFW_S_STATE_INTERMEDIATE )
264 hr = VFW_E_STATE_CHANGED;
265 if ( fs != State_Stopped )
266 hr = VFW_E_NOT_STOPPED;
267 if ( FAILED(hr) )
268 goto end;
269
270 hr = S_FALSE; /* FIXME? */
271 pItem = QUARTZ_CompList_SearchComp(
272 This->m_pFilterList, (IUnknown*)pFilter );
273 if ( pItem != NULL )
274 {
275 CFilterGraph_DisconnectAllPins(pFilter);
276 IBaseFilter_SetSyncSource( pFilter, NULL );
277 hr = IBaseFilter_JoinFilterGraph(
278 pFilter, NULL, QUARTZ_CompList_GetDataPtr(pItem) );
279 QUARTZ_CompList_RemoveComp(
280 This->m_pFilterList, (IUnknown*)pFilter );
281 }
282
283 hr = CFilterGraph_GraphChanged(This);
284 if ( FAILED(hr) )
285 goto end;
286
287end:;
288 QUARTZ_CompList_Unlock( This->m_pFilterList );
289
290 return hr;
291}
292
293static HRESULT WINAPI
294IFilterGraph2_fnEnumFilters(IFilterGraph2* iface,IEnumFilters** ppEnum)
295{
296 CFilterGraph_THIS(iface,fgraph);
297 HRESULT hr;
298
299 TRACE( "(%p)->(%p)\n",This,ppEnum );
300
301 QUARTZ_CompList_Lock( This->m_pFilterList );
302
303 hr = QUARTZ_CreateEnumUnknown(
304 &IID_IEnumFilters, (void**)ppEnum, This->m_pFilterList );
305
306 QUARTZ_CompList_Unlock( This->m_pFilterList );
307
308 return hr;
309}
310
311static HRESULT WINAPI
312IFilterGraph2_fnFindFilterByName(IFilterGraph2* iface,LPCWSTR pName,IBaseFilter** ppFilter)
313{
314 CFilterGraph_THIS(iface,fgraph);
315 QUARTZ_CompListItem* pItem;
316 HRESULT hr = E_FAIL;
317
318 TRACE( "(%p)->(%s,%p)\n",This,debugstr_w(pName),ppFilter );
319
320 if ( ppFilter == NULL )
321 return E_POINTER;
322 *ppFilter = NULL;
323
324 QUARTZ_CompList_Lock( This->m_pFilterList );
325
326 pItem = QUARTZ_CompList_SearchData(
327 This->m_pFilterList,
328 pName, sizeof(WCHAR)*(strlenW(pName)+1) );
329 if ( pItem != NULL )
330 {
331 *ppFilter = (IBaseFilter*)QUARTZ_CompList_GetItemPtr(pItem);
332 hr = NOERROR;
333 }
334
335 QUARTZ_CompList_Unlock( This->m_pFilterList );
336
337 return hr;
338}
339
340static HRESULT WINAPI
341IFilterGraph2_fnConnectDirect(IFilterGraph2* iface,IPin* pOut,IPin* pIn,const AM_MEDIA_TYPE* pmt)
342{
343 CFilterGraph_THIS(iface,fgraph);
344 IPin* pConnTo;
345 PIN_INFO infoIn;
346 PIN_INFO infoOut;
347 FILTER_INFO finfoIn;
348 FILTER_INFO finfoOut;
349 HRESULT hr;
350
351 TRACE( "(%p)->(%p,%p,%p)\n",This,pOut,pIn,pmt );
352
353 infoIn.pFilter = NULL;
354 infoOut.pFilter = NULL;
355 finfoIn.pGraph = NULL;
356 finfoOut.pGraph = NULL;
357
358 QUARTZ_CompList_Lock( This->m_pFilterList );
359
360 hr = IPin_QueryPinInfo(pIn,&infoIn);
361 if ( FAILED(hr) )
362 goto end;
363 hr = IPin_QueryPinInfo(pOut,&infoOut);
364 if ( FAILED(hr) )
365 goto end;
366 if ( infoIn.pFilter == NULL || infoOut.pFilter == NULL ||
367 infoIn.dir != PINDIR_INPUT || infoOut.dir != PINDIR_OUTPUT )
368 {
369 hr = E_FAIL;
370 goto end;
371 }
372
373 hr = IBaseFilter_QueryFilterInfo(infoIn.pFilter,&finfoIn);
374 if ( FAILED(hr) )
375 goto end;
376 hr = IBaseFilter_QueryFilterInfo(infoOut.pFilter,&finfoOut);
377 if ( FAILED(hr) )
378 goto end;
379 if ( finfoIn.pGraph != ((IFilterGraph*)iface) ||
380 finfoOut.pGraph != ((IFilterGraph*)iface) )
381 {
382 hr = E_FAIL;
383 goto end;
384 }
385
386 pConnTo = NULL;
387 hr = IPin_ConnectedTo(pIn,&pConnTo);
388 if ( hr == NOERROR && pConnTo != NULL )
389 {
390 IPin_Release(pConnTo);
391 hr = VFW_E_ALREADY_CONNECTED;
392 goto end;
393 }
394
395 pConnTo = NULL;
396 hr = IPin_ConnectedTo(pOut,&pConnTo);
397 if ( hr == NOERROR && pConnTo != NULL )
398 {
399 IPin_Release(pConnTo);
400 hr = VFW_E_ALREADY_CONNECTED;
401 goto end;
402 }
403
404 TRACE("(%p) try to connect %p<->%p\n",This,pIn,pOut);
405 hr = IPin_Connect(pOut,pIn,pmt);
406 if ( FAILED(hr) )
407 {
408 TRACE("(%p)->Connect(%p,%p) hr = %08lx\n",pOut,pIn,pmt,hr);
409 IPin_Disconnect(pOut);
410 IPin_Disconnect(pIn);
411 goto end;
412 }
413
414 hr = CFilterGraph_GraphChanged(This);
415 if ( FAILED(hr) )
416 goto end;
417
418end:
419 QUARTZ_CompList_Unlock( This->m_pFilterList );
420
421 if ( infoIn.pFilter != NULL )
422 IBaseFilter_Release(infoIn.pFilter);
423 if ( infoOut.pFilter != NULL )
424 IBaseFilter_Release(infoOut.pFilter);
425 if ( finfoIn.pGraph != NULL )
426 IFilterGraph_Release(finfoIn.pGraph);
427 if ( finfoOut.pGraph != NULL )
428 IFilterGraph_Release(finfoOut.pGraph);
429
430 return hr;
431}
432
433static HRESULT WINAPI
434IFilterGraph2_fnReconnect(IFilterGraph2* iface,IPin* pPin)
435{
436 CFilterGraph_THIS(iface,fgraph);
437
438 TRACE( "(%p)->(%p)\n",This,pPin );
439
440 return IFilterGraph2_ReconnectEx(iface,pPin,NULL);
441}
442
443static HRESULT WINAPI
444IFilterGraph2_fnDisconnect(IFilterGraph2* iface,IPin* pPin)
445{
446 CFilterGraph_THIS(iface,fgraph);
447 IPin* pConnTo;
448 HRESULT hr;
449
450 TRACE( "(%p)->(%p)\n",This,pPin );
451
452 QUARTZ_CompList_Lock( This->m_pFilterList );
453
454 pConnTo = NULL;
455 hr = IPin_ConnectedTo(pPin,&pConnTo);
456 if ( hr == NOERROR && pConnTo != NULL )
457 {
458 IPin_Disconnect(pConnTo);
459 IPin_Release(pConnTo);
460 }
461 hr = IPin_Disconnect(pPin);
462 if ( FAILED(hr) )
463 goto end;
464
465 hr = CFilterGraph_GraphChanged(This);
466 if ( FAILED(hr) )
467 goto end;
468
469end:
470 QUARTZ_CompList_Unlock( This->m_pFilterList );
471
472 return hr;
473}
474
475static HRESULT WINAPI
476IFilterGraph2_fnSetDefaultSyncSource(IFilterGraph2* iface)
477{
478 CFilterGraph_THIS(iface,fgraph);
479 IUnknown* punk;
480 IReferenceClock* pClock;
481 HRESULT hr;
482
483 FIXME( "(%p)->() stub!\n", This );
484
485 /* FIXME - search all filters. */
486
487 hr = QUARTZ_CreateSystemClock( NULL, (void**)&punk );
488 if ( FAILED(hr) )
489 return hr;
490 hr = IUnknown_QueryInterface( punk, &IID_IReferenceClock, (void**)&pClock ); IUnknown_Release( punk );
491 if ( FAILED(hr) )
492 return hr;
493
494 hr = IMediaFilter_SetSyncSource(
495 CFilterGraph_IMediaFilter(This), pClock );
496 IReferenceClock_Release( pClock );
497
498 return hr;
499}
500
501static HRESULT WINAPI
502IFilterGraph2_fnConnect(IFilterGraph2* iface,IPin* pOut,IPin* pIn)
503{
504 CFilterGraph_THIS(iface,fgraph);
505 HRESULT hr;
506
507 TRACE( "(%p)->(%p,%p)\n",This,pOut,pIn );
508
509 /* At first, try to connect directly. */
510 hr = IFilterGraph_ConnectDirect(iface,pOut,pIn,NULL);
511 if ( hr == NOERROR )
512 return NOERROR;
513
514 /* FIXME - try to connect indirectly. */
515 FIXME( "(%p)->(%p,%p) stub!\n",This,pOut,pIn );
516
517
518 return E_NOTIMPL;
519}
520
521static HRESULT WINAPI
522IFilterGraph2_fnRender(IFilterGraph2* iface,IPin* pOut)
523{
524 CFilterGraph_THIS(iface,fgraph);
525
526 FIXME( "(%p)->(%p) stub!\n",This,pOut );
527 return E_NOTIMPL;
528}
529
530static HRESULT WINAPI
531IFilterGraph2_fnRenderFile(IFilterGraph2* iface,LPCWSTR lpFileName,LPCWSTR lpPlayList)
532{
533 CFilterGraph_THIS(iface,fgraph);
534 HRESULT hr;
535 IBaseFilter* pFilter = NULL;
536 IEnumPins* pEnum = NULL;
537 IPin* pPin;
538 ULONG cFetched;
539 PIN_DIRECTION dir;
540 ULONG cTryToRender;
541 ULONG cActRender;
542
543 TRACE( "(%p)->(%s,%s)\n",This,
544 debugstr_w(lpFileName),debugstr_w(lpPlayList) );
545
546 if ( lpPlayList != NULL )
547 return E_INVALIDARG;
548
549 pFilter = NULL;
550 hr = IFilterGraph2_AddSourceFilter(iface,lpFileName,NULL,&pFilter);
551 if ( FAILED(hr) )
552 goto end;
553 if ( pFilter == NULL )
554 {
555 hr = E_FAIL;
556 goto end;
557 }
558 pEnum = NULL;
559 hr = IBaseFilter_EnumPins( pFilter, &pEnum );
560 if ( FAILED(hr) )
561 goto end;
562 if ( pEnum == NULL )
563 {
564 hr = E_FAIL;
565 goto end;
566 }
567
568 cTryToRender = 0;
569 cActRender = 0;
570
571 while ( 1 )
572 {
573 pPin = NULL;
574 cFetched = 0;
575 hr = IEnumPins_Next( pEnum, 1, &pPin, &cFetched );
576 if ( FAILED(hr) )
577 goto end;
578 if ( hr != NOERROR || pPin == NULL || cFetched != 1 )
579 {
580 hr = NOERROR;
581 break;
582 }
583 hr = IPin_QueryDirection( pPin, &dir );
584 if ( hr == NOERROR && dir == PINDIR_OUTPUT )
585 {
586 cTryToRender ++;
587 hr = IFilterGraph2_Render( iface, pPin );
588 if ( hr == NOERROR )
589 cActRender ++;
590 }
591 IPin_Release( pPin );
592 }
593
594 if ( hr == NOERROR )
595 {
596 if ( cTryToRender > cActRender )
597 hr = VFW_S_PARTIAL_RENDER;
598 if ( cActRender == 0 )
599 hr = E_FAIL;
600 }
601
602end:
603 if ( pEnum != NULL )
604 IEnumPins_Release( pEnum );
605 if ( pFilter != NULL )
606 IBaseFilter_Release( pFilter );
607
608 return hr;
609}
610
611static HRESULT WINAPI
612IFilterGraph2_fnAddSourceFilter(IFilterGraph2* iface,LPCWSTR lpFileName,LPCWSTR lpFilterName,IBaseFilter** ppBaseFilter)
613{
614 CFilterGraph_THIS(iface,fgraph);
615
616 FIXME( "(%p)->(%s,%s,%p) stub!\n",This,
617 debugstr_w(lpFileName),debugstr_w(lpFilterName),ppBaseFilter );
618 return E_NOTIMPL;
619}
620
621static HRESULT WINAPI
622IFilterGraph2_fnSetLogFile(IFilterGraph2* iface,DWORD_PTR hFile)
623{
624 CFilterGraph_THIS(iface,fgraph);
625
626 FIXME( "(%p)->() stub!\n", This );
627 return E_NOTIMPL;
628}
629
630static HRESULT WINAPI
631IFilterGraph2_fnAbort(IFilterGraph2* iface)
632{
633 CFilterGraph_THIS(iface,fgraph);
634
635 /* undoc. */
636
637 FIXME( "(%p)->() stub!\n", This );
638 return E_NOTIMPL;
639}
640
641static HRESULT WINAPI
642IFilterGraph2_fnShouldOperationContinue(IFilterGraph2* iface)
643{
644 CFilterGraph_THIS(iface,fgraph);
645
646 /* undoc. */
647
648 FIXME( "(%p)->() stub!\n", This );
649 return E_NOTIMPL;
650}
651
652static HRESULT WINAPI
653IFilterGraph2_fnAddSourceFilterForMoniker(IFilterGraph2* iface,IMoniker* pMon,IBindCtx* pCtx,LPCWSTR pFilterName,IBaseFilter** ppFilter)
654{
655 CFilterGraph_THIS(iface,fgraph);
656
657 FIXME( "(%p)->() stub!\n", This );
658 return E_NOTIMPL;
659}
660
661static HRESULT WINAPI
662IFilterGraph2_fnReconnectEx(IFilterGraph2* iface,IPin* pPin,const AM_MEDIA_TYPE* pmt)
663{
664 CFilterGraph_THIS(iface,fgraph);
665 HRESULT hr;
666
667 FIXME( "(%p)->(%p,%p) stub!\n",This,pPin,pmt );
668
669 /* reconnect asynchronously. */
670
671 hr = CFilterGraph_GraphChanged(This);
672
673 return E_NOTIMPL;
674}
675
676static HRESULT WINAPI
677IFilterGraph2_fnRenderEx(IFilterGraph2* iface,IPin* pPin,DWORD dwParam1,DWORD* pdwParam2)
678{
679 CFilterGraph_THIS(iface,fgraph);
680
681 /* undoc. */
682 FIXME( "(%p)->(%p,%08lx,%p) stub!\n",This,pPin,dwParam1,pdwParam2);
683 return E_NOTIMPL;
684}
685
686
687
688
689static ICOM_VTABLE(IFilterGraph2) ifgraph =
690{
691 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
692 /* IUnknown fields */
693 IFilterGraph2_fnQueryInterface,
694 IFilterGraph2_fnAddRef,
695 IFilterGraph2_fnRelease,
696 /* IFilterGraph fields */
697 IFilterGraph2_fnAddFilter,
698 IFilterGraph2_fnRemoveFilter,
699 IFilterGraph2_fnEnumFilters,
700 IFilterGraph2_fnFindFilterByName,
701 IFilterGraph2_fnConnectDirect,
702 IFilterGraph2_fnReconnect,
703 IFilterGraph2_fnDisconnect,
704 IFilterGraph2_fnSetDefaultSyncSource,
705 /* IGraphBuilder fields */
706 IFilterGraph2_fnConnect,
707 IFilterGraph2_fnRender,
708 IFilterGraph2_fnRenderFile,
709 IFilterGraph2_fnAddSourceFilter,
710 IFilterGraph2_fnSetLogFile,
711 IFilterGraph2_fnAbort,
712 IFilterGraph2_fnShouldOperationContinue,
713 /* IFilterGraph2 fields */
714 IFilterGraph2_fnAddSourceFilterForMoniker,
715 IFilterGraph2_fnReconnectEx,
716 IFilterGraph2_fnRenderEx,
717};
718
719HRESULT CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg )
720{
721 TRACE("(%p)\n",pfg);
722 ICOM_VTBL(&pfg->fgraph) = &ifgraph;
723
724 pfg->m_pFilterList = QUARTZ_CompList_Alloc();
725 if ( pfg->m_pFilterList == NULL )
726 return E_OUTOFMEMORY;
727
728 return NOERROR;
729}
730
731void CFilterGraph_UninitIFilterGraph2( CFilterGraph* pfg )
732{
733 QUARTZ_CompListItem* pItem;
734
735 TRACE("(%p)\n",pfg);
736
737 /* remove all filters... */
738 while ( 1 )
739 {
740 pItem = QUARTZ_CompList_GetFirst( pfg->m_pFilterList );
741 if ( pItem == NULL )
742 break;
743 IFilterGraph2_RemoveFilter(
744 (IFilterGraph2*)(&pfg->fgraph),
745 (IBaseFilter*)QUARTZ_CompList_GetItemPtr(pItem) );
746 }
747
748 QUARTZ_CompList_Free( pfg->m_pFilterList );
749}
Note: See TracBrowser for help on using the repository browser.