[STRMBASE]
[reactos.git] / reactos / lib / 3rdparty / strmbase / renderer.c
1 /*
2 * Generic Implementation of strmbase Base Renderer classes
3 *
4 * Copyright 2012 Aric Stewart, CodeWeavers
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #include "strmbase_private.h"
22
23 static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
24 static const WCHAR wcsAltInputPinName[] = {'I','n',0};
25
26 static inline BaseInputPin *impl_BaseInputPin_from_IPin( IPin *iface )
27 {
28 return CONTAINING_RECORD(iface, BaseInputPin, pin.IPin_iface);
29 }
30
31 static inline BaseRenderer *impl_from_IBaseFilter(IBaseFilter *iface)
32 {
33 return CONTAINING_RECORD(iface, BaseRenderer, filter.IBaseFilter_iface);
34 }
35
36 static inline BaseRenderer *impl_from_BaseFilter(BaseFilter *iface)
37 {
38 return CONTAINING_RECORD(iface, BaseRenderer, filter);
39 }
40
41 static const IQualityControlVtbl Renderer_QualityControl_Vtbl = {
42 QualityControlImpl_QueryInterface,
43 QualityControlImpl_AddRef,
44 QualityControlImpl_Release,
45 QualityControlImpl_Notify,
46 QualityControlImpl_SetSink
47 };
48
49 static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
50 {
51 BaseInputPin *This = impl_BaseInputPin_from_IPin(iface);
52 BaseRenderer *renderer = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
53 HRESULT hr = S_OK;
54
55 TRACE("(%p/%p)->(%p, %p)\n", This, renderer, pReceivePin, pmt);
56
57 EnterCriticalSection(This->pin.pCritSec);
58 hr = BaseInputPinImpl_ReceiveConnection(iface, pReceivePin, pmt);
59 if (SUCCEEDED(hr))
60 {
61 if (renderer->pFuncsTable->pfnCompleteConnect)
62 hr = renderer->pFuncsTable->pfnCompleteConnect(renderer, pReceivePin);
63 }
64 LeaveCriticalSection(This->pin.pCritSec);
65
66 return hr;
67 }
68
69 static HRESULT WINAPI BaseRenderer_InputPin_Disconnect(IPin * iface)
70 {
71 BaseInputPin *This = impl_BaseInputPin_from_IPin(iface);
72 BaseRenderer *renderer = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
73 HRESULT hr;
74
75 TRACE("(%p/%p)\n", This, renderer);
76
77 EnterCriticalSection(This->pin.pCritSec);
78 hr = BasePinImpl_Disconnect(iface);
79 if (SUCCEEDED(hr))
80 {
81 if (renderer->pFuncsTable->pfnBreakConnect)
82 hr = renderer->pFuncsTable->pfnBreakConnect(renderer);
83 }
84 BaseRendererImpl_ClearPendingSample(renderer);
85 LeaveCriticalSection(This->pin.pCritSec);
86
87 return hr;
88 }
89
90 static HRESULT WINAPI BaseRenderer_InputPin_EndOfStream(IPin * iface)
91 {
92 HRESULT hr = S_OK;
93 BaseInputPin* This = impl_BaseInputPin_from_IPin(iface);
94 BaseRenderer *pFilter = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
95
96 TRACE("(%p/%p)->()\n", This, pFilter);
97
98 EnterCriticalSection(&pFilter->filter.csFilter);
99 EnterCriticalSection(&pFilter->csRenderLock);
100 hr = BaseInputPinImpl_EndOfStream(iface);
101 EnterCriticalSection(This->pin.pCritSec);
102 if (SUCCEEDED(hr))
103 {
104 if (pFilter->pFuncsTable->pfnEndOfStream)
105 hr = pFilter->pFuncsTable->pfnEndOfStream(pFilter);
106 else
107 hr = BaseRendererImpl_EndOfStream(pFilter);
108 }
109 LeaveCriticalSection(This->pin.pCritSec);
110 LeaveCriticalSection(&pFilter->csRenderLock);
111 LeaveCriticalSection(&pFilter->filter.csFilter);
112 return hr;
113 }
114
115 static HRESULT WINAPI BaseRenderer_InputPin_BeginFlush(IPin * iface)
116 {
117 BaseInputPin* This = impl_BaseInputPin_from_IPin(iface);
118 BaseRenderer *pFilter = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
119 HRESULT hr = S_OK;
120
121 TRACE("(%p/%p)->()\n", This, iface);
122
123 EnterCriticalSection(&pFilter->filter.csFilter);
124 EnterCriticalSection(&pFilter->csRenderLock);
125 EnterCriticalSection(This->pin.pCritSec);
126 hr = BaseInputPinImpl_BeginFlush(iface);
127 if (SUCCEEDED(hr))
128 {
129 if (pFilter->pFuncsTable->pfnBeginFlush)
130 hr = pFilter->pFuncsTable->pfnBeginFlush(pFilter);
131 else
132 hr = BaseRendererImpl_BeginFlush(pFilter);
133 }
134 LeaveCriticalSection(This->pin.pCritSec);
135 LeaveCriticalSection(&pFilter->filter.csFilter);
136 LeaveCriticalSection(&pFilter->csRenderLock);
137 return hr;
138 }
139
140 static HRESULT WINAPI BaseRenderer_InputPin_EndFlush(IPin * iface)
141 {
142 BaseInputPin* This = impl_BaseInputPin_from_IPin(iface);
143 BaseRenderer *pFilter = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
144 HRESULT hr = S_OK;
145
146 TRACE("(%p/%p)->()\n", This, pFilter);
147
148 EnterCriticalSection(&pFilter->filter.csFilter);
149 EnterCriticalSection(&pFilter->csRenderLock);
150 EnterCriticalSection(This->pin.pCritSec);
151 hr = BaseInputPinImpl_EndFlush(iface);
152 if (SUCCEEDED(hr))
153 {
154 if (pFilter->pFuncsTable->pfnEndFlush)
155 hr = pFilter->pFuncsTable->pfnEndFlush(pFilter);
156 else
157 hr = BaseRendererImpl_EndFlush(pFilter);
158 }
159 LeaveCriticalSection(This->pin.pCritSec);
160 LeaveCriticalSection(&pFilter->csRenderLock);
161 LeaveCriticalSection(&pFilter->filter.csFilter);
162 return hr;
163 }
164
165 static const IPinVtbl BaseRenderer_InputPin_Vtbl =
166 {
167 BaseInputPinImpl_QueryInterface,
168 BasePinImpl_AddRef,
169 BaseInputPinImpl_Release,
170 BaseInputPinImpl_Connect,
171 BaseRenderer_InputPin_ReceiveConnection,
172 BaseRenderer_InputPin_Disconnect,
173 BasePinImpl_ConnectedTo,
174 BasePinImpl_ConnectionMediaType,
175 BasePinImpl_QueryPinInfo,
176 BasePinImpl_QueryDirection,
177 BasePinImpl_QueryId,
178 BaseInputPinImpl_QueryAccept,
179 BasePinImpl_EnumMediaTypes,
180 BasePinImpl_QueryInternalConnections,
181 BaseRenderer_InputPin_EndOfStream,
182 BaseRenderer_InputPin_BeginFlush,
183 BaseRenderer_InputPin_EndFlush,
184 BaseInputPinImpl_NewSegment
185 };
186
187 static IPin* WINAPI BaseRenderer_GetPin(BaseFilter *iface, int pos)
188 {
189 BaseRenderer *This = impl_from_BaseFilter(iface);
190
191 if (pos >= 1 || pos < 0)
192 return NULL;
193
194 IPin_AddRef(&This->pInputPin->pin.IPin_iface);
195 return &This->pInputPin->pin.IPin_iface;
196 }
197
198 static LONG WINAPI BaseRenderer_GetPinCount(BaseFilter *iface)
199 {
200 return 1;
201 }
202
203 static HRESULT WINAPI BaseRenderer_Input_CheckMediaType(BasePin *pin, const AM_MEDIA_TYPE * pmt)
204 {
205 BaseRenderer *This = impl_from_IBaseFilter(pin->pinInfo.pFilter);
206 return This->pFuncsTable->pfnCheckMediaType(This, pmt);
207 }
208
209 static HRESULT WINAPI BaseRenderer_Receive(BaseInputPin *pin, IMediaSample * pSample)
210 {
211 BaseRenderer *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
212 return BaseRendererImpl_Receive(This, pSample);
213 }
214
215 static const BaseFilterFuncTable RendererBaseFilterFuncTable = {
216 BaseRenderer_GetPin,
217 BaseRenderer_GetPinCount
218 };
219
220 static const BasePinFuncTable input_BaseFuncTable = {
221 BaseRenderer_Input_CheckMediaType,
222 NULL,
223 BasePinImpl_GetMediaTypeVersion,
224 BasePinImpl_GetMediaType
225 };
226
227 static const BaseInputPinFuncTable input_BaseInputFuncTable = {
228 BaseRenderer_Receive
229 };
230
231
232 HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtbl, IUnknown *pUnkOuter, const CLSID *pClsid, DWORD_PTR DebugInfo, const BaseRendererFuncTable* pBaseFuncsTable)
233 {
234 PIN_INFO piInput;
235 HRESULT hr;
236
237 BaseFilter_Init(&This->filter, Vtbl, pClsid, DebugInfo, &RendererBaseFilterFuncTable);
238
239 This->pFuncsTable = pBaseFuncsTable;
240
241 /* construct input pin */
242 piInput.dir = PINDIR_INPUT;
243 piInput.pFilter = &This->filter.IBaseFilter_iface;
244 lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
245
246 hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin);
247
248 if (SUCCEEDED(hr))
249 {
250 hr = CreatePosPassThru(pUnkOuter ? pUnkOuter: (IUnknown*)This, TRUE, &This->pInputPin->pin.IPin_iface, &This->pPosition);
251 if (FAILED(hr))
252 return hr;
253
254 InitializeCriticalSection(&This->csRenderLock);
255 This->csRenderLock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__": BaseRenderer.csRenderLock");
256 This->evComplete = CreateEventW(NULL, TRUE, TRUE, NULL);
257 This->ThreadSignal = CreateEventW(NULL, TRUE, TRUE, NULL);
258 This->RenderEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
259 This->pMediaSample = NULL;
260
261 QualityControlImpl_Create(&This->pInputPin->pin.IPin_iface, &This->filter.IBaseFilter_iface, &This->qcimpl);
262 This->qcimpl->IQualityControl_iface.lpVtbl = &Renderer_QualityControl_Vtbl;
263 }
264
265 return hr;
266 }
267
268 HRESULT WINAPI BaseRendererImpl_QueryInterface(IBaseFilter* iface, REFIID riid, LPVOID * ppv)
269 {
270 BaseRenderer *This = impl_from_IBaseFilter(iface);
271
272 if (IsEqualIID(riid, &IID_IMediaSeeking) || IsEqualIID(riid, &IID_IMediaPosition))
273 return IUnknown_QueryInterface(This->pPosition, riid, ppv);
274 else if (IsEqualIID(riid, &IID_IQualityControl))
275 {
276 *ppv = &This->qcimpl->IQualityControl_iface;
277 IUnknown_AddRef((IUnknown *)(*ppv));
278 return S_OK;
279 }
280 else
281 return BaseFilterImpl_QueryInterface(iface, riid, ppv);
282 }
283
284 ULONG WINAPI BaseRendererImpl_Release(IBaseFilter* iface)
285 {
286 BaseRenderer *This = impl_from_IBaseFilter(iface);
287 ULONG refCount = BaseFilterImpl_Release(iface);
288
289 if (!refCount)
290 {
291 IPin *pConnectedTo;
292
293 if (SUCCEEDED(IPin_ConnectedTo(&This->pInputPin->pin.IPin_iface, &pConnectedTo)))
294 {
295 IPin_Disconnect(pConnectedTo);
296 IPin_Release(pConnectedTo);
297 }
298 IPin_Disconnect(&This->pInputPin->pin.IPin_iface);
299 IPin_Release(&This->pInputPin->pin.IPin_iface);
300
301 if (This->pPosition)
302 IUnknown_Release(This->pPosition);
303
304 This->csRenderLock.DebugInfo->Spare[0] = 0;
305 DeleteCriticalSection(&This->csRenderLock);
306
307 BaseRendererImpl_ClearPendingSample(This);
308 CloseHandle(This->evComplete);
309 CloseHandle(This->ThreadSignal);
310 CloseHandle(This->RenderEvent);
311 QualityControlImpl_Destroy(This->qcimpl);
312 }
313 return refCount;
314 }
315
316 HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSample)
317 {
318 HRESULT hr = S_OK;
319 REFERENCE_TIME start, stop;
320 AM_MEDIA_TYPE *pmt;
321
322 TRACE("(%p)->%p\n", This, pSample);
323
324 if (This->pInputPin->end_of_stream || This->pInputPin->flushing)
325 return S_FALSE;
326
327 if (This->filter.state == State_Stopped)
328 return VFW_E_WRONG_STATE;
329
330 if (IMediaSample_GetMediaType(pSample, &pmt) == S_OK)
331 {
332 if (FAILED(This->pFuncsTable->pfnCheckMediaType(This, pmt)))
333 {
334 return VFW_E_TYPE_NOT_ACCEPTED;
335 }
336 }
337
338 This->pMediaSample = pSample;
339 IMediaSample_AddRef(pSample);
340
341 if (This->pFuncsTable->pfnPrepareReceive)
342 hr = This->pFuncsTable->pfnPrepareReceive(This, pSample);
343 if (FAILED(hr))
344 {
345 if (hr == VFW_E_SAMPLE_REJECTED)
346 return S_OK;
347 else
348 return hr;
349 }
350
351 if (This->pFuncsTable->pfnPrepareRender)
352 This->pFuncsTable->pfnPrepareRender(This);
353
354 EnterCriticalSection(&This->csRenderLock);
355 if ( This->filter.state == State_Paused )
356 {
357 if (This->pFuncsTable->pfnOnReceiveFirstSample)
358 This->pFuncsTable->pfnOnReceiveFirstSample(This, pSample);
359
360 SetEvent(This->evComplete);
361 }
362
363 /* Wait for render Time */
364 if (SUCCEEDED(IMediaSample_GetTime(pSample, &start, &stop)))
365 {
366 hr = S_FALSE;
367 RendererPosPassThru_RegisterMediaTime(This->pPosition, start);
368 if (This->pFuncsTable->pfnShouldDrawSampleNow)
369 hr = This->pFuncsTable->pfnShouldDrawSampleNow(This, pSample, &start, &stop);
370
371 if (hr == S_OK)
372 ;/* Do not wait: drop through */
373 else if (hr == S_FALSE)
374 {
375 if (This->pFuncsTable->pfnOnWaitStart)
376 This->pFuncsTable->pfnOnWaitStart(This);
377
378 LeaveCriticalSection(&This->csRenderLock);
379 hr = QualityControlRender_WaitFor(This->qcimpl, pSample, This->RenderEvent);
380 EnterCriticalSection(&This->csRenderLock);
381
382 if (This->pFuncsTable->pfnOnWaitEnd)
383 This->pFuncsTable->pfnOnWaitEnd(This);
384 }
385 else
386 {
387 LeaveCriticalSection(&This->csRenderLock);
388 /* Drop Sample */
389 return S_OK;
390 }
391 }
392
393 if (SUCCEEDED(hr))
394 {
395 QualityControlRender_BeginRender(This->qcimpl);
396 hr = This->pFuncsTable->pfnDoRenderSample(This, pSample);
397 QualityControlRender_EndRender(This->qcimpl);
398 }
399
400 QualityControlRender_DoQOS(This->qcimpl);
401
402 BaseRendererImpl_ClearPendingSample(This);
403 LeaveCriticalSection(&This->csRenderLock);
404
405 return hr;
406 }
407
408 HRESULT WINAPI BaseRendererImpl_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
409 {
410 BaseRenderer *This = impl_from_IBaseFilter(iface);
411
412 TRACE("(%p)->(%s,%p)\n", This, debugstr_w(Id), ppPin);
413
414 if (!Id || !ppPin)
415 return E_POINTER;
416
417 if (!lstrcmpiW(Id,wcsInputPinName) || !lstrcmpiW(Id,wcsAltInputPinName))
418 {
419 *ppPin = &This->pInputPin->pin.IPin_iface;
420 IPin_AddRef(*ppPin);
421 return S_OK;
422 }
423 *ppPin = NULL;
424 return VFW_E_NOT_FOUND;
425 }
426
427 HRESULT WINAPI BaseRendererImpl_Stop(IBaseFilter * iface)
428 {
429 BaseRenderer *This = impl_from_IBaseFilter(iface);
430
431 TRACE("(%p)->()\n", This);
432
433 EnterCriticalSection(&This->csRenderLock);
434 {
435 RendererPosPassThru_ResetMediaTime(This->pPosition);
436 if (This->pFuncsTable->pfnOnStopStreaming)
437 This->pFuncsTable->pfnOnStopStreaming(This);
438 This->filter.state = State_Stopped;
439 SetEvent(This->evComplete);
440 SetEvent(This->ThreadSignal);
441 SetEvent(This->RenderEvent);
442 }
443 LeaveCriticalSection(&This->csRenderLock);
444
445 return S_OK;
446 }
447
448 HRESULT WINAPI BaseRendererImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
449 {
450 HRESULT hr = S_OK;
451 BaseRenderer *This = impl_from_IBaseFilter(iface);
452 TRACE("(%p)->(%s)\n", This, wine_dbgstr_longlong(tStart));
453
454 EnterCriticalSection(&This->csRenderLock);
455 This->filter.rtStreamStart = tStart;
456 if (This->filter.state == State_Running)
457 goto out;
458
459 SetEvent(This->evComplete);
460 ResetEvent(This->ThreadSignal);
461
462 if (This->pInputPin->pin.pConnectedTo)
463 {
464 This->pInputPin->end_of_stream = 0;
465 }
466 else if (This->filter.filterInfo.pGraph)
467 {
468 IMediaEventSink *pEventSink;
469 hr = IFilterGraph_QueryInterface(This->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
470 if (SUCCEEDED(hr))
471 {
472 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)This);
473 IMediaEventSink_Release(pEventSink);
474 }
475 hr = S_OK;
476 }
477 if (SUCCEEDED(hr))
478 {
479 QualityControlRender_Start(This->qcimpl, This->filter.rtStreamStart);
480 if (This->pFuncsTable->pfnOnStartStreaming)
481 This->pFuncsTable->pfnOnStartStreaming(This);
482 if (This->filter.state == State_Stopped)
483 BaseRendererImpl_ClearPendingSample(This);
484 SetEvent(This->RenderEvent);
485 This->filter.state = State_Running;
486 }
487 out:
488 LeaveCriticalSection(&This->csRenderLock);
489
490 return hr;
491 }
492
493 HRESULT WINAPI BaseRendererImpl_Pause(IBaseFilter * iface)
494 {
495 BaseRenderer *This = impl_from_IBaseFilter(iface);
496
497 TRACE("(%p)->()\n", This);
498
499 EnterCriticalSection(&This->csRenderLock);
500 {
501 if (This->filter.state != State_Paused)
502 {
503 if (This->filter.state == State_Stopped)
504 {
505 if (This->pInputPin->pin.pConnectedTo)
506 ResetEvent(This->evComplete);
507 This->pInputPin->end_of_stream = 0;
508 }
509 else if (This->pFuncsTable->pfnOnStopStreaming)
510 This->pFuncsTable->pfnOnStopStreaming(This);
511
512 if (This->filter.state == State_Stopped)
513 BaseRendererImpl_ClearPendingSample(This);
514 ResetEvent(This->RenderEvent);
515 This->filter.state = State_Paused;
516 }
517 }
518 ResetEvent(This->ThreadSignal);
519 LeaveCriticalSection(&This->csRenderLock);
520
521 return S_OK;
522 }
523
524 HRESULT WINAPI BaseRendererImpl_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock)
525 {
526 BaseRenderer *This = impl_from_IBaseFilter(iface);
527 HRESULT hr;
528
529 EnterCriticalSection(&This->filter.csFilter);
530 QualityControlRender_SetClock(This->qcimpl, clock);
531 hr = BaseFilterImpl_SetSyncSource(iface, clock);
532 LeaveCriticalSection(&This->filter.csFilter);
533 return hr;
534 }
535
536
537 HRESULT WINAPI BaseRendererImpl_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
538 {
539 HRESULT hr;
540 BaseRenderer *This = impl_from_IBaseFilter(iface);
541
542 TRACE("(%p)->(%d, %p)\n", This, dwMilliSecsTimeout, pState);
543
544 if (WaitForSingleObject(This->evComplete, dwMilliSecsTimeout) == WAIT_TIMEOUT)
545 hr = VFW_S_STATE_INTERMEDIATE;
546 else
547 hr = S_OK;
548
549 BaseFilterImpl_GetState(iface, dwMilliSecsTimeout, pState);
550
551 return hr;
552 }
553
554 HRESULT WINAPI BaseRendererImpl_EndOfStream(BaseRenderer* iface)
555 {
556 IMediaEventSink* pEventSink;
557 IFilterGraph *graph;
558 HRESULT hr = S_OK;
559
560 TRACE("(%p)\n", iface);
561
562 graph = iface->filter.filterInfo.pGraph;
563 if (graph)
564 { hr = IFilterGraph_QueryInterface(iface->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
565 if (SUCCEEDED(hr))
566 {
567 hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)iface);
568 IMediaEventSink_Release(pEventSink);
569 }
570 }
571 RendererPosPassThru_EOS(iface->pPosition);
572 SetEvent(iface->evComplete);
573
574 return hr;
575 }
576
577 HRESULT WINAPI BaseRendererImpl_BeginFlush(BaseRenderer* iface)
578 {
579 TRACE("(%p)\n", iface);
580 BaseRendererImpl_ClearPendingSample(iface);
581 SetEvent(iface->ThreadSignal);
582 SetEvent(iface->RenderEvent);
583 return S_OK;
584 }
585
586 HRESULT WINAPI BaseRendererImpl_EndFlush(BaseRenderer* iface)
587 {
588 TRACE("(%p)\n", iface);
589 QualityControlRender_Start(iface->qcimpl, iface->filter.rtStreamStart);
590 RendererPosPassThru_ResetMediaTime(iface->pPosition);
591 ResetEvent(iface->ThreadSignal);
592 ResetEvent(iface->RenderEvent);
593 return S_OK;
594 }
595
596 HRESULT WINAPI BaseRendererImpl_ClearPendingSample(BaseRenderer *iface)
597 {
598 if (iface->pMediaSample)
599 {
600 IMediaSample_Release(iface->pMediaSample);
601 iface->pMediaSample = NULL;
602 }
603 return S_OK;
604 }