Fixed some bugs.
[wine] / dlls / quartz / seekpass.c
1 /*
2  *      Implementation of CLSID_SeekingPassThru
3  *
4  *      FIXME - not tested yet.
5  *
6  * hidenori@a2.ctktv.ne.jp
7  */
8
9 #include "config.h"
10
11 #include "windef.h"
12 #include "winbase.h"
13 #include "wingdi.h"
14 #include "winuser.h"
15 #include "winerror.h"
16 #include "strmif.h"
17 #include "control.h"
18 #include "uuids.h"
19
20 #include "debugtools.h"
21 DEFAULT_DEBUG_CHANNEL(quartz);
22
23 #include "quartz_private.h"
24 #include "seekpass.h"
25
26
27 /***************************************************************************
28  *
29  *      CSeekingPassThru::ISeekingPassThru
30  *
31  */
32
33 static HRESULT WINAPI
34 ISeekingPassThru_fnQueryInterface(ISeekingPassThru* iface,REFIID riid,void** ppobj)
35 {
36         CSeekingPassThru_THIS(iface,seekpass);
37
38         TRACE("(%p)->()\n",This);
39
40         return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
41 }
42
43 static ULONG WINAPI
44 ISeekingPassThru_fnAddRef(ISeekingPassThru* iface)
45 {
46         CSeekingPassThru_THIS(iface,seekpass);
47
48         TRACE("(%p)->()\n",This);
49
50         return IUnknown_AddRef(This->unk.punkControl);
51 }
52
53 static ULONG WINAPI
54 ISeekingPassThru_fnRelease(ISeekingPassThru* iface)
55 {
56         CSeekingPassThru_THIS(iface,seekpass);
57
58         TRACE("(%p)->()\n",This);
59
60         return IUnknown_Release(This->unk.punkControl);
61 }
62
63 static HRESULT WINAPI
64 ISeekingPassThru_fnInit(ISeekingPassThru* iface,BOOL bRendering,IPin* pPin)
65 {
66         CSeekingPassThru_THIS(iface,seekpass);
67
68         FIXME("(%p)->(%d,%p) not tested!\n",This,bRendering,pPin);
69
70         if ( pPin == NULL )
71                 return E_POINTER;
72
73         /* Why is 'bRendering' given as an argument?? */
74         EnterCriticalSection( &This->cs );
75
76         if ( This->passthru.pPin != NULL )
77                 IPin_Release( This->passthru.pPin );
78         This->passthru.pPin = pPin; IPin_AddRef( pPin );
79
80         LeaveCriticalSection( &This->cs );
81
82         return NOERROR;
83 }
84
85
86 static ICOM_VTABLE(ISeekingPassThru) iseekingpassthru =
87 {
88         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
89         /* IUnknown fields */
90         ISeekingPassThru_fnQueryInterface,
91         ISeekingPassThru_fnAddRef,
92         ISeekingPassThru_fnRelease,
93         /* ISeekingPassThru fields */
94         ISeekingPassThru_fnInit,
95 };
96
97 static
98 HRESULT CSeekingPassThru_InitISeekingPassThru(CSeekingPassThru* This)
99 {
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 );
105
106         return NOERROR;
107 }
108
109 static
110 void CSeekingPassThru_UninitISeekingPassThru(CSeekingPassThru* This)
111 {
112         TRACE("(%p)\n",This);
113         if ( This->passthru.pPin != NULL )
114         {
115                 IPin_Release( This->passthru.pPin );
116                 This->passthru.pPin = NULL;
117         }
118         DeleteCriticalSection( &This->cs );
119 }
120
121 /***************************************************************************
122  *
123  *      new/delete for CLSID_SeekingPassThru.
124  *
125  */
126
127 /* can I use offsetof safely? - FIXME? */
128 static QUARTZ_IFEntry IFEntries[] =
129 {
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) },
133 };
134
135
136 static void QUARTZ_DestroySeekingPassThru(IUnknown* punk)
137 {
138         CSeekingPassThru_THIS(punk,unk);
139
140         TRACE("(%p)\n",This);
141
142         CPassThruImpl_UninitIMediaSeeking( &This->passthru );
143         CPassThruImpl_UninitIMediaPosition( &This->passthru );
144         CSeekingPassThru_UninitISeekingPassThru(This);
145 }
146
147 HRESULT QUARTZ_CreateSeekingPassThru(IUnknown* punkOuter,void** ppobj)
148 {
149         HRESULT hr;
150         CSeekingPassThru*       This;
151
152         TRACE("(%p,%p)\n",punkOuter,ppobj);
153
154         hr = QUARTZ_CreateSeekingPassThruInternal(punkOuter,&This,FALSE,NULL);
155         if ( hr != S_OK )
156                 return hr;
157
158         ppobj = (void*)(&This->unk);
159
160         return NOERROR;
161 }
162
163 HRESULT QUARTZ_CreateSeekingPassThruInternal(IUnknown* punkOuter,CSeekingPassThru** ppobj,BOOL bRendering,IPin* pPin)
164 {
165         CSeekingPassThru*       This;
166         HRESULT hr;
167
168         TRACE("(%p,%p,%d,%p)\n",punkOuter,ppobj,(int)bRendering,pPin);
169
170         This = (CSeekingPassThru*)QUARTZ_AllocObj( sizeof(CSeekingPassThru) );
171         if ( This == NULL )
172                 return E_OUTOFMEMORY;
173
174         QUARTZ_IUnkInit( &This->unk, punkOuter );
175         hr = CSeekingPassThru_InitISeekingPassThru(This);
176         if ( SUCCEEDED(hr) )
177         {
178                 hr = CPassThruImpl_InitIMediaPosition( &This->passthru );
179                 if ( SUCCEEDED(hr) )
180                 {
181                         hr = CPassThruImpl_InitIMediaSeeking( &This->passthru );
182                         if ( FAILED(hr) )
183                         {
184                                 CPassThruImpl_UninitIMediaPosition( &This->passthru );
185                         }
186                 }
187                 else
188                 {
189                         CSeekingPassThru_UninitISeekingPassThru(This);
190                 }
191         }
192
193         if ( FAILED(hr) )
194         {
195                 QUARTZ_FreeObj( This );
196                 return hr;
197         }
198
199         This->unk.pEntries = IFEntries;
200         This->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
201         This->unk.pOnFinalRelease = QUARTZ_DestroySeekingPassThru;
202
203         *ppobj = This;
204
205         if ( pPin != NULL )
206         {
207                 hr = ISeekingPassThru_Init((ISeekingPassThru*)(&This->seekpass),bRendering,pPin);
208                 if ( FAILED(hr) )
209                 {
210                         IUnknown_Release(This->unk.punkControl);
211                         return hr;
212                 }
213         }
214
215         return S_OK;
216 }
217
218
219
220
221 /***************************************************************************
222  *
223  *      CPassThruImpl Helper methods.
224  *
225  */
226
227 static
228 HRESULT CPassThruImpl_GetConnected( CPassThruImpl* pImpl, IPin** ppPin )
229 {
230         return IPin_ConnectedTo( pImpl->pPin, ppPin );
231 }
232
233 HRESULT CPassThruImpl_QueryPosPass(
234         CPassThruImpl* pImpl, IMediaPosition** ppPosition )
235 {
236         IPin*   pPin;
237         HRESULT hr;
238
239         hr = CPassThruImpl_GetConnected( pImpl, &pPin );
240         if ( FAILED(hr) )
241                 return hr;
242         hr = IPin_QueryInterface(pPin,&IID_IMediaPosition,(void**)ppPosition);
243         IPin_Release(pPin);
244
245         return hr;
246 }
247
248 HRESULT CPassThruImpl_QuerySeekPass(
249         CPassThruImpl* pImpl, IMediaSeeking** ppSeeking )
250 {
251         IPin*   pPin;
252         HRESULT hr;
253
254         hr = CPassThruImpl_GetConnected( pImpl, &pPin );
255         if ( FAILED(hr) )
256                 return hr;
257         hr = IPin_QueryInterface(pPin,&IID_IMediaSeeking,(void**)ppSeeking);
258         IPin_Release(pPin);
259
260         return hr;
261 }
262
263 /***************************************************************************
264  *
265  *      An implementation for CPassThruImpl::IMediaPosition.
266  *
267  */
268
269
270 #define QUERYPOSPASS \
271         IMediaPosition* pPos = NULL; \
272         HRESULT hr; \
273         hr = CPassThruImpl_QueryPosPass( This, &pPos ); \
274         if ( FAILED(hr) ) return hr;
275
276 static HRESULT WINAPI
277 IMediaPosition_fnQueryInterface(IMediaPosition* iface,REFIID riid,void** ppobj)
278 {
279         CPassThruImpl_THIS(iface,mpos);
280
281         TRACE("(%p)->()\n",This);
282
283         return IUnknown_QueryInterface(This->punk,riid,ppobj);
284 }
285
286 static ULONG WINAPI
287 IMediaPosition_fnAddRef(IMediaPosition* iface)
288 {
289         CPassThruImpl_THIS(iface,mpos);
290
291         TRACE("(%p)->()\n",This);
292
293         return IUnknown_AddRef(This->punk);
294 }
295
296 static ULONG WINAPI
297 IMediaPosition_fnRelease(IMediaPosition* iface)
298 {
299         CPassThruImpl_THIS(iface,mpos);
300
301         TRACE("(%p)->()\n",This);
302
303         return IUnknown_Release(This->punk);
304 }
305
306 static HRESULT WINAPI
307 IMediaPosition_fnGetTypeInfoCount(IMediaPosition* iface,UINT* pcTypeInfo)
308 {
309         CPassThruImpl_THIS(iface,mpos);
310
311         FIXME("(%p)->() stub!\n",This);
312
313         return E_NOTIMPL;
314 }
315
316 static HRESULT WINAPI
317 IMediaPosition_fnGetTypeInfo(IMediaPosition* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
318 {
319         CPassThruImpl_THIS(iface,mpos);
320
321         FIXME("(%p)->() stub!\n",This);
322
323         return E_NOTIMPL;
324 }
325
326 static HRESULT WINAPI
327 IMediaPosition_fnGetIDsOfNames(IMediaPosition* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
328 {
329         CPassThruImpl_THIS(iface,mpos);
330
331         FIXME("(%p)->() stub!\n",This);
332
333         return E_NOTIMPL;
334 }
335
336 static HRESULT WINAPI
337 IMediaPosition_fnInvoke(IMediaPosition* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
338 {
339         CPassThruImpl_THIS(iface,mpos);
340
341         FIXME("(%p)->() stub!\n",This);
342
343         return E_NOTIMPL;
344 }
345
346
347 static HRESULT WINAPI
348 IMediaPosition_fnget_Duration(IMediaPosition* iface,REFTIME* prefTime)
349 {
350         CPassThruImpl_THIS(iface,mpos);
351         QUERYPOSPASS
352
353         TRACE("(%p)->()\n",This);
354
355         hr = IMediaPosition_get_Duration(pPos,prefTime);
356         IMediaPosition_Release(pPos);
357         return hr;
358 }
359
360 static HRESULT WINAPI
361 IMediaPosition_fnput_CurrentPosition(IMediaPosition* iface,REFTIME refTime)
362 {
363         CPassThruImpl_THIS(iface,mpos);
364         QUERYPOSPASS
365
366         TRACE("(%p)->()\n",This);
367
368         hr = IMediaPosition_put_CurrentPosition(pPos,refTime);
369         IMediaPosition_Release(pPos);
370         return hr;
371 }
372
373 static HRESULT WINAPI
374 IMediaPosition_fnget_CurrentPosition(IMediaPosition* iface,REFTIME* prefTime)
375 {
376         CPassThruImpl_THIS(iface,mpos);
377         QUERYPOSPASS
378
379         TRACE("(%p)->()\n",This);
380
381         hr = IMediaPosition_get_CurrentPosition(pPos,prefTime);
382         IMediaPosition_Release(pPos);
383         return hr;
384 }
385
386 static HRESULT WINAPI
387 IMediaPosition_fnget_StopTime(IMediaPosition* iface,REFTIME* prefTime)
388 {
389         CPassThruImpl_THIS(iface,mpos);
390         QUERYPOSPASS
391
392         TRACE("(%p)->()\n",This);
393
394         hr = IMediaPosition_get_StopTime(pPos,prefTime);
395         IMediaPosition_Release(pPos);
396         return hr;
397 }
398
399 static HRESULT WINAPI
400 IMediaPosition_fnput_StopTime(IMediaPosition* iface,REFTIME refTime)
401 {
402         CPassThruImpl_THIS(iface,mpos);
403         QUERYPOSPASS
404
405         TRACE("(%p)->()\n",This);
406
407         hr = IMediaPosition_put_StopTime(pPos,refTime);
408         IMediaPosition_Release(pPos);
409         return hr;
410 }
411
412 static HRESULT WINAPI
413 IMediaPosition_fnget_PrerollTime(IMediaPosition* iface,REFTIME* prefTime)
414 {
415         CPassThruImpl_THIS(iface,mpos);
416         QUERYPOSPASS
417
418         TRACE("(%p)->()\n",This);
419
420         hr = IMediaPosition_get_PrerollTime(pPos,prefTime);
421         IMediaPosition_Release(pPos);
422         return hr;
423 }
424
425 static HRESULT WINAPI
426 IMediaPosition_fnput_PrerollTime(IMediaPosition* iface,REFTIME refTime)
427 {
428         CPassThruImpl_THIS(iface,mpos);
429         QUERYPOSPASS
430
431         TRACE("(%p)->()\n",This);
432
433         hr = IMediaPosition_put_PrerollTime(pPos,refTime);
434         IMediaPosition_Release(pPos);
435         return hr;
436 }
437
438 static HRESULT WINAPI
439 IMediaPosition_fnput_Rate(IMediaPosition* iface,double dblRate)
440 {
441         CPassThruImpl_THIS(iface,mpos);
442         QUERYPOSPASS
443
444         TRACE("(%p)->()\n",This);
445
446         hr = IMediaPosition_put_Rate(pPos,dblRate);
447         IMediaPosition_Release(pPos);
448         return hr;
449 }
450
451 static HRESULT WINAPI
452 IMediaPosition_fnget_Rate(IMediaPosition* iface,double* pdblRate)
453 {
454         CPassThruImpl_THIS(iface,mpos);
455         QUERYPOSPASS
456
457         TRACE("(%p)->()\n",This);
458
459         hr = IMediaPosition_get_Rate(pPos,pdblRate);
460         IMediaPosition_Release(pPos);
461         return hr;
462 }
463
464 static HRESULT WINAPI
465 IMediaPosition_fnCanSeekForward(IMediaPosition* iface,LONG* pCanSeek)
466 {
467         CPassThruImpl_THIS(iface,mpos);
468         QUERYPOSPASS
469
470         TRACE("(%p)->()\n",This);
471
472         hr = IMediaPosition_CanSeekForward(pPos,pCanSeek);
473         IMediaPosition_Release(pPos);
474         return hr;
475 }
476
477 static HRESULT WINAPI
478 IMediaPosition_fnCanSeekBackward(IMediaPosition* iface,LONG* pCanSeek)
479 {
480         CPassThruImpl_THIS(iface,mpos);
481         QUERYPOSPASS
482
483         TRACE("(%p)->()\n",This);
484
485         hr = IMediaPosition_CanSeekBackward(pPos,pCanSeek);
486         IMediaPosition_Release(pPos);
487         return hr;
488 }
489
490
491 static ICOM_VTABLE(IMediaPosition) impos =
492 {
493         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
494         /* IUnknown fields */
495         IMediaPosition_fnQueryInterface,
496         IMediaPosition_fnAddRef,
497         IMediaPosition_fnRelease,
498         /* IDispatch fields */
499         IMediaPosition_fnGetTypeInfoCount,
500         IMediaPosition_fnGetTypeInfo,
501         IMediaPosition_fnGetIDsOfNames,
502         IMediaPosition_fnInvoke,
503         /* IMediaPosition fields */
504         IMediaPosition_fnget_Duration,
505         IMediaPosition_fnput_CurrentPosition,
506         IMediaPosition_fnget_CurrentPosition,
507         IMediaPosition_fnget_StopTime,
508         IMediaPosition_fnput_StopTime,
509         IMediaPosition_fnget_PrerollTime,
510         IMediaPosition_fnput_PrerollTime,
511         IMediaPosition_fnput_Rate,
512         IMediaPosition_fnget_Rate,
513         IMediaPosition_fnCanSeekForward,
514         IMediaPosition_fnCanSeekBackward,
515 };
516
517
518 HRESULT CPassThruImpl_InitIMediaPosition( CPassThruImpl* pImpl )
519 {
520         TRACE("(%p)\n",pImpl);
521         ICOM_VTBL(&pImpl->mpos) = &impos;
522
523         return NOERROR;
524 }
525
526 void CPassThruImpl_UninitIMediaPosition( CPassThruImpl* pImpl )
527 {
528         TRACE("(%p)\n",pImpl);
529 }
530
531 #undef QUERYPOSPASS
532
533
534 /***************************************************************************
535  *
536  *      An implementation for CPassThruImpl::IMediaSeeking.
537  *
538  */
539
540 #define QUERYSEEKPASS \
541         IMediaSeeking* pSeek = NULL; \
542         HRESULT hr; \
543         hr = CPassThruImpl_QuerySeekPass( This, &pSeek ); \
544         if ( FAILED(hr) ) return hr;
545
546
547 static HRESULT WINAPI
548 IMediaSeeking_fnQueryInterface(IMediaSeeking* iface,REFIID riid,void** ppobj)
549 {
550         CPassThruImpl_THIS(iface,mseek);
551
552         TRACE("(%p)->()\n",This);
553
554         return IUnknown_QueryInterface(This->punk,riid,ppobj);
555 }
556
557 static ULONG WINAPI
558 IMediaSeeking_fnAddRef(IMediaSeeking* iface)
559 {
560         CPassThruImpl_THIS(iface,mseek);
561
562         TRACE("(%p)->()\n",This);
563
564         return IUnknown_AddRef(This->punk);
565 }
566
567 static ULONG WINAPI
568 IMediaSeeking_fnRelease(IMediaSeeking* iface)
569 {
570         CPassThruImpl_THIS(iface,mseek);
571
572         TRACE("(%p)->()\n",This);
573
574         return IUnknown_Release(This->punk);
575 }
576
577
578 static HRESULT WINAPI
579 IMediaSeeking_fnGetCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
580 {
581         CPassThruImpl_THIS(iface,mseek);
582         QUERYSEEKPASS
583
584         TRACE("(%p)->()\n",This);
585
586         hr = IMediaSeeking_GetCapabilities(pSeek,pdwCaps);
587         IMediaSeeking_Release(pSeek);
588         return hr;
589 }
590
591 static HRESULT WINAPI
592 IMediaSeeking_fnCheckCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
593 {
594         CPassThruImpl_THIS(iface,mseek);
595         QUERYSEEKPASS
596
597         TRACE("(%p)->()\n",This);
598
599         hr = IMediaSeeking_CheckCapabilities(pSeek,pdwCaps);
600         IMediaSeeking_Release(pSeek);
601         return hr;
602 }
603
604 static HRESULT WINAPI
605 IMediaSeeking_fnIsFormatSupported(IMediaSeeking* iface,const GUID* pidFormat)
606 {
607         CPassThruImpl_THIS(iface,mseek);
608         QUERYSEEKPASS
609
610         TRACE("(%p)->()\n",This);
611
612         hr = IMediaSeeking_IsFormatSupported(pSeek,pidFormat);
613         IMediaSeeking_Release(pSeek);
614         return hr;
615 }
616
617 static HRESULT WINAPI
618 IMediaSeeking_fnQueryPreferredFormat(IMediaSeeking* iface,GUID* pidFormat)
619 {
620         CPassThruImpl_THIS(iface,mseek);
621         QUERYSEEKPASS
622
623         TRACE("(%p)->()\n",This);
624
625         hr = IMediaSeeking_QueryPreferredFormat(pSeek,pidFormat);
626         IMediaSeeking_Release(pSeek);
627         return hr;
628 }
629
630 static HRESULT WINAPI
631 IMediaSeeking_fnGetTimeFormat(IMediaSeeking* iface,GUID* pidFormat)
632 {
633         CPassThruImpl_THIS(iface,mseek);
634         QUERYSEEKPASS
635
636         TRACE("(%p)->()\n",This);
637
638         hr = IMediaSeeking_GetTimeFormat(pSeek,pidFormat);
639         IMediaSeeking_Release(pSeek);
640         return hr;
641 }
642
643 static HRESULT WINAPI
644 IMediaSeeking_fnIsUsingTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
645 {
646         CPassThruImpl_THIS(iface,mseek);
647         QUERYSEEKPASS
648
649         TRACE("(%p)->()\n",This);
650
651         hr = IMediaSeeking_IsUsingTimeFormat(pSeek,pidFormat);
652         IMediaSeeking_Release(pSeek);
653         return hr;
654 }
655
656 static HRESULT WINAPI
657 IMediaSeeking_fnSetTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
658 {
659         CPassThruImpl_THIS(iface,mseek);
660         QUERYSEEKPASS
661
662         TRACE("(%p)->()\n",This);
663
664         hr = IMediaSeeking_SetTimeFormat(pSeek,pidFormat);
665         IMediaSeeking_Release(pSeek);
666         return hr;
667 }
668
669 static HRESULT WINAPI
670 IMediaSeeking_fnGetDuration(IMediaSeeking* iface,LONGLONG* pllDuration)
671 {
672         CPassThruImpl_THIS(iface,mseek);
673         QUERYSEEKPASS
674
675         TRACE("(%p)->()\n",This);
676
677         hr = IMediaSeeking_GetDuration(pSeek,pllDuration);
678         IMediaSeeking_Release(pSeek);
679         return hr;
680 }
681
682 static HRESULT WINAPI
683 IMediaSeeking_fnGetStopPosition(IMediaSeeking* iface,LONGLONG* pllPos)
684 {
685         CPassThruImpl_THIS(iface,mseek);
686         QUERYSEEKPASS
687
688         TRACE("(%p)->()\n",This);
689
690         hr = IMediaSeeking_GetStopPosition(pSeek,pllPos);
691         IMediaSeeking_Release(pSeek);
692         return hr;
693 }
694
695 static HRESULT WINAPI
696 IMediaSeeking_fnGetCurrentPosition(IMediaSeeking* iface,LONGLONG* pllPos)
697 {
698         CPassThruImpl_THIS(iface,mseek);
699         QUERYSEEKPASS
700
701         TRACE("(%p)->()\n",This);
702
703         hr = IMediaSeeking_GetCurrentPosition(pSeek,pllPos);
704         IMediaSeeking_Release(pSeek);
705         return hr;
706 }
707
708 static HRESULT WINAPI
709 IMediaSeeking_fnConvertTimeFormat(IMediaSeeking* iface,LONGLONG* pllOut,const GUID* pidFmtOut,LONGLONG llIn,const GUID* pidFmtIn)
710 {
711         CPassThruImpl_THIS(iface,mseek);
712         QUERYSEEKPASS
713
714         TRACE("(%p)->()\n",This);
715
716         hr = IMediaSeeking_ConvertTimeFormat(pSeek,pllOut,pidFmtOut,llIn,pidFmtIn);
717         IMediaSeeking_Release(pSeek);
718         return hr;
719 }
720
721 static HRESULT WINAPI
722 IMediaSeeking_fnSetPositions(IMediaSeeking* iface,LONGLONG* pllCur,DWORD dwCurFlags,LONGLONG* pllStop,DWORD dwStopFlags)
723 {
724         CPassThruImpl_THIS(iface,mseek);
725         QUERYSEEKPASS
726
727         TRACE("(%p)->()\n",This);
728
729         hr = IMediaSeeking_SetPositions(pSeek,pllCur,dwCurFlags,pllStop,dwStopFlags);
730         IMediaSeeking_Release(pSeek);
731         return hr;
732 }
733
734 static HRESULT WINAPI
735 IMediaSeeking_fnGetPositions(IMediaSeeking* iface,LONGLONG* pllCur,LONGLONG* pllStop)
736 {
737         CPassThruImpl_THIS(iface,mseek);
738         QUERYSEEKPASS
739
740         TRACE("(%p)->()\n",This);
741
742         hr = IMediaSeeking_GetPositions(pSeek,pllCur,pllStop);
743         IMediaSeeking_Release(pSeek);
744         return hr;
745 }
746
747 static HRESULT WINAPI
748 IMediaSeeking_fnGetAvailable(IMediaSeeking* iface,LONGLONG* pllFirst,LONGLONG* pllLast)
749 {
750         CPassThruImpl_THIS(iface,mseek);
751         QUERYSEEKPASS
752
753         TRACE("(%p)->()\n",This);
754
755         hr = IMediaSeeking_GetAvailable(pSeek,pllFirst,pllLast);
756         IMediaSeeking_Release(pSeek);
757         return hr;
758 }
759
760 static HRESULT WINAPI
761 IMediaSeeking_fnSetRate(IMediaSeeking* iface,double dblRate)
762 {
763         CPassThruImpl_THIS(iface,mseek);
764         QUERYSEEKPASS
765
766         TRACE("(%p)->()\n",This);
767
768         hr = IMediaSeeking_SetRate(pSeek,dblRate);
769         IMediaSeeking_Release(pSeek);
770         return hr;
771 }
772
773 static HRESULT WINAPI
774 IMediaSeeking_fnGetRate(IMediaSeeking* iface,double* pdblRate)
775 {
776         CPassThruImpl_THIS(iface,mseek);
777         QUERYSEEKPASS
778
779         TRACE("(%p)->()\n",This);
780
781         hr = IMediaSeeking_GetRate(pSeek,pdblRate);
782         IMediaSeeking_Release(pSeek);
783         return hr;
784 }
785
786 static HRESULT WINAPI
787 IMediaSeeking_fnGetPreroll(IMediaSeeking* iface,LONGLONG* pllPreroll)
788 {
789         CPassThruImpl_THIS(iface,mseek);
790         QUERYSEEKPASS
791
792         TRACE("(%p)->()\n",This);
793
794         hr = IMediaSeeking_GetPreroll(pSeek,pllPreroll);
795         IMediaSeeking_Release(pSeek);
796         return hr;
797 }
798
799
800
801
802 static ICOM_VTABLE(IMediaSeeking) imseek =
803 {
804         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
805         /* IUnknown fields */
806         IMediaSeeking_fnQueryInterface,
807         IMediaSeeking_fnAddRef,
808         IMediaSeeking_fnRelease,
809         /* IMediaSeeking fields */
810         IMediaSeeking_fnGetCapabilities,
811         IMediaSeeking_fnCheckCapabilities,
812         IMediaSeeking_fnIsFormatSupported,
813         IMediaSeeking_fnQueryPreferredFormat,
814         IMediaSeeking_fnGetTimeFormat,
815         IMediaSeeking_fnIsUsingTimeFormat,
816         IMediaSeeking_fnSetTimeFormat,
817         IMediaSeeking_fnGetDuration,
818         IMediaSeeking_fnGetStopPosition,
819         IMediaSeeking_fnGetCurrentPosition,
820         IMediaSeeking_fnConvertTimeFormat,
821         IMediaSeeking_fnSetPositions,
822         IMediaSeeking_fnGetPositions,
823         IMediaSeeking_fnGetAvailable,
824         IMediaSeeking_fnSetRate,
825         IMediaSeeking_fnGetRate,
826         IMediaSeeking_fnGetPreroll,
827 };
828
829
830
831 HRESULT CPassThruImpl_InitIMediaSeeking( CPassThruImpl* pImpl )
832 {
833         TRACE("(%p)\n",pImpl);
834         ICOM_VTBL(&pImpl->mseek) = &imseek;
835
836         return NOERROR;
837 }
838
839 void CPassThruImpl_UninitIMediaSeeking( CPassThruImpl* pImpl )
840 {
841         TRACE("(%p)\n",pImpl);
842 }
843
844 #undef QUERYSEEKPASS