Commit 6ab9ad10 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Move run_event handling to strmbase.

parent 914ad66c
......@@ -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,
};
......
......@@ -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,
......
......@@ -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)
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment