2 * Implementation of CLSID_SeekingPassThru
4 * FIXME - not tested yet.
6 * hidenori@a2.ctktv.ne.jp
20 #include "debugtools.h"
21 DEFAULT_DEBUG_CHANNEL(quartz
);
23 #include "quartz_private.h"
27 /***************************************************************************
29 * CSeekingPassThru::ISeekingPassThru
34 ISeekingPassThru_fnQueryInterface(ISeekingPassThru
* iface
,REFIID riid
,void** ppobj
)
36 CSeekingPassThru_THIS(iface
,seekpass
);
38 TRACE("(%p)->()\n",This
);
40 return IUnknown_QueryInterface(This
->unk
.punkControl
,riid
,ppobj
);
44 ISeekingPassThru_fnAddRef(ISeekingPassThru
* iface
)
46 CSeekingPassThru_THIS(iface
,seekpass
);
48 TRACE("(%p)->()\n",This
);
50 return IUnknown_AddRef(This
->unk
.punkControl
);
54 ISeekingPassThru_fnRelease(ISeekingPassThru
* iface
)
56 CSeekingPassThru_THIS(iface
,seekpass
);
58 TRACE("(%p)->()\n",This
);
60 return IUnknown_Release(This
->unk
.punkControl
);
64 ISeekingPassThru_fnInit(ISeekingPassThru
* iface
,BOOL bRendering
,IPin
* pPin
)
66 CSeekingPassThru_THIS(iface
,seekpass
);
68 FIXME("(%p)->(%d,%p) not tested!\n",This
,bRendering
,pPin
);
73 /* Why is 'bRendering' given as an argument?? */
74 EnterCriticalSection( &This
->cs
);
76 if ( This
->passthru
.pPin
!= NULL
)
77 IPin_Release( This
->passthru
.pPin
);
78 This
->passthru
.pPin
= pPin
; IPin_AddRef( pPin
);
80 LeaveCriticalSection( &This
->cs
);
86 static ICOM_VTABLE(ISeekingPassThru
) iseekingpassthru
=
88 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
90 ISeekingPassThru_fnQueryInterface
,
91 ISeekingPassThru_fnAddRef
,
92 ISeekingPassThru_fnRelease
,
93 /* ISeekingPassThru fields */
94 ISeekingPassThru_fnInit
,
98 HRESULT
CSeekingPassThru_InitISeekingPassThru(CSeekingPassThru
* This
)
100 TRACE("(%p)\n",This
);
101 ICOM_VTBL(&This
->seekpass
) = &iseekingpassthru
;
102 This
->passthru
.punk
= This
->unk
.punkControl
;
103 This
->passthru
.pPin
= NULL
;
104 InitializeCriticalSection( &This
->cs
);
110 void CSeekingPassThru_UninitISeekingPassThru(CSeekingPassThru
* This
)
112 TRACE("(%p)\n",This
);
113 if ( This
->passthru
.pPin
!= NULL
)
115 IPin_Release( This
->passthru
.pPin
);
116 This
->passthru
.pPin
= NULL
;
118 DeleteCriticalSection( &This
->cs
);
121 /***************************************************************************
123 * new/delete for CLSID_SeekingPassThru.
127 /* can I use offsetof safely? - FIXME? */
128 static QUARTZ_IFEntry IFEntries
[] =
130 { &IID_ISeekingPassThru
, offsetof(CSeekingPassThru
,seekpass
)-offsetof(CSeekingPassThru
,unk
) },
131 { &IID_IMediaPosition
, offsetof(CSeekingPassThru
,passthru
.mpos
)-offsetof(CSeekingPassThru
,unk
) },
132 { &IID_IMediaSeeking
, offsetof(CSeekingPassThru
,passthru
.mseek
)-offsetof(CSeekingPassThru
,unk
) },
136 static void QUARTZ_DestroySeekingPassThru(IUnknown
* punk
)
138 CSeekingPassThru_THIS(punk
,unk
);
140 CSeekingPassThru_UninitISeekingPassThru(This
);
143 HRESULT
QUARTZ_CreateSeekingPassThru(IUnknown
* punkOuter
,void** ppobj
)
145 CSeekingPassThru
* This
;
148 TRACE("(%p,%p)\n",punkOuter
,ppobj
);
150 This
= (CSeekingPassThru
*)QUARTZ_AllocObj( sizeof(CSeekingPassThru
) );
152 return E_OUTOFMEMORY
;
154 QUARTZ_IUnkInit( &This
->unk
, punkOuter
);
155 hr
= CSeekingPassThru_InitISeekingPassThru(This
);
158 QUARTZ_FreeObj( This
);
162 This
->unk
.pEntries
= IFEntries
;
163 This
->unk
.dwEntries
= sizeof(IFEntries
)/sizeof(IFEntries
[0]);
164 This
->unk
.pOnFinalRelease
= QUARTZ_DestroySeekingPassThru
;
166 *ppobj
= (void*)(&This
->unk
);
174 /***************************************************************************
176 * CPassThruImpl Helper methods.
181 HRESULT
CPassThruImpl_GetConnected( CPassThruImpl
* pImpl
, IPin
** ppPin
)
183 return IPin_ConnectedTo( pImpl
->pPin
, ppPin
);
186 HRESULT
CPassThruImpl_QueryPosPass(
187 CPassThruImpl
* pImpl
, IMediaPosition
** ppPosition
)
192 hr
= CPassThruImpl_GetConnected( pImpl
, &pPin
);
195 hr
= IPin_QueryInterface(pPin
,&IID_IMediaPosition
,(void**)ppPosition
);
201 HRESULT
CPassThruImpl_QuerySeekPass(
202 CPassThruImpl
* pImpl
, IMediaSeeking
** ppSeeking
)
207 hr
= CPassThruImpl_GetConnected( pImpl
, &pPin
);
210 hr
= IPin_QueryInterface(pPin
,&IID_IMediaSeeking
,(void**)ppSeeking
);
216 /***************************************************************************
218 * An implementation for CPassThruImpl::IMediaPosition.
223 #define QUERYPOSPASS \
224 IMediaPosition* pPos = NULL; \
226 hr = CPassThruImpl_QueryPosPass( This, &pPos ); \
227 if ( FAILED(hr) ) return hr;
229 static HRESULT WINAPI
230 IMediaPosition_fnQueryInterface(IMediaPosition
* iface
,REFIID riid
,void** ppobj
)
232 CPassThruImpl_THIS(iface
,mpos
);
234 TRACE("(%p)->()\n",This
);
236 return IUnknown_QueryInterface(This
->punk
,riid
,ppobj
);
240 IMediaPosition_fnAddRef(IMediaPosition
* iface
)
242 CPassThruImpl_THIS(iface
,mpos
);
244 TRACE("(%p)->()\n",This
);
246 return IUnknown_AddRef(This
->punk
);
250 IMediaPosition_fnRelease(IMediaPosition
* iface
)
252 CPassThruImpl_THIS(iface
,mpos
);
254 TRACE("(%p)->()\n",This
);
256 return IUnknown_Release(This
->punk
);
259 static HRESULT WINAPI
260 IMediaPosition_fnGetTypeInfoCount(IMediaPosition
* iface
,UINT
* pcTypeInfo
)
262 CPassThruImpl_THIS(iface
,mpos
);
264 FIXME("(%p)->() stub!\n",This
);
269 static HRESULT WINAPI
270 IMediaPosition_fnGetTypeInfo(IMediaPosition
* iface
,UINT iTypeInfo
, LCID lcid
, ITypeInfo
** ppobj
)
272 CPassThruImpl_THIS(iface
,mpos
);
274 FIXME("(%p)->() stub!\n",This
);
279 static HRESULT WINAPI
280 IMediaPosition_fnGetIDsOfNames(IMediaPosition
* iface
,REFIID riid
, LPOLESTR
* ppwszName
, UINT cNames
, LCID lcid
, DISPID
* pDispId
)
282 CPassThruImpl_THIS(iface
,mpos
);
284 FIXME("(%p)->() stub!\n",This
);
289 static HRESULT WINAPI
290 IMediaPosition_fnInvoke(IMediaPosition
* iface
,DISPID DispId
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarRes
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
292 CPassThruImpl_THIS(iface
,mpos
);
294 FIXME("(%p)->() stub!\n",This
);
300 static HRESULT WINAPI
301 IMediaPosition_fnget_Duration(IMediaPosition
* iface
,REFTIME
* prefTime
)
303 CPassThruImpl_THIS(iface
,mpos
);
306 TRACE("(%p)->()\n",This
);
308 return IMediaPosition_get_Duration(pPos
,prefTime
);
311 static HRESULT WINAPI
312 IMediaPosition_fnput_CurrentPosition(IMediaPosition
* iface
,REFTIME refTime
)
314 CPassThruImpl_THIS(iface
,mpos
);
317 TRACE("(%p)->()\n",This
);
319 return IMediaPosition_put_CurrentPosition(pPos
,refTime
);
322 static HRESULT WINAPI
323 IMediaPosition_fnget_CurrentPosition(IMediaPosition
* iface
,REFTIME
* prefTime
)
325 CPassThruImpl_THIS(iface
,mpos
);
328 TRACE("(%p)->()\n",This
);
330 return IMediaPosition_get_CurrentPosition(pPos
,prefTime
);
333 static HRESULT WINAPI
334 IMediaPosition_fnget_StopTime(IMediaPosition
* iface
,REFTIME
* prefTime
)
336 CPassThruImpl_THIS(iface
,mpos
);
339 TRACE("(%p)->()\n",This
);
341 return IMediaPosition_get_StopTime(pPos
,prefTime
);
344 static HRESULT WINAPI
345 IMediaPosition_fnput_StopTime(IMediaPosition
* iface
,REFTIME refTime
)
347 CPassThruImpl_THIS(iface
,mpos
);
350 TRACE("(%p)->()\n",This
);
352 return IMediaPosition_put_StopTime(pPos
,refTime
);
355 static HRESULT WINAPI
356 IMediaPosition_fnget_PrerollTime(IMediaPosition
* iface
,REFTIME
* prefTime
)
358 CPassThruImpl_THIS(iface
,mpos
);
361 TRACE("(%p)->()\n",This
);
363 return IMediaPosition_get_PrerollTime(pPos
,prefTime
);
366 static HRESULT WINAPI
367 IMediaPosition_fnput_PrerollTime(IMediaPosition
* iface
,REFTIME refTime
)
369 CPassThruImpl_THIS(iface
,mpos
);
372 TRACE("(%p)->()\n",This
);
374 return IMediaPosition_put_PrerollTime(pPos
,refTime
);
377 static HRESULT WINAPI
378 IMediaPosition_fnput_Rate(IMediaPosition
* iface
,double dblRate
)
380 CPassThruImpl_THIS(iface
,mpos
);
383 TRACE("(%p)->()\n",This
);
385 return IMediaPosition_put_Rate(pPos
,dblRate
);
388 static HRESULT WINAPI
389 IMediaPosition_fnget_Rate(IMediaPosition
* iface
,double* pdblRate
)
391 CPassThruImpl_THIS(iface
,mpos
);
394 TRACE("(%p)->()\n",This
);
396 return IMediaPosition_get_Rate(pPos
,pdblRate
);
399 static HRESULT WINAPI
400 IMediaPosition_fnCanSeekForward(IMediaPosition
* iface
,LONG
* pCanSeek
)
402 CPassThruImpl_THIS(iface
,mpos
);
405 TRACE("(%p)->()\n",This
);
407 return IMediaPosition_CanSeekForward(pPos
,pCanSeek
);
410 static HRESULT WINAPI
411 IMediaPosition_fnCanSeekBackward(IMediaPosition
* iface
,LONG
* pCanSeek
)
413 CPassThruImpl_THIS(iface
,mpos
);
416 TRACE("(%p)->()\n",This
);
418 return IMediaPosition_CanSeekBackward(pPos
,pCanSeek
);
422 static ICOM_VTABLE(IMediaPosition
) impos
=
424 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
425 /* IUnknown fields */
426 IMediaPosition_fnQueryInterface
,
427 IMediaPosition_fnAddRef
,
428 IMediaPosition_fnRelease
,
429 /* IDispatch fields */
430 IMediaPosition_fnGetTypeInfoCount
,
431 IMediaPosition_fnGetTypeInfo
,
432 IMediaPosition_fnGetIDsOfNames
,
433 IMediaPosition_fnInvoke
,
434 /* IMediaPosition fields */
435 IMediaPosition_fnget_Duration
,
436 IMediaPosition_fnput_CurrentPosition
,
437 IMediaPosition_fnget_CurrentPosition
,
438 IMediaPosition_fnget_StopTime
,
439 IMediaPosition_fnput_StopTime
,
440 IMediaPosition_fnget_PrerollTime
,
441 IMediaPosition_fnput_PrerollTime
,
442 IMediaPosition_fnput_Rate
,
443 IMediaPosition_fnget_Rate
,
444 IMediaPosition_fnCanSeekForward
,
445 IMediaPosition_fnCanSeekBackward
,
449 HRESULT
CPassThruImpl_InitIMediaPosition( CPassThruImpl
* pImpl
)
451 TRACE("(%p)\n",pImpl
);
452 ICOM_VTBL(&pImpl
->mpos
) = &impos
;
457 void CPassThruImpl_UninitIMediaPosition( CPassThruImpl
* pImpl
)
459 TRACE("(%p)\n",pImpl
);
465 /***************************************************************************
467 * An implementation for CPassThruImpl::IMediaSeeking.
471 #define QUERYSEEKPASS \
472 IMediaSeeking* pSeek = NULL; \
474 hr = CPassThruImpl_QuerySeekPass( This, &pSeek ); \
475 if ( FAILED(hr) ) return hr;
478 static HRESULT WINAPI
479 IMediaSeeking_fnQueryInterface(IMediaSeeking
* iface
,REFIID riid
,void** ppobj
)
481 CPassThruImpl_THIS(iface
,mseek
);
483 TRACE("(%p)->()\n",This
);
485 return IUnknown_QueryInterface(This
->punk
,riid
,ppobj
);
489 IMediaSeeking_fnAddRef(IMediaSeeking
* iface
)
491 CPassThruImpl_THIS(iface
,mseek
);
493 TRACE("(%p)->()\n",This
);
495 return IUnknown_AddRef(This
->punk
);
499 IMediaSeeking_fnRelease(IMediaSeeking
* iface
)
501 CPassThruImpl_THIS(iface
,mseek
);
503 TRACE("(%p)->()\n",This
);
505 return IUnknown_Release(This
->punk
);
509 static HRESULT WINAPI
510 IMediaSeeking_fnGetCapabilities(IMediaSeeking
* iface
,DWORD
* pdwCaps
)
512 CPassThruImpl_THIS(iface
,mseek
);
515 TRACE("(%p)->()\n",This
);
517 return IMediaSeeking_GetCapabilities(pSeek
,pdwCaps
);
520 static HRESULT WINAPI
521 IMediaSeeking_fnCheckCapabilities(IMediaSeeking
* iface
,DWORD
* pdwCaps
)
523 CPassThruImpl_THIS(iface
,mseek
);
526 TRACE("(%p)->()\n",This
);
528 return IMediaSeeking_CheckCapabilities(pSeek
,pdwCaps
);
531 static HRESULT WINAPI
532 IMediaSeeking_fnIsFormatSupported(IMediaSeeking
* iface
,const GUID
* pidFormat
)
534 CPassThruImpl_THIS(iface
,mseek
);
537 TRACE("(%p)->()\n",This
);
539 return IMediaSeeking_IsFormatSupported(pSeek
,pidFormat
);
542 static HRESULT WINAPI
543 IMediaSeeking_fnQueryPreferredFormat(IMediaSeeking
* iface
,GUID
* pidFormat
)
545 CPassThruImpl_THIS(iface
,mseek
);
548 TRACE("(%p)->()\n",This
);
550 return IMediaSeeking_QueryPreferredFormat(pSeek
,pidFormat
);
553 static HRESULT WINAPI
554 IMediaSeeking_fnGetTimeFormat(IMediaSeeking
* iface
,GUID
* pidFormat
)
556 CPassThruImpl_THIS(iface
,mseek
);
559 TRACE("(%p)->()\n",This
);
561 return IMediaSeeking_GetTimeFormat(pSeek
,pidFormat
);
564 static HRESULT WINAPI
565 IMediaSeeking_fnIsUsingTimeFormat(IMediaSeeking
* iface
,const GUID
* pidFormat
)
567 CPassThruImpl_THIS(iface
,mseek
);
570 TRACE("(%p)->()\n",This
);
572 return IMediaSeeking_IsUsingTimeFormat(pSeek
,pidFormat
);
575 static HRESULT WINAPI
576 IMediaSeeking_fnSetTimeFormat(IMediaSeeking
* iface
,const GUID
* pidFormat
)
578 CPassThruImpl_THIS(iface
,mseek
);
581 TRACE("(%p)->()\n",This
);
583 return IMediaSeeking_SetTimeFormat(pSeek
,pidFormat
);
586 static HRESULT WINAPI
587 IMediaSeeking_fnGetDuration(IMediaSeeking
* iface
,LONGLONG
* pllDuration
)
589 CPassThruImpl_THIS(iface
,mseek
);
592 TRACE("(%p)->()\n",This
);
594 return IMediaSeeking_GetDuration(pSeek
,pllDuration
);
597 static HRESULT WINAPI
598 IMediaSeeking_fnGetStopPosition(IMediaSeeking
* iface
,LONGLONG
* pllPos
)
600 CPassThruImpl_THIS(iface
,mseek
);
603 TRACE("(%p)->()\n",This
);
605 return IMediaSeeking_GetStopPosition(pSeek
,pllPos
);
608 static HRESULT WINAPI
609 IMediaSeeking_fnGetCurrentPosition(IMediaSeeking
* iface
,LONGLONG
* pllPos
)
611 CPassThruImpl_THIS(iface
,mseek
);
614 TRACE("(%p)->()\n",This
);
616 return IMediaSeeking_GetCurrentPosition(pSeek
,pllPos
);
619 static HRESULT WINAPI
620 IMediaSeeking_fnConvertTimeFormat(IMediaSeeking
* iface
,LONGLONG
* pllOut
,const GUID
* pidFmtOut
,LONGLONG llIn
,const GUID
* pidFmtIn
)
622 CPassThruImpl_THIS(iface
,mseek
);
625 TRACE("(%p)->()\n",This
);
627 return IMediaSeeking_ConvertTimeFormat(pSeek
,pllOut
,pidFmtOut
,llIn
,pidFmtIn
);
630 static HRESULT WINAPI
631 IMediaSeeking_fnSetPositions(IMediaSeeking
* iface
,LONGLONG
* pllCur
,DWORD dwCurFlags
,LONGLONG
* pllStop
,DWORD dwStopFlags
)
633 CPassThruImpl_THIS(iface
,mseek
);
636 TRACE("(%p)->()\n",This
);
638 return IMediaSeeking_SetPositions(pSeek
,pllCur
,dwCurFlags
,pllStop
,dwStopFlags
);
641 static HRESULT WINAPI
642 IMediaSeeking_fnGetPositions(IMediaSeeking
* iface
,LONGLONG
* pllCur
,LONGLONG
* pllStop
)
644 CPassThruImpl_THIS(iface
,mseek
);
647 TRACE("(%p)->()\n",This
);
649 return IMediaSeeking_GetPositions(pSeek
,pllCur
,pllStop
);
652 static HRESULT WINAPI
653 IMediaSeeking_fnGetAvailable(IMediaSeeking
* iface
,LONGLONG
* pllFirst
,LONGLONG
* pllLast
)
655 CPassThruImpl_THIS(iface
,mseek
);
658 TRACE("(%p)->()\n",This
);
660 return IMediaSeeking_GetAvailable(pSeek
,pllFirst
,pllLast
);
663 static HRESULT WINAPI
664 IMediaSeeking_fnSetRate(IMediaSeeking
* iface
,double dblRate
)
666 CPassThruImpl_THIS(iface
,mseek
);
669 TRACE("(%p)->()\n",This
);
671 return IMediaSeeking_SetRate(pSeek
,dblRate
);
674 static HRESULT WINAPI
675 IMediaSeeking_fnGetRate(IMediaSeeking
* iface
,double* pdblRate
)
677 CPassThruImpl_THIS(iface
,mseek
);
680 TRACE("(%p)->()\n",This
);
682 return IMediaSeeking_GetRate(pSeek
,pdblRate
);
685 static HRESULT WINAPI
686 IMediaSeeking_fnGetPreroll(IMediaSeeking
* iface
,LONGLONG
* pllPreroll
)
688 CPassThruImpl_THIS(iface
,mseek
);
691 TRACE("(%p)->()\n",This
);
693 return IMediaSeeking_GetPreroll(pSeek
,pllPreroll
);
699 static ICOM_VTABLE(IMediaSeeking
) imseek
=
701 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
702 /* IUnknown fields */
703 IMediaSeeking_fnQueryInterface
,
704 IMediaSeeking_fnAddRef
,
705 IMediaSeeking_fnRelease
,
706 /* IMediaSeeking fields */
707 IMediaSeeking_fnGetCapabilities
,
708 IMediaSeeking_fnCheckCapabilities
,
709 IMediaSeeking_fnIsFormatSupported
,
710 IMediaSeeking_fnQueryPreferredFormat
,
711 IMediaSeeking_fnGetTimeFormat
,
712 IMediaSeeking_fnIsUsingTimeFormat
,
713 IMediaSeeking_fnSetTimeFormat
,
714 IMediaSeeking_fnGetDuration
,
715 IMediaSeeking_fnGetStopPosition
,
716 IMediaSeeking_fnGetCurrentPosition
,
717 IMediaSeeking_fnConvertTimeFormat
,
718 IMediaSeeking_fnSetPositions
,
719 IMediaSeeking_fnGetPositions
,
720 IMediaSeeking_fnGetAvailable
,
721 IMediaSeeking_fnSetRate
,
722 IMediaSeeking_fnGetRate
,
723 IMediaSeeking_fnGetPreroll
,
728 HRESULT
CPassThruImpl_InitIMediaSeeking( CPassThruImpl
* pImpl
)
730 TRACE("(%p)\n",pImpl
);
731 ICOM_VTBL(&pImpl
->mseek
) = &imseek
;
736 void CPassThruImpl_UninitIMediaSeeking( CPassThruImpl
* pImpl
)
738 TRACE("(%p)\n",pImpl
);