diff --git a/dlls/qedit/nullrenderer.c b/dlls/qedit/nullrenderer.c index 85493da02f1..e703ea24305 100644 --- a/dlls/qedit/nullrenderer.c +++ b/dlls/qedit/nullrenderer.c @@ -38,16 +38,6 @@ static struct null_renderer *impl_from_strmbase_renderer(struct strmbase_rendere static HRESULT WINAPI NullRenderer_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *sample) { - struct null_renderer *filter = impl_from_strmbase_renderer(iface); - - if (filter->renderer.filter.state == State_Paused) - { - const HANDLE events[2] = {filter->renderer.run_event, filter->renderer.flush_event}; - - SetEvent(filter->renderer.state_event); - WaitForMultipleObjects(2, events, FALSE, INFINITE); - } - return S_OK; } @@ -65,24 +55,10 @@ static void null_renderer_destroy(struct strmbase_renderer *iface) free(filter); } -static void null_renderer_start_stream(struct strmbase_renderer *iface) -{ - struct null_renderer *filter = impl_from_strmbase_renderer(iface); - SetEvent(filter->renderer.run_event); -} - -static void null_renderer_stop_stream(struct strmbase_renderer *iface) -{ - struct null_renderer *filter = impl_from_strmbase_renderer(iface); - ResetEvent(filter->renderer.run_event); -} - static const struct strmbase_renderer_ops renderer_ops = { .pfnCheckMediaType = NullRenderer_CheckMediaType, .pfnDoRenderSample = NullRenderer_DoRenderSample, - .renderer_start_stream = null_renderer_start_stream, - .renderer_stop_stream = null_renderer_stop_stream, .renderer_destroy = null_renderer_destroy, }; diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 1da5ad02d7a..a90e96c8f2a 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -102,16 +102,6 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa (BITMAPINFO *)get_bitmap_header(&filter->renderer.sink.pin.mt), DIB_RGB_COLORS, SRCCOPY); ReleaseDC(filter->window.hwnd, dc); - if (filter->renderer.filter.state == State_Paused) - { - const HANDLE events[2] = {filter->renderer.run_event, filter->renderer.flush_event}; - - SetEvent(filter->renderer.state_event); - LeaveCriticalSection(&filter->renderer.filter.stream_cs); - WaitForMultipleObjects(2, events, FALSE, INFINITE); - EnterCriticalSection(&filter->renderer.filter.stream_cs); - } - return S_OK; } @@ -172,13 +162,6 @@ static HRESULT video_renderer_pin_query_interface(struct strmbase_renderer *ifac return S_OK; } -static void video_renderer_start_stream(struct strmbase_renderer *iface) -{ - struct video_renderer *filter = impl_from_strmbase_renderer(iface); - - SetEvent(filter->renderer.run_event); -} - static void video_renderer_stop_stream(struct strmbase_renderer *iface) { struct video_renderer *This = impl_from_strmbase_renderer(iface); @@ -188,8 +171,6 @@ static void video_renderer_stop_stream(struct strmbase_renderer *iface) if (This->window.AutoShow) /* Black it out */ RedrawWindow(This->window.hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE); - - ResetEvent(This->renderer.run_event); } static void video_renderer_init_stream(struct strmbase_renderer *iface) @@ -235,7 +216,6 @@ static const struct strmbase_renderer_ops renderer_ops = .pfnCheckMediaType = VideoRenderer_CheckMediaType, .pfnDoRenderSample = VideoRenderer_DoRenderSample, .renderer_init_stream = video_renderer_init_stream, - .renderer_start_stream = video_renderer_start_stream, .renderer_stop_stream = video_renderer_stop_stream, .renderer_destroy = video_renderer_destroy, .renderer_query_interface = video_renderer_query_interface, diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 7e0edc57f61..b98e172e48e 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -209,7 +209,6 @@ static inline struct quartz_vmr *impl_from_IBaseFilter(IBaseFilter *iface) static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *sample) { struct quartz_vmr *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface); - const HANDLE events[2] = {filter->renderer.run_event, filter->renderer.flush_event}; unsigned int data_size, width, depth, src_pitch; const BITMAPINFOHEADER *bitmap_header; REFERENCE_TIME start_time, end_time; @@ -310,17 +309,7 @@ static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMedi IDirect3DSurface9_UnlockRect(info.lpSurf); - hr = IVMRImagePresenter9_PresentImage(filter->presenter, filter->cookie, &info); - - if (filter->renderer.filter.state == State_Paused) - { - SetEvent(filter->renderer.state_event); - LeaveCriticalSection(&filter->renderer.filter.stream_cs); - WaitForMultipleObjects(2, events, FALSE, INFINITE); - EnterCriticalSection(&filter->renderer.filter.stream_cs); - } - - return hr; + return IVMRImagePresenter9_PresentImage(filter->presenter, filter->cookie, &info); } static HRESULT WINAPI VMR9_CheckMediaType(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt) @@ -484,7 +473,6 @@ static void vmr_start_stream(struct strmbase_renderer *iface) struct quartz_vmr *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface); IVMRImagePresenter9_StartPresenting(filter->presenter, filter->cookie); - SetEvent(filter->renderer.run_event); } static void vmr_stop_stream(struct strmbase_renderer *iface) @@ -495,7 +483,6 @@ static void vmr_stop_stream(struct strmbase_renderer *iface) if (This->renderer.filter.state == State_Running) IVMRImagePresenter9_StopPresenting(This->presenter, This->cookie); - ResetEvent(This->renderer.run_event); } static HRESULT vmr_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt) diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 0978f7305c8..c95fe63c3f9 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -245,6 +245,7 @@ static HRESULT renderer_start_stream(struct strmbase_filter *iface, REFERENCE_TI filter->stream_start = start; SetEvent(filter->state_event); + SetEvent(filter->run_event); if (filter->sink.pin.peer) filter->eos = FALSE; reset_qos(filter); @@ -258,6 +259,8 @@ static HRESULT renderer_stop_stream(struct strmbase_filter *iface) { struct strmbase_renderer *filter = impl_from_strmbase_filter(iface); + ResetEvent(filter->run_event); + if (filter->sink.pin.peer && filter->pFuncsTable->renderer_stop_stream) filter->pFuncsTable->renderer_stop_stream(filter); @@ -354,8 +357,17 @@ static HRESULT WINAPI BaseRenderer_Receive(struct strmbase_sink *pin, IMediaSamp if (state == State_Paused) { + HANDLE events[2] = {filter->run_event, filter->flush_event}; + filter->current_sample = sample; + hr = filter->pFuncsTable->pfnDoRenderSample(filter, sample); + + SetEvent(filter->state_event); + LeaveCriticalSection(&filter->filter.stream_cs); + WaitForMultipleObjects(2, events, FALSE, INFINITE); + EnterCriticalSection(&filter->filter.stream_cs); + filter->current_sample = NULL; }