2 * Filter Seeking and Control Interfaces
4 * Copyright 2003 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 /* FIXME: critical sections */
22 #include "quartz_private.h"
23 #include "control_private.h"
26 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
32 static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl
;
34 typedef struct PassThruImpl
{
35 const ISeekingPassThruVtbl
*IPassThru_vtbl
;
36 const IUnknownVtbl
*IInner_vtbl
;
37 const IMediaSeekingVtbl
*IMediaSeeking_vtbl
;
47 static HRESULT WINAPI
SeekInner_QueryInterface(IUnknown
* iface
,
50 ICOM_THIS_MULTI(PassThruImpl
, IInner_vtbl
, iface
);
51 TRACE("(%p)->(%s (%p), %p)\n", This
, debugstr_guid(riid
), riid
, ppvObj
);
53 if (This
->bAggregatable
)
54 This
->bUnkOuterValid
= TRUE
;
56 if (IsEqualGUID(&IID_IUnknown
, riid
))
58 *ppvObj
= &(This
->IInner_vtbl
);
59 TRACE(" returning IUnknown interface (%p)\n", *ppvObj
);
60 } else if (IsEqualGUID(&IID_ISeekingPassThru
, riid
)) {
61 *ppvObj
= &(This
->IPassThru_vtbl
);
62 TRACE(" returning ISeekingPassThru interface (%p)\n", *ppvObj
);
63 } else if (IsEqualGUID(&IID_IMediaSeeking
, riid
)) {
64 *ppvObj
= &(This
->IMediaSeeking_vtbl
);
65 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj
);
68 FIXME("unknown interface %s\n", debugstr_guid(riid
));
72 IUnknown_AddRef((IUnknown
*)(*ppvObj
));
76 static ULONG WINAPI
SeekInner_AddRef(IUnknown
* iface
) {
77 ICOM_THIS_MULTI(PassThruImpl
, IInner_vtbl
, iface
);
78 ULONG ref
= InterlockedIncrement(&This
->ref
);
80 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
85 static ULONG WINAPI
SeekInner_Release(IUnknown
* iface
) {
86 ICOM_THIS_MULTI(PassThruImpl
, IInner_vtbl
, iface
);
87 ULONG ref
= InterlockedDecrement(&This
->ref
);
89 TRACE("(%p)->(): new ref = %d\n", This
, ref
);
98 static const IUnknownVtbl IInner_VTable
=
100 SeekInner_QueryInterface
,
105 /* Generic functions for aggregation */
106 static HRESULT WINAPI
SeekOuter_QueryInterface(PassThruImpl
*This
, REFIID riid
, LPVOID
*ppv
)
108 if (This
->bAggregatable
)
109 This
->bUnkOuterValid
= TRUE
;
113 if (This
->bAggregatable
)
114 return IUnknown_QueryInterface(This
->pUnkOuter
, riid
, ppv
);
116 if (IsEqualIID(riid
, &IID_IUnknown
))
120 IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
121 hr
= IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
122 IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
123 This
->bAggregatable
= TRUE
;
128 return E_NOINTERFACE
;
131 return IUnknown_QueryInterface((IUnknown
*)&(This
->IInner_vtbl
), riid
, ppv
);
134 static ULONG WINAPI
SeekOuter_AddRef(PassThruImpl
*This
)
136 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
137 return IUnknown_AddRef(This
->pUnkOuter
);
138 return IUnknown_AddRef((IUnknown
*)&(This
->IInner_vtbl
));
141 static ULONG WINAPI
SeekOuter_Release(PassThruImpl
*This
)
143 if (This
->pUnkOuter
&& This
->bUnkOuterValid
)
144 return IUnknown_Release(This
->pUnkOuter
);
145 return IUnknown_Release((IUnknown
*)&(This
->IInner_vtbl
));
148 static HRESULT WINAPI
SeekingPassThru_QueryInterface(ISeekingPassThru
*iface
, REFIID riid
, LPVOID
*ppvObj
)
150 ICOM_THIS_MULTI(PassThruImpl
, IPassThru_vtbl
, iface
);
152 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
154 return SeekOuter_QueryInterface(This
, riid
, ppvObj
);
157 static ULONG WINAPI
SeekingPassThru_AddRef(ISeekingPassThru
*iface
)
159 ICOM_THIS_MULTI(PassThruImpl
, IPassThru_vtbl
, iface
);
161 TRACE("(%p/%p)->()\n", This
, iface
);
163 return SeekOuter_AddRef(This
);
166 static ULONG WINAPI
SeekingPassThru_Release(ISeekingPassThru
*iface
)
168 ICOM_THIS_MULTI(PassThruImpl
, IPassThru_vtbl
, iface
);
170 TRACE("(%p/%p)->()\n", This
, iface
);
172 return SeekOuter_Release(This
);
175 static HRESULT WINAPI
SeekingPassThru_Init(ISeekingPassThru
*iface
, BOOL renderer
, IPin
*pin
)
177 ICOM_THIS_MULTI(PassThruImpl
, IPassThru_vtbl
, iface
);
179 TRACE("(%p/%p)->(%d, %p)\n", This
, iface
, renderer
, pin
);
182 FIXME("Re-initializing?\n");
184 This
->renderer
= renderer
;
190 static const ISeekingPassThruVtbl ISeekingPassThru_Vtbl
=
192 SeekingPassThru_QueryInterface
,
193 SeekingPassThru_AddRef
,
194 SeekingPassThru_Release
,
198 HRESULT
SeekingPassThru_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
202 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
204 *ppObj
= fimpl
= CoTaskMemAlloc(sizeof(*fimpl
));
206 return E_OUTOFMEMORY
;
208 fimpl
->pUnkOuter
= pUnkOuter
;
209 fimpl
->bUnkOuterValid
= FALSE
;
210 fimpl
->bAggregatable
= FALSE
;
211 fimpl
->IInner_vtbl
= &IInner_VTable
;
212 fimpl
->IPassThru_vtbl
= &ISeekingPassThru_Vtbl
;
213 fimpl
->IMediaSeeking_vtbl
= &IMediaSeekingPassThru_Vtbl
;
219 typedef HRESULT (*SeekFunc
)( IMediaSeeking
*to
, LPVOID arg
);
221 static HRESULT
ForwardCmdSeek( PCRITICAL_SECTION crit_sect
, IBaseFilter
* from
, SeekFunc fnSeek
, LPVOID arg
)
224 HRESULT hr_return
= S_OK
;
225 IEnumPins
*enumpins
= NULL
;
226 BOOL foundend
= FALSE
, allnotimpl
= TRUE
;
228 hr
= IBaseFilter_EnumPins( from
, &enumpins
);
232 hr
= IEnumPins_Reset( enumpins
);
235 hr
= IEnumPins_Next( enumpins
, 1, &pin
, NULL
);
236 if (hr
== VFW_E_ENUM_OUT_OF_SYNC
)
238 hr
= IEnumPins_Reset( enumpins
);
245 IPin_QueryDirection( pin
, &dir
);
246 if (dir
== PINDIR_INPUT
)
248 IPin
*connected
= NULL
;
250 IPin_ConnectedTo( pin
, &connected
);
254 IMediaSeeking
*seek
= NULL
;
256 hr_local
= IPin_QueryInterface( connected
, &IID_IMediaSeeking
, (void**)&seek
);
262 LeaveCriticalSection( crit_sect
);
263 hr_local
= fnSeek( seek
, arg
);
264 EnterCriticalSection( crit_sect
);
267 hr_local
= fnSeek( seek
, arg
);
269 if (hr_local
!= E_NOTIMPL
)
272 hr_return
= updatehres( hr_return
, hr_local
);
273 IMediaSeeking_Release( seek
);
275 IPin_Release(connected
);
281 if (foundend
&& allnotimpl
)
287 TRACE("Returning: %08x\n", hr
);
292 HRESULT
MediaSeekingImpl_Init(IBaseFilter
*pUserData
, CHANGEPROC fnChangeStop
, CHANGEPROC fnChangeCurrent
, CHANGEPROC fnChangeRate
, MediaSeekingImpl
* pSeeking
, PCRITICAL_SECTION crit_sect
)
294 assert(fnChangeStop
&& fnChangeCurrent
&& fnChangeRate
);
296 pSeeking
->refCount
= 1;
297 pSeeking
->pUserData
= pUserData
;
298 pSeeking
->fnChangeRate
= fnChangeRate
;
299 pSeeking
->fnChangeStop
= fnChangeStop
;
300 pSeeking
->fnChangeCurrent
= fnChangeCurrent
;
301 pSeeking
->dwCapabilities
= AM_SEEKING_CanSeekForwards
|
302 AM_SEEKING_CanSeekBackwards
|
303 AM_SEEKING_CanSeekAbsolute
|
304 AM_SEEKING_CanGetStopPos
|
305 AM_SEEKING_CanGetDuration
;
306 pSeeking
->llCurrent
= 0;
307 pSeeking
->llStop
= ((ULONGLONG
)0x80000000) << 32;
308 pSeeking
->llDuration
= pSeeking
->llStop
;
309 pSeeking
->dRate
= 1.0;
310 pSeeking
->timeformat
= TIME_FORMAT_MEDIA_TIME
;
311 pSeeking
->crst
= crit_sect
;
317 LONGLONG
* current
, *stop
;
318 DWORD curflags
, stopflags
;
321 static HRESULT
fwd_setposition(IMediaSeeking
*seek
, LPVOID pargs
)
323 struct pos_args
*args
= (void*)pargs
;
325 return IMediaSeeking_SetPositions(seek
, args
->current
, args
->curflags
, args
->stop
, args
->stopflags
);
328 static HRESULT
fwd_checkcaps(IMediaSeeking
*iface
, LPVOID pcaps
)
331 return IMediaSeeking_CheckCapabilities(iface
, caps
);
334 static HRESULT
fwd_settimeformat(IMediaSeeking
*iface
, LPVOID pformat
)
336 const GUID
*format
= pformat
;
337 return IMediaSeeking_SetTimeFormat(iface
, format
);
340 static HRESULT
fwd_getduration(IMediaSeeking
*iface
, LPVOID pdur
)
342 LONGLONG
*duration
= pdur
;
343 LONGLONG mydur
= *duration
;
346 hr
= IMediaSeeking_GetDuration(iface
, &mydur
);
350 if ((mydur
< *duration
) || (*duration
< 0 && mydur
> 0))
355 static HRESULT
fwd_getstopposition(IMediaSeeking
*iface
, LPVOID pdur
)
357 LONGLONG
*duration
= pdur
;
358 LONGLONG mydur
= *duration
;
361 hr
= IMediaSeeking_GetStopPosition(iface
, &mydur
);
365 if ((mydur
< *duration
) || (*duration
< 0 && mydur
> 0))
370 static HRESULT
fwd_getcurposition(IMediaSeeking
*iface
, LPVOID pdur
)
372 LONGLONG
*duration
= pdur
;
373 LONGLONG mydur
= *duration
;
376 hr
= IMediaSeeking_GetCurrentPosition(iface
, &mydur
);
380 if ((mydur
< *duration
) || (*duration
< 0 && mydur
> 0))
385 static HRESULT
fwd_setrate(IMediaSeeking
*iface
, LPVOID prate
)
387 double *rate
= prate
;
391 hr
= IMediaSeeking_SetRate(iface
, *rate
);
399 HRESULT WINAPI
MediaSeekingImpl_GetCapabilities(IMediaSeeking
* iface
, DWORD
* pCapabilities
)
401 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
403 TRACE("(%p)\n", pCapabilities
);
405 *pCapabilities
= This
->dwCapabilities
;
410 HRESULT WINAPI
MediaSeekingImpl_CheckCapabilities(IMediaSeeking
* iface
, DWORD
* pCapabilities
)
412 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
416 TRACE("(%p)\n", pCapabilities
);
421 EnterCriticalSection(This
->crst
);
422 hr
= ForwardCmdSeek(This
->crst
, This
->pUserData
, fwd_checkcaps
, pCapabilities
);
423 LeaveCriticalSection(This
->crst
);
424 if (FAILED(hr
) && hr
!= E_NOTIMPL
)
427 dwCommonCaps
= *pCapabilities
& This
->dwCapabilities
;
432 hr
= (*pCapabilities
== dwCommonCaps
) ? S_OK
: S_FALSE
;
433 *pCapabilities
= dwCommonCaps
;
438 HRESULT WINAPI
MediaSeekingImpl_IsFormatSupported(IMediaSeeking
* iface
, const GUID
* pFormat
)
440 TRACE("(%s)\n", qzdebugstr_guid(pFormat
));
442 return (IsEqualIID(pFormat
, &TIME_FORMAT_MEDIA_TIME
) ? S_OK
: S_FALSE
);
445 HRESULT WINAPI
MediaSeekingImpl_QueryPreferredFormat(IMediaSeeking
* iface
, GUID
* pFormat
)
447 TRACE("(%s)\n", qzdebugstr_guid(pFormat
));
449 *pFormat
= TIME_FORMAT_MEDIA_TIME
;
453 HRESULT WINAPI
MediaSeekingImpl_GetTimeFormat(IMediaSeeking
* iface
, GUID
* pFormat
)
455 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
456 TRACE("(%s)\n", qzdebugstr_guid(pFormat
));
458 EnterCriticalSection(This
->crst
);
459 *pFormat
= This
->timeformat
;
460 LeaveCriticalSection(This
->crst
);
465 HRESULT WINAPI
MediaSeekingImpl_IsUsingTimeFormat(IMediaSeeking
* iface
, const GUID
* pFormat
)
467 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
470 TRACE("(%s)\n", qzdebugstr_guid(pFormat
));
472 EnterCriticalSection(This
->crst
);
473 if (!IsEqualIID(pFormat
, &This
->timeformat
))
475 LeaveCriticalSection(This
->crst
);
481 HRESULT WINAPI
MediaSeekingImpl_SetTimeFormat(IMediaSeeking
* iface
, const GUID
* pFormat
)
483 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
484 TRACE("(%s)\n", qzdebugstr_guid(pFormat
));
486 EnterCriticalSection(This
->crst
);
487 ForwardCmdSeek(This
->crst
, This
->pUserData
, fwd_settimeformat
, (LPVOID
)pFormat
);
488 LeaveCriticalSection(This
->crst
);
490 return (IsEqualIID(pFormat
, &TIME_FORMAT_MEDIA_TIME
) ? S_OK
: S_FALSE
);
494 HRESULT WINAPI
MediaSeekingImpl_GetDuration(IMediaSeeking
* iface
, LONGLONG
* pDuration
)
496 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
498 TRACE("(%p)\n", pDuration
);
500 EnterCriticalSection(This
->crst
);
501 *pDuration
= This
->llDuration
;
502 ForwardCmdSeek(This
->crst
, This
->pUserData
, fwd_getduration
, pDuration
);
503 LeaveCriticalSection(This
->crst
);
508 HRESULT WINAPI
MediaSeekingImpl_GetStopPosition(IMediaSeeking
* iface
, LONGLONG
* pStop
)
510 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
512 TRACE("(%p)\n", pStop
);
514 EnterCriticalSection(This
->crst
);
515 *pStop
= This
->llStop
;
516 ForwardCmdSeek(This
->crst
, This
->pUserData
, fwd_getstopposition
, pStop
);
517 LeaveCriticalSection(This
->crst
);
522 /* FIXME: Make use of the info the filter should expose */
523 HRESULT WINAPI
MediaSeekingImpl_GetCurrentPosition(IMediaSeeking
* iface
, LONGLONG
* pCurrent
)
525 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
527 TRACE("(%p)\n", pCurrent
);
529 EnterCriticalSection(This
->crst
);
530 *pCurrent
= This
->llCurrent
;
531 ForwardCmdSeek(This
->crst
, This
->pUserData
, fwd_getcurposition
, pCurrent
);
532 LeaveCriticalSection(This
->crst
);
537 HRESULT WINAPI
MediaSeekingImpl_ConvertTimeFormat(IMediaSeeking
* iface
, LONGLONG
* pTarget
, const GUID
* pTargetFormat
, LONGLONG Source
, const GUID
* pSourceFormat
)
539 if (IsEqualIID(pTargetFormat
, &TIME_FORMAT_MEDIA_TIME
) && IsEqualIID(pSourceFormat
, &TIME_FORMAT_MEDIA_TIME
))
544 /* FIXME: clear pTarget? */
548 static inline LONGLONG
Adjust(LONGLONG value
, const LONGLONG
* pModifier
, DWORD dwFlags
)
550 switch (dwFlags
& AM_SEEKING_PositioningBitsMask
)
552 case AM_SEEKING_NoPositioning
:
554 case AM_SEEKING_AbsolutePositioning
:
556 case AM_SEEKING_RelativePositioning
:
557 case AM_SEEKING_IncrementalPositioning
:
558 return value
+ *pModifier
;
565 HRESULT WINAPI
MediaSeekingImpl_SetPositions(IMediaSeeking
* iface
, LONGLONG
* pCurrent
, DWORD dwCurrentFlags
, LONGLONG
* pStop
, DWORD dwStopFlags
)
567 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
568 BOOL bChangeCurrent
= FALSE
, bChangeStop
= FALSE
;
569 LONGLONG llNewCurrent
, llNewStop
;
570 struct pos_args args
;
572 TRACE("(%p, %x, %p, %x)\n", pCurrent
, dwCurrentFlags
, pStop
, dwStopFlags
);
574 args
.current
= pCurrent
;
576 args
.curflags
= dwCurrentFlags
;
577 args
.stopflags
= dwStopFlags
;
579 EnterCriticalSection(This
->crst
);
581 llNewCurrent
= Adjust(This
->llCurrent
, pCurrent
, dwCurrentFlags
);
582 llNewStop
= Adjust(This
->llStop
, pStop
, dwStopFlags
);
585 bChangeCurrent
= TRUE
;
586 if (llNewStop
!= This
->llStop
)
589 TRACE("Old: %u, New: %u\n", (DWORD
)(This
->llCurrent
/10000000), (DWORD
)(llNewCurrent
/10000000));
591 This
->llCurrent
= llNewCurrent
;
592 This
->llStop
= llNewStop
;
594 if (dwCurrentFlags
& AM_SEEKING_ReturnTime
)
595 *pCurrent
= llNewCurrent
;
596 if (dwStopFlags
& AM_SEEKING_ReturnTime
)
599 ForwardCmdSeek(This
->crst
, This
->pUserData
, fwd_setposition
, &args
);
600 LeaveCriticalSection(This
->crst
);
603 This
->fnChangeCurrent(This
->pUserData
);
605 This
->fnChangeStop(This
->pUserData
);
610 HRESULT WINAPI
MediaSeekingImpl_GetPositions(IMediaSeeking
* iface
, LONGLONG
* pCurrent
, LONGLONG
* pStop
)
612 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
614 TRACE("(%p, %p)\n", pCurrent
, pStop
);
616 EnterCriticalSection(This
->crst
);
617 *pCurrent
= This
->llCurrent
;
618 *pStop
= This
->llStop
;
619 LeaveCriticalSection(This
->crst
);
624 HRESULT WINAPI
MediaSeekingImpl_GetAvailable(IMediaSeeking
* iface
, LONGLONG
* pEarliest
, LONGLONG
* pLatest
)
626 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
628 TRACE("(%p, %p)\n", pEarliest
, pLatest
);
630 EnterCriticalSection(This
->crst
);
632 *pLatest
= This
->llDuration
;
633 LeaveCriticalSection(This
->crst
);
638 HRESULT WINAPI
MediaSeekingImpl_SetRate(IMediaSeeking
* iface
, double dRate
)
640 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
641 BOOL bChangeRate
= (dRate
!= This
->dRate
);
644 TRACE("(%e)\n", dRate
);
646 if (dRate
> 100 || dRate
< .001)
648 FIXME("Excessive rate %e, ignoring\n", dRate
);
649 return VFW_E_UNSUPPORTED_AUDIO
;
652 EnterCriticalSection(This
->crst
);
655 hr
= This
->fnChangeRate(This
->pUserData
);
656 ForwardCmdSeek(This
->crst
, This
->pUserData
, fwd_setrate
, &dRate
);
657 LeaveCriticalSection(This
->crst
);
662 HRESULT WINAPI
MediaSeekingImpl_GetRate(IMediaSeeking
* iface
, double * dRate
)
664 MediaSeekingImpl
*This
= (MediaSeekingImpl
*)iface
;
666 TRACE("(%p)\n", dRate
);
668 EnterCriticalSection(This
->crst
);
670 *dRate
= This
->dRate
;
671 LeaveCriticalSection(This
->crst
);
676 HRESULT WINAPI
MediaSeekingImpl_GetPreroll(IMediaSeeking
* iface
, LONGLONG
* pPreroll
)
678 TRACE("(%p)\n", pPreroll
);
684 static HRESULT WINAPI
MediaSeekingPassThru_QueryInterface(IMediaSeeking
*iface
, REFIID riid
, LPVOID
*ppvObj
)
686 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
688 TRACE("(%p/%p)->(%s (%p), %p)\n", This
, iface
, debugstr_guid(riid
), riid
, ppvObj
);
690 return SeekOuter_QueryInterface(This
, riid
, ppvObj
);
693 static ULONG WINAPI
MediaSeekingPassThru_AddRef(IMediaSeeking
*iface
)
695 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
697 TRACE("(%p/%p)->()\n", iface
, This
);
699 return SeekOuter_AddRef(This
);
702 static ULONG WINAPI
MediaSeekingPassThru_Release(IMediaSeeking
*iface
)
704 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
706 TRACE("(%p/%p)->()\n", iface
, This
);
708 return SeekOuter_Release(This
);
711 static HRESULT WINAPI
MediaSeekingPassThru_GetCapabilities(IMediaSeeking
* iface
, DWORD
* pCapabilities
)
713 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
715 TRACE("(%p/%p)->(%p)\n", iface
, This
, pCapabilities
);
721 static HRESULT WINAPI
MediaSeekingPassThru_CheckCapabilities(IMediaSeeking
* iface
, DWORD
* pCapabilities
)
723 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
725 TRACE("(%p/%p)->(%p)\n", iface
, This
, pCapabilities
);
734 static HRESULT WINAPI
MediaSeekingPassThru_IsFormatSupported(IMediaSeeking
* iface
, const GUID
* pFormat
)
736 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
737 TRACE("(%p/%p)->(%s)\n", iface
, This
, qzdebugstr_guid(pFormat
));
743 static HRESULT WINAPI
MediaSeekingPassThru_QueryPreferredFormat(IMediaSeeking
* iface
, GUID
* pFormat
)
745 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
746 TRACE("(%p/%p)->(%p)\n", iface
, This
, pFormat
);
752 static HRESULT WINAPI
MediaSeekingPassThru_GetTimeFormat(IMediaSeeking
* iface
, GUID
* pFormat
)
754 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
755 TRACE("(%p/%p)->(%p)\n", iface
, This
, pFormat
);
761 static HRESULT WINAPI
MediaSeekingPassThru_IsUsingTimeFormat(IMediaSeeking
* iface
, const GUID
* pFormat
)
763 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
765 TRACE("(%p/%p)->(%s)\n", iface
, This
, qzdebugstr_guid(pFormat
));
772 static HRESULT WINAPI
MediaSeekingPassThru_SetTimeFormat(IMediaSeeking
* iface
, const GUID
* pFormat
)
774 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
775 TRACE("(%p/%p)->(%s)\n", iface
, This
, qzdebugstr_guid(pFormat
));
782 static HRESULT WINAPI
MediaSeekingPassThru_GetDuration(IMediaSeeking
* iface
, LONGLONG
* pDuration
)
784 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
788 TRACE("(%p/%p)->(%p)\n", iface
, This
, pDuration
);
790 IPin_QueryPinInfo(This
->pin
, &info
);
792 hr
= ForwardCmdSeek(NULL
, info
.pFilter
, fwd_getduration
, pDuration
);
793 IBaseFilter_Release(info
.pFilter
);
798 static HRESULT WINAPI
MediaSeekingPassThru_GetStopPosition(IMediaSeeking
* iface
, LONGLONG
* pStop
)
800 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
802 TRACE("(%p/%p)->(%p)\n", iface
, This
, pStop
);
808 /* FIXME: Make use of the info the filter should expose */
809 static HRESULT WINAPI
MediaSeekingPassThru_GetCurrentPosition(IMediaSeeking
* iface
, LONGLONG
* pCurrent
)
811 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
813 TRACE("(%p/%p)->(%p)\n", iface
, This
, pCurrent
);
819 static HRESULT WINAPI
MediaSeekingPassThru_ConvertTimeFormat(IMediaSeeking
* iface
, LONGLONG
* pTarget
, const GUID
* pTargetFormat
, LONGLONG Source
, const GUID
* pSourceFormat
)
821 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
823 TRACE("(%p/%p)->(%p,%s,%x%08x,%s)\n", iface
, This
, pTarget
, debugstr_guid(pTargetFormat
), (DWORD
)(Source
>>32), (DWORD
)Source
, debugstr_guid(pSourceFormat
));
829 static HRESULT WINAPI
MediaSeekingPassThru_SetPositions(IMediaSeeking
* iface
, LONGLONG
* pCurrent
, DWORD dwCurrentFlags
, LONGLONG
* pStop
, DWORD dwStopFlags
)
831 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
832 struct pos_args args
;
836 TRACE("(%p/%p)->(%p, %p)\n", iface
, This
, pCurrent
, pStop
);
837 args
.current
= pCurrent
;
839 args
.curflags
= dwCurrentFlags
;
840 args
.stopflags
= dwStopFlags
;
842 IPin_QueryPinInfo(This
->pin
, &info
);
844 hr
= ForwardCmdSeek(NULL
, info
.pFilter
, fwd_setposition
, &args
);
845 IBaseFilter_Release(info
.pFilter
);
849 static HRESULT WINAPI
MediaSeekingPassThru_GetPositions(IMediaSeeking
* iface
, LONGLONG
* pCurrent
, LONGLONG
* pStop
)
851 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
853 TRACE("(%p/%p)->(%p, %p)\n", iface
, This
, pCurrent
, pStop
);
859 static HRESULT WINAPI
MediaSeekingPassThru_GetAvailable(IMediaSeeking
* iface
, LONGLONG
* pEarliest
, LONGLONG
* pLatest
)
861 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
863 TRACE("(%p/%p)->(%p,%p)\n", iface
, This
, pEarliest
, pLatest
);
869 static HRESULT WINAPI
MediaSeekingPassThru_SetRate(IMediaSeeking
* iface
, double dRate
)
871 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
873 TRACE("(%p/%p)->(%e)\n", iface
, This
, dRate
);
879 static HRESULT WINAPI
MediaSeekingPassThru_GetRate(IMediaSeeking
* iface
, double * dRate
)
881 ICOM_THIS_MULTI(PassThruImpl
, IMediaSeeking_vtbl
, iface
);
883 TRACE("(%p/%p)->(%p)\n", iface
, This
, dRate
);
889 static HRESULT WINAPI
MediaSeekingPassThru_GetPreroll(IMediaSeeking
* iface
, LONGLONG
* pPreroll
)
891 TRACE("(%p)\n", pPreroll
);
897 static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl
=
899 MediaSeekingPassThru_QueryInterface
,
900 MediaSeekingPassThru_AddRef
,
901 MediaSeekingPassThru_Release
,
902 MediaSeekingPassThru_GetCapabilities
,
903 MediaSeekingPassThru_CheckCapabilities
,
904 MediaSeekingPassThru_IsFormatSupported
,
905 MediaSeekingPassThru_QueryPreferredFormat
,
906 MediaSeekingPassThru_GetTimeFormat
,
907 MediaSeekingPassThru_IsUsingTimeFormat
,
908 MediaSeekingPassThru_SetTimeFormat
,
909 MediaSeekingPassThru_GetDuration
,
910 MediaSeekingPassThru_GetStopPosition
,
911 MediaSeekingPassThru_GetCurrentPosition
,
912 MediaSeekingPassThru_ConvertTimeFormat
,
913 MediaSeekingPassThru_SetPositions
,
914 MediaSeekingPassThru_GetPositions
,
915 MediaSeekingPassThru_GetAvailable
,
916 MediaSeekingPassThru_SetRate
,
917 MediaSeekingPassThru_GetRate
,
918 MediaSeekingPassThru_GetPreroll