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

strmbase: Get rid of the "pCritSec" member of BasePin.

parent 28a51155
...@@ -505,9 +505,9 @@ static HRESULT WINAPI DSoundRender_BreakConnect(BaseRenderer* iface) ...@@ -505,9 +505,9 @@ static HRESULT WINAPI DSoundRender_BreakConnect(BaseRenderer* iface)
if (This->threadid) { if (This->threadid) {
PostThreadMessageW(This->threadid, WM_APP, 0, 0); PostThreadMessageW(This->threadid, WM_APP, 0, 0);
LeaveCriticalSection(This->renderer.sink.pin.pCritSec); LeaveCriticalSection(&This->renderer.filter.csFilter);
WaitForSingleObject(This->advisethread, INFINITE); WaitForSingleObject(This->advisethread, INFINITE);
EnterCriticalSection(This->renderer.sink.pin.pCritSec); EnterCriticalSection(&This->renderer.filter.csFilter);
CloseHandle(This->advisethread); CloseHandle(This->advisethread);
} }
if (This->dsbuffer) if (This->dsbuffer)
......
...@@ -552,9 +552,9 @@ static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, ...@@ -552,9 +552,9 @@ static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin,
ParserImpl *parser = impl_from_IBaseFilter(&This->pin.pin.filter->IBaseFilter_iface); ParserImpl *parser = impl_from_IBaseFilter(&This->pin.pin.filter->IBaseFilter_iface);
/* Set the allocator to our input pin's */ /* Set the allocator to our input pin's */
EnterCriticalSection(This->pin.pin.pCritSec); EnterCriticalSection(&parser->filter.csFilter);
This->alloc = parser->pInputPin->pAlloc; This->alloc = parser->pInputPin->pAlloc;
LeaveCriticalSection(This->pin.pin.pCritSec); LeaveCriticalSection(&parser->filter.csFilter);
return BaseOutputPinImpl_Connect(iface, pReceivePin, pmt); return BaseOutputPinImpl_Connect(iface, pReceivePin, pmt);
} }
...@@ -623,22 +623,22 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface) ...@@ -623,22 +623,22 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
TRACE("()\n"); TRACE("()\n");
EnterCriticalSection(&This->thread_lock); EnterCriticalSection(&This->thread_lock);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
{ {
FILTER_STATE state; FILTER_STATE state;
ParserImpl *Parser = impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface); ParserImpl *Parser = impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state); hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
if (SUCCEEDED(hr) && (state == State_Stopped) && SUCCEEDED(Parser->fnDisconnect(Parser))) if (SUCCEEDED(hr) && (state == State_Stopped) && SUCCEEDED(Parser->fnDisconnect(Parser)))
{ {
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
PullPin_Disconnect(iface); PullPin_Disconnect(iface);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
hr = Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface)); hr = Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface));
} }
else else
...@@ -647,7 +647,7 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface) ...@@ -647,7 +647,7 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
else else
hr = S_FALSE; hr = S_FALSE;
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
LeaveCriticalSection(&This->thread_lock); LeaveCriticalSection(&This->thread_lock);
return hr; return hr;
...@@ -664,9 +664,9 @@ static HRESULT WINAPI Parser_PullPin_ReceiveConnection(IPin * iface, IPin * pRec ...@@ -664,9 +664,9 @@ static HRESULT WINAPI Parser_PullPin_ReceiveConnection(IPin * iface, IPin * pRec
{ {
BasePin *This = (BasePin *)iface; BasePin *This = (BasePin *)iface;
EnterCriticalSection(This->pCritSec); EnterCriticalSection(&This->filter->csFilter);
Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->filter->IBaseFilter_iface)); Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->filter->IBaseFilter_iface));
LeaveCriticalSection(This->pCritSec); LeaveCriticalSection(&This->filter->csFilter);
} }
return hr; return hr;
......
...@@ -174,7 +174,6 @@ static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter ...@@ -174,7 +174,6 @@ static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter
/* Common attributes */ /* Common attributes */
pPinImpl->pin.IPin_iface.lpVtbl = PullPin_Vtbl; pPinImpl->pin.IPin_iface.lpVtbl = PullPin_Vtbl;
pPinImpl->pin.pConnectedTo = NULL; pPinImpl->pin.pConnectedTo = NULL;
pPinImpl->pin.pCritSec = &filter->csFilter;
wcscpy(pPinImpl->pin.name, name); wcscpy(pPinImpl->pin.name, name);
pPinImpl->pin.dir = PINDIR_INPUT; pPinImpl->pin.dir = PINDIR_INPUT;
pPinImpl->pin.filter = filter; pPinImpl->pin.filter = filter;
...@@ -244,7 +243,7 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const ...@@ -244,7 +243,7 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt); TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
dump_AM_MEDIA_TYPE(pmt); dump_AM_MEDIA_TYPE(pmt);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
if (!This->pin.pConnectedTo) if (!This->pin.pConnectedTo)
{ {
ALLOCATOR_PROPERTIES props; ALLOCATOR_PROPERTIES props;
...@@ -323,7 +322,7 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const ...@@ -323,7 +322,7 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
} }
else else
hr = VFW_E_ALREADY_CONNECTED; hr = VFW_E_ALREADY_CONNECTED;
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
return hr; return hr;
} }
...@@ -382,7 +381,7 @@ static void PullPin_Flush(PullPin *This) ...@@ -382,7 +381,7 @@ static void PullPin_Flush(PullPin *This)
if (This->pReader) if (This->pReader)
{ {
/* Do not allow state to change while flushing */ /* Do not allow state to change while flushing */
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
/* Flush outstanding samples */ /* Flush outstanding samples */
IAsyncReader_BeginFlush(This->pReader); IAsyncReader_BeginFlush(This->pReader);
...@@ -404,7 +403,7 @@ static void PullPin_Flush(PullPin *This) ...@@ -404,7 +403,7 @@ static void PullPin_Flush(PullPin *This)
IAsyncReader_EndFlush(This->pReader); IAsyncReader_EndFlush(This->pReader);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
} }
} }
...@@ -435,9 +434,9 @@ static void PullPin_Thread_Process(PullPin *This) ...@@ -435,9 +434,9 @@ static void PullPin_Thread_Process(PullPin *This)
if (FAILED(hr)) if (FAILED(hr))
ERR("Request error: %x\n", hr); ERR("Request error: %x\n", hr);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
SetEvent(This->hEventStateChanged); SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
do do
...@@ -505,19 +504,19 @@ static void PullPin_Thread_Pause(PullPin *This) ...@@ -505,19 +504,19 @@ static void PullPin_Thread_Pause(PullPin *This)
{ {
PullPin_Flush(This); PullPin_Flush(This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
This->state = Req_Sleepy; This->state = Req_Sleepy;
SetEvent(This->hEventStateChanged); SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
} }
static void PullPin_Thread_Stop(PullPin *This) static void PullPin_Thread_Stop(PullPin *This)
{ {
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
SetEvent(This->hEventStateChanged); SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
IPin_Release(&This->pin.IPin_iface); IPin_Release(&This->pin.IPin_iface);
...@@ -562,7 +561,7 @@ static HRESULT PullPin_InitProcessing(PullPin * This) ...@@ -562,7 +561,7 @@ static HRESULT PullPin_InitProcessing(PullPin * This)
DWORD dwThreadId; DWORD dwThreadId;
WaitForSingleObject(This->hEventStateChanged, INFINITE); WaitForSingleObject(This->hEventStateChanged, INFINITE);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
assert(!This->hThread); assert(!This->hThread);
assert(This->state == Req_Die); assert(This->state == Req_Die);
...@@ -584,7 +583,7 @@ static HRESULT PullPin_InitProcessing(PullPin * This) ...@@ -584,7 +583,7 @@ static HRESULT PullPin_InitProcessing(PullPin * This)
SetEvent(This->hEventStateChanged); SetEvent(This->hEventStateChanged);
/* If assert fails, that means a command was not processed before the thread previously terminated */ /* If assert fails, that means a command was not processed before the thread previously terminated */
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
} }
TRACE(" -- %x\n", hr); TRACE(" -- %x\n", hr);
...@@ -625,7 +624,7 @@ HRESULT PullPin_PauseProcessing(PullPin * This) ...@@ -625,7 +624,7 @@ HRESULT PullPin_PauseProcessing(PullPin * This)
PullPin_WaitForStateChange(This, INFINITE); PullPin_WaitForStateChange(This, INFINITE);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
assert(!This->stop_playback); assert(!This->stop_playback);
assert(This->state == Req_Run|| This->state == Req_Sleepy); assert(This->state == Req_Run|| This->state == Req_Sleepy);
...@@ -652,7 +651,7 @@ HRESULT PullPin_PauseProcessing(PullPin * This) ...@@ -652,7 +651,7 @@ HRESULT PullPin_PauseProcessing(PullPin * This)
} while(pSample); } while(pSample);
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
} }
return S_OK; return S_OK;
...@@ -700,10 +699,10 @@ HRESULT WINAPI PullPin_EndOfStream(IPin * iface) ...@@ -700,10 +699,10 @@ HRESULT WINAPI PullPin_EndOfStream(IPin * iface)
TRACE("(%p)->()\n", iface); TRACE("(%p)->()\n", iface);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
hr = SendFurther( iface, deliver_endofstream, NULL, NULL ); hr = SendFurther( iface, deliver_endofstream, NULL, NULL );
SetEvent(This->hEventStateChanged); SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
return hr; return hr;
} }
...@@ -713,11 +712,11 @@ HRESULT WINAPI PullPin_BeginFlush(IPin * iface) ...@@ -713,11 +712,11 @@ HRESULT WINAPI PullPin_BeginFlush(IPin * iface)
PullPin *This = impl_PullPin_from_IPin(iface); PullPin *This = impl_PullPin_from_IPin(iface);
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
SendFurther( iface, deliver_beginflush, NULL, NULL ); SendFurther( iface, deliver_beginflush, NULL, NULL );
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
EnterCriticalSection(&This->thread_lock); EnterCriticalSection(&This->thread_lock);
{ {
...@@ -733,11 +732,11 @@ HRESULT WINAPI PullPin_BeginFlush(IPin * iface) ...@@ -733,11 +732,11 @@ HRESULT WINAPI PullPin_BeginFlush(IPin * iface)
} }
LeaveCriticalSection(&This->thread_lock); LeaveCriticalSection(&This->thread_lock);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
This->fnCleanProc(This->pUserData); This->fnCleanProc(This->pUserData);
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
return S_OK; return S_OK;
} }
...@@ -749,9 +748,9 @@ HRESULT WINAPI PullPin_EndFlush(IPin * iface) ...@@ -749,9 +748,9 @@ HRESULT WINAPI PullPin_EndFlush(IPin * iface)
TRACE("(%p)->()\n", iface); TRACE("(%p)->()\n", iface);
/* Send further first: Else a race condition might terminate processing early */ /* Send further first: Else a race condition might terminate processing early */
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
SendFurther( iface, deliver_endflush, NULL, NULL ); SendFurther( iface, deliver_endflush, NULL, NULL );
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
EnterCriticalSection(&This->thread_lock); EnterCriticalSection(&This->thread_lock);
{ {
...@@ -779,7 +778,7 @@ HRESULT WINAPI PullPin_Disconnect(IPin *iface) ...@@ -779,7 +778,7 @@ HRESULT WINAPI PullPin_Disconnect(IPin *iface)
TRACE("()\n"); TRACE("()\n");
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
if (FAILED(hr = IMemAllocator_Decommit(This->pAlloc))) if (FAILED(hr = IMemAllocator_Decommit(This->pAlloc)))
ERR("Allocator decommit failed with error %x. Possible memory leak\n", hr); ERR("Allocator decommit failed with error %x. Possible memory leak\n", hr);
...@@ -797,7 +796,7 @@ HRESULT WINAPI PullPin_Disconnect(IPin *iface) ...@@ -797,7 +796,7 @@ HRESULT WINAPI PullPin_Disconnect(IPin *iface)
else else
hr = S_FALSE; hr = S_FALSE;
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
WaitForSingleObject(This->hThread, INFINITE); WaitForSingleObject(This->hThread, INFINITE);
CloseHandle(This->hThread); CloseHandle(This->hThread);
......
...@@ -184,7 +184,7 @@ HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface) ...@@ -184,7 +184,7 @@ HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface)
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pCritSec); EnterCriticalSection(&This->filter->csFilter);
{ {
if (This->pConnectedTo) if (This->pConnectedTo)
{ {
...@@ -197,7 +197,7 @@ HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface) ...@@ -197,7 +197,7 @@ HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface)
else else
hr = S_FALSE; hr = S_FALSE;
} }
LeaveCriticalSection(This->pCritSec); LeaveCriticalSection(&This->filter->csFilter);
return hr; return hr;
} }
...@@ -209,7 +209,7 @@ HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin) ...@@ -209,7 +209,7 @@ HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin)
TRACE("(%p)->(%p)\n", This, ppPin); TRACE("(%p)->(%p)\n", This, ppPin);
EnterCriticalSection(This->pCritSec); EnterCriticalSection(&This->filter->csFilter);
{ {
if (This->pConnectedTo) if (This->pConnectedTo)
{ {
...@@ -223,7 +223,7 @@ HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin) ...@@ -223,7 +223,7 @@ HRESULT WINAPI BasePinImpl_ConnectedTo(IPin * iface, IPin ** ppPin)
*ppPin = NULL; *ppPin = NULL;
} }
} }
LeaveCriticalSection(This->pCritSec); LeaveCriticalSection(&This->filter->csFilter);
return hr; return hr;
} }
...@@ -235,7 +235,7 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt ...@@ -235,7 +235,7 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt
TRACE("(%p)->(%p)\n", This, pmt); TRACE("(%p)->(%p)\n", This, pmt);
EnterCriticalSection(This->pCritSec); EnterCriticalSection(&This->filter->csFilter);
{ {
if (This->pConnectedTo) if (This->pConnectedTo)
{ {
...@@ -248,7 +248,7 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt ...@@ -248,7 +248,7 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt
hr = VFW_E_NOT_CONNECTED; hr = VFW_E_NOT_CONNECTED;
} }
} }
LeaveCriticalSection(This->pCritSec); LeaveCriticalSection(&This->filter->csFilter);
return hr; return hr;
} }
...@@ -384,7 +384,7 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const ...@@ -384,7 +384,7 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const
* catches the obvious case */ * catches the obvious case */
assert(pReceivePin != iface); assert(pReceivePin != iface);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
/* if we have been a specific type to connect with, then we can either connect /* if we have been a specific type to connect with, then we can either connect
* with that or fail. We cannot choose different AM_MEDIA_TYPE */ * with that or fail. We cannot choose different AM_MEDIA_TYPE */
...@@ -447,7 +447,7 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const ...@@ -447,7 +447,7 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const
} /* if not found */ } /* if not found */
} /* if negotiate media type */ } /* if negotiate media type */
} /* if succeeded */ } /* if succeeded */
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
TRACE(" -- %x\n", hr); TRACE(" -- %x\n", hr);
return hr; return hr;
...@@ -466,7 +466,7 @@ HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface) ...@@ -466,7 +466,7 @@ HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface)
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
if (This->pMemInputPin) if (This->pMemInputPin)
{ {
...@@ -484,7 +484,7 @@ HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface) ...@@ -484,7 +484,7 @@ HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface)
else else
hr = S_FALSE; hr = S_FALSE;
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
return hr; return hr;
} }
...@@ -542,7 +542,7 @@ HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin *This, IMediaSample * pSa ...@@ -542,7 +542,7 @@ HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin *This, IMediaSample * pSa
PIN_INFO pinInfo; PIN_INFO pinInfo;
HRESULT hr; HRESULT hr;
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
if (!This->pin.pConnectedTo || !This->pMemInputPin) if (!This->pin.pConnectedTo || !This->pMemInputPin)
hr = VFW_E_NOT_CONNECTED; hr = VFW_E_NOT_CONNECTED;
...@@ -556,7 +556,7 @@ HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin *This, IMediaSample * pSa ...@@ -556,7 +556,7 @@ HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin *This, IMediaSample * pSa
hr = IPin_QueryPinInfo(This->pin.pConnectedTo, &pinInfo); hr = IPin_QueryPinInfo(This->pin.pConnectedTo, &pinInfo);
} }
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -582,14 +582,14 @@ HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin *This) ...@@ -582,14 +582,14 @@ HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin *This)
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
if (!This->pin.pConnectedTo || !This->pMemInputPin) if (!This->pin.pConnectedTo || !This->pMemInputPin)
hr = VFW_E_NOT_CONNECTED; hr = VFW_E_NOT_CONNECTED;
else else
hr = IMemAllocator_Commit(This->pAllocator); hr = IMemAllocator_Commit(This->pAllocator);
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
TRACE("--> %08x\n", hr); TRACE("--> %08x\n", hr);
return hr; return hr;
...@@ -602,14 +602,14 @@ HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin *This) ...@@ -602,14 +602,14 @@ HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin *This)
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
if (!This->pin.pConnectedTo || !This->pMemInputPin) if (!This->pin.pConnectedTo || !This->pMemInputPin)
hr = VFW_E_NOT_CONNECTED; hr = VFW_E_NOT_CONNECTED;
else else
hr = IMemAllocator_Decommit(This->pAllocator); hr = IMemAllocator_Decommit(This->pAllocator);
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
TRACE("--> %08x\n", hr); TRACE("--> %08x\n", hr);
return hr; return hr;
...@@ -709,7 +709,6 @@ void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, struct strmb ...@@ -709,7 +709,6 @@ void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, struct strmb
{ {
memset(pin, 0, sizeof(*pin)); memset(pin, 0, sizeof(*pin));
pin->pin.IPin_iface.lpVtbl = vtbl; pin->pin.IPin_iface.lpVtbl = vtbl;
pin->pin.pCritSec = &filter->csFilter;
pin->pin.dRate = 1.0; pin->pin.dRate = 1.0;
pin->pin.filter = filter; pin->pin.filter = filter;
pin->pin.dir = PINDIR_OUTPUT; pin->pin.dir = PINDIR_OUTPUT;
...@@ -779,7 +778,7 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP ...@@ -779,7 +778,7 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP
TRACE("(%p)->(%p, %p)\n", This, pReceivePin, pmt); TRACE("(%p)->(%p, %p)\n", This, pReceivePin, pmt);
dump_AM_MEDIA_TYPE(pmt); dump_AM_MEDIA_TYPE(pmt);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
{ {
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
hr = VFW_E_ALREADY_CONNECTED; hr = VFW_E_ALREADY_CONNECTED;
...@@ -806,7 +805,7 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP ...@@ -806,7 +805,7 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP
IPin_AddRef(pReceivePin); IPin_AddRef(pReceivePin);
} }
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
return hr; return hr;
} }
...@@ -823,12 +822,12 @@ HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface) ...@@ -823,12 +822,12 @@ HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface)
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
if (This->flushing) if (This->flushing)
hr = S_FALSE; hr = S_FALSE;
else else
This->end_of_stream = TRUE; This->end_of_stream = TRUE;
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
if (hr == S_OK) if (hr == S_OK)
hr = SendFurther( iface, deliver_endofstream, NULL, NULL ); hr = SendFurther( iface, deliver_endofstream, NULL, NULL );
...@@ -846,11 +845,11 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface) ...@@ -846,11 +845,11 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface)
HRESULT hr; HRESULT hr;
TRACE("(%p) semi-stub\n", This); TRACE("(%p) semi-stub\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
This->flushing = TRUE; This->flushing = TRUE;
hr = SendFurther( iface, deliver_beginflush, NULL, NULL ); hr = SendFurther( iface, deliver_beginflush, NULL, NULL );
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
return hr; return hr;
} }
...@@ -866,11 +865,11 @@ HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface) ...@@ -866,11 +865,11 @@ HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface)
HRESULT hr; HRESULT hr;
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&This->pin.filter->csFilter);
This->flushing = This->end_of_stream = FALSE; This->flushing = This->end_of_stream = FALSE;
hr = SendFurther( iface, deliver_endflush, NULL, NULL ); hr = SendFurther( iface, deliver_endflush, NULL, NULL );
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&This->pin.filter->csFilter);
return hr; return hr;
} }
...@@ -1037,7 +1036,6 @@ void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, struct strmbase ...@@ -1037,7 +1036,6 @@ void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, struct strmbase
{ {
memset(pin, 0, sizeof(*pin)); memset(pin, 0, sizeof(*pin));
pin->pin.IPin_iface.lpVtbl = vtbl; pin->pin.IPin_iface.lpVtbl = vtbl;
pin->pin.pCritSec = &filter->csFilter;
pin->pin.dRate = 1.0; pin->pin.dRate = 1.0;
pin->pin.filter = filter; pin->pin.filter = filter;
pin->pin.dir = PINDIR_INPUT; pin->pin.dir = PINDIR_INPUT;
......
...@@ -52,14 +52,14 @@ static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin *iface, IPin ...@@ -52,14 +52,14 @@ static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin *iface, IPin
TRACE("iface %p, peer %p, mt %p.\n", iface, peer, mt); TRACE("iface %p, peer %p, mt %p.\n", iface, peer, mt);
EnterCriticalSection(filter->sink.pin.pCritSec); EnterCriticalSection(&filter->filter.csFilter);
hr = BaseInputPinImpl_ReceiveConnection(iface, peer, mt); hr = BaseInputPinImpl_ReceiveConnection(iface, peer, mt);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
if (filter->pFuncsTable->pfnCompleteConnect) if (filter->pFuncsTable->pfnCompleteConnect)
hr = filter->pFuncsTable->pfnCompleteConnect(filter, peer); hr = filter->pFuncsTable->pfnCompleteConnect(filter, peer);
} }
LeaveCriticalSection(filter->sink.pin.pCritSec); LeaveCriticalSection(&filter->filter.csFilter);
return hr; return hr;
} }
...@@ -71,7 +71,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_Disconnect(IPin * iface) ...@@ -71,7 +71,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_Disconnect(IPin * iface)
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
EnterCriticalSection(filter->sink.pin.pCritSec); EnterCriticalSection(&filter->filter.csFilter);
hr = BasePinImpl_Disconnect(iface); hr = BasePinImpl_Disconnect(iface);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -79,7 +79,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_Disconnect(IPin * iface) ...@@ -79,7 +79,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_Disconnect(IPin * iface)
hr = filter->pFuncsTable->pfnBreakConnect(filter); hr = filter->pFuncsTable->pfnBreakConnect(filter);
} }
BaseRendererImpl_ClearPendingSample(filter); BaseRendererImpl_ClearPendingSample(filter);
LeaveCriticalSection(filter->sink.pin.pCritSec); LeaveCriticalSection(&filter->filter.csFilter);
return hr; return hr;
} }
......
...@@ -1287,7 +1287,6 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr) ...@@ -1287,7 +1287,6 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr)
lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name)); lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name));
This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl; This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl;
This->pInputPin.pin.pConnectedTo = NULL; This->pInputPin.pin.pConnectedTo = NULL;
This->pInputPin.pin.pCritSec = &This->filter.csFilter;
ZeroMemory(&This->pInputPin.pin.mtCurrent, sizeof(AM_MEDIA_TYPE)); ZeroMemory(&This->pInputPin.pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
*phr = S_OK; *phr = S_OK;
...@@ -1744,14 +1743,12 @@ static HRESULT WINAPI GSTOutPin_DecideAllocator(BaseOutputPin *base, IMemInputPi ...@@ -1744,14 +1743,12 @@ static HRESULT WINAPI GSTOutPin_DecideAllocator(BaseOutputPin *base, IMemInputPi
static void free_source_pin(GSTOutPin *pin) static void free_source_pin(GSTOutPin *pin)
{ {
EnterCriticalSection(pin->pin.pin.pCritSec);
if (pin->pin.pin.pConnectedTo) if (pin->pin.pin.pConnectedTo)
{ {
if (SUCCEEDED(IMemAllocator_Decommit(pin->pin.pAllocator))) if (SUCCEEDED(IMemAllocator_Decommit(pin->pin.pAllocator)))
IPin_Disconnect(pin->pin.pin.pConnectedTo); IPin_Disconnect(pin->pin.pin.pConnectedTo);
IPin_Disconnect(&pin->pin.pin.IPin_iface); IPin_Disconnect(&pin->pin.pin.IPin_iface);
} }
LeaveCriticalSection(pin->pin.pin.pCritSec);
if (pin->their_src) if (pin->their_src)
{ {
...@@ -1881,7 +1878,7 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1881,7 +1878,7 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
mark_wine_thread(); mark_wine_thread();
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&filter->filter.csFilter);
if (!This->pin.pConnectedTo) { if (!This->pin.pConnectedTo) {
ALLOCATOR_PROPERTIES props; ALLOCATOR_PROPERTIES props;
IMemAllocator *pAlloc = NULL; IMemAllocator *pAlloc = NULL;
...@@ -1940,13 +1937,14 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1940,13 +1937,14 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
TRACE("Size: %i\n", props.cbBuffer); TRACE("Size: %i\n", props.cbBuffer);
} else } else
hr = VFW_E_ALREADY_CONNECTED; hr = VFW_E_ALREADY_CONNECTED;
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&filter->filter.csFilter);
return hr; return hr;
} }
static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface) static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface)
{ {
GSTInPin *This = impl_sink_from_IPin(iface); GSTInPin *This = impl_sink_from_IPin(iface);
GSTImpl *filter = impl_from_strmbase_filter(This->pin.filter);
HRESULT hr; HRESULT hr;
FILTER_STATE state; FILTER_STATE state;
...@@ -1954,8 +1952,8 @@ static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface) ...@@ -1954,8 +1952,8 @@ static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface)
mark_wine_thread(); mark_wine_thread();
hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state); hr = IBaseFilter_GetState(&filter->filter.IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&filter->filter.csFilter);
if (This->pin.pConnectedTo) { if (This->pin.pConnectedTo) {
GSTImpl *Parser = impl_from_strmbase_filter(This->pin.filter); GSTImpl *Parser = impl_from_strmbase_filter(This->pin.filter);
...@@ -1969,7 +1967,7 @@ static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface) ...@@ -1969,7 +1967,7 @@ static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface)
hr = VFW_E_NOT_STOPPED; hr = VFW_E_NOT_STOPPED;
} else } else
hr = S_FALSE; hr = S_FALSE;
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&filter->filter.csFilter);
return hr; return hr;
} }
......
...@@ -317,7 +317,6 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr) ...@@ -317,7 +317,6 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name)); lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name));
This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl; This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl;
This->pInputPin.pin.pConnectedTo = NULL; This->pInputPin.pin.pConnectedTo = NULL;
This->pInputPin.pin.pCritSec = &This->filter.csFilter;
SourceSeeking_Init(&This->sourceSeeking, &QT_Seeking_Vtbl, QTSplitter_ChangeStop, QTSplitter_ChangeStart, QTSplitter_ChangeRate, &This->filter.csFilter); SourceSeeking_Init(&This->sourceSeeking, &QT_Seeking_Vtbl, QTSplitter_ChangeStop, QTSplitter_ChangeStart, QTSplitter_ChangeRate, &This->filter.csFilter);
...@@ -778,14 +777,12 @@ static const IBaseFilterVtbl QT_Vtbl = { ...@@ -778,14 +777,12 @@ static const IBaseFilterVtbl QT_Vtbl = {
static void free_source_pin(QTOutPin *pin) static void free_source_pin(QTOutPin *pin)
{ {
EnterCriticalSection(pin->pin.pin.pCritSec);
if (pin->pin.pin.pConnectedTo) if (pin->pin.pin.pConnectedTo)
{ {
if (SUCCEEDED(IMemAllocator_Decommit(pin->pin.pAllocator))) if (SUCCEEDED(IMemAllocator_Decommit(pin->pin.pAllocator)))
IPin_Disconnect(pin->pin.pin.pConnectedTo); IPin_Disconnect(pin->pin.pin.pConnectedTo);
IPin_Disconnect(&pin->pin.pin.IPin_iface); IPin_Disconnect(&pin->pin.pin.IPin_iface);
} }
LeaveCriticalSection(pin->pin.pin.pCritSec);
DeleteMediaType(pin->pmt); DeleteMediaType(pin->pmt);
strmbase_source_cleanup(&pin->pin); strmbase_source_cleanup(&pin->pin);
...@@ -1044,7 +1041,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1044,7 +1041,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt); TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&filter->filter.csFilter);
This->pReader = NULL; This->pReader = NULL;
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
...@@ -1061,19 +1058,19 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1061,19 +1058,19 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
if (FAILED(hr)) if (FAILED(hr))
{ {
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&filter->filter.csFilter);
return hr; return hr;
} }
hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader); hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
if (FAILED(hr)) if (FAILED(hr))
{ {
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&filter->filter.csFilter);
TRACE("Input source is not an AsyncReader\n"); TRACE("Input source is not an AsyncReader\n");
return hr; return hr;
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&filter->filter.csFilter);
EnterCriticalSection(&filter->filter.csFilter); EnterCriticalSection(&filter->filter.csFilter);
hr = QT_Process_Movie(filter); hr = QT_Process_Movie(filter);
if (FAILED(hr)) if (FAILED(hr))
...@@ -1129,11 +1126,12 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface) ...@@ -1129,11 +1126,12 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface)
{ {
HRESULT hr; HRESULT hr;
QTInPin *This = impl_from_IPin(iface); QTInPin *This = impl_from_IPin(iface);
QTSplitter *filter = impl_from_strmbase_filter(This->pin.filter);
FILTER_STATE state; FILTER_STATE state;
TRACE("()\n"); TRACE("()\n");
hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state); hr = IBaseFilter_GetState(&filter->filter.IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(&filter->filter.csFilter);
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
{ {
QTSplitter *Parser = impl_from_strmbase_filter(This->pin.filter); QTSplitter *Parser = impl_from_strmbase_filter(This->pin.filter);
...@@ -1151,7 +1149,7 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface) ...@@ -1151,7 +1149,7 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface)
} }
else else
hr = S_FALSE; hr = S_FALSE;
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(&filter->filter.csFilter);
return hr; return hr;
} }
......
...@@ -31,7 +31,6 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType); ...@@ -31,7 +31,6 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
typedef struct BasePin typedef struct BasePin
{ {
IPin IPin_iface; IPin IPin_iface;
CRITICAL_SECTION *pCritSec;
struct strmbase_filter *filter; struct strmbase_filter *filter;
PIN_DIRECTION dir; PIN_DIRECTION dir;
WCHAR name[128]; WCHAR name[128];
......
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