1 /* DirectShow FilterGraph object (QUARTZ.DLL)
3 * Copyright 2002 Lionel Ulmer
4 * Copyright 2004 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
35 #include "wine/debug.h"
36 #include "quartz_private.h"
42 #include "wine/unicode.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
48 HWND hWnd
; /* Target window */
49 long msg
; /* User window message */
50 long instance
; /* User data */
51 int disabled
; /* Disabled messages posting */
55 long lEventCode
; /* Event code */
56 LONG_PTR lParam1
; /* Param1 */
57 LONG_PTR lParam2
; /* Param2 */
60 /* messages ring implementation for queuing events (taken from winmm) */
61 #define EVENTS_RING_BUFFER_INCREMENT 64
67 CRITICAL_SECTION msg_crst
;
68 HANDLE msg_event
; /* Signaled for no empty queue */
71 static int EventsQueue_Init(EventsQueue
* omr
)
75 omr
->msg_event
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
76 omr
->ring_buffer_size
= EVENTS_RING_BUFFER_INCREMENT
;
77 omr
->messages
= CoTaskMemAlloc(omr
->ring_buffer_size
* sizeof(Event
));
78 ZeroMemory(omr
->messages
, omr
->ring_buffer_size
* sizeof(Event
));
80 InitializeCriticalSection(&omr
->msg_crst
);
81 omr
->msg_crst
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": EventsQueue.msg_crst");
85 static int EventsQueue_Destroy(EventsQueue
* omr
)
87 CloseHandle(omr
->msg_event
);
88 CoTaskMemFree(omr
->messages
);
89 omr
->msg_crst
.DebugInfo
->Spare
[0] = 0;
90 DeleteCriticalSection(&omr
->msg_crst
);
94 static int EventsQueue_PutEvent(EventsQueue
* omr
, const Event
* evt
)
96 EnterCriticalSection(&omr
->msg_crst
);
97 if ((omr
->msg_toget
== ((omr
->msg_tosave
+ 1) % omr
->ring_buffer_size
)))
99 int old_ring_buffer_size
= omr
->ring_buffer_size
;
100 omr
->ring_buffer_size
+= EVENTS_RING_BUFFER_INCREMENT
;
101 TRACE("omr->ring_buffer_size=%d\n",omr
->ring_buffer_size
);
102 omr
->messages
= HeapReAlloc(GetProcessHeap(),0,omr
->messages
, omr
->ring_buffer_size
* sizeof(Event
));
103 /* Now we need to rearrange the ring buffer so that the new
104 buffers just allocated are in between omr->msg_tosave and
107 if (omr
->msg_tosave
< omr
->msg_toget
)
109 memmove(&(omr
->messages
[omr
->msg_toget
+ EVENTS_RING_BUFFER_INCREMENT
]),
110 &(omr
->messages
[omr
->msg_toget
]),
111 sizeof(Event
)*(old_ring_buffer_size
- omr
->msg_toget
)
113 omr
->msg_toget
+= EVENTS_RING_BUFFER_INCREMENT
;
116 omr
->messages
[omr
->msg_tosave
] = *evt
;
117 SetEvent(omr
->msg_event
);
118 omr
->msg_tosave
= (omr
->msg_tosave
+ 1) % omr
->ring_buffer_size
;
119 LeaveCriticalSection(&omr
->msg_crst
);
123 static int EventsQueue_GetEvent(EventsQueue
* omr
, Event
* evt
, long msTimeOut
)
125 if (WaitForSingleObject(omr
->msg_event
, msTimeOut
) != WAIT_OBJECT_0
)
128 EnterCriticalSection(&omr
->msg_crst
);
130 if (omr
->msg_toget
== omr
->msg_tosave
) /* buffer empty ? */
132 LeaveCriticalSection(&omr
->msg_crst
);
136 *evt
= omr
->messages
[omr
->msg_toget
];
137 omr
->msg_toget
= (omr
->msg_toget
+ 1) % omr
->ring_buffer_size
;
139 /* Mark the buffer as empty if needed */
140 if (omr
->msg_toget
== omr
->msg_tosave
) /* buffer empty ? */
141 ResetEvent(omr
->msg_event
);
143 LeaveCriticalSection(&omr
->msg_crst
);
147 #define MAX_ITF_CACHE_ENTRIES 3
148 typedef struct _ITF_CACHE_ENTRY
{
154 typedef struct _IFilterGraphImpl
{
155 const IFilterGraph2Vtbl
*IFilterGraph2_vtbl
;
156 const IMediaControlVtbl
*IMediaControl_vtbl
;
157 const IMediaSeekingVtbl
*IMediaSeeking_vtbl
;
158 const IBasicAudioVtbl
*IBasicAudio_vtbl
;
159 const IBasicVideo2Vtbl
*IBasicVideo_vtbl
;
160 const IVideoWindowVtbl
*IVideoWindow_vtbl
;
161 const IMediaEventExVtbl
*IMediaEventEx_vtbl
;
162 const IMediaFilterVtbl
*IMediaFilter_vtbl
;
163 const IMediaEventSinkVtbl
*IMediaEventSink_vtbl
;
164 const IGraphConfigVtbl
*IGraphConfig_vtbl
;
165 const IMediaPositionVtbl
*IMediaPosition_vtbl
;
166 const IUnknownVtbl
* IInner_vtbl
;
167 /* IAMGraphStreams */
173 /* IRegisterServiceProvider */
174 /* IResourceMananger */
175 /* IServiceProvider */
176 /* IVideoFrameStep */
179 IFilterMapper2
* pFilterMapper2
;
180 IBaseFilter
** ppFiltersInGraph
;
181 LPWSTR
* pFilterNames
;
185 IReferenceClock
*refClock
;
187 HANDLE hEventCompletion
;
188 int CompletionStatus
;
192 int HandleEcComplete
;
194 int HandleEcClockChanged
;
197 ITF_CACHE_ENTRY ItfCacheEntries
[MAX_ITF_CACHE_ENTRIES
];
198 int nItfCacheEntries
;
199 IUnknown
* pUnkOuter
;
205 LONGLONG stop_position
;
208 static HRESULT WINAPI
Filtergraph_QueryInterface(IFilterGraphImpl
*This
,
209 REFIID riid
, LPVOID
* ppv
);
210 static ULONG WINAPI
Filtergraph_AddRef(IFilterGraphImpl
*This
);
211 static ULONG WINAPI
Filtergraph_Release(IFilterGraphImpl
*This
);
213 static HRESULT WINAPI
FilterGraphInner_QueryInterface(IUnknown
* iface
,
216 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
217 TRACE("(%p)->(%s (%p), %p)\n", This
, debugstr_guid(riid
), riid
, ppvObj
);
219 if (This
->bAggregatable
)
220 This
->bUnkOuterValid
= TRUE
;
222 if (IsEqualGUID(&IID_IUnknown
, riid
)) {
223 *ppvObj
= &(This
->IInner_vtbl
);
224 TRACE(" returning IUnknown interface (%p)\n", *ppvObj
);
225 } else if (IsEqualGUID(&IID_IFilterGraph
, riid
) ||
226 IsEqualGUID(&IID_IFilterGraph2
, riid
) ||
227 IsEqualGUID(&IID_IGraphBuilder
, riid
)) {
228 *ppvObj
= &(This
->IFilterGraph2_vtbl
);
229 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj
);
230 } else if (IsEqualGUID(&IID_IMediaControl
, riid
)) {
231 *ppvObj
= &(This
->IMediaControl_vtbl
);
232 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj
);
233 } else if (IsEqualGUID(&IID_IMediaSeeking
, riid
)) {
234 *ppvObj
= &(This
->IMediaSeeking_vtbl
);
235 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj
);
236 } else if (IsEqualGUID(&IID_IBasicAudio
, riid
)) {
237 *ppvObj
= &(This
->IBasicAudio_vtbl
);
238 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj
);
239 } else if (IsEqualGUID(&IID_IBasicVideo
, riid
) ||
240 IsEqualGUID(&IID_IBasicVideo2
, riid
)) {
241 *ppvObj
= &(This
->IBasicVideo_vtbl
);
242 TRACE(" returning IBasicVideo2 interface (%p)\n", *ppvObj
);
243 } else if (IsEqualGUID(&IID_IVideoWindow
, riid
)) {
244 *ppvObj
= &(This
->IVideoWindow_vtbl
);
245 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj
);
246 } else if (IsEqualGUID(&IID_IMediaEvent
, riid
) ||
247 IsEqualGUID(&IID_IMediaEventEx
, riid
)) {
248 *ppvObj
= &(This
->IMediaEventEx_vtbl
);
249 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj
);
250 } else if (IsEqualGUID(&IID_IMediaFilter
, riid
) ||
251 IsEqualGUID(&IID_IPersist
, riid
)) {
252 *ppvObj
= &(This
->IMediaFilter_vtbl
);
253 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj
);
254 } else if (IsEqualGUID(&IID_IMediaEventSink
, riid
)) {
255 *ppvObj
= &(This
->IMediaEventSink_vtbl
);
256 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj
);
257 } else if (IsEqualGUID(&IID_IGraphConfig
, riid
)) {
258 *ppvObj
= &(This
->IGraphConfig_vtbl
);
259 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj
);
260 } else if (IsEqualGUID(&IID_IMediaPosition
, riid
)) {
261 *ppvObj
= &(This
->IMediaPosition_vtbl
);
262 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj
);
265 FIXME("unknown interface %s\n", debugstr_guid(riid
));
266 return E_NOINTERFACE
;
269 IUnknown_AddRef((IUnknown
*)(*ppvObj
));
273 static ULONG WINAPI
FilterGraphInner_AddRef(IUnknown
* iface
) {
274 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
275 ULONG ref
= InterlockedIncrement(&This
->ref
);
277 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
282 static ULONG WINAPI
FilterGraphInner_Release(IUnknown
* iface
)
284 ICOM_THIS_MULTI(IFilterGraphImpl
, IInner_vtbl
, iface
);
285 ULONG ref
= InterlockedDecrement(&This
->ref
);
287 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
292 IMediaControl_Stop((IMediaControl
*)&(This
->IMediaControl_vtbl
));
294 while (This
->nFilters
)
295 IFilterGraph2_RemoveFilter((IFilterGraph2
*)This
, This
->ppFiltersInGraph
[0]);
298 IReferenceClock_Release(This
->refClock
);
300 for (i
= 0; i
< This
->nItfCacheEntries
; i
++)
302 if (This
->ItfCacheEntries
[i
].iface
)
303 IUnknown_Release(This
->ItfCacheEntries
[i
].iface
);
305 IFilterMapper2_Release(This
->pFilterMapper2
);
306 CloseHandle(This
->hEventCompletion
);
307 EventsQueue_Destroy(&This
->evqueue
);
308 This
->cs
.DebugInfo
->Spare
[0] = 0;
309 DeleteCriticalSection(&This
->cs
);
310 CoTaskMemFree(This
->ppFiltersInGraph
);
311 CoTaskMemFree(This
->pFilterNames
);
318 /*** IUnknown methods ***/
319 static HRESULT WINAPI
FilterGraph2_QueryInterface(IFilterGraph2
*iface
,
322 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
324 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
325 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
328 static ULONG WINAPI
FilterGraph2_AddRef(IFilterGraph2
*iface
) {
329 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
331 TRACE("(%p/%p)->() calling FilterGraph AddRef\n", This
, iface
);
333 return Filtergraph_AddRef(This
);
336 static ULONG WINAPI
FilterGraph2_Release(IFilterGraph2
*iface
) {
337 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
339 TRACE("(%p/%p)->() calling FilterGraph Release\n", This
, iface
);
341 return Filtergraph_Release(This
);
344 /*** IFilterGraph methods ***/
345 static HRESULT WINAPI
FilterGraph2_AddFilter(IFilterGraph2
*iface
,
346 IBaseFilter
*pFilter
,
348 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
351 WCHAR
* wszFilterName
= NULL
;
352 int duplicate_name
= FALSE
;
354 TRACE("(%p/%p)->(%p, %s (%p))\n", This
, iface
, pFilter
, debugstr_w(pName
), pName
);
359 wszFilterName
= CoTaskMemAlloc( (pName
? strlenW(pName
) + 6 : 5) * sizeof(WCHAR
) );
363 /* Check if name already exists */
364 for(i
= 0; i
< This
->nFilters
; i
++)
365 if (!strcmpW(This
->pFilterNames
[i
], pName
))
367 duplicate_name
= TRUE
;
372 /* If no name given or name already existing, generate one */
373 if (!pName
|| duplicate_name
)
375 static const WCHAR wszFmt1
[] = {'%','s',' ','%','0','4','d',0};
376 static const WCHAR wszFmt2
[] = {'%','0','4','d',0};
378 for (j
= 0; j
< 10000 ; j
++)
382 sprintfW(wszFilterName
, wszFmt1
, pName
, This
->nameIndex
);
384 sprintfW(wszFilterName
, wszFmt2
, This
->nameIndex
);
385 TRACE("Generated name %s\n", debugstr_w(wszFilterName
));
387 /* Check if the generated name already exists */
388 for(i
= 0; i
< This
->nFilters
; i
++)
389 if (!strcmpW(This
->pFilterNames
[i
], wszFilterName
))
392 /* Compute next index and exit if generated name is suitable */
393 if (This
->nameIndex
++ == 10000)
395 if (i
== This
->nFilters
)
398 /* Unable to find a suitable name */
401 CoTaskMemFree(wszFilterName
);
402 return VFW_E_DUPLICATE_NAME
;
406 memcpy(wszFilterName
, pName
, (strlenW(pName
) + 1) * sizeof(WCHAR
));
408 if (This
->nFilters
+ 1 > This
->filterCapacity
)
410 int newCapacity
= This
->filterCapacity
? 2 * This
->filterCapacity
: 1;
411 IBaseFilter
** ppNewFilters
= CoTaskMemAlloc(newCapacity
* sizeof(IBaseFilter
*));
412 LPWSTR
* pNewNames
= CoTaskMemAlloc(newCapacity
* sizeof(LPWSTR
));
413 memcpy(ppNewFilters
, This
->ppFiltersInGraph
, This
->nFilters
* sizeof(IBaseFilter
*));
414 memcpy(pNewNames
, This
->pFilterNames
, This
->nFilters
* sizeof(LPWSTR
));
415 if (This
->filterCapacity
)
417 CoTaskMemFree(This
->ppFiltersInGraph
);
418 CoTaskMemFree(This
->pFilterNames
);
420 This
->ppFiltersInGraph
= ppNewFilters
;
421 This
->pFilterNames
= pNewNames
;
422 This
->filterCapacity
= newCapacity
;
425 hr
= IBaseFilter_JoinFilterGraph(pFilter
, (IFilterGraph
*)This
, wszFilterName
);
429 IBaseFilter_AddRef(pFilter
);
430 This
->ppFiltersInGraph
[This
->nFilters
] = pFilter
;
431 This
->pFilterNames
[This
->nFilters
] = wszFilterName
;
433 IBaseFilter_SetSyncSource(pFilter
, This
->refClock
);
436 CoTaskMemFree(wszFilterName
);
438 if (SUCCEEDED(hr
) && duplicate_name
)
439 return VFW_S_DUPLICATE_NAME
;
444 static HRESULT WINAPI
FilterGraph2_RemoveFilter(IFilterGraph2
*iface
, IBaseFilter
*pFilter
)
446 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
450 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFilter
);
452 /* FIXME: check graph is stopped */
454 for (i
= 0; i
< This
->nFilters
; i
++)
456 if (This
->ppFiltersInGraph
[i
] == pFilter
)
458 IEnumPins
*penumpins
= NULL
;
461 TRACE("Removing filter %s\n", debugstr_w(This
->pFilterNames
[i
]));
462 IBaseFilter_GetState(pFilter
, 0, &state
);
463 if (state
== State_Running
)
464 IBaseFilter_Pause(pFilter
);
465 if (state
!= State_Stopped
)
466 IBaseFilter_Stop(pFilter
);
468 hr
= IBaseFilter_EnumPins(pFilter
, &penumpins
);
471 while(IEnumPins_Next(penumpins
, 1, &ppin
, NULL
) == S_OK
)
475 IPin_ConnectedTo(ppin
, &victim
);
478 h
= IPin_Disconnect(victim
);
479 TRACE("Disconnect other side: %08x\n", h
);
480 if (h
== VFW_E_NOT_STOPPED
)
483 IPin_QueryPinInfo(victim
, &pinfo
);
485 IBaseFilter_GetState(pinfo
.pFilter
, 0, &state
);
486 if (state
== State_Running
)
487 IBaseFilter_Pause(pinfo
.pFilter
);
488 IBaseFilter_Stop(pinfo
.pFilter
);
489 IBaseFilter_Release(pinfo
.pFilter
);
490 h
= IPin_Disconnect(victim
);
491 TRACE("Disconnect retry: %08x\n", h
);
493 IPin_Release(victim
);
495 h
= IPin_Disconnect(ppin
);
496 TRACE("Disconnect 2: %08x\n", h
);
498 IEnumPins_Release(penumpins
);
501 hr
= IBaseFilter_JoinFilterGraph(pFilter
, NULL
, This
->pFilterNames
[i
]);
504 IBaseFilter_SetSyncSource(pFilter
, NULL
);
505 IBaseFilter_Release(pFilter
);
506 CoTaskMemFree(This
->pFilterNames
[i
]);
507 memmove(This
->ppFiltersInGraph
+i
, This
->ppFiltersInGraph
+i
+1, sizeof(IBaseFilter
*)*(This
->nFilters
- 1 - i
));
508 memmove(This
->pFilterNames
+i
, This
->pFilterNames
+i
+1, sizeof(LPWSTR
)*(This
->nFilters
- 1 - i
));
510 /* Invalidate interfaces in the cache */
511 for (i
= 0; i
< This
->nItfCacheEntries
; i
++)
512 if (pFilter
== This
->ItfCacheEntries
[i
].filter
)
514 IUnknown_Release(This
->ItfCacheEntries
[i
].iface
);
515 This
->ItfCacheEntries
[i
].iface
= NULL
;
516 This
->ItfCacheEntries
[i
].filter
= NULL
;
524 return hr
; /* FIXME: check this error code */
527 static HRESULT WINAPI
FilterGraph2_EnumFilters(IFilterGraph2
*iface
,
528 IEnumFilters
**ppEnum
) {
529 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
531 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppEnum
);
533 return IEnumFiltersImpl_Construct(This
->ppFiltersInGraph
, This
->nFilters
, ppEnum
);
536 static HRESULT WINAPI
FilterGraph2_FindFilterByName(IFilterGraph2
*iface
,
538 IBaseFilter
**ppFilter
) {
539 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
542 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_w(pName
), pName
, ppFilter
);
547 for (i
= 0; i
< This
->nFilters
; i
++)
549 if (!strcmpW(pName
, This
->pFilterNames
[i
]))
551 *ppFilter
= This
->ppFiltersInGraph
[i
];
552 IBaseFilter_AddRef(*ppFilter
);
558 return VFW_E_NOT_FOUND
;
561 /* Don't allow a circular connection to form, return VFW_E_CIRCULAR_GRAPH if this would be the case.
562 * A circular connection will be formed if from the filter of the output pin, the input pin can be reached
564 static HRESULT WINAPI
CheckCircularConnection(IFilterGraphImpl
*This
, IPin
*out
, IPin
*in
)
568 PIN_INFO info_out
, info_in
;
570 hr
= IPin_QueryPinInfo(out
, &info_out
);
573 if (info_out
.dir
!= PINDIR_OUTPUT
)
575 IBaseFilter_Release(info_out
.pFilter
);
579 hr
= IPin_QueryPinInfo(in
, &info_in
);
581 IBaseFilter_Release(info_in
.pFilter
);
584 if (info_in
.dir
!= PINDIR_INPUT
)
590 if (info_out
.pFilter
== info_in
.pFilter
)
591 hr
= VFW_E_CIRCULAR_GRAPH
;
597 hr
= IBaseFilter_EnumPins(info_out
.pFilter
, &enumpins
);
601 IEnumPins_Reset(enumpins
);
602 while ((hr
= IEnumPins_Next(enumpins
, 1, &test
, NULL
)) == S_OK
)
604 PIN_DIRECTION dir
= PINDIR_OUTPUT
;
605 IPin_QueryDirection(test
, &dir
);
606 if (dir
== PINDIR_INPUT
)
609 IPin_ConnectedTo(test
, &victim
);
612 hr
= CheckCircularConnection(This
, victim
, in
);
613 IPin_Release(victim
);
623 IEnumPins_Release(enumpins
);
627 IBaseFilter_Release(info_out
.pFilter
);
629 ERR("Checking filtergraph returned %08x, something's not right!\n", hr
);
632 /* Debugging filtergraphs not enabled */
638 /* NOTE: despite the implication, it doesn't matter which
639 * way round you put in the input and output pins */
640 static HRESULT WINAPI
FilterGraph2_ConnectDirect(IFilterGraph2
*iface
,
643 const AM_MEDIA_TYPE
*pmt
) {
647 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
649 TRACE("(%p/%p)->(%p, %p, %p)\n", This
, iface
, ppinIn
, ppinOut
, pmt
);
651 /* FIXME: check pins are in graph */
653 if (TRACE_ON(quartz
))
657 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
661 TRACE("Filter owning first pin => %p\n", PinInfo
.pFilter
);
662 IBaseFilter_Release(PinInfo
.pFilter
);
664 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
668 TRACE("Filter owning second pin => %p\n", PinInfo
.pFilter
);
669 IBaseFilter_Release(PinInfo
.pFilter
);
672 hr
= IPin_QueryDirection(ppinIn
, &dir
);
675 if (dir
== PINDIR_INPUT
)
677 hr
= CheckCircularConnection(This
, ppinOut
, ppinIn
);
679 hr
= IPin_Connect(ppinOut
, ppinIn
, pmt
);
683 hr
= CheckCircularConnection(This
, ppinIn
, ppinOut
);
685 hr
= IPin_Connect(ppinIn
, ppinOut
, pmt
);
692 static HRESULT WINAPI
FilterGraph2_Reconnect(IFilterGraph2
*iface
,
694 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
695 IPin
*pConnectedTo
= NULL
;
697 PIN_DIRECTION pindir
;
699 IPin_QueryDirection(ppin
, &pindir
);
700 hr
= IPin_ConnectedTo(ppin
, &pConnectedTo
);
702 TRACE("Querying connected to failed: %x\n", hr
);
705 IPin_Disconnect(ppin
);
706 IPin_Disconnect(pConnectedTo
);
707 if (pindir
== PINDIR_INPUT
)
708 hr
= IPin_Connect(pConnectedTo
, ppin
, NULL
);
710 hr
= IPin_Connect(ppin
, pConnectedTo
, NULL
);
711 IPin_Release(pConnectedTo
);
713 WARN("Reconnecting pins failed, pins are not connected now..\n");
714 TRACE("(%p->%p) -- %p %p -> %x\n", iface
, This
, ppin
, pConnectedTo
, hr
);
718 static HRESULT WINAPI
FilterGraph2_Disconnect(IFilterGraph2
*iface
, IPin
*ppin
)
720 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
722 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppin
);
724 return IPin_Disconnect(ppin
);
727 static HRESULT WINAPI
FilterGraph2_SetDefaultSyncSource(IFilterGraph2
*iface
) {
728 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
729 IReferenceClock
*pClock
= NULL
;
732 TRACE("(%p/%p)->() semi-stub\n", iface
, This
);
734 hr
= CoCreateInstance(&CLSID_SystemClock
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IReferenceClock
, (LPVOID
*)&pClock
);
738 hr
= IMediaFilter_SetSyncSource((IMediaFilter
*)&(This
->IMediaFilter_vtbl
), pClock
);
739 IReferenceClock_Release(pClock
);
745 static HRESULT
GetFilterInfo(IMoniker
* pMoniker
, GUID
* pclsid
, VARIANT
* pvar
)
747 static const WCHAR wszClsidName
[] = {'C','L','S','I','D',0};
748 static const WCHAR wszFriendlyName
[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
749 IPropertyBag
* pPropBagCat
= NULL
;
753 V_VT(pvar
) = VT_BSTR
;
755 hr
= IMoniker_BindToStorage(pMoniker
, NULL
, NULL
, &IID_IPropertyBag
, (LPVOID
*)&pPropBagCat
);
758 hr
= IPropertyBag_Read(pPropBagCat
, wszClsidName
, pvar
, NULL
);
761 hr
= CLSIDFromString(V_UNION(pvar
, bstrVal
), pclsid
);
764 hr
= IPropertyBag_Read(pPropBagCat
, wszFriendlyName
, pvar
, NULL
);
767 TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid
), debugstr_w(V_UNION(pvar
, bstrVal
)));
770 IPropertyBag_Release(pPropBagCat
);
775 static HRESULT
GetInternalConnections(IBaseFilter
* pfilter
, IPin
* pinputpin
, IPin
*** pppins
, ULONG
* pnb
)
780 TRACE("(%p, %p, %p, %p)\n", pfilter
, pinputpin
, pppins
, pnb
);
781 hr
= IPin_QueryInternalConnections(pinputpin
, NULL
, &nb
);
784 } else if (hr
== S_FALSE
) {
785 *pppins
= CoTaskMemAlloc(sizeof(IPin
*)*nb
);
786 hr
= IPin_QueryInternalConnections(pinputpin
, *pppins
, &nb
);
788 WARN("Error (%x)\n", hr
);
790 } else if (hr
== E_NOTIMPL
) {
791 /* Input connected to all outputs */
792 IEnumPins
* penumpins
;
795 TRACE("E_NOTIMPL\n");
796 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
798 WARN("filter Enumpins failed (%x)\n", hr
);
802 /* Count output pins */
803 while(IEnumPins_Next(penumpins
, 1, &ppin
, &nb
) == S_OK
) {
804 PIN_DIRECTION pindir
;
805 IPin_QueryDirection(ppin
, &pindir
);
806 if (pindir
== PINDIR_OUTPUT
)
810 *pppins
= CoTaskMemAlloc(sizeof(IPin
*)*i
);
811 /* Retrieve output pins */
812 IEnumPins_Reset(penumpins
);
814 while(IEnumPins_Next(penumpins
, 1, &ppin
, &nb
) == S_OK
) {
815 PIN_DIRECTION pindir
;
816 IPin_QueryDirection(ppin
, &pindir
);
817 if (pindir
== PINDIR_OUTPUT
)
818 (*pppins
)[i
++] = ppin
;
822 IEnumPins_Release(penumpins
);
825 WARN("Next failed (%x)\n", hr
);
828 } else if (FAILED(hr
)) {
829 WARN("Cannot get internal connection (%x)\n", hr
);
837 /*** IGraphBuilder methods ***/
838 static HRESULT WINAPI
FilterGraph2_Connect(IFilterGraph2
*iface
, IPin
*ppinOut
, IPin
*ppinIn
)
840 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
843 IEnumMediaTypes
* penummt
;
845 IEnumPins
* penumpins
;
846 IEnumMoniker
* pEnumMoniker
;
855 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, ppinOut
, ppinIn
);
857 if (TRACE_ON(quartz
))
859 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
863 TRACE("Filter owning first pin => %p\n", PinInfo
.pFilter
);
864 IBaseFilter_Release(PinInfo
.pFilter
);
866 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
870 TRACE("Filter owning second pin => %p\n", PinInfo
.pFilter
);
871 IBaseFilter_Release(PinInfo
.pFilter
);
874 hr
= IPin_QueryDirection(ppinOut
, &dir
);
878 if (dir
== PINDIR_INPUT
)
887 hr
= CheckCircularConnection(This
, ppinOut
, ppinIn
);
891 /* Try direct connection first */
892 hr
= IPin_Connect(ppinOut
, ppinIn
, NULL
);
896 TRACE("Direct connection failed, trying to render using extra filters\n");
898 hr
= IPin_QueryPinInfo(ppinIn
, &PinInfo
);
902 hr
= IBaseFilter_GetClassID(PinInfo
.pFilter
, &FilterCLSID
);
903 IBaseFilter_Release(PinInfo
.pFilter
);
907 /* Find the appropriate transform filter than can transform the minor media type of output pin of the upstream
908 * filter to the minor mediatype of input pin of the renderer */
909 hr
= IPin_EnumMediaTypes(ppinOut
, &penummt
);
911 WARN("EnumMediaTypes (%x)\n", hr
);
915 hr
= IEnumMediaTypes_Next(penummt
, 1, &mt
, &nbmt
);
917 WARN("IEnumMediaTypes_Next (%x)\n", hr
);
923 WARN("No media type found!\n");
926 TRACE("MajorType %s\n", debugstr_guid(&mt
->majortype
));
927 TRACE("SubType %s\n", debugstr_guid(&mt
->subtype
));
929 /* Try to find a suitable filter that can connect to the pin to render */
930 tab
[0] = mt
->majortype
;
931 tab
[1] = mt
->subtype
;
932 hr
= IFilterMapper2_EnumMatchingFilters(This
->pFilterMapper2
, &pEnumMoniker
, 0, FALSE
, MERIT_UNLIKELY
, TRUE
, 1, tab
, NULL
, NULL
, FALSE
, FALSE
, 0, NULL
, NULL
, NULL
);
934 WARN("Unable to enum filters (%x)\n", hr
);
938 hr
= VFW_E_CANNOT_RENDER
;
939 while(IEnumMoniker_Next(pEnumMoniker
, 1, &pMoniker
, &nb
) == S_OK
)
944 IPin
* ppinfilter
= NULL
;
945 IBaseFilter
* pfilter
= NULL
;
947 hr
= GetFilterInfo(pMoniker
, &clsid
, &var
);
948 IMoniker_Release(pMoniker
);
950 WARN("Unable to retrieve filter info (%x)\n", hr
);
954 if (IsEqualGUID(&clsid
, &FilterCLSID
)) {
955 /* Skip filter (same as the one the output pin belongs to) */
959 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&pfilter
);
961 WARN("Unable to create filter (%x), trying next one\n", hr
);
965 hr
= IFilterGraph2_AddFilter(iface
, pfilter
, V_UNION(&var
, bstrVal
));
967 WARN("Unable to add filter (%x)\n", hr
);
968 IBaseFilter_Release(pfilter
);
973 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
975 WARN("Enumpins (%x)\n", hr
);
979 hr
= IEnumPins_Next(penumpins
, 1, &ppinfilter
, &pin
);
980 IEnumPins_Release(penumpins
);
983 WARN("Obtaining next pin: (%x)\n", hr
);
987 WARN("Cannot use this filter: no pins\n");
991 hr
= IPin_Connect(ppinOut
, ppinfilter
, NULL
);
993 TRACE("Cannot connect to filter (%x), trying next one\n", hr
);
996 TRACE("Successfully connected to filter, follow chain...\n");
998 /* Render all output pins of the filter by calling IFilterGraph2_Connect on each of them */
999 hr
= GetInternalConnections(pfilter
, ppinfilter
, &ppins
, &nb
);
1001 if (SUCCEEDED(hr
)) {
1004 IPin_Disconnect(ppinfilter
);
1005 IPin_Disconnect(ppinOut
);
1008 TRACE("pins to consider: %d\n", nb
);
1009 for(i
= 0; i
< nb
; i
++)
1011 LPWSTR pinname
= NULL
;
1013 TRACE("Processing pin %d\n", i
);
1015 hr
= IPin_QueryId(ppins
[i
], &pinname
);
1018 if (pinname
[0] == '~')
1020 TRACE("Pinname=%s, skipping\n", debugstr_w(pinname
));
1024 hr
= IFilterGraph2_Connect(iface
, ppins
[i
], ppinIn
);
1025 CoTaskMemFree(pinname
);
1029 TRACE("Cannot connect pin %p (%x)\n", ppinfilter
, hr
);
1031 IPin_Release(ppins
[i
]);
1032 if (SUCCEEDED(hr
)) break;
1034 while (++i
< nb
) IPin_Release(ppins
[i
]);
1035 CoTaskMemFree(ppins
);
1036 IPin_Release(ppinfilter
);
1037 IBaseFilter_Release(pfilter
);
1040 IPin_Disconnect(ppinfilter
);
1041 IPin_Disconnect(ppinOut
);
1042 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1049 if (ppinfilter
) IPin_Release(ppinfilter
);
1051 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1052 IBaseFilter_Release(pfilter
);
1056 IEnumMediaTypes_Release(penummt
);
1057 DeleteMediaType(mt
);
1059 TRACE("--> %08x\n", hr
);
1060 return SUCCEEDED(hr
) ? S_OK
: hr
;
1063 static HRESULT WINAPI
FilterGraph2_RenderRecurse(IFilterGraphImpl
*This
, IPin
*ppinOut
)
1065 /* This pin has been connected now, try to call render on all pins that aren't connected */
1068 IEnumPins
*enumpins
= NULL
;
1069 BOOL renderany
= FALSE
;
1070 BOOL renderall
= TRUE
;
1072 IPin_QueryPinInfo(ppinOut
, &info
);
1074 IBaseFilter_EnumPins(info
.pFilter
, &enumpins
);
1075 /* Don't need to hold a reference, IEnumPins does */
1076 IBaseFilter_Release(info
.pFilter
);
1078 IEnumPins_Reset(enumpins
);
1079 while (IEnumPins_Next(enumpins
, 1, &to
, NULL
) == S_OK
)
1081 PIN_DIRECTION dir
= PINDIR_INPUT
;
1083 IPin_QueryDirection(to
, &dir
);
1085 if (dir
== PINDIR_OUTPUT
)
1089 IPin_ConnectedTo(to
, &out
);
1093 hr
= IFilterGraph2_Render((IFilterGraph2
*)&This
->IFilterGraph2_vtbl
, to
);
1106 IEnumPins_Release(enumpins
);
1112 return VFW_S_PARTIAL_RENDER
;
1114 return VFW_E_CANNOT_RENDER
;
1117 /* Ogg hates me if I create a direct rendering method
1119 * It can only connect to a pin properly once, so use a recursive method that does
1121 * +----+ --- (PIN 1) (Render is called on this pin)
1123 * +----+ --- (PIN 2)
1125 * Enumerate possible renderers that EXACTLY match the requested type
1127 * If none is available, try to add intermediate filters that can connect to the input pin
1128 * then call Render on that intermediate pin's output pins
1129 * if it succeeds: Render returns success, if it doesn't, the intermediate filter is removed,
1130 * and another filter that can connect to the input pin is tried
1131 * if we run out of filters that can, give up and return VFW_E_CANNOT_RENDER
1132 * It's recursive, but fun!
1135 static HRESULT WINAPI
FilterGraph2_Render(IFilterGraph2
*iface
, IPin
*ppinOut
)
1137 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1138 IEnumMediaTypes
* penummt
;
1143 IEnumMoniker
* pEnumMoniker
;
1149 TRACE("(%p/%p)->(%p)\n", This
, iface
, ppinOut
);
1151 if (TRACE_ON(quartz
))
1155 hr
= IPin_QueryPinInfo(ppinOut
, &PinInfo
);
1159 TRACE("Filter owning pin => %p\n", PinInfo
.pFilter
);
1160 IBaseFilter_Release(PinInfo
.pFilter
);
1163 /* Try to find out if there is a renderer for the specified subtype already, and use that
1165 EnterCriticalSection(&This
->cs
);
1166 for (x
= 0; x
< This
->nFilters
; ++x
)
1168 IEnumPins
*enumpins
= NULL
;
1171 hr
= IBaseFilter_EnumPins(This
->ppFiltersInGraph
[x
], &enumpins
);
1173 if (FAILED(hr
) || !enumpins
)
1176 IEnumPins_Reset(enumpins
);
1177 while (IEnumPins_Next(enumpins
, 1, &pin
, NULL
) == S_OK
)
1180 PIN_DIRECTION dir
= PINDIR_OUTPUT
;
1182 IPin_QueryDirection(pin
, &dir
);
1183 if (dir
!= PINDIR_INPUT
)
1188 IPin_ConnectedTo(pin
, &to
);
1192 hr
= IPin_Connect(ppinOut
, pin
, NULL
);
1195 TRACE("Connected successfully %p/%p, %08x look if we should render more!\n", ppinOut
, pin
, hr
);
1198 hr
= FilterGraph2_RenderRecurse(This
, pin
);
1201 IPin_Disconnect(ppinOut
);
1202 IPin_Disconnect(pin
);
1205 IEnumPins_Release(enumpins
);
1206 LeaveCriticalSection(&This
->cs
);
1209 WARN("Could not connect!\n");
1216 IEnumPins_Release(enumpins
);
1219 LeaveCriticalSection(&This
->cs
);
1221 hr
= IPin_EnumMediaTypes(ppinOut
, &penummt
);
1223 WARN("EnumMediaTypes (%x)\n", hr
);
1227 IEnumMediaTypes_Reset(penummt
);
1229 /* Looks like no existing renderer of the kind exists
1230 * Try adding new ones
1232 tab
[0] = tab
[1] = GUID_NULL
;
1233 while (SUCCEEDED(hr
))
1235 hr
= IEnumMediaTypes_Next(penummt
, 1, &mt
, &nbmt
);
1237 WARN("IEnumMediaTypes_Next (%x)\n", hr
);
1242 hr
= VFW_E_CANNOT_RENDER
;
1247 TRACE("MajorType %s\n", debugstr_guid(&mt
->majortype
));
1248 TRACE("SubType %s\n", debugstr_guid(&mt
->subtype
));
1250 /* Only enumerate once, this doesn't account for all previous ones, but this should be enough nonetheless */
1251 if (IsEqualIID(&tab
[0], &mt
->majortype
) && IsEqualIID(&tab
[1], &mt
->subtype
))
1253 DeleteMediaType(mt
);
1257 /* Try to find a suitable renderer with the same media type */
1258 tab
[0] = mt
->majortype
;
1259 tab
[1] = mt
->subtype
;
1260 hr
= IFilterMapper2_EnumMatchingFilters(This
->pFilterMapper2
, &pEnumMoniker
, 0, FALSE
, MERIT_UNLIKELY
, TRUE
, 1, tab
, NULL
, NULL
, FALSE
, FALSE
, 0, NULL
, NULL
, NULL
);
1263 WARN("Unable to enum filters (%x)\n", hr
);
1269 while (IEnumMoniker_Next(pEnumMoniker
, 1, &pMoniker
, &nb
) == S_OK
)
1274 IBaseFilter
* pfilter
= NULL
;
1275 IEnumPins
* penumpins
;
1278 hr
= GetFilterInfo(pMoniker
, &clsid
, &var
);
1279 IMoniker_Release(pMoniker
);
1281 WARN("Unable to retrieve filter info (%x)\n", hr
);
1285 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&pfilter
);
1288 WARN("Unable to create filter (%x), trying next one\n", hr
);
1292 hr
= IFilterGraph2_AddFilter(iface
, pfilter
, V_UNION(&var
, bstrVal
));
1294 WARN("Unable to add filter (%x)\n", hr
);
1295 IBaseFilter_Release(pfilter
);
1300 hr
= IBaseFilter_EnumPins(pfilter
, &penumpins
);
1302 WARN("Splitter Enumpins (%x)\n", hr
);
1305 hr
= IEnumPins_Next(penumpins
, 1, &ppinfilter
, &pin
);
1306 IEnumPins_Release(penumpins
);
1308 WARN("Next (%x)\n", hr
);
1317 /* Connect the pin to the "Renderer" */
1318 hr
= IPin_Connect(ppinOut
, ppinfilter
, NULL
);
1319 IPin_Release(ppinfilter
);
1322 WARN("Unable to connect %s to renderer (%x)\n", debugstr_w(V_UNION(&var
, bstrVal
)), hr
);
1325 TRACE("Connected, recursing %s\n", debugstr_w(V_UNION(&var
, bstrVal
)));
1326 hr
= FilterGraph2_RenderRecurse(This
, ppinfilter
);
1328 WARN("Unable to connect recursively (%x)\n", hr
);
1331 IBaseFilter_Release(pfilter
);
1336 IFilterGraph2_RemoveFilter(iface
, pfilter
);
1337 IBaseFilter_Release(pfilter
);
1339 if (!FAILED(hr
)) DebugBreak();
1343 DeleteMediaType(mt
);
1349 IEnumMediaTypes_Release(penummt
);
1353 static HRESULT WINAPI
FilterGraph2_RenderFile(IFilterGraph2
*iface
,
1354 LPCWSTR lpcwstrFile
,
1355 LPCWSTR lpcwstrPlayList
)
1357 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1358 static const WCHAR string
[] = {'R','e','a','d','e','r',0};
1359 IBaseFilter
* preader
= NULL
;
1360 IPin
* ppinreader
= NULL
;
1361 IEnumPins
* penumpins
= NULL
;
1363 BOOL partial
= FALSE
;
1364 HRESULT any
= FALSE
;
1366 TRACE("(%p/%p)->(%s, %s)\n", This
, iface
, debugstr_w(lpcwstrFile
), debugstr_w(lpcwstrPlayList
));
1368 if (lpcwstrPlayList
!= NULL
)
1369 return E_INVALIDARG
;
1371 hr
= IFilterGraph2_AddSourceFilter(iface
, lpcwstrFile
, string
, &preader
);
1376 hr
= IBaseFilter_EnumPins(preader
, &penumpins
);
1379 while (IEnumPins_Next(penumpins
, 1, &ppinreader
, NULL
) == S_OK
)
1383 IPin_QueryDirection(ppinreader
, &dir
);
1384 if (dir
== PINDIR_OUTPUT
)
1388 hr
= IFilterGraph2_Render(iface
, ppinreader
);
1389 TRACE("Render %08x\n", hr
);
1391 for (i
= 0; i
< This
->nFilters
; ++i
)
1392 TRACE("Filters in chain: %s\n", debugstr_w(This
->pFilterNames
[i
]));
1399 IPin_Release(ppinreader
);
1401 IEnumPins_Release(penumpins
);
1404 hr
= VFW_E_CANNOT_RENDER
;
1406 hr
= VFW_S_PARTIAL_RENDER
;
1410 IBaseFilter_Release(preader
);
1412 TRACE("--> %08x\n", hr
);
1416 /* Some filters implement their own asynchronous reader (Theoretically they all should, try to load it first */
1417 static HRESULT
GetFileSourceFilter(LPCOLESTR pszFileName
, IBaseFilter
**filter
)
1419 static const WCHAR wszReg
[] = {'M','e','d','i','a',' ','T','y','p','e','\\','E','x','t','e','n','s','i','o','n','s',0};
1424 lRet
= RegOpenKeyExW(HKEY_CLASSES_ROOT
, wszReg
, 0, KEY_READ
, &extkey
);
1425 hr
= HRESULT_FROM_WIN32(lRet
);
1429 static const WCHAR filtersource
[] = {'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
1430 WCHAR
*ext
= PathFindExtensionW(pszFileName
);
1431 WCHAR clsid_key
[39];
1433 DWORD size
= sizeof(clsid_key
);
1438 CloseHandle(extkey
);
1442 lRet
= RegOpenKeyExW(extkey
, ext
, 0, KEY_READ
, &pathkey
);
1443 hr
= HRESULT_FROM_WIN32(lRet
);
1444 CloseHandle(extkey
);
1448 lRet
= RegQueryValueExW(pathkey
, filtersource
, NULL
, NULL
, (LPBYTE
)clsid_key
, &size
);
1449 hr
= HRESULT_FROM_WIN32(lRet
);
1450 CloseHandle(pathkey
);
1454 CLSIDFromString(clsid_key
, &clsid
);
1456 TRACE("CLSID: %s\n", debugstr_guid(&clsid
));
1457 hr
= CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)filter
);
1460 IFileSourceFilter
*source
= NULL
;
1461 hr
= IBaseFilter_QueryInterface(*filter
, &IID_IFileSourceFilter
, (LPVOID
*)&source
);
1463 IFileSourceFilter_Release(source
);
1465 IBaseFilter_Release(*filter
);
1473 static HRESULT WINAPI
FilterGraph2_AddSourceFilter(IFilterGraph2
*iface
,
1474 LPCWSTR lpcwstrFileName
,
1475 LPCWSTR lpcwstrFilterName
,
1476 IBaseFilter
**ppFilter
) {
1477 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1479 IBaseFilter
* preader
;
1480 IFileSourceFilter
* pfile
= NULL
;
1484 TRACE("(%p/%p)->(%s, %s, %p)\n", This
, iface
, debugstr_w(lpcwstrFileName
), debugstr_w(lpcwstrFilterName
), ppFilter
);
1486 /* Try from file name first, then fall back to default asynchronous reader */
1487 hr
= GetFileSourceFilter(lpcwstrFileName
, &preader
);
1490 hr
= CoCreateInstance(&CLSID_AsyncReader
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IBaseFilter
, (LPVOID
*)&preader
);
1492 WARN("Unable to create file source filter (%x)\n", hr
);
1496 hr
= IFilterGraph2_AddFilter(iface
, preader
, lpcwstrFilterName
);
1498 WARN("Unable add filter (%x)\n", hr
);
1499 IBaseFilter_Release(preader
);
1503 hr
= IBaseFilter_QueryInterface(preader
, &IID_IFileSourceFilter
, (LPVOID
*)&pfile
);
1505 WARN("Unable to get IFileSourceInterface (%x)\n", hr
);
1509 /* Load the file in the file source filter */
1510 hr
= IFileSourceFilter_Load(pfile
, lpcwstrFileName
, NULL
);
1512 WARN("Load (%x)\n", hr
);
1516 IFileSourceFilter_GetCurFile(pfile
, &filename
, &mt
);
1518 WARN("GetCurFile (%x)\n", hr
);
1522 TRACE("File %s\n", debugstr_w(filename
));
1523 TRACE("MajorType %s\n", debugstr_guid(&mt
.majortype
));
1524 TRACE("SubType %s\n", debugstr_guid(&mt
.subtype
));
1527 *ppFilter
= preader
;
1528 IFileSourceFilter_Release(pfile
);
1534 IFileSourceFilter_Release(pfile
);
1535 IFilterGraph2_RemoveFilter(iface
, preader
);
1536 IBaseFilter_Release(preader
);
1541 static HRESULT WINAPI
FilterGraph2_SetLogFile(IFilterGraph2
*iface
,
1543 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1545 TRACE("(%p/%p)->(%08x): stub !!!\n", This
, iface
, (DWORD
) hFile
);
1550 static HRESULT WINAPI
FilterGraph2_Abort(IFilterGraph2
*iface
) {
1551 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1553 TRACE("(%p/%p)->(): stub !!!\n", This
, iface
);
1558 static HRESULT WINAPI
FilterGraph2_ShouldOperationContinue(IFilterGraph2
*iface
) {
1559 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1561 TRACE("(%p/%p)->(): stub !!!\n", This
, iface
);
1566 /*** IFilterGraph2 methods ***/
1567 static HRESULT WINAPI
FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2
*iface
,
1570 LPCWSTR lpcwstrFilterName
,
1571 IBaseFilter
**ppFilter
) {
1572 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1574 TRACE("(%p/%p)->(%p %p %s %p): stub !!!\n", This
, iface
, pMoniker
, pCtx
, debugstr_w(lpcwstrFilterName
), ppFilter
);
1579 static HRESULT WINAPI
FilterGraph2_ReconnectEx(IFilterGraph2
*iface
,
1581 const AM_MEDIA_TYPE
*pmt
) {
1582 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1584 TRACE("(%p/%p)->(%p %p): stub !!!\n", This
, iface
, ppin
, pmt
);
1589 static HRESULT WINAPI
FilterGraph2_RenderEx(IFilterGraph2
*iface
,
1593 ICOM_THIS_MULTI(IFilterGraphImpl
, IFilterGraph2_vtbl
, iface
);
1595 TRACE("(%p/%p)->(%p %08x %p): stub !!!\n", This
, iface
, pPinOut
, dwFlags
, pvContext
);
1601 static const IFilterGraph2Vtbl IFilterGraph2_VTable
=
1603 FilterGraph2_QueryInterface
,
1604 FilterGraph2_AddRef
,
1605 FilterGraph2_Release
,
1606 FilterGraph2_AddFilter
,
1607 FilterGraph2_RemoveFilter
,
1608 FilterGraph2_EnumFilters
,
1609 FilterGraph2_FindFilterByName
,
1610 FilterGraph2_ConnectDirect
,
1611 FilterGraph2_Reconnect
,
1612 FilterGraph2_Disconnect
,
1613 FilterGraph2_SetDefaultSyncSource
,
1614 FilterGraph2_Connect
,
1615 FilterGraph2_Render
,
1616 FilterGraph2_RenderFile
,
1617 FilterGraph2_AddSourceFilter
,
1618 FilterGraph2_SetLogFile
,
1620 FilterGraph2_ShouldOperationContinue
,
1621 FilterGraph2_AddSourceFilterForMoniker
,
1622 FilterGraph2_ReconnectEx
,
1623 FilterGraph2_RenderEx
1626 /*** IUnknown methods ***/
1627 static HRESULT WINAPI
MediaControl_QueryInterface(IMediaControl
*iface
,
1630 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1632 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
1634 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
1637 static ULONG WINAPI
MediaControl_AddRef(IMediaControl
*iface
) {
1638 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1640 TRACE("(%p/%p)->()\n", This
, iface
);
1642 return Filtergraph_AddRef(This
);
1645 static ULONG WINAPI
MediaControl_Release(IMediaControl
*iface
) {
1646 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1648 TRACE("(%p/%p)->()\n", This
, iface
);
1650 return Filtergraph_Release(This
);
1654 /*** IDispatch methods ***/
1655 static HRESULT WINAPI
MediaControl_GetTypeInfoCount(IMediaControl
*iface
,
1657 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1659 TRACE("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
1664 static HRESULT WINAPI
MediaControl_GetTypeInfo(IMediaControl
*iface
,
1667 ITypeInfo
**ppTInfo
) {
1668 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1670 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
1675 static HRESULT WINAPI
MediaControl_GetIDsOfNames(IMediaControl
*iface
,
1681 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1683 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1688 static HRESULT WINAPI
MediaControl_Invoke(IMediaControl
*iface
,
1689 DISPID dispIdMember
,
1693 DISPPARAMS
*pDispParams
,
1695 EXCEPINFO
*pExepInfo
,
1697 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1699 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
1704 typedef HRESULT(WINAPI
*fnFoundFilter
)(IBaseFilter
*, DWORD_PTR data
);
1706 static HRESULT
ExploreGraph(IFilterGraphImpl
* pGraph
, IPin
* pOutputPin
, fnFoundFilter FoundFilter
, DWORD_PTR data
)
1715 TRACE("%p %p\n", pGraph
, pOutputPin
);
1716 PinInfo
.pFilter
= NULL
;
1718 hr
= IPin_ConnectedTo(pOutputPin
, &pInputPin
);
1722 hr
= IPin_QueryPinInfo(pInputPin
, &PinInfo
);
1724 hr
= GetInternalConnections(PinInfo
.pFilter
, pInputPin
, &ppPins
, &nb
);
1725 IPin_Release(pInputPin
);
1732 TRACE("Reached a renderer\n");
1733 /* Count renderers for end of stream notification */
1734 pGraph
->nRenderers
++;
1738 for(i
= 0; i
< nb
; i
++)
1740 /* Explore the graph downstream from this pin
1741 * FIXME: We should prevent exploring from a pin more than once. This can happens when
1742 * several input pins are connected to the same output (a MUX for instance). */
1743 ExploreGraph(pGraph
, ppPins
[i
], FoundFilter
, data
);
1744 IPin_Release(ppPins
[i
]);
1747 CoTaskMemFree(ppPins
);
1749 TRACE("Doing stuff with filter %p\n", PinInfo
.pFilter
);
1751 FoundFilter(PinInfo
.pFilter
, data
);
1754 if (PinInfo
.pFilter
) IBaseFilter_Release(PinInfo
.pFilter
);
1758 static HRESULT WINAPI
SendRun(IBaseFilter
*pFilter
, DWORD_PTR data
)
1761 IReferenceClock
*clock
= NULL
;
1763 IBaseFilter_GetSyncSource(pFilter
, &clock
);
1766 IReferenceClock_GetTime(clock
, &time
);
1772 IReferenceClock_Release(clock
);
1775 return IBaseFilter_Run(pFilter
, time
);
1778 static HRESULT WINAPI
SendPause(IBaseFilter
*pFilter
, DWORD_PTR data
)
1780 return IBaseFilter_Pause(pFilter
);
1783 static HRESULT WINAPI
SendStop(IBaseFilter
*pFilter
, DWORD_PTR data
)
1785 return IBaseFilter_Stop(pFilter
);
1788 static HRESULT WINAPI
SendGetState(IBaseFilter
*pFilter
, DWORD_PTR data
)
1791 DWORD time_end
= data
;
1792 DWORD time_now
= GetTickCount();
1795 if (time_end
== INFINITE
)
1799 else if (time_end
> time_now
)
1801 wait
= time_end
- time_now
;
1806 return IBaseFilter_GetState(pFilter
, wait
, &state
);
1810 static HRESULT
SendFilterMessage(IMediaControl
*iface
, fnFoundFilter FoundFilter
, DWORD_PTR data
)
1812 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1814 IBaseFilter
* pfilter
;
1820 TRACE("(%p/%p)->()\n", This
, iface
);
1822 /* Explorer the graph from source filters to renderers, determine renderers
1823 * number and run filters from renderers to source filters */
1824 This
->nRenderers
= 0;
1825 ResetEvent(This
->hEventCompletion
);
1827 for(i
= 0; i
< This
->nFilters
; i
++)
1830 pfilter
= This
->ppFiltersInGraph
[i
];
1831 hr
= IBaseFilter_EnumPins(pfilter
, &pEnum
);
1834 WARN("Enum pins failed %x\n", hr
);
1837 /* Check if it is a source filter */
1838 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
1840 IPin_QueryDirection(pPin
, &dir
);
1842 if (dir
== PINDIR_INPUT
)
1850 TRACE("Found a source filter %p\n", pfilter
);
1851 IEnumPins_Reset(pEnum
);
1852 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
1854 /* Explore the graph downstream from this pin */
1855 ExploreGraph(This
, pPin
, FoundFilter
, data
);
1858 FoundFilter(pfilter
, data
);
1860 IEnumPins_Release(pEnum
);
1866 /*** IMediaControl methods ***/
1867 static HRESULT WINAPI
MediaControl_Run(IMediaControl
*iface
) {
1868 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1869 TRACE("(%p/%p)->()\n", This
, iface
);
1871 if (This
->state
== State_Running
) return S_OK
;
1873 EnterCriticalSection(&This
->cs
);
1874 if (This
->state
== State_Stopped
)
1875 This
->EcCompleteCount
= 0;
1879 IReferenceClock_GetTime(This
->refClock
, &This
->start_time
);
1880 This
->start_time
+= 500000;
1882 else This
->position
= This
->start_time
= 0;
1884 SendFilterMessage(iface
, SendRun
, 0);
1885 This
->state
= State_Running
;
1886 LeaveCriticalSection(&This
->cs
);
1890 static HRESULT WINAPI
MediaControl_Pause(IMediaControl
*iface
) {
1891 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1892 TRACE("(%p/%p)->()\n", This
, iface
);
1894 if (This
->state
== State_Paused
) return S_OK
;
1896 EnterCriticalSection(&This
->cs
);
1897 if (This
->state
== State_Stopped
)
1898 This
->EcCompleteCount
= 0;
1900 if (This
->state
== State_Running
&& This
->refClock
)
1902 LONGLONG time
= This
->start_time
;
1903 IReferenceClock_GetTime(This
->refClock
, &time
);
1904 This
->position
+= time
- This
->start_time
;
1907 SendFilterMessage(iface
, SendPause
, 0);
1908 This
->state
= State_Paused
;
1909 LeaveCriticalSection(&This
->cs
);
1913 static HRESULT WINAPI
MediaControl_Stop(IMediaControl
*iface
) {
1914 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1915 TRACE("(%p/%p)->()\n", This
, iface
);
1917 if (This
->state
== State_Stopped
) return S_OK
;
1919 EnterCriticalSection(&This
->cs
);
1920 if (This
->state
== State_Running
&& This
->refClock
)
1922 LONGLONG time
= This
->start_time
;
1923 IReferenceClock_GetTime(This
->refClock
, &time
);
1924 This
->position
+= time
- This
->start_time
;
1927 if (This
->state
== State_Running
) SendFilterMessage(iface
, SendPause
, 0);
1928 SendFilterMessage(iface
, SendStop
, 0);
1929 This
->state
= State_Stopped
;
1930 LeaveCriticalSection(&This
->cs
);
1934 static HRESULT WINAPI
MediaControl_GetState(IMediaControl
*iface
,
1936 OAFilterState
*pfs
) {
1937 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1940 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, msTimeout
, pfs
);
1945 EnterCriticalSection(&This
->cs
);
1950 end
= GetTickCount() + msTimeout
;
1952 else if (msTimeout
< 0)
1961 SendFilterMessage(iface
, SendGetState
, end
);
1963 LeaveCriticalSection(&This
->cs
);
1968 static HRESULT WINAPI
MediaControl_RenderFile(IMediaControl
*iface
,
1970 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1972 FIXME("(%p/%p)->(%s (%p)): stub !!!\n", This
, iface
, debugstr_w(strFilename
), strFilename
);
1977 static HRESULT WINAPI
MediaControl_AddSourceFilter(IMediaControl
*iface
,
1979 IDispatch
**ppUnk
) {
1980 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1982 FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This
, iface
, debugstr_w(strFilename
), strFilename
, ppUnk
);
1987 static HRESULT WINAPI
MediaControl_get_FilterCollection(IMediaControl
*iface
,
1988 IDispatch
**ppUnk
) {
1989 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
1991 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, ppUnk
);
1996 static HRESULT WINAPI
MediaControl_get_RegFilterCollection(IMediaControl
*iface
,
1997 IDispatch
**ppUnk
) {
1998 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
2000 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, ppUnk
);
2005 static HRESULT WINAPI
MediaControl_StopWhenReady(IMediaControl
*iface
) {
2006 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaControl_vtbl
, iface
);
2008 FIXME("(%p/%p)->(): stub !!!\n", This
, iface
);
2014 static const IMediaControlVtbl IMediaControl_VTable
=
2016 MediaControl_QueryInterface
,
2017 MediaControl_AddRef
,
2018 MediaControl_Release
,
2019 MediaControl_GetTypeInfoCount
,
2020 MediaControl_GetTypeInfo
,
2021 MediaControl_GetIDsOfNames
,
2022 MediaControl_Invoke
,
2026 MediaControl_GetState
,
2027 MediaControl_RenderFile
,
2028 MediaControl_AddSourceFilter
,
2029 MediaControl_get_FilterCollection
,
2030 MediaControl_get_RegFilterCollection
,
2031 MediaControl_StopWhenReady
2035 /*** IUnknown methods ***/
2036 static HRESULT WINAPI
MediaSeeking_QueryInterface(IMediaSeeking
*iface
,
2039 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2041 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2043 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2046 static ULONG WINAPI
MediaSeeking_AddRef(IMediaSeeking
*iface
) {
2047 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2049 TRACE("(%p/%p)->()\n", This
, iface
);
2051 return Filtergraph_AddRef(This
);
2054 static ULONG WINAPI
MediaSeeking_Release(IMediaSeeking
*iface
) {
2055 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2057 TRACE("(%p/%p)->()\n", This
, iface
);
2059 return Filtergraph_Release(This
);
2062 typedef HRESULT
WINAPI (*fnFoundSeek
)(IFilterGraphImpl
*This
, IMediaSeeking
*, DWORD_PTR arg
);
2064 static HRESULT
all_renderers_seek(IFilterGraphImpl
*This
, fnFoundSeek FoundSeek
, DWORD_PTR arg
) {
2065 BOOL allnotimpl
= TRUE
;
2067 IBaseFilter
* pfilter
;
2069 HRESULT hr
, hr_return
= S_OK
;
2074 TRACE("(%p)->(%p %08lx)\n", This
, FoundSeek
, arg
);
2075 /* Send a message to all renderers, they are responsible for broadcasting it further */
2077 for(i
= 0; i
< This
->nFilters
; i
++)
2079 BOOL renderer
= TRUE
;
2080 pfilter
= This
->ppFiltersInGraph
[i
];
2081 hr
= IBaseFilter_EnumPins(pfilter
, &pEnum
);
2084 WARN("Enum pins failed %x\n", hr
);
2087 /* Check if it is a source filter */
2088 while(IEnumPins_Next(pEnum
, 1, &pPin
, &dummy
) == S_OK
)
2090 IPin_QueryDirection(pPin
, &dir
);
2092 if (dir
!= PINDIR_INPUT
)
2098 IEnumPins_Release(pEnum
);
2101 IMediaSeeking
*seek
= NULL
;
2102 IBaseFilter_QueryInterface(pfilter
, &IID_IMediaSeeking
, (void**)&seek
);
2106 hr
= FoundSeek(This
, seek
, arg
);
2108 IMediaSeeking_Release(seek
);
2109 if (hr_return
!= E_NOTIMPL
)
2111 if (hr_return
== S_OK
|| (FAILED(hr
) && hr
!= E_NOTIMPL
&& !FAILED(hr_return
)))
2121 static HRESULT WINAPI
FoundCapabilities(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pcaps
)
2126 hr
= IMediaSeeking_GetCapabilities(seek
, &caps
);
2130 /* Only add common capabilities everything supports */
2131 *(DWORD
*)pcaps
&= caps
;
2136 /*** IMediaSeeking methods ***/
2137 static HRESULT WINAPI
MediaSeeking_GetCapabilities(IMediaSeeking
*iface
,
2138 DWORD
*pCapabilities
) {
2139 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2141 TRACE("(%p/%p)->(%p)\n", This
, iface
, pCapabilities
);
2146 EnterCriticalSection(&This
->cs
);
2147 *pCapabilities
= 0xffffffff;
2149 hr
= all_renderers_seek(This
, FoundCapabilities
, (DWORD_PTR
)pCapabilities
);
2150 LeaveCriticalSection(&This
->cs
);
2155 static HRESULT WINAPI
MediaSeeking_CheckCapabilities(IMediaSeeking
*iface
,
2156 DWORD
*pCapabilities
) {
2157 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2160 TRACE("(%p/%p)->(%p)\n", This
, iface
, pCapabilities
);
2165 EnterCriticalSection(&This
->cs
);
2166 originalcaps
= *pCapabilities
;
2167 hr
= all_renderers_seek(This
, FoundCapabilities
, (DWORD_PTR
)pCapabilities
);
2168 LeaveCriticalSection(&This
->cs
);
2173 if (!*pCapabilities
)
2175 if (*pCapabilities
!= originalcaps
)
2180 static HRESULT WINAPI
MediaSeeking_IsFormatSupported(IMediaSeeking
*iface
,
2181 const GUID
*pFormat
) {
2182 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2187 TRACE("(%p/%p)->(%s)\n", This
, iface
, debugstr_guid(pFormat
));
2189 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, pFormat
))
2191 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat
));
2198 static HRESULT WINAPI
MediaSeeking_QueryPreferredFormat(IMediaSeeking
*iface
,
2200 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2205 FIXME("(%p/%p)->(%p): semi-stub !!!\n", This
, iface
, pFormat
);
2206 memcpy(pFormat
, &TIME_FORMAT_MEDIA_TIME
, sizeof(GUID
));
2211 static HRESULT WINAPI
MediaSeeking_GetTimeFormat(IMediaSeeking
*iface
,
2213 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2218 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFormat
);
2219 memcpy(pFormat
, &This
->timeformatseek
, sizeof(GUID
));
2224 static HRESULT WINAPI
MediaSeeking_IsUsingTimeFormat(IMediaSeeking
*iface
,
2225 const GUID
*pFormat
) {
2226 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2228 TRACE("(%p/%p)->(%p)\n", This
, iface
, pFormat
);
2232 if (memcmp(pFormat
, &This
->timeformatseek
, sizeof(GUID
)))
2238 static HRESULT WINAPI
MediaSeeking_SetTimeFormat(IMediaSeeking
*iface
,
2239 const GUID
*pFormat
) {
2240 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2245 TRACE("(%p/%p)->(%s)\n", This
, iface
, debugstr_guid(pFormat
));
2247 if (This
->state
!= State_Stopped
)
2248 return VFW_E_WRONG_STATE
;
2250 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME
, pFormat
))
2252 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat
));
2253 return E_INVALIDARG
;
2259 static HRESULT WINAPI
FoundDuration(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pduration
)
2262 LONGLONG duration
= 0, *pdur
= (LONGLONG
*)pduration
;
2264 hr
= IMediaSeeking_GetDuration(seek
, &duration
);
2268 /* FIXME: Minimum or maximum duration? Assuming minimum */
2269 if (duration
> 0 && *pdur
< duration
)
2275 static HRESULT WINAPI
MediaSeeking_GetDuration(IMediaSeeking
*iface
,
2276 LONGLONG
*pDuration
) {
2277 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2280 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDuration
);
2285 EnterCriticalSection(&This
->cs
);
2287 hr
= all_renderers_seek(This
, FoundDuration
, (DWORD_PTR
)pDuration
);
2288 LeaveCriticalSection(&This
->cs
);
2290 TRACE("--->%08x\n", hr
);
2294 static HRESULT WINAPI
MediaSeeking_GetStopPosition(IMediaSeeking
*iface
,
2296 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2299 TRACE("(%p/%p)->(%p)\n", This
, iface
, pStop
);
2304 EnterCriticalSection(&This
->cs
);
2305 if (This
->stop_position
< 0)
2306 /* Stop position not set, use duration instead */
2307 hr
= IMediaSeeking_GetDuration(iface
, pStop
);
2309 *pStop
= This
->stop_position
;
2311 LeaveCriticalSection(&This
->cs
);
2316 static HRESULT WINAPI
MediaSeeking_GetCurrentPosition(IMediaSeeking
*iface
,
2317 LONGLONG
*pCurrent
) {
2318 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2324 EnterCriticalSection(&This
->cs
);
2325 if (This
->state
== State_Running
&& This
->refClock
)
2327 IReferenceClock_GetTime(This
->refClock
, &time
);
2329 time
+= This
->position
- This
->start_time
;
2330 if (time
< This
->position
)
2331 time
= This
->position
;
2335 *pCurrent
= This
->position
;
2336 LeaveCriticalSection(&This
->cs
);
2338 TRACE("Time: %u.%03u\n", (DWORD
)(*pCurrent
/ 10000000), (DWORD
)((*pCurrent
/ 10000)%1000));
2343 static HRESULT WINAPI
MediaSeeking_ConvertTimeFormat(IMediaSeeking
*iface
,
2345 const GUID
*pTargetFormat
,
2347 const GUID
*pSourceFormat
) {
2348 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2350 FIXME("(%p/%p)->(%p, %p, 0x%s, %p): stub !!!\n", This
, iface
, pTarget
,
2351 pTargetFormat
, wine_dbgstr_longlong(Source
), pSourceFormat
);
2357 LONGLONG
* current
, *stop
;
2358 DWORD curflags
, stopflags
;
2361 static HRESULT WINAPI
found_setposition(IFilterGraphImpl
*This
, IMediaSeeking
*seek
, DWORD_PTR pargs
)
2363 struct pos_args
*args
= (void*)pargs
;
2365 return IMediaSeeking_SetPositions(seek
, args
->current
, args
->curflags
, args
->stop
, args
->stopflags
);
2368 static HRESULT WINAPI
MediaSeeking_SetPositions(IMediaSeeking
*iface
,
2370 DWORD dwCurrentFlags
,
2372 DWORD dwStopFlags
) {
2373 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2376 struct pos_args args
;
2378 TRACE("(%p/%p)->(%p, %08x, %p, %08x)\n", This
, iface
, pCurrent
, dwCurrentFlags
, pStop
, dwStopFlags
);
2380 EnterCriticalSection(&This
->cs
);
2381 state
= This
->state
;
2382 TRACE("State: %s\n", state
== State_Running
? "Running" : (state
== State_Paused
? "Paused" : (state
== State_Stopped
? "Stopped" : "UNKNOWN")));
2384 if ((dwCurrentFlags
& 0x7) == AM_SEEKING_AbsolutePositioning
)
2386 This
->position
= *pCurrent
;
2388 else if ((dwCurrentFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2389 FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags
& 0x7);
2391 if ((dwStopFlags
& 0x7) == AM_SEEKING_AbsolutePositioning
)
2392 This
->stop_position
= *pStop
;
2393 else if ((dwStopFlags
& 0x7) != AM_SEEKING_NoPositioning
)
2394 FIXME("Stop position not handled yet!\n");
2396 args
.current
= pCurrent
;
2398 args
.curflags
= dwCurrentFlags
;
2399 args
.stopflags
= dwStopFlags
;
2400 hr
= all_renderers_seek(This
, found_setposition
, (DWORD_PTR
)&args
);
2402 if (This
->refClock
&& ((dwCurrentFlags
& 0x7) != AM_SEEKING_NoPositioning
))
2404 /* Update start time, prevents weird jumps */
2405 IReferenceClock_GetTime(This
->refClock
, &This
->start_time
);
2407 LeaveCriticalSection(&This
->cs
);
2412 static HRESULT WINAPI
MediaSeeking_GetPositions(IMediaSeeking
*iface
,
2415 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2418 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pCurrent
, pStop
);
2419 hr
= IMediaSeeking_GetCurrentPosition(iface
, pCurrent
);
2421 hr
= IMediaSeeking_GetStopPosition(iface
, pStop
);
2426 static HRESULT WINAPI
MediaSeeking_GetAvailable(IMediaSeeking
*iface
,
2427 LONGLONG
*pEarliest
,
2428 LONGLONG
*pLatest
) {
2429 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2431 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This
, iface
, pEarliest
, pLatest
);
2436 static HRESULT WINAPI
MediaSeeking_SetRate(IMediaSeeking
*iface
,
2438 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2440 FIXME("(%p/%p)->(%f): stub !!!\n", This
, iface
, dRate
);
2445 static HRESULT WINAPI
MediaSeeking_GetRate(IMediaSeeking
*iface
,
2447 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2449 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pdRate
);
2454 static HRESULT WINAPI
MediaSeeking_GetPreroll(IMediaSeeking
*iface
,
2455 LONGLONG
*pllPreroll
) {
2456 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaSeeking_vtbl
, iface
);
2458 FIXME("(%p/%p)->(%p): stub !!!\n", This
, iface
, pllPreroll
);
2464 static const IMediaSeekingVtbl IMediaSeeking_VTable
=
2466 MediaSeeking_QueryInterface
,
2467 MediaSeeking_AddRef
,
2468 MediaSeeking_Release
,
2469 MediaSeeking_GetCapabilities
,
2470 MediaSeeking_CheckCapabilities
,
2471 MediaSeeking_IsFormatSupported
,
2472 MediaSeeking_QueryPreferredFormat
,
2473 MediaSeeking_GetTimeFormat
,
2474 MediaSeeking_IsUsingTimeFormat
,
2475 MediaSeeking_SetTimeFormat
,
2476 MediaSeeking_GetDuration
,
2477 MediaSeeking_GetStopPosition
,
2478 MediaSeeking_GetCurrentPosition
,
2479 MediaSeeking_ConvertTimeFormat
,
2480 MediaSeeking_SetPositions
,
2481 MediaSeeking_GetPositions
,
2482 MediaSeeking_GetAvailable
,
2483 MediaSeeking_SetRate
,
2484 MediaSeeking_GetRate
,
2485 MediaSeeking_GetPreroll
2488 /*** IUnknown methods ***/
2489 static HRESULT WINAPI
MediaPosition_QueryInterface(IMediaPosition
* iface
, REFIID riid
, void** ppvObj
){
2490 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaPosition_vtbl
, iface
);
2492 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2494 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2497 static ULONG WINAPI
MediaPosition_AddRef(IMediaPosition
*iface
){
2498 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaPosition_vtbl
, iface
);
2500 TRACE("(%p/%p)->()\n", This
, iface
);
2502 return Filtergraph_AddRef(This
);
2505 static ULONG WINAPI
MediaPosition_Release(IMediaPosition
*iface
){
2506 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaPosition_vtbl
, iface
);
2508 TRACE("(%p/%p)->()\n", This
, iface
);
2510 return Filtergraph_Release(This
);
2513 /*** IDispatch methods ***/
2514 static HRESULT WINAPI
MediaPosition_GetTypeInfoCount(IMediaPosition
*iface
, UINT
* pctinfo
){
2515 FIXME("(%p) stub!\n", iface
);
2519 static HRESULT WINAPI
MediaPosition_GetTypeInfo(IMediaPosition
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
** ppTInfo
){
2520 FIXME("(%p) stub!\n", iface
);
2524 static HRESULT WINAPI
MediaPosition_GetIDsOfNames(IMediaPosition
* iface
, REFIID riid
, LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
){
2525 FIXME("(%p) stub!\n", iface
);
2529 static HRESULT WINAPI
MediaPosition_Invoke(IMediaPosition
* iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
){
2530 FIXME("(%p) stub!\n", iface
);
2534 /*** IMediaPosition methods ***/
2535 static HRESULT WINAPI
MediaPosition_get_Duration(IMediaPosition
* iface
, REFTIME
*plength
){
2536 FIXME("(%p)->(%p) stub!\n", iface
, plength
);
2540 static HRESULT WINAPI
MediaPosition_put_CurrentPosition(IMediaPosition
* iface
, REFTIME llTime
){
2541 FIXME("(%p)->(%f) stub!\n", iface
, llTime
);
2545 static HRESULT WINAPI
MediaPosition_get_CurrentPosition(IMediaPosition
* iface
, REFTIME
*pllTime
){
2546 FIXME("(%p)->(%p) stub!\n", iface
, pllTime
);
2550 static HRESULT WINAPI
MediaPosition_get_StopTime(IMediaPosition
* iface
, REFTIME
*pllTime
){
2551 FIXME("(%p)->(%p) stub!\n", iface
, pllTime
);
2555 static HRESULT WINAPI
MediaPosition_put_StopTime(IMediaPosition
* iface
, REFTIME llTime
){
2556 FIXME("(%p)->(%f) stub!\n", iface
, llTime
);
2560 static HRESULT WINAPI
MediaPosition_get_PrerollTime(IMediaPosition
* iface
, REFTIME
*pllTime
){
2561 FIXME("(%p)->(%p) stub!\n", iface
, pllTime
);
2565 static HRESULT WINAPI
MediaPosition_put_PrerollTime(IMediaPosition
* iface
, REFTIME llTime
){
2566 FIXME("(%p)->(%f) stub!\n", iface
, llTime
);
2570 static HRESULT WINAPI
MediaPosition_put_Rate(IMediaPosition
* iface
, double dRate
){
2571 FIXME("(%p)->(%f) stub!\n", iface
, dRate
);
2575 static HRESULT WINAPI
MediaPosition_get_Rate(IMediaPosition
* iface
, double *pdRate
){
2576 FIXME("(%p)->(%p) stub!\n", iface
, pdRate
);
2580 static HRESULT WINAPI
MediaPosition_CanSeekForward(IMediaPosition
* iface
, LONG
*pCanSeekForward
){
2581 FIXME("(%p)->(%p) stub!\n", iface
, pCanSeekForward
);
2585 static HRESULT WINAPI
MediaPosition_CanSeekBackward(IMediaPosition
* iface
, LONG
*pCanSeekBackward
){
2586 FIXME("(%p)->(%p) stub!\n", iface
, pCanSeekBackward
);
2591 static const IMediaPositionVtbl IMediaPosition_VTable
=
2593 MediaPosition_QueryInterface
,
2594 MediaPosition_AddRef
,
2595 MediaPosition_Release
,
2596 MediaPosition_GetTypeInfoCount
,
2597 MediaPosition_GetTypeInfo
,
2598 MediaPosition_GetIDsOfNames
,
2599 MediaPosition_Invoke
,
2600 MediaPosition_get_Duration
,
2601 MediaPosition_put_CurrentPosition
,
2602 MediaPosition_get_CurrentPosition
,
2603 MediaPosition_get_StopTime
,
2604 MediaPosition_put_StopTime
,
2605 MediaPosition_get_PrerollTime
,
2606 MediaPosition_put_PrerollTime
,
2607 MediaPosition_put_Rate
,
2608 MediaPosition_get_Rate
,
2609 MediaPosition_CanSeekForward
,
2610 MediaPosition_CanSeekBackward
2613 static HRESULT
GetTargetInterface(IFilterGraphImpl
* pGraph
, REFIID riid
, LPVOID
* ppvObj
)
2615 HRESULT hr
= E_NOINTERFACE
;
2619 /* Check if the interface type is already registered */
2620 for (entry
= 0; entry
< pGraph
->nItfCacheEntries
; entry
++)
2621 if (riid
== pGraph
->ItfCacheEntries
[entry
].riid
)
2623 if (pGraph
->ItfCacheEntries
[entry
].iface
)
2625 /* Return the interface if available */
2626 *ppvObj
= pGraph
->ItfCacheEntries
[entry
].iface
;
2632 if (entry
>= MAX_ITF_CACHE_ENTRIES
)
2634 FIXME("Not enough space to store interface in the cache\n");
2635 return E_OUTOFMEMORY
;
2638 /* Find a filter supporting the requested interface */
2639 for (i
= 0; i
< pGraph
->nFilters
; i
++)
2641 hr
= IBaseFilter_QueryInterface(pGraph
->ppFiltersInGraph
[i
], riid
, ppvObj
);
2644 pGraph
->ItfCacheEntries
[entry
].riid
= riid
;
2645 pGraph
->ItfCacheEntries
[entry
].filter
= pGraph
->ppFiltersInGraph
[i
];
2646 pGraph
->ItfCacheEntries
[entry
].iface
= (IUnknown
*)*ppvObj
;
2647 if (entry
>= pGraph
->nItfCacheEntries
)
2648 pGraph
->nItfCacheEntries
++;
2651 if (hr
!= E_NOINTERFACE
)
2658 /*** IUnknown methods ***/
2659 static HRESULT WINAPI
BasicAudio_QueryInterface(IBasicAudio
*iface
,
2662 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2664 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2666 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2669 static ULONG WINAPI
BasicAudio_AddRef(IBasicAudio
*iface
) {
2670 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2672 TRACE("(%p/%p)->()\n", This
, iface
);
2674 return Filtergraph_AddRef(This
);
2677 static ULONG WINAPI
BasicAudio_Release(IBasicAudio
*iface
) {
2678 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2680 TRACE("(%p/%p)->()\n", This
, iface
);
2682 return Filtergraph_Release(This
);
2685 /*** IDispatch methods ***/
2686 static HRESULT WINAPI
BasicAudio_GetTypeInfoCount(IBasicAudio
*iface
,
2688 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2689 IBasicAudio
* pBasicAudio
;
2692 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
2694 EnterCriticalSection(&This
->cs
);
2696 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2699 hr
= IBasicAudio_GetTypeInfoCount(pBasicAudio
, pctinfo
);
2701 LeaveCriticalSection(&This
->cs
);
2706 static HRESULT WINAPI
BasicAudio_GetTypeInfo(IBasicAudio
*iface
,
2709 ITypeInfo
**ppTInfo
) {
2710 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2711 IBasicAudio
* pBasicAudio
;
2714 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
2716 EnterCriticalSection(&This
->cs
);
2718 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2721 hr
= IBasicAudio_GetTypeInfo(pBasicAudio
, iTInfo
, lcid
, ppTInfo
);
2723 LeaveCriticalSection(&This
->cs
);
2728 static HRESULT WINAPI
BasicAudio_GetIDsOfNames(IBasicAudio
*iface
,
2734 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2735 IBasicAudio
* pBasicAudio
;
2738 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2740 EnterCriticalSection(&This
->cs
);
2742 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2745 hr
= IBasicAudio_GetIDsOfNames(pBasicAudio
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2747 LeaveCriticalSection(&This
->cs
);
2752 static HRESULT WINAPI
BasicAudio_Invoke(IBasicAudio
*iface
,
2753 DISPID dispIdMember
,
2757 DISPPARAMS
*pDispParams
,
2759 EXCEPINFO
*pExepInfo
,
2761 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2762 IBasicAudio
* pBasicAudio
;
2765 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
2767 EnterCriticalSection(&This
->cs
);
2769 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2772 hr
= IBasicAudio_Invoke(pBasicAudio
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
2774 LeaveCriticalSection(&This
->cs
);
2779 /*** IBasicAudio methods ***/
2780 static HRESULT WINAPI
BasicAudio_put_Volume(IBasicAudio
*iface
,
2782 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2783 IBasicAudio
* pBasicAudio
;
2786 TRACE("(%p/%p)->(%ld)\n", This
, iface
, lVolume
);
2788 EnterCriticalSection(&This
->cs
);
2790 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2793 hr
= IBasicAudio_put_Volume(pBasicAudio
, lVolume
);
2795 LeaveCriticalSection(&This
->cs
);
2800 static HRESULT WINAPI
BasicAudio_get_Volume(IBasicAudio
*iface
,
2802 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2803 IBasicAudio
* pBasicAudio
;
2806 TRACE("(%p/%p)->(%p)\n", This
, iface
, plVolume
);
2808 EnterCriticalSection(&This
->cs
);
2810 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2813 hr
= IBasicAudio_get_Volume(pBasicAudio
, plVolume
);
2815 LeaveCriticalSection(&This
->cs
);
2820 static HRESULT WINAPI
BasicAudio_put_Balance(IBasicAudio
*iface
,
2822 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2823 IBasicAudio
* pBasicAudio
;
2826 TRACE("(%p/%p)->(%ld)\n", This
, iface
, lBalance
);
2828 EnterCriticalSection(&This
->cs
);
2830 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2833 hr
= IBasicAudio_put_Balance(pBasicAudio
, lBalance
);
2835 LeaveCriticalSection(&This
->cs
);
2840 static HRESULT WINAPI
BasicAudio_get_Balance(IBasicAudio
*iface
,
2842 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicAudio_vtbl
, iface
);
2843 IBasicAudio
* pBasicAudio
;
2846 TRACE("(%p/%p)->(%p)\n", This
, iface
, plBalance
);
2848 EnterCriticalSection(&This
->cs
);
2850 hr
= GetTargetInterface(This
, &IID_IBasicAudio
, (LPVOID
*)&pBasicAudio
);
2853 hr
= IBasicAudio_get_Balance(pBasicAudio
, plBalance
);
2855 LeaveCriticalSection(&This
->cs
);
2860 static const IBasicAudioVtbl IBasicAudio_VTable
=
2862 BasicAudio_QueryInterface
,
2865 BasicAudio_GetTypeInfoCount
,
2866 BasicAudio_GetTypeInfo
,
2867 BasicAudio_GetIDsOfNames
,
2869 BasicAudio_put_Volume
,
2870 BasicAudio_get_Volume
,
2871 BasicAudio_put_Balance
,
2872 BasicAudio_get_Balance
2875 /*** IUnknown methods ***/
2876 static HRESULT WINAPI
BasicVideo_QueryInterface(IBasicVideo2
*iface
,
2879 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
2881 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
2883 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
2886 static ULONG WINAPI
BasicVideo_AddRef(IBasicVideo2
*iface
) {
2887 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
2889 TRACE("(%p/%p)->()\n", This
, iface
);
2891 return Filtergraph_AddRef(This
);
2894 static ULONG WINAPI
BasicVideo_Release(IBasicVideo2
*iface
) {
2895 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
2897 TRACE("(%p/%p)->()\n", This
, iface
);
2899 return Filtergraph_Release(This
);
2902 /*** IDispatch methods ***/
2903 static HRESULT WINAPI
BasicVideo_GetTypeInfoCount(IBasicVideo2
*iface
,
2905 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
2906 IBasicVideo
* pBasicVideo
;
2909 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
2911 EnterCriticalSection(&This
->cs
);
2913 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
2916 hr
= IBasicVideo_GetTypeInfoCount(pBasicVideo
, pctinfo
);
2918 LeaveCriticalSection(&This
->cs
);
2923 static HRESULT WINAPI
BasicVideo_GetTypeInfo(IBasicVideo2
*iface
,
2926 ITypeInfo
**ppTInfo
) {
2927 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
2928 IBasicVideo
* pBasicVideo
;
2931 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
2933 EnterCriticalSection(&This
->cs
);
2935 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
2938 hr
= IBasicVideo_GetTypeInfo(pBasicVideo
, iTInfo
, lcid
, ppTInfo
);
2940 LeaveCriticalSection(&This
->cs
);
2945 static HRESULT WINAPI
BasicVideo_GetIDsOfNames(IBasicVideo2
*iface
,
2951 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
2952 IBasicVideo
* pBasicVideo
;
2955 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2957 EnterCriticalSection(&This
->cs
);
2959 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
2962 hr
= IBasicVideo_GetIDsOfNames(pBasicVideo
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2964 LeaveCriticalSection(&This
->cs
);
2969 static HRESULT WINAPI
BasicVideo_Invoke(IBasicVideo2
*iface
,
2970 DISPID dispIdMember
,
2974 DISPPARAMS
*pDispParams
,
2976 EXCEPINFO
*pExepInfo
,
2978 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
2979 IBasicVideo
* pBasicVideo
;
2982 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
2984 EnterCriticalSection(&This
->cs
);
2986 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
2989 hr
= IBasicVideo_Invoke(pBasicVideo
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
2991 LeaveCriticalSection(&This
->cs
);
2996 /*** IBasicVideo methods ***/
2997 static HRESULT WINAPI
BasicVideo_get_AvgTimePerFrame(IBasicVideo2
*iface
,
2998 REFTIME
*pAvgTimePerFrame
) {
2999 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3000 IBasicVideo
* pBasicVideo
;
3003 TRACE("(%p/%p)->(%p)\n", This
, iface
, pAvgTimePerFrame
);
3005 EnterCriticalSection(&This
->cs
);
3007 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3010 hr
= IBasicVideo_get_AvgTimePerFrame(pBasicVideo
, pAvgTimePerFrame
);
3012 LeaveCriticalSection(&This
->cs
);
3017 static HRESULT WINAPI
BasicVideo_get_BitRate(IBasicVideo2
*iface
,
3019 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3020 IBasicVideo
* pBasicVideo
;
3023 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBitRate
);
3025 EnterCriticalSection(&This
->cs
);
3027 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3030 hr
= IBasicVideo_get_BitRate(pBasicVideo
, pBitRate
);
3032 LeaveCriticalSection(&This
->cs
);
3037 static HRESULT WINAPI
BasicVideo_get_BitErrorRate(IBasicVideo2
*iface
,
3038 long *pBitErrorRate
) {
3039 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3040 IBasicVideo
* pBasicVideo
;
3043 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBitErrorRate
);
3045 EnterCriticalSection(&This
->cs
);
3047 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3050 hr
= IBasicVideo_get_BitErrorRate(pBasicVideo
, pBitErrorRate
);
3052 LeaveCriticalSection(&This
->cs
);
3057 static HRESULT WINAPI
BasicVideo_get_VideoWidth(IBasicVideo2
*iface
,
3058 long *pVideoWidth
) {
3059 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3060 IBasicVideo
* pBasicVideo
;
3063 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoWidth
);
3065 EnterCriticalSection(&This
->cs
);
3067 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3070 hr
= IBasicVideo_get_VideoWidth(pBasicVideo
, pVideoWidth
);
3072 LeaveCriticalSection(&This
->cs
);
3077 static HRESULT WINAPI
BasicVideo_get_VideoHeight(IBasicVideo2
*iface
,
3078 long *pVideoHeight
) {
3079 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3080 IBasicVideo
* pBasicVideo
;
3083 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVideoHeight
);
3085 EnterCriticalSection(&This
->cs
);
3087 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3090 hr
= IBasicVideo_get_VideoHeight(pBasicVideo
, pVideoHeight
);
3092 LeaveCriticalSection(&This
->cs
);
3097 static HRESULT WINAPI
BasicVideo_put_SourceLeft(IBasicVideo2
*iface
,
3099 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3100 IBasicVideo
* pBasicVideo
;
3103 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceLeft
);
3105 EnterCriticalSection(&This
->cs
);
3107 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3110 hr
= IBasicVideo_put_SourceLeft(pBasicVideo
, SourceLeft
);
3112 LeaveCriticalSection(&This
->cs
);
3117 static HRESULT WINAPI
BasicVideo_get_SourceLeft(IBasicVideo2
*iface
,
3118 long *pSourceLeft
) {
3119 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3120 IBasicVideo
* pBasicVideo
;
3123 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceLeft
);
3125 EnterCriticalSection(&This
->cs
);
3127 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3130 hr
= IBasicVideo_get_SourceLeft(pBasicVideo
, pSourceLeft
);
3132 LeaveCriticalSection(&This
->cs
);
3137 static HRESULT WINAPI
BasicVideo_put_SourceWidth(IBasicVideo2
*iface
,
3139 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3140 IBasicVideo
* pBasicVideo
;
3143 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceWidth
);
3145 EnterCriticalSection(&This
->cs
);
3147 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3150 hr
= IBasicVideo_put_SourceWidth(pBasicVideo
, SourceWidth
);
3152 LeaveCriticalSection(&This
->cs
);
3157 static HRESULT WINAPI
BasicVideo_get_SourceWidth(IBasicVideo2
*iface
,
3158 long *pSourceWidth
) {
3159 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3160 IBasicVideo
* pBasicVideo
;
3163 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceWidth
);
3165 EnterCriticalSection(&This
->cs
);
3167 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3170 hr
= IBasicVideo_get_SourceWidth(pBasicVideo
, pSourceWidth
);
3172 LeaveCriticalSection(&This
->cs
);
3177 static HRESULT WINAPI
BasicVideo_put_SourceTop(IBasicVideo2
*iface
,
3179 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3180 IBasicVideo
* pBasicVideo
;
3183 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceTop
);
3185 EnterCriticalSection(&This
->cs
);
3187 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3190 hr
= IBasicVideo_put_SourceTop(pBasicVideo
, SourceTop
);
3192 LeaveCriticalSection(&This
->cs
);
3197 static HRESULT WINAPI
BasicVideo_get_SourceTop(IBasicVideo2
*iface
,
3199 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3200 IBasicVideo
* pBasicVideo
;
3203 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceTop
);
3205 EnterCriticalSection(&This
->cs
);
3207 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3210 hr
= IBasicVideo_get_SourceTop(pBasicVideo
, pSourceTop
);
3212 LeaveCriticalSection(&This
->cs
);
3217 static HRESULT WINAPI
BasicVideo_put_SourceHeight(IBasicVideo2
*iface
,
3218 long SourceHeight
) {
3219 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3220 IBasicVideo
* pBasicVideo
;
3223 TRACE("(%p/%p)->(%ld)\n", This
, iface
, SourceHeight
);
3225 EnterCriticalSection(&This
->cs
);
3227 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3230 hr
= IBasicVideo_put_SourceHeight(pBasicVideo
, SourceHeight
);
3232 LeaveCriticalSection(&This
->cs
);
3237 static HRESULT WINAPI
BasicVideo_get_SourceHeight(IBasicVideo2
*iface
,
3238 long *pSourceHeight
) {
3239 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3240 IBasicVideo
* pBasicVideo
;
3243 TRACE("(%p/%p)->(%p)\n", This
, iface
, pSourceHeight
);
3245 EnterCriticalSection(&This
->cs
);
3247 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3250 hr
= IBasicVideo_get_SourceHeight(pBasicVideo
, pSourceHeight
);
3252 LeaveCriticalSection(&This
->cs
);
3257 static HRESULT WINAPI
BasicVideo_put_DestinationLeft(IBasicVideo2
*iface
,
3258 long DestinationLeft
) {
3259 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3260 IBasicVideo
* pBasicVideo
;
3263 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationLeft
);
3265 EnterCriticalSection(&This
->cs
);
3267 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3270 hr
= IBasicVideo_put_DestinationLeft(pBasicVideo
, DestinationLeft
);
3272 LeaveCriticalSection(&This
->cs
);
3277 static HRESULT WINAPI
BasicVideo_get_DestinationLeft(IBasicVideo2
*iface
,
3278 long *pDestinationLeft
) {
3279 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3280 IBasicVideo
* pBasicVideo
;
3283 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationLeft
);
3285 EnterCriticalSection(&This
->cs
);
3287 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3290 hr
= IBasicVideo_get_DestinationLeft(pBasicVideo
, pDestinationLeft
);
3292 LeaveCriticalSection(&This
->cs
);
3297 static HRESULT WINAPI
BasicVideo_put_DestinationWidth(IBasicVideo2
*iface
,
3298 long DestinationWidth
) {
3299 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3300 IBasicVideo
* pBasicVideo
;
3303 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationWidth
);
3305 EnterCriticalSection(&This
->cs
);
3307 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3310 hr
= IBasicVideo_put_DestinationWidth(pBasicVideo
, DestinationWidth
);
3312 LeaveCriticalSection(&This
->cs
);
3317 static HRESULT WINAPI
BasicVideo_get_DestinationWidth(IBasicVideo2
*iface
,
3318 long *pDestinationWidth
) {
3319 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3320 IBasicVideo
* pBasicVideo
;
3323 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationWidth
);
3325 EnterCriticalSection(&This
->cs
);
3327 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3330 hr
= IBasicVideo_get_DestinationWidth(pBasicVideo
, pDestinationWidth
);
3332 LeaveCriticalSection(&This
->cs
);
3337 static HRESULT WINAPI
BasicVideo_put_DestinationTop(IBasicVideo2
*iface
,
3338 long DestinationTop
) {
3339 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3340 IBasicVideo
* pBasicVideo
;
3343 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationTop
);
3345 EnterCriticalSection(&This
->cs
);
3347 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3350 hr
= IBasicVideo_put_DestinationTop(pBasicVideo
, DestinationTop
);
3352 LeaveCriticalSection(&This
->cs
);
3357 static HRESULT WINAPI
BasicVideo_get_DestinationTop(IBasicVideo2
*iface
,
3358 long *pDestinationTop
) {
3359 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3360 IBasicVideo
* pBasicVideo
;
3363 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationTop
);
3365 EnterCriticalSection(&This
->cs
);
3367 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3370 hr
= IBasicVideo_get_DestinationTop(pBasicVideo
, pDestinationTop
);
3372 LeaveCriticalSection(&This
->cs
);
3377 static HRESULT WINAPI
BasicVideo_put_DestinationHeight(IBasicVideo2
*iface
,
3378 long DestinationHeight
) {
3379 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3380 IBasicVideo
* pBasicVideo
;
3383 TRACE("(%p/%p)->(%ld)\n", This
, iface
, DestinationHeight
);
3385 EnterCriticalSection(&This
->cs
);
3387 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3390 hr
= IBasicVideo_put_DestinationHeight(pBasicVideo
, DestinationHeight
);
3392 LeaveCriticalSection(&This
->cs
);
3397 static HRESULT WINAPI
BasicVideo_get_DestinationHeight(IBasicVideo2
*iface
,
3398 long *pDestinationHeight
) {
3399 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3400 IBasicVideo
* pBasicVideo
;
3403 TRACE("(%p/%p)->(%p)\n", This
, iface
, pDestinationHeight
);
3405 EnterCriticalSection(&This
->cs
);
3407 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3410 hr
= IBasicVideo_get_DestinationHeight(pBasicVideo
, pDestinationHeight
);
3412 LeaveCriticalSection(&This
->cs
);
3417 static HRESULT WINAPI
BasicVideo_SetSourcePosition(IBasicVideo2
*iface
,
3422 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3423 IBasicVideo
* pBasicVideo
;
3426 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
3428 EnterCriticalSection(&This
->cs
);
3430 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3433 hr
= IBasicVideo_SetSourcePosition(pBasicVideo
, Left
, Top
, Width
, Height
);
3435 LeaveCriticalSection(&This
->cs
);
3440 static HRESULT WINAPI
BasicVideo_GetSourcePosition(IBasicVideo2
*iface
,
3445 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3446 IBasicVideo
* pBasicVideo
;
3449 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
3451 EnterCriticalSection(&This
->cs
);
3453 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3456 hr
= IBasicVideo_GetSourcePosition(pBasicVideo
, pLeft
, pTop
, pWidth
, pHeight
);
3458 LeaveCriticalSection(&This
->cs
);
3463 static HRESULT WINAPI
BasicVideo_SetDefaultSourcePosition(IBasicVideo2
*iface
) {
3464 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3465 IBasicVideo
* pBasicVideo
;
3468 TRACE("(%p/%p)->()\n", This
, iface
);
3470 EnterCriticalSection(&This
->cs
);
3472 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3475 hr
= IBasicVideo_SetDefaultSourcePosition(pBasicVideo
);
3477 LeaveCriticalSection(&This
->cs
);
3482 static HRESULT WINAPI
BasicVideo_SetDestinationPosition(IBasicVideo2
*iface
,
3487 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3488 IBasicVideo
* pBasicVideo
;
3491 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
3493 EnterCriticalSection(&This
->cs
);
3495 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3498 hr
= IBasicVideo_SetDestinationPosition(pBasicVideo
, Left
, Top
, Width
, Height
);
3500 LeaveCriticalSection(&This
->cs
);
3505 static HRESULT WINAPI
BasicVideo_GetDestinationPosition(IBasicVideo2
*iface
,
3510 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3511 IBasicVideo
* pBasicVideo
;
3514 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
3516 EnterCriticalSection(&This
->cs
);
3518 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3521 hr
= IBasicVideo_GetDestinationPosition(pBasicVideo
, pLeft
, pTop
, pWidth
, pHeight
);
3523 LeaveCriticalSection(&This
->cs
);
3528 static HRESULT WINAPI
BasicVideo_SetDefaultDestinationPosition(IBasicVideo2
*iface
) {
3529 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3530 IBasicVideo
* pBasicVideo
;
3533 TRACE("(%p/%p)->()\n", This
, iface
);
3535 EnterCriticalSection(&This
->cs
);
3537 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3540 hr
= IBasicVideo_SetDefaultDestinationPosition(pBasicVideo
);
3542 LeaveCriticalSection(&This
->cs
);
3547 static HRESULT WINAPI
BasicVideo_GetVideoSize(IBasicVideo2
*iface
,
3550 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3551 IBasicVideo
* pBasicVideo
;
3554 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
3556 EnterCriticalSection(&This
->cs
);
3558 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3561 hr
= IBasicVideo_GetVideoSize(pBasicVideo
, pWidth
, pHeight
);
3563 LeaveCriticalSection(&This
->cs
);
3568 static HRESULT WINAPI
BasicVideo_GetVideoPaletteEntries(IBasicVideo2
*iface
,
3573 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3574 IBasicVideo
* pBasicVideo
;
3577 TRACE("(%p/%p)->(%ld, %ld, %p, %p)\n", This
, iface
, StartIndex
, Entries
, pRetrieved
, pPalette
);
3579 EnterCriticalSection(&This
->cs
);
3581 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3584 hr
= IBasicVideo_GetVideoPaletteEntries(pBasicVideo
, StartIndex
, Entries
, pRetrieved
, pPalette
);
3586 LeaveCriticalSection(&This
->cs
);
3591 static HRESULT WINAPI
BasicVideo_GetCurrentImage(IBasicVideo2
*iface
,
3594 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3595 IBasicVideo
* pBasicVideo
;
3598 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pBufferSize
, pDIBImage
);
3600 EnterCriticalSection(&This
->cs
);
3602 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3605 hr
= IBasicVideo_GetCurrentImage(pBasicVideo
, pBufferSize
, pDIBImage
);
3607 LeaveCriticalSection(&This
->cs
);
3612 static HRESULT WINAPI
BasicVideo_IsUsingDefaultSource(IBasicVideo2
*iface
) {
3613 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3614 IBasicVideo
* pBasicVideo
;
3617 TRACE("(%p/%p)->()\n", This
, iface
);
3619 EnterCriticalSection(&This
->cs
);
3621 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3624 hr
= IBasicVideo_IsUsingDefaultSource(pBasicVideo
);
3626 LeaveCriticalSection(&This
->cs
);
3631 static HRESULT WINAPI
BasicVideo_IsUsingDefaultDestination(IBasicVideo2
*iface
) {
3632 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3633 IBasicVideo
* pBasicVideo
;
3636 TRACE("(%p/%p)->()\n", This
, iface
);
3638 EnterCriticalSection(&This
->cs
);
3640 hr
= GetTargetInterface(This
, &IID_IBasicVideo
, (LPVOID
*)&pBasicVideo
);
3643 hr
= IBasicVideo_IsUsingDefaultDestination(pBasicVideo
);
3645 LeaveCriticalSection(&This
->cs
);
3650 static HRESULT WINAPI
BasicVideo2_GetPreferredAspectRatio(IBasicVideo2
*iface
, LONG
*plAspectX
, LONG
*plAspectY
) {
3651 ICOM_THIS_MULTI(IFilterGraphImpl
, IBasicVideo_vtbl
, iface
);
3652 IBasicVideo2
*pBasicVideo2
;
3655 TRACE("(%p/%p)->()\n", This
, iface
);
3657 EnterCriticalSection(&This
->cs
);
3659 hr
= GetTargetInterface(This
, &IID_IBasicVideo2
, (LPVOID
*)&pBasicVideo2
);
3662 hr
= BasicVideo2_GetPreferredAspectRatio(iface
, plAspectX
, plAspectY
);
3664 LeaveCriticalSection(&This
->cs
);
3669 static const IBasicVideo2Vtbl IBasicVideo_VTable
=
3671 BasicVideo_QueryInterface
,
3674 BasicVideo_GetTypeInfoCount
,
3675 BasicVideo_GetTypeInfo
,
3676 BasicVideo_GetIDsOfNames
,
3678 BasicVideo_get_AvgTimePerFrame
,
3679 BasicVideo_get_BitRate
,
3680 BasicVideo_get_BitErrorRate
,
3681 BasicVideo_get_VideoWidth
,
3682 BasicVideo_get_VideoHeight
,
3683 BasicVideo_put_SourceLeft
,
3684 BasicVideo_get_SourceLeft
,
3685 BasicVideo_put_SourceWidth
,
3686 BasicVideo_get_SourceWidth
,
3687 BasicVideo_put_SourceTop
,
3688 BasicVideo_get_SourceTop
,
3689 BasicVideo_put_SourceHeight
,
3690 BasicVideo_get_SourceHeight
,
3691 BasicVideo_put_DestinationLeft
,
3692 BasicVideo_get_DestinationLeft
,
3693 BasicVideo_put_DestinationWidth
,
3694 BasicVideo_get_DestinationWidth
,
3695 BasicVideo_put_DestinationTop
,
3696 BasicVideo_get_DestinationTop
,
3697 BasicVideo_put_DestinationHeight
,
3698 BasicVideo_get_DestinationHeight
,
3699 BasicVideo_SetSourcePosition
,
3700 BasicVideo_GetSourcePosition
,
3701 BasicVideo_SetDefaultSourcePosition
,
3702 BasicVideo_SetDestinationPosition
,
3703 BasicVideo_GetDestinationPosition
,
3704 BasicVideo_SetDefaultDestinationPosition
,
3705 BasicVideo_GetVideoSize
,
3706 BasicVideo_GetVideoPaletteEntries
,
3707 BasicVideo_GetCurrentImage
,
3708 BasicVideo_IsUsingDefaultSource
,
3709 BasicVideo_IsUsingDefaultDestination
,
3710 BasicVideo2_GetPreferredAspectRatio
3714 /*** IUnknown methods ***/
3715 static HRESULT WINAPI
VideoWindow_QueryInterface(IVideoWindow
*iface
,
3718 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3720 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
3722 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
3725 static ULONG WINAPI
VideoWindow_AddRef(IVideoWindow
*iface
) {
3726 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3728 TRACE("(%p/%p)->()\n", This
, iface
);
3730 return Filtergraph_AddRef(This
);
3733 static ULONG WINAPI
VideoWindow_Release(IVideoWindow
*iface
) {
3734 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3736 TRACE("(%p/%p)->()\n", This
, iface
);
3738 return Filtergraph_Release(This
);
3741 /*** IDispatch methods ***/
3742 static HRESULT WINAPI
VideoWindow_GetTypeInfoCount(IVideoWindow
*iface
,
3744 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3745 IVideoWindow
* pVideoWindow
;
3748 TRACE("(%p/%p)->(%p)\n", This
, iface
, pctinfo
);
3750 EnterCriticalSection(&This
->cs
);
3752 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3755 hr
= IVideoWindow_GetTypeInfoCount(pVideoWindow
, pctinfo
);
3757 LeaveCriticalSection(&This
->cs
);
3762 static HRESULT WINAPI
VideoWindow_GetTypeInfo(IVideoWindow
*iface
,
3765 ITypeInfo
**ppTInfo
) {
3766 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3767 IVideoWindow
* pVideoWindow
;
3770 TRACE("(%p/%p)->(%d, %d, %p)\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
3772 EnterCriticalSection(&This
->cs
);
3774 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3777 hr
= IVideoWindow_GetTypeInfo(pVideoWindow
, iTInfo
, lcid
, ppTInfo
);
3779 LeaveCriticalSection(&This
->cs
);
3784 static HRESULT WINAPI
VideoWindow_GetIDsOfNames(IVideoWindow
*iface
,
3790 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3791 IVideoWindow
* pVideoWindow
;
3794 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p)\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3796 EnterCriticalSection(&This
->cs
);
3798 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3801 hr
= IVideoWindow_GetIDsOfNames(pVideoWindow
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3803 LeaveCriticalSection(&This
->cs
);
3808 static HRESULT WINAPI
VideoWindow_Invoke(IVideoWindow
*iface
,
3809 DISPID dispIdMember
,
3813 DISPPARAMS
*pDispParams
,
3815 EXCEPINFO
*pExepInfo
,
3817 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3818 IVideoWindow
* pVideoWindow
;
3821 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p)\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3823 EnterCriticalSection(&This
->cs
);
3825 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3828 hr
= IVideoWindow_Invoke(pVideoWindow
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
3830 LeaveCriticalSection(&This
->cs
);
3836 /*** IVideoWindow methods ***/
3837 static HRESULT WINAPI
VideoWindow_put_Caption(IVideoWindow
*iface
,
3839 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3840 IVideoWindow
* pVideoWindow
;
3843 TRACE("(%p/%p)->(%s (%p))\n", This
, iface
, debugstr_w(strCaption
), strCaption
);
3845 EnterCriticalSection(&This
->cs
);
3847 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3850 hr
= IVideoWindow_put_Caption(pVideoWindow
, strCaption
);
3852 LeaveCriticalSection(&This
->cs
);
3857 static HRESULT WINAPI
VideoWindow_get_Caption(IVideoWindow
*iface
,
3859 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3860 IVideoWindow
* pVideoWindow
;
3863 TRACE("(%p/%p)->(%p)\n", This
, iface
, strCaption
);
3865 EnterCriticalSection(&This
->cs
);
3867 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3870 hr
= IVideoWindow_get_Caption(pVideoWindow
, strCaption
);
3872 LeaveCriticalSection(&This
->cs
);
3877 static HRESULT WINAPI
VideoWindow_put_WindowStyle(IVideoWindow
*iface
,
3879 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3880 IVideoWindow
* pVideoWindow
;
3883 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyle
);
3885 EnterCriticalSection(&This
->cs
);
3887 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3890 hr
= IVideoWindow_put_WindowStyle(pVideoWindow
, WindowStyle
);
3892 LeaveCriticalSection(&This
->cs
);
3897 static HRESULT WINAPI
VideoWindow_get_WindowStyle(IVideoWindow
*iface
,
3898 long *WindowStyle
) {
3899 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3900 IVideoWindow
* pVideoWindow
;
3903 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyle
);
3905 EnterCriticalSection(&This
->cs
);
3907 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3910 hr
= IVideoWindow_get_WindowStyle(pVideoWindow
, WindowStyle
);
3912 LeaveCriticalSection(&This
->cs
);
3917 static HRESULT WINAPI
VideoWindow_put_WindowStyleEx(IVideoWindow
*iface
,
3918 long WindowStyleEx
) {
3919 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3920 IVideoWindow
* pVideoWindow
;
3923 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowStyleEx
);
3925 EnterCriticalSection(&This
->cs
);
3927 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3930 hr
= IVideoWindow_put_WindowStyleEx(pVideoWindow
, WindowStyleEx
);
3932 LeaveCriticalSection(&This
->cs
);
3937 static HRESULT WINAPI
VideoWindow_get_WindowStyleEx(IVideoWindow
*iface
,
3938 long *WindowStyleEx
) {
3939 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3940 IVideoWindow
* pVideoWindow
;
3943 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowStyleEx
);
3945 EnterCriticalSection(&This
->cs
);
3947 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3950 hr
= IVideoWindow_get_WindowStyleEx(pVideoWindow
, WindowStyleEx
);
3952 LeaveCriticalSection(&This
->cs
);
3957 static HRESULT WINAPI
VideoWindow_put_AutoShow(IVideoWindow
*iface
,
3959 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3960 IVideoWindow
* pVideoWindow
;
3963 TRACE("(%p/%p)->(%ld)\n", This
, iface
, AutoShow
);
3965 EnterCriticalSection(&This
->cs
);
3967 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3970 hr
= IVideoWindow_put_AutoShow(pVideoWindow
, AutoShow
);
3972 LeaveCriticalSection(&This
->cs
);
3977 static HRESULT WINAPI
VideoWindow_get_AutoShow(IVideoWindow
*iface
,
3979 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
3980 IVideoWindow
* pVideoWindow
;
3983 TRACE("(%p/%p)->(%p)\n", This
, iface
, AutoShow
);
3985 EnterCriticalSection(&This
->cs
);
3987 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
3990 hr
= IVideoWindow_get_AutoShow(pVideoWindow
, AutoShow
);
3992 LeaveCriticalSection(&This
->cs
);
3997 static HRESULT WINAPI
VideoWindow_put_WindowState(IVideoWindow
*iface
,
3999 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4000 IVideoWindow
* pVideoWindow
;
4003 TRACE("(%p/%p)->(%ld)\n", This
, iface
, WindowState
);
4005 EnterCriticalSection(&This
->cs
);
4007 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4010 hr
= IVideoWindow_put_WindowState(pVideoWindow
, WindowState
);
4012 LeaveCriticalSection(&This
->cs
);
4017 static HRESULT WINAPI
VideoWindow_get_WindowState(IVideoWindow
*iface
,
4018 long *WindowState
) {
4019 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4020 IVideoWindow
* pVideoWindow
;
4023 TRACE("(%p/%p)->(%p)\n", This
, iface
, WindowState
);
4025 EnterCriticalSection(&This
->cs
);
4027 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4030 hr
= IVideoWindow_get_WindowState(pVideoWindow
, WindowState
);
4032 LeaveCriticalSection(&This
->cs
);
4037 static HRESULT WINAPI
VideoWindow_put_BackgroundPalette(IVideoWindow
*iface
,
4038 long BackgroundPalette
) {
4039 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4040 IVideoWindow
* pVideoWindow
;
4043 TRACE("(%p/%p)->(%ld)\n", This
, iface
, BackgroundPalette
);
4045 EnterCriticalSection(&This
->cs
);
4047 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4050 hr
= IVideoWindow_put_BackgroundPalette(pVideoWindow
, BackgroundPalette
);
4052 LeaveCriticalSection(&This
->cs
);
4057 static HRESULT WINAPI
VideoWindow_get_BackgroundPalette(IVideoWindow
*iface
,
4058 long *pBackgroundPalette
) {
4059 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4060 IVideoWindow
* pVideoWindow
;
4063 TRACE("(%p/%p)->(%p)\n", This
, iface
, pBackgroundPalette
);
4065 EnterCriticalSection(&This
->cs
);
4067 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4070 hr
= IVideoWindow_get_BackgroundPalette(pVideoWindow
, pBackgroundPalette
);
4072 LeaveCriticalSection(&This
->cs
);
4077 static HRESULT WINAPI
VideoWindow_put_Visible(IVideoWindow
*iface
,
4079 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4080 IVideoWindow
* pVideoWindow
;
4083 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Visible
);
4085 EnterCriticalSection(&This
->cs
);
4087 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4090 hr
= IVideoWindow_put_Visible(pVideoWindow
, Visible
);
4092 LeaveCriticalSection(&This
->cs
);
4097 static HRESULT WINAPI
VideoWindow_get_Visible(IVideoWindow
*iface
,
4099 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4100 IVideoWindow
* pVideoWindow
;
4103 TRACE("(%p/%p)->(%p)\n", This
, iface
, pVisible
);
4105 EnterCriticalSection(&This
->cs
);
4107 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4110 hr
= IVideoWindow_get_Visible(pVideoWindow
, pVisible
);
4112 LeaveCriticalSection(&This
->cs
);
4117 static HRESULT WINAPI
VideoWindow_put_Left(IVideoWindow
*iface
,
4119 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4120 IVideoWindow
* pVideoWindow
;
4123 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Left
);
4125 EnterCriticalSection(&This
->cs
);
4127 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4130 hr
= IVideoWindow_put_Left(pVideoWindow
, Left
);
4132 LeaveCriticalSection(&This
->cs
);
4137 static HRESULT WINAPI
VideoWindow_get_Left(IVideoWindow
*iface
,
4139 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4140 IVideoWindow
* pVideoWindow
;
4143 TRACE("(%p/%p)->(%p)\n", This
, iface
, pLeft
);
4145 EnterCriticalSection(&This
->cs
);
4147 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4150 hr
= IVideoWindow_get_Left(pVideoWindow
, pLeft
);
4152 LeaveCriticalSection(&This
->cs
);
4157 static HRESULT WINAPI
VideoWindow_put_Width(IVideoWindow
*iface
,
4159 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4160 IVideoWindow
* pVideoWindow
;
4163 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Width
);
4165 EnterCriticalSection(&This
->cs
);
4167 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4170 hr
= IVideoWindow_put_Width(pVideoWindow
, Width
);
4172 LeaveCriticalSection(&This
->cs
);
4177 static HRESULT WINAPI
VideoWindow_get_Width(IVideoWindow
*iface
,
4179 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4180 IVideoWindow
* pVideoWindow
;
4183 TRACE("(%p/%p)->(%p)\n", This
, iface
, pWidth
);
4185 EnterCriticalSection(&This
->cs
);
4187 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4190 hr
= IVideoWindow_get_Width(pVideoWindow
, pWidth
);
4192 LeaveCriticalSection(&This
->cs
);
4197 static HRESULT WINAPI
VideoWindow_put_Top(IVideoWindow
*iface
,
4199 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4200 IVideoWindow
* pVideoWindow
;
4203 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Top
);
4205 EnterCriticalSection(&This
->cs
);
4207 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4210 hr
= IVideoWindow_put_Top(pVideoWindow
, Top
);
4212 LeaveCriticalSection(&This
->cs
);
4217 static HRESULT WINAPI
VideoWindow_get_Top(IVideoWindow
*iface
,
4219 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4220 IVideoWindow
* pVideoWindow
;
4223 TRACE("(%p/%p)->(%p)\n", This
, iface
, pTop
);
4225 EnterCriticalSection(&This
->cs
);
4227 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4230 hr
= IVideoWindow_get_Top(pVideoWindow
, pTop
);
4232 LeaveCriticalSection(&This
->cs
);
4237 static HRESULT WINAPI
VideoWindow_put_Height(IVideoWindow
*iface
,
4239 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4240 IVideoWindow
* pVideoWindow
;
4243 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Height
);
4245 EnterCriticalSection(&This
->cs
);
4247 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4250 hr
= IVideoWindow_put_Height(pVideoWindow
, Height
);
4252 LeaveCriticalSection(&This
->cs
);
4257 static HRESULT WINAPI
VideoWindow_get_Height(IVideoWindow
*iface
,
4259 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4260 IVideoWindow
* pVideoWindow
;
4263 TRACE("(%p/%p)->(%p)\n", This
, iface
, pHeight
);
4265 EnterCriticalSection(&This
->cs
);
4267 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4270 hr
= IVideoWindow_get_Height(pVideoWindow
, pHeight
);
4272 LeaveCriticalSection(&This
->cs
);
4277 static HRESULT WINAPI
VideoWindow_put_Owner(IVideoWindow
*iface
,
4279 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4280 IVideoWindow
* pVideoWindow
;
4283 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Owner
);
4285 EnterCriticalSection(&This
->cs
);
4287 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4290 hr
= IVideoWindow_put_Owner(pVideoWindow
, Owner
);
4292 LeaveCriticalSection(&This
->cs
);
4297 static HRESULT WINAPI
VideoWindow_get_Owner(IVideoWindow
*iface
,
4299 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4300 IVideoWindow
* pVideoWindow
;
4303 TRACE("(%p/%p)->(%p)\n", This
, iface
, Owner
);
4305 EnterCriticalSection(&This
->cs
);
4307 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4310 hr
= IVideoWindow_get_Owner(pVideoWindow
, Owner
);
4312 LeaveCriticalSection(&This
->cs
);
4317 static HRESULT WINAPI
VideoWindow_put_MessageDrain(IVideoWindow
*iface
,
4319 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4320 IVideoWindow
* pVideoWindow
;
4323 TRACE("(%p/%p)->(%08x)\n", This
, iface
, (DWORD
) Drain
);
4325 EnterCriticalSection(&This
->cs
);
4327 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4330 hr
= IVideoWindow_put_MessageDrain(pVideoWindow
, Drain
);
4332 LeaveCriticalSection(&This
->cs
);
4337 static HRESULT WINAPI
VideoWindow_get_MessageDrain(IVideoWindow
*iface
,
4339 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4340 IVideoWindow
* pVideoWindow
;
4343 TRACE("(%p/%p)->(%p)\n", This
, iface
, Drain
);
4345 EnterCriticalSection(&This
->cs
);
4347 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4350 hr
= IVideoWindow_get_MessageDrain(pVideoWindow
, Drain
);
4352 LeaveCriticalSection(&This
->cs
);
4357 static HRESULT WINAPI
VideoWindow_get_BorderColor(IVideoWindow
*iface
,
4359 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4360 IVideoWindow
* pVideoWindow
;
4363 TRACE("(%p/%p)->(%p)\n", This
, iface
, Color
);
4365 EnterCriticalSection(&This
->cs
);
4367 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4370 hr
= IVideoWindow_get_BorderColor(pVideoWindow
, Color
);
4372 LeaveCriticalSection(&This
->cs
);
4377 static HRESULT WINAPI
VideoWindow_put_BorderColor(IVideoWindow
*iface
,
4379 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4380 IVideoWindow
* pVideoWindow
;
4383 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Color
);
4385 EnterCriticalSection(&This
->cs
);
4387 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4390 hr
= IVideoWindow_put_BorderColor(pVideoWindow
, Color
);
4392 LeaveCriticalSection(&This
->cs
);
4397 static HRESULT WINAPI
VideoWindow_get_FullScreenMode(IVideoWindow
*iface
,
4398 long *FullScreenMode
) {
4399 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4400 IVideoWindow
* pVideoWindow
;
4403 TRACE("(%p/%p)->(%p)\n", This
, iface
, FullScreenMode
);
4405 EnterCriticalSection(&This
->cs
);
4407 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4410 hr
= IVideoWindow_get_FullScreenMode(pVideoWindow
, FullScreenMode
);
4412 LeaveCriticalSection(&This
->cs
);
4417 static HRESULT WINAPI
VideoWindow_put_FullScreenMode(IVideoWindow
*iface
,
4418 long FullScreenMode
) {
4419 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4420 IVideoWindow
* pVideoWindow
;
4423 TRACE("(%p/%p)->(%ld)\n", This
, iface
, FullScreenMode
);
4425 EnterCriticalSection(&This
->cs
);
4427 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4430 hr
= IVideoWindow_put_FullScreenMode(pVideoWindow
, FullScreenMode
);
4432 LeaveCriticalSection(&This
->cs
);
4437 static HRESULT WINAPI
VideoWindow_SetWindowForeground(IVideoWindow
*iface
,
4439 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4440 IVideoWindow
* pVideoWindow
;
4443 TRACE("(%p/%p)->(%ld)\n", This
, iface
, Focus
);
4445 EnterCriticalSection(&This
->cs
);
4447 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4450 hr
= IVideoWindow_SetWindowForeground(pVideoWindow
, Focus
);
4452 LeaveCriticalSection(&This
->cs
);
4457 static HRESULT WINAPI
VideoWindow_NotifyOwnerMessage(IVideoWindow
*iface
,
4462 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4463 IVideoWindow
* pVideoWindow
;
4466 TRACE("(%p/%p)->(%08x, %ld, %08lx, %08lx)\n", This
, iface
, (DWORD
) hwnd
, uMsg
, wParam
, lParam
);
4468 EnterCriticalSection(&This
->cs
);
4470 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4473 hr
= IVideoWindow_NotifyOwnerMessage(pVideoWindow
, hwnd
, uMsg
, wParam
, lParam
);
4475 LeaveCriticalSection(&This
->cs
);
4480 static HRESULT WINAPI
VideoWindow_SetWindowPosition(IVideoWindow
*iface
,
4485 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4486 IVideoWindow
* pVideoWindow
;
4489 TRACE("(%p/%p)->(%ld, %ld, %ld, %ld)\n", This
, iface
, Left
, Top
, Width
, Height
);
4491 EnterCriticalSection(&This
->cs
);
4493 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4496 hr
= IVideoWindow_SetWindowPosition(pVideoWindow
, Left
, Top
, Width
, Height
);
4498 LeaveCriticalSection(&This
->cs
);
4503 static HRESULT WINAPI
VideoWindow_GetWindowPosition(IVideoWindow
*iface
,
4508 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4509 IVideoWindow
* pVideoWindow
;
4512 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
4514 EnterCriticalSection(&This
->cs
);
4516 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4519 hr
= IVideoWindow_GetWindowPosition(pVideoWindow
, pLeft
, pTop
, pWidth
, pHeight
);
4521 LeaveCriticalSection(&This
->cs
);
4526 static HRESULT WINAPI
VideoWindow_GetMinIdealImageSize(IVideoWindow
*iface
,
4529 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4530 IVideoWindow
* pVideoWindow
;
4533 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
4535 EnterCriticalSection(&This
->cs
);
4537 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4540 hr
= IVideoWindow_GetMinIdealImageSize(pVideoWindow
, pWidth
, pHeight
);
4542 LeaveCriticalSection(&This
->cs
);
4547 static HRESULT WINAPI
VideoWindow_GetMaxIdealImageSize(IVideoWindow
*iface
,
4550 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4551 IVideoWindow
* pVideoWindow
;
4554 TRACE("(%p/%p)->(%p, %p)\n", This
, iface
, pWidth
, pHeight
);
4556 EnterCriticalSection(&This
->cs
);
4558 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4561 hr
= IVideoWindow_GetMaxIdealImageSize(pVideoWindow
, pWidth
, pHeight
);
4563 LeaveCriticalSection(&This
->cs
);
4568 static HRESULT WINAPI
VideoWindow_GetRestorePosition(IVideoWindow
*iface
,
4573 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4574 IVideoWindow
* pVideoWindow
;
4577 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This
, iface
, pLeft
, pTop
, pWidth
, pHeight
);
4579 EnterCriticalSection(&This
->cs
);
4581 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4584 hr
= IVideoWindow_GetRestorePosition(pVideoWindow
, pLeft
, pTop
, pWidth
, pHeight
);
4586 LeaveCriticalSection(&This
->cs
);
4591 static HRESULT WINAPI
VideoWindow_HideCursor(IVideoWindow
*iface
,
4593 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4594 IVideoWindow
* pVideoWindow
;
4597 TRACE("(%p/%p)->(%ld)\n", This
, iface
, HideCursor
);
4599 EnterCriticalSection(&This
->cs
);
4601 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4604 hr
= IVideoWindow_HideCursor(pVideoWindow
, HideCursor
);
4606 LeaveCriticalSection(&This
->cs
);
4611 static HRESULT WINAPI
VideoWindow_IsCursorHidden(IVideoWindow
*iface
,
4612 long *CursorHidden
) {
4613 ICOM_THIS_MULTI(IFilterGraphImpl
, IVideoWindow_vtbl
, iface
);
4614 IVideoWindow
* pVideoWindow
;
4617 TRACE("(%p/%p)->(%p)\n", This
, iface
, CursorHidden
);
4619 EnterCriticalSection(&This
->cs
);
4621 hr
= GetTargetInterface(This
, &IID_IVideoWindow
, (LPVOID
*)&pVideoWindow
);
4624 hr
= IVideoWindow_IsCursorHidden(pVideoWindow
, CursorHidden
);
4626 LeaveCriticalSection(&This
->cs
);
4632 static const IVideoWindowVtbl IVideoWindow_VTable
=
4634 VideoWindow_QueryInterface
,
4636 VideoWindow_Release
,
4637 VideoWindow_GetTypeInfoCount
,
4638 VideoWindow_GetTypeInfo
,
4639 VideoWindow_GetIDsOfNames
,
4641 VideoWindow_put_Caption
,
4642 VideoWindow_get_Caption
,
4643 VideoWindow_put_WindowStyle
,
4644 VideoWindow_get_WindowStyle
,
4645 VideoWindow_put_WindowStyleEx
,
4646 VideoWindow_get_WindowStyleEx
,
4647 VideoWindow_put_AutoShow
,
4648 VideoWindow_get_AutoShow
,
4649 VideoWindow_put_WindowState
,
4650 VideoWindow_get_WindowState
,
4651 VideoWindow_put_BackgroundPalette
,
4652 VideoWindow_get_BackgroundPalette
,
4653 VideoWindow_put_Visible
,
4654 VideoWindow_get_Visible
,
4655 VideoWindow_put_Left
,
4656 VideoWindow_get_Left
,
4657 VideoWindow_put_Width
,
4658 VideoWindow_get_Width
,
4659 VideoWindow_put_Top
,
4660 VideoWindow_get_Top
,
4661 VideoWindow_put_Height
,
4662 VideoWindow_get_Height
,
4663 VideoWindow_put_Owner
,
4664 VideoWindow_get_Owner
,
4665 VideoWindow_put_MessageDrain
,
4666 VideoWindow_get_MessageDrain
,
4667 VideoWindow_get_BorderColor
,
4668 VideoWindow_put_BorderColor
,
4669 VideoWindow_get_FullScreenMode
,
4670 VideoWindow_put_FullScreenMode
,
4671 VideoWindow_SetWindowForeground
,
4672 VideoWindow_NotifyOwnerMessage
,
4673 VideoWindow_SetWindowPosition
,
4674 VideoWindow_GetWindowPosition
,
4675 VideoWindow_GetMinIdealImageSize
,
4676 VideoWindow_GetMaxIdealImageSize
,
4677 VideoWindow_GetRestorePosition
,
4678 VideoWindow_HideCursor
,
4679 VideoWindow_IsCursorHidden
4683 /*** IUnknown methods ***/
4684 static HRESULT WINAPI
MediaEvent_QueryInterface(IMediaEventEx
*iface
,
4687 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4689 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
4691 return Filtergraph_QueryInterface(This
, riid
, ppvObj
);
4694 static ULONG WINAPI
MediaEvent_AddRef(IMediaEventEx
*iface
) {
4695 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4697 TRACE("(%p/%p)->()\n", This
, iface
);
4699 return Filtergraph_AddRef(This
);
4702 static ULONG WINAPI
MediaEvent_Release(IMediaEventEx
*iface
) {
4703 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4705 TRACE("(%p/%p)->()\n", This
, iface
);
4707 return Filtergraph_Release(This
);
4710 /*** IDispatch methods ***/
4711 static HRESULT WINAPI
MediaEvent_GetTypeInfoCount(IMediaEventEx
*iface
,
4713 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4715 TRACE("(%p/%p)->(%p): stub !!!\n", This
, iface
, pctinfo
);
4720 static HRESULT WINAPI
MediaEvent_GetTypeInfo(IMediaEventEx
*iface
,
4723 ITypeInfo
**ppTInfo
) {
4724 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4726 TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This
, iface
, iTInfo
, lcid
, ppTInfo
);
4731 static HRESULT WINAPI
MediaEvent_GetIDsOfNames(IMediaEventEx
*iface
,
4737 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4739 TRACE("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This
, iface
, debugstr_guid(riid
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4744 static HRESULT WINAPI
MediaEvent_Invoke(IMediaEventEx
*iface
,
4745 DISPID dispIdMember
,
4749 DISPPARAMS
*pDispParams
,
4751 EXCEPINFO
*pExepInfo
,
4753 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4755 TRACE("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This
, iface
, dispIdMember
, debugstr_guid(riid
), riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExepInfo
, puArgErr
);
4760 /*** IMediaEvent methods ***/
4761 static HRESULT WINAPI
MediaEvent_GetEventHandle(IMediaEventEx
*iface
,
4763 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4765 TRACE("(%p/%p)->(%p)\n", This
, iface
, hEvent
);
4767 *hEvent
= (OAEVENT
)This
->evqueue
.msg_event
;
4772 static HRESULT WINAPI
MediaEvent_GetEvent(IMediaEventEx
*iface
,
4777 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4780 TRACE("(%p/%p)->(%p, %p, %p, %ld)\n", This
, iface
, lEventCode
, lParam1
, lParam2
, msTimeout
);
4782 if (EventsQueue_GetEvent(&This
->evqueue
, &evt
, msTimeout
))
4784 *lEventCode
= evt
.lEventCode
;
4785 *lParam1
= evt
.lParam1
;
4786 *lParam2
= evt
.lParam2
;
4794 static HRESULT WINAPI
MediaEvent_WaitForCompletion(IMediaEventEx
*iface
,
4797 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4799 TRACE("(%p/%p)->(%ld, %p)\n", This
, iface
, msTimeout
, pEvCode
);
4801 if (WaitForSingleObject(This
->hEventCompletion
, msTimeout
) == WAIT_OBJECT_0
)
4803 *pEvCode
= This
->CompletionStatus
;
4811 static HRESULT WINAPI
MediaEvent_CancelDefaultHandling(IMediaEventEx
*iface
,
4813 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4815 TRACE("(%p/%p)->(%ld)\n", This
, iface
, lEvCode
);
4817 if (lEvCode
== EC_COMPLETE
)
4818 This
->HandleEcComplete
= FALSE
;
4819 else if (lEvCode
== EC_REPAINT
)
4820 This
->HandleEcRepaint
= FALSE
;
4821 else if (lEvCode
== EC_CLOCK_CHANGED
)
4822 This
->HandleEcClockChanged
= FALSE
;
4829 static HRESULT WINAPI
MediaEvent_RestoreDefaultHandling(IMediaEventEx
*iface
,
4831 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4833 TRACE("(%p/%p)->(%ld)\n", This
, iface
, lEvCode
);
4835 if (lEvCode
== EC_COMPLETE
)
4836 This
->HandleEcComplete
= TRUE
;
4837 else if (lEvCode
== EC_REPAINT
)
4838 This
->HandleEcRepaint
= TRUE
;
4839 else if (lEvCode
== EC_CLOCK_CHANGED
)
4840 This
->HandleEcClockChanged
= TRUE
;
4847 static HRESULT WINAPI
MediaEvent_FreeEventParams(IMediaEventEx
*iface
,
4851 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4853 TRACE("(%p/%p)->(%ld, %08lx, %08lx): stub !!!\n", This
, iface
, lEvCode
, lParam1
, lParam2
);
4858 /*** IMediaEventEx methods ***/
4859 static HRESULT WINAPI
MediaEvent_SetNotifyWindow(IMediaEventEx
*iface
,
4862 LONG_PTR lInstanceData
) {
4863 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4865 TRACE("(%p/%p)->(%08x, %ld, %08lx)\n", This
, iface
, (DWORD
) hwnd
, lMsg
, lInstanceData
);
4867 This
->notif
.hWnd
= (HWND
)hwnd
;
4868 This
->notif
.msg
= lMsg
;
4869 This
->notif
.instance
= (long) lInstanceData
;
4874 static HRESULT WINAPI
MediaEvent_SetNotifyFlags(IMediaEventEx
*iface
,
4875 long lNoNotifyFlags
) {
4876 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4878 TRACE("(%p/%p)->(%ld)\n", This
, iface
, lNoNotifyFlags
);
4880 if ((lNoNotifyFlags
!= 0) && (lNoNotifyFlags
!= 1))
4881 return E_INVALIDARG
;
4883 This
->notif
.disabled
= lNoNotifyFlags
;
4888 static HRESULT WINAPI
MediaEvent_GetNotifyFlags(IMediaEventEx
*iface
,
4889 long *lplNoNotifyFlags
) {
4890 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventEx_vtbl
, iface
);
4892 TRACE("(%p/%p)->(%p)\n", This
, iface
, lplNoNotifyFlags
);
4894 if (!lplNoNotifyFlags
)
4897 *lplNoNotifyFlags
= This
->notif
.disabled
;
4903 static const IMediaEventExVtbl IMediaEventEx_VTable
=
4905 MediaEvent_QueryInterface
,
4908 MediaEvent_GetTypeInfoCount
,
4909 MediaEvent_GetTypeInfo
,
4910 MediaEvent_GetIDsOfNames
,
4912 MediaEvent_GetEventHandle
,
4913 MediaEvent_GetEvent
,
4914 MediaEvent_WaitForCompletion
,
4915 MediaEvent_CancelDefaultHandling
,
4916 MediaEvent_RestoreDefaultHandling
,
4917 MediaEvent_FreeEventParams
,
4918 MediaEvent_SetNotifyWindow
,
4919 MediaEvent_SetNotifyFlags
,
4920 MediaEvent_GetNotifyFlags
4924 static HRESULT WINAPI
MediaFilter_QueryInterface(IMediaFilter
*iface
, REFIID riid
, LPVOID
*ppv
)
4926 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaFilter_vtbl
, iface
);
4928 return Filtergraph_QueryInterface(This
, riid
, ppv
);
4931 static ULONG WINAPI
MediaFilter_AddRef(IMediaFilter
*iface
)
4933 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaFilter_vtbl
, iface
);
4935 return Filtergraph_AddRef(This
);
4938 static ULONG WINAPI
MediaFilter_Release(IMediaFilter
*iface
)
4940 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaFilter_vtbl
, iface
);
4942 return Filtergraph_Release(This
);
4945 static HRESULT WINAPI
MediaFilter_GetClassID(IMediaFilter
*iface
, CLSID
* pClassID
)
4947 FIXME("(%p): stub\n", pClassID
);
4952 static HRESULT WINAPI
MediaFilter_Stop(IMediaFilter
*iface
)
4954 FIXME("(): stub\n");
4959 static HRESULT WINAPI
MediaFilter_Pause(IMediaFilter
*iface
)
4961 FIXME("(): stub\n");
4966 static HRESULT WINAPI
MediaFilter_Run(IMediaFilter
*iface
, REFERENCE_TIME tStart
)
4968 FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart
));
4973 static HRESULT WINAPI
MediaFilter_GetState(IMediaFilter
*iface
, DWORD dwMsTimeout
, FILTER_STATE
* pState
)
4975 FIXME("(%d, %p): stub\n", dwMsTimeout
, pState
);
4980 static HRESULT WINAPI
MediaFilter_SetSyncSource(IMediaFilter
*iface
, IReferenceClock
*pClock
)
4982 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaFilter_vtbl
, iface
);
4986 TRACE("(%p/%p)->(%p)\n", iface
, This
, pClock
);
4988 EnterCriticalSection(&This
->cs
);
4990 for (i
= 0;i
< This
->nFilters
;i
++)
4992 hr
= IBaseFilter_SetSyncSource(This
->ppFiltersInGraph
[i
], pClock
);
5000 IBaseFilter_SetSyncSource(This
->ppFiltersInGraph
[i
], This
->refClock
);
5005 IReferenceClock_Release(This
->refClock
);
5006 This
->refClock
= pClock
;
5008 IReferenceClock_AddRef(This
->refClock
);
5010 if (This
->HandleEcClockChanged
)
5012 IMediaEventSink
*pEventSink
;
5015 eshr
= IMediaFilter_QueryInterface(iface
, &IID_IMediaEventSink
, (LPVOID
)&pEventSink
);
5016 if (SUCCEEDED(eshr
))
5018 IMediaEventSink_Notify(pEventSink
, EC_CLOCK_CHANGED
, 0, 0);
5019 IMediaEventSink_Release(pEventSink
);
5024 LeaveCriticalSection(&This
->cs
);
5029 static HRESULT WINAPI
MediaFilter_GetSyncSource(IMediaFilter
*iface
, IReferenceClock
**ppClock
)
5031 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaFilter_vtbl
, iface
);
5033 TRACE("(%p/%p)->(%p)\n", iface
, This
, ppClock
);
5038 EnterCriticalSection(&This
->cs
);
5040 *ppClock
= This
->refClock
;
5042 IReferenceClock_AddRef(*ppClock
);
5044 LeaveCriticalSection(&This
->cs
);
5049 static const IMediaFilterVtbl IMediaFilter_VTable
=
5051 MediaFilter_QueryInterface
,
5053 MediaFilter_Release
,
5054 MediaFilter_GetClassID
,
5058 MediaFilter_GetState
,
5059 MediaFilter_SetSyncSource
,
5060 MediaFilter_GetSyncSource
5063 static HRESULT WINAPI
MediaEventSink_QueryInterface(IMediaEventSink
*iface
, REFIID riid
, LPVOID
*ppv
)
5065 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventSink_vtbl
, iface
);
5067 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5070 static ULONG WINAPI
MediaEventSink_AddRef(IMediaEventSink
*iface
)
5072 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventSink_vtbl
, iface
);
5074 return Filtergraph_AddRef(This
);
5077 static ULONG WINAPI
MediaEventSink_Release(IMediaEventSink
*iface
)
5079 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventSink_vtbl
, iface
);
5081 return Filtergraph_Release(This
);
5084 static HRESULT WINAPI
MediaEventSink_Notify(IMediaEventSink
*iface
, long EventCode
, LONG_PTR EventParam1
, LONG_PTR EventParam2
)
5086 ICOM_THIS_MULTI(IFilterGraphImpl
, IMediaEventSink_vtbl
, iface
);
5089 TRACE("(%p/%p)->(%ld, %ld, %ld)\n", This
, iface
, EventCode
, EventParam1
, EventParam2
);
5091 /* We need thread safety here, let's use the events queue's one */
5092 EnterCriticalSection(&This
->evqueue
.msg_crst
);
5094 if ((EventCode
== EC_COMPLETE
) && This
->HandleEcComplete
)
5096 TRACE("Process EC_COMPLETE notification\n");
5097 if (++This
->EcCompleteCount
== This
->nRenderers
)
5099 evt
.lEventCode
= EC_COMPLETE
;
5102 TRACE("Send EC_COMPLETE to app\n");
5103 EventsQueue_PutEvent(&This
->evqueue
, &evt
);
5104 if (!This
->notif
.disabled
&& This
->notif
.hWnd
)
5106 TRACE("Send Window message\n");
5107 PostMessageW(This
->notif
.hWnd
, This
->notif
.msg
, 0, This
->notif
.instance
);
5109 This
->CompletionStatus
= EC_COMPLETE
;
5110 SetEvent(This
->hEventCompletion
);
5113 else if ((EventCode
== EC_REPAINT
) && This
->HandleEcRepaint
)
5115 /* FIXME: Not handled yet */
5119 evt
.lEventCode
= EventCode
;
5120 evt
.lParam1
= EventParam1
;
5121 evt
.lParam2
= EventParam2
;
5122 EventsQueue_PutEvent(&This
->evqueue
, &evt
);
5123 if (!This
->notif
.disabled
&& This
->notif
.hWnd
)
5124 PostMessageW(This
->notif
.hWnd
, This
->notif
.msg
, 0, This
->notif
.instance
);
5127 LeaveCriticalSection(&This
->evqueue
.msg_crst
);
5131 static const IMediaEventSinkVtbl IMediaEventSink_VTable
=
5133 MediaEventSink_QueryInterface
,
5134 MediaEventSink_AddRef
,
5135 MediaEventSink_Release
,
5136 MediaEventSink_Notify
5139 static HRESULT WINAPI
GraphConfig_QueryInterface(IGraphConfig
*iface
, REFIID riid
, LPVOID
*ppv
)
5141 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5143 return Filtergraph_QueryInterface(This
, riid
, ppv
);
5146 static ULONG WINAPI
GraphConfig_AddRef(IGraphConfig
*iface
)
5148 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5150 return Filtergraph_AddRef(This
);
5153 static ULONG WINAPI
GraphConfig_Release(IGraphConfig
*iface
)
5155 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5157 return Filtergraph_Release(This
);
5160 static HRESULT WINAPI
GraphConfig_Reconnect(IGraphConfig
*iface
,
5163 const AM_MEDIA_TYPE
* pmtFirstConnection
,
5164 IBaseFilter
* pUsingFilter
,
5168 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5170 FIXME("(%p)->(%p, %p, %p, %p, %p, %x): stub!\n", This
, pOutputPin
, pInputPin
, pmtFirstConnection
, pUsingFilter
, hAbortEvent
, dwFlags
);
5175 static HRESULT WINAPI
GraphConfig_Reconfigure(IGraphConfig
*iface
,
5176 IGraphConfigCallback
* pCallback
,
5181 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5184 WARN("(%p)->(%p, %p, %x, %p): partial stub!\n", This
, pCallback
, pvContext
, dwFlags
, hAbortEvent
);
5187 FIXME("The parameter hAbortEvent is not handled!\n");
5189 EnterCriticalSection(&This
->cs
);
5191 hr
= IGraphConfigCallback_Reconfigure(pCallback
, pvContext
, dwFlags
);
5193 LeaveCriticalSection(&This
->cs
);
5198 static HRESULT WINAPI
GraphConfig_AddFilterToCache(IGraphConfig
*iface
,
5199 IBaseFilter
* pFilter
)
5201 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5203 FIXME("(%p)->(%p): stub!\n", This
, pFilter
);
5208 static HRESULT WINAPI
GraphConfig_EnumCacheFilter(IGraphConfig
*iface
,
5209 IEnumFilters
** pEnum
)
5211 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5213 FIXME("(%p)->(%p): stub!\n", This
, pEnum
);
5218 static HRESULT WINAPI
GraphConfig_RemoveFilterFromCache(IGraphConfig
*iface
,
5219 IBaseFilter
* pFilter
)
5221 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5223 FIXME("(%p)->(%p): stub!\n", This
, pFilter
);
5228 static HRESULT WINAPI
GraphConfig_GetStartTime(IGraphConfig
*iface
,
5229 REFERENCE_TIME
* prtStart
)
5231 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5233 FIXME("(%p)->(%p): stub!\n", This
, prtStart
);
5238 static HRESULT WINAPI
GraphConfig_PushThroughData(IGraphConfig
*iface
,
5240 IPinConnection
* pConnection
,
5243 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5245 FIXME("(%p)->(%p, %p, %p): stub!\n", This
, pOutputPin
, pConnection
, hEventAbort
);
5250 static HRESULT WINAPI
GraphConfig_SetFilterFlags(IGraphConfig
*iface
,
5251 IBaseFilter
* pFilter
,
5254 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5256 FIXME("(%p)->(%p, %x): stub!\n", This
, pFilter
, dwFlags
);
5261 static HRESULT WINAPI
GraphConfig_GetFilterFlags(IGraphConfig
*iface
,
5262 IBaseFilter
* pFilter
,
5265 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5267 FIXME("(%p)->(%p, %p): stub!\n", This
, pFilter
, dwFlags
);
5272 static HRESULT WINAPI
GraphConfig_RemoveFilterEx(IGraphConfig
*iface
,
5273 IBaseFilter
* pFilter
,
5276 ICOM_THIS_MULTI(IFilterGraphImpl
, IGraphConfig_vtbl
, iface
);
5278 FIXME("(%p)->(%p, %x): stub!\n", This
, pFilter
, dwFlags
);
5283 static const IGraphConfigVtbl IGraphConfig_VTable
=
5285 GraphConfig_QueryInterface
,
5287 GraphConfig_Release
,
5288 GraphConfig_Reconnect
,
5289 GraphConfig_Reconfigure
,
5290 GraphConfig_AddFilterToCache
,
5291 GraphConfig_EnumCacheFilter
,
5292 GraphConfig_RemoveFilterFromCache
,
5293 GraphConfig_GetStartTime
,
5294 GraphConfig_PushThroughData
,
5295 GraphConfig_SetFilterFlags
,
5296 GraphConfig_GetFilterFlags
,
5297 GraphConfig_RemoveFilterEx
5300 static const IUnknownVtbl IInner_VTable
=
5302 FilterGraphInner_QueryInterface
,
5303 FilterGraphInner_AddRef
,
5304 FilterGraphInner_Release
5307 static HRESULT WINAPI
Filtergraph_QueryInterface(IFilterGraphImpl
*This
,
5310 if (This
->bAggregatable
)
5311 This
->bUnkOuterValid
= TRUE
;
5313 if (This
->pUnkOuter
)
5315 if (This
->bAggregatable
)
5316 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
5318 if (IsEqualIID(riid
, &IID_IUnknown
))
5322 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
5323 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
5324 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
5325 This
->bAggregatable
= TRUE
;
5330 return E_NOINTERFACE
;
5333 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
5336 static ULONG WINAPI
Filtergraph_AddRef(IFilterGraphImpl
*This
) {
5337 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
5338 return IUnknown_AddRef(This
->pUnkOuter
);
5339 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
5342 static ULONG WINAPI
Filtergraph_Release(IFilterGraphImpl
*This
) {
5343 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
5344 return IUnknown_Release(This
->pUnkOuter
);
5345 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
5348 /* This is the only function that actually creates a FilterGraph class... */
5349 HRESULT
FilterGraph_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
5351 IFilterGraphImpl
*fimpl
;
5354 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
5358 fimpl
= CoTaskMemAlloc(sizeof(*fimpl
));
5359 fimpl
->pUnkOuter
= pUnkOuter
;
5360 fimpl
->bUnkOuterValid
= FALSE
;
5361 fimpl
->bAggregatable
= FALSE
;
5362 fimpl
->IInner_vtbl
= &IInner_VTable
;
5363 fimpl
->IFilterGraph2_vtbl
= &IFilterGraph2_VTable
;
5364 fimpl
->IMediaControl_vtbl
= &IMediaControl_VTable
;
5365 fimpl
->IMediaSeeking_vtbl
= &IMediaSeeking_VTable
;
5366 fimpl
->IBasicAudio_vtbl
= &IBasicAudio_VTable
;
5367 fimpl
->IBasicVideo_vtbl
= &IBasicVideo_VTable
;
5368 fimpl
->IVideoWindow_vtbl
= &IVideoWindow_VTable
;
5369 fimpl
->IMediaEventEx_vtbl
= &IMediaEventEx_VTable
;
5370 fimpl
->IMediaFilter_vtbl
= &IMediaFilter_VTable
;
5371 fimpl
->IMediaEventSink_vtbl
= &IMediaEventSink_VTable
;
5372 fimpl
->IGraphConfig_vtbl
= &IGraphConfig_VTable
;
5373 fimpl
->IMediaPosition_vtbl
= &IMediaPosition_VTable
;
5375 fimpl
->ppFiltersInGraph
= NULL
;
5376 fimpl
->pFilterNames
= NULL
;
5377 fimpl
->nFilters
= 0;
5378 fimpl
->filterCapacity
= 0;
5379 fimpl
->nameIndex
= 1;
5380 fimpl
->refClock
= NULL
;
5381 fimpl
->hEventCompletion
= CreateEventW(0, TRUE
, FALSE
, 0);
5382 fimpl
->HandleEcComplete
= TRUE
;
5383 fimpl
->HandleEcRepaint
= TRUE
;
5384 fimpl
->HandleEcClockChanged
= TRUE
;
5385 fimpl
->notif
.hWnd
= 0;
5386 fimpl
->notif
.disabled
= FALSE
;
5387 fimpl
->nRenderers
= 0;
5388 fimpl
->EcCompleteCount
= 0;
5389 fimpl
->state
= State_Stopped
;
5390 EventsQueue_Init(&fimpl
->evqueue
);
5391 InitializeCriticalSection(&fimpl
->cs
);
5392 fimpl
->cs
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": IFilterGraphImpl.cs");
5393 fimpl
->nItfCacheEntries
= 0;
5394 memcpy(&fimpl
->timeformatseek
, &TIME_FORMAT_MEDIA_TIME
, sizeof(GUID
));
5395 fimpl
->start_time
= fimpl
->position
= 0;
5396 fimpl
->stop_position
= -1;
5398 hr
= CoCreateInstance(&CLSID_FilterMapper2
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IFilterMapper2
, (LPVOID
*)&fimpl
->pFilterMapper2
);
5400 ERR("Unable to create filter mapper (%x)\n", hr
);
5403 IFilterGraph2_SetDefaultSyncSource((IFilterGraph2
*)fimpl
);
5409 HRESULT
FilterGraphNoThread_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
5411 FIXME("CLSID_FilterGraphNoThread partially implemented - Forwarding to CLSID_FilterGraph\n");
5412 return FilterGraph_create(pUnkOuter
, ppObj
);