Commit e468aab0 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Move strmbase_renderer.csRenderLock into the strmbase_filter structure.

parent 690afb42
......@@ -112,9 +112,9 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa
filter->current_sample = pSample;
SetEvent(filter->renderer.state_event);
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
WaitForMultipleObjects(2, events, FALSE, INFINITE);
EnterCriticalSection(&filter->renderer.csRenderLock);
EnterCriticalSection(&filter->renderer.filter.stream_cs);
filter->current_sample = NULL;
}
......@@ -258,33 +258,33 @@ static HRESULT video_renderer_get_current_image(struct video_window *iface, LONG
size_t image_size;
BYTE *sample_data;
EnterCriticalSection(&filter->renderer.csRenderLock);
EnterCriticalSection(&filter->renderer.filter.stream_cs);
bih = get_bitmap_header(&filter->renderer.sink.pin.mt);
image_size = bih->biWidth * bih->biHeight * bih->biBitCount / 8;
if (!image)
{
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
*size = sizeof(BITMAPINFOHEADER) + image_size;
return S_OK;
}
if (filter->renderer.filter.state != State_Paused)
{
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
return VFW_E_NOT_PAUSED;
}
if (!filter->current_sample)
{
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
return E_UNEXPECTED;
}
if (*size < sizeof(BITMAPINFOHEADER) + image_size)
{
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
return E_OUTOFMEMORY;
}
......@@ -292,7 +292,7 @@ static HRESULT video_renderer_get_current_image(struct video_window *iface, LONG
IMediaSample_GetPointer(filter->current_sample, &sample_data);
memcpy((char *)image + sizeof(BITMAPINFOHEADER), sample_data, image_size);
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
return S_OK;
}
......
......@@ -317,9 +317,9 @@ static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMedi
if (filter->renderer.filter.state == State_Paused)
{
SetEvent(filter->renderer.state_event);
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
WaitForMultipleObjects(2, events, FALSE, INFINITE);
EnterCriticalSection(&filter->renderer.csRenderLock);
EnterCriticalSection(&filter->renderer.filter.stream_cs);
}
return hr;
......@@ -687,7 +687,7 @@ static HRESULT vmr_get_current_image(struct video_window *iface, LONG *size, LON
char *dst;
HRESULT hr;
EnterCriticalSection(&filter->renderer.csRenderLock);
EnterCriticalSection(&filter->renderer.filter.stream_cs);
device = filter->allocator_d3d9_dev;
bih = *get_bitmap_header(&filter->renderer.sink.pin.mt);
......@@ -696,7 +696,7 @@ static HRESULT vmr_get_current_image(struct video_window *iface, LONG *size, LON
if (!image)
{
*size = sizeof(BITMAPINFOHEADER) + bih.biSizeImage;
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
return S_OK;
}
......@@ -732,7 +732,7 @@ static HRESULT vmr_get_current_image(struct video_window *iface, LONG *size, LON
out:
if (surface) IDirect3DSurface9_Release(surface);
if (rt) IDirect3DSurface9_Release(rt);
LeaveCriticalSection(&filter->renderer.csRenderLock);
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
return hr;
}
......
......@@ -527,6 +527,9 @@ void strmbase_filter_init(struct strmbase_filter *filter, IUnknown *outer,
InitializeCriticalSection(&filter->filter_cs);
if (filter->filter_cs.DebugInfo != (RTL_CRITICAL_SECTION_DEBUG *)-1)
filter->filter_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": strmbase_filter.filter_cs");
InitializeCriticalSection(&filter->stream_cs);
if (filter->stream_cs.DebugInfo != (RTL_CRITICAL_SECTION_DEBUG *)-1)
filter->stream_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": strmbase_filter.stream_cs");
filter->clsid = *clsid;
filter->pin_version = 1;
filter->ops = ops;
......@@ -541,4 +544,7 @@ void strmbase_filter_cleanup(struct strmbase_filter *filter)
if (filter->filter_cs.DebugInfo != (RTL_CRITICAL_SECTION_DEBUG *)-1)
filter->filter_cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&filter->filter_cs);
if (filter->stream_cs.DebugInfo != (RTL_CRITICAL_SECTION_DEBUG *)-1)
filter->stream_cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&filter->stream_cs);
}
......@@ -192,7 +192,7 @@ static HRESULT WINAPI BaseRenderer_Receive(struct strmbase_sink *pin, IMediaSamp
DeleteMediaType(mt);
}
EnterCriticalSection(&filter->csRenderLock);
EnterCriticalSection(&filter->filter.stream_cs);
if (filter->filter.clock && SUCCEEDED(IMediaSample_GetTime(sample, &start, &stop)))
{
......@@ -229,7 +229,7 @@ static HRESULT WINAPI BaseRenderer_Receive(struct strmbase_sink *pin, IMediaSamp
if (ret == 1)
{
LeaveCriticalSection(&filter->csRenderLock);
LeaveCriticalSection(&filter->filter.stream_cs);
TRACE("Flush signaled; discarding current sample.\n");
return S_OK;
}
......@@ -245,7 +245,7 @@ static HRESULT WINAPI BaseRenderer_Receive(struct strmbase_sink *pin, IMediaSamp
QualityControlRender_DoQOS(&filter->qc);
LeaveCriticalSection(&filter->csRenderLock);
LeaveCriticalSection(&filter->filter.stream_cs);
return hr;
}
......@@ -273,7 +273,7 @@ static HRESULT sink_eos(struct strmbase_sink *iface)
IFilterGraph *graph = filter->filter.graph;
IMediaEventSink *event_sink;
EnterCriticalSection(&filter->csRenderLock);
EnterCriticalSection(&filter->filter.stream_cs);
filter->eos = TRUE;
......@@ -287,7 +287,7 @@ static HRESULT sink_eos(struct strmbase_sink *iface)
strmbase_passthrough_eos(&filter->passthrough);
SetEvent(filter->state_event);
LeaveCriticalSection(&filter->csRenderLock);
LeaveCriticalSection(&filter->filter.stream_cs);
return S_OK;
}
......@@ -304,14 +304,14 @@ static HRESULT sink_end_flush(struct strmbase_sink *iface)
{
struct strmbase_renderer *filter = impl_from_IPin(&iface->pin.IPin_iface);
EnterCriticalSection(&filter->csRenderLock);
EnterCriticalSection(&filter->filter.stream_cs);
filter->eos = FALSE;
QualityControlRender_Start(&filter->qc, filter->stream_start);
strmbase_passthrough_invalidate_time(&filter->passthrough);
ResetEvent(filter->flush_event);
LeaveCriticalSection(&filter->csRenderLock);
LeaveCriticalSection(&filter->filter.stream_cs);
return S_OK;
}
......@@ -336,9 +336,6 @@ void strmbase_renderer_cleanup(struct strmbase_renderer *filter)
strmbase_passthrough_cleanup(&filter->passthrough);
filter->csRenderLock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&filter->csRenderLock);
CloseHandle(filter->state_event);
CloseHandle(filter->advise_event);
CloseHandle(filter->flush_event);
......@@ -358,8 +355,6 @@ void strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer,
strmbase_sink_init(&filter->sink, &filter->filter, sink_name, &sink_ops, NULL);
InitializeCriticalSection(&filter->csRenderLock);
filter->csRenderLock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__": strmbase_renderer.csRenderLock");
filter->state_event = CreateEventW(NULL, TRUE, TRUE, NULL);
filter->advise_event = CreateEventW(NULL, FALSE, FALSE, NULL);
filter->flush_event = CreateEventW(NULL, TRUE, TRUE, NULL);
......
......@@ -127,6 +127,7 @@ struct strmbase_filter
IUnknown *outer_unk;
LONG refcount;
CRITICAL_SECTION filter_cs;
CRITICAL_SECTION stream_cs;
FILTER_STATE state;
IReferenceClock *clock;
......@@ -295,7 +296,6 @@ struct strmbase_renderer
struct strmbase_sink sink;
CRITICAL_SECTION csRenderLock;
/* Signaled when the filter has completed a state change. The filter waits
* for this event in IBaseFilter::GetState(). */
HANDLE state_event;
......
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