mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
quartz: COM cleanup for ParserImpl.
This commit is contained in:
parent
7fab2428c8
commit
11f24690d5
1 changed files with 34 additions and 24 deletions
|
@ -53,10 +53,20 @@ static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
|
|||
return CONTAINING_RECORD(iface, ParserImpl, sourceSeeking.IMediaSeeking_iface);
|
||||
}
|
||||
|
||||
static inline ParserImpl *impl_from_IBaseFilter( IBaseFilter *iface )
|
||||
{
|
||||
return CONTAINING_RECORD(iface, ParserImpl, filter.IBaseFilter_iface);
|
||||
}
|
||||
|
||||
static inline ParserImpl *impl_from_BaseFilter( BaseFilter *iface )
|
||||
{
|
||||
return CONTAINING_RECORD(iface, ParserImpl, filter);
|
||||
}
|
||||
|
||||
/* FIXME: WRONG */
|
||||
static IPin* WINAPI Parser_GetPin(BaseFilter *iface, int pos)
|
||||
{
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_BaseFilter(iface);
|
||||
|
||||
TRACE("Asking for pos %x\n", pos);
|
||||
|
||||
|
@ -70,7 +80,7 @@ static IPin* WINAPI Parser_GetPin(BaseFilter *iface, int pos)
|
|||
|
||||
static LONG WINAPI Parser_GetPinCount(BaseFilter *iface)
|
||||
{
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_BaseFilter(iface);
|
||||
|
||||
return This->cStreams;
|
||||
}
|
||||
|
@ -95,7 +105,7 @@ HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, c
|
|||
|
||||
/* construct input pin */
|
||||
piInput.dir = PINDIR_INPUT;
|
||||
piInput.pFilter = (IBaseFilter *)pParser;
|
||||
piInput.pFilter = &pParser->filter.IBaseFilter_iface;
|
||||
lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
|
||||
|
||||
if (!start)
|
||||
|
@ -119,7 +129,7 @@ HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, c
|
|||
else
|
||||
{
|
||||
CoTaskMemFree(pParser->ppPins);
|
||||
BaseFilterImpl_Release((IBaseFilter*)pParser);
|
||||
BaseFilterImpl_Release(&pParser->filter.IBaseFilter_iface);
|
||||
CoTaskMemFree(pParser);
|
||||
}
|
||||
|
||||
|
@ -128,7 +138,7 @@ HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, c
|
|||
|
||||
HRESULT WINAPI Parser_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
||||
{
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
TRACE("(%s, %p)\n", qzdebugstr_guid(riid), ppv);
|
||||
|
||||
*ppv = NULL;
|
||||
|
@ -191,7 +201,7 @@ void Parser_Destroy(ParserImpl *This)
|
|||
|
||||
ULONG WINAPI Parser_Release(IBaseFilter * iface)
|
||||
{
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
ULONG refCount = BaseFilterImpl_Release(iface);
|
||||
|
||||
TRACE("(%p)->() Release from %d\n", This, refCount + 1);
|
||||
|
@ -206,7 +216,7 @@ ULONG WINAPI Parser_Release(IBaseFilter * iface)
|
|||
|
||||
HRESULT WINAPI Parser_GetClassID(IBaseFilter * iface, CLSID * pClsid)
|
||||
{
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
|
||||
TRACE("(%p)\n", pClsid);
|
||||
|
||||
|
@ -219,7 +229,7 @@ HRESULT WINAPI Parser_GetClassID(IBaseFilter * iface, CLSID * pClsid)
|
|||
|
||||
HRESULT WINAPI Parser_Stop(IBaseFilter * iface)
|
||||
{
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]);
|
||||
ULONG i;
|
||||
|
||||
|
@ -258,7 +268,7 @@ HRESULT WINAPI Parser_Stop(IBaseFilter * iface)
|
|||
HRESULT WINAPI Parser_Pause(IBaseFilter * iface)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]);
|
||||
|
||||
TRACE("()\n");
|
||||
|
@ -292,7 +302,7 @@ HRESULT WINAPI Parser_Pause(IBaseFilter * iface)
|
|||
HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]);
|
||||
|
||||
ULONG i;
|
||||
|
@ -339,7 +349,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
|
|||
|
||||
HRESULT WINAPI Parser_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
|
||||
{
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]);
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
|
@ -361,7 +371,7 @@ HRESULT WINAPI Parser_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FI
|
|||
|
||||
HRESULT WINAPI Parser_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
|
||||
{
|
||||
ParserImpl *This = (ParserImpl *)iface;
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]);
|
||||
|
||||
TRACE("(%p)\n", pClock);
|
||||
|
@ -445,7 +455,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
|
|||
pin->pin.pin.pinInfo.pFilter = (LPVOID)This;
|
||||
pin->allocProps = *props;
|
||||
This->cStreams++;
|
||||
BaseFilterImpl_IncrementPinVersion((BaseFilter*)This);
|
||||
BaseFilterImpl_IncrementPinVersion(&This->filter);
|
||||
CoTaskMemFree(ppOldPins);
|
||||
}
|
||||
else
|
||||
|
@ -478,7 +488,7 @@ static HRESULT Parser_RemoveOutputPins(ParserImpl * This)
|
|||
IPin_Release(ppOldPins[i + 1]);
|
||||
}
|
||||
|
||||
BaseFilterImpl_IncrementPinVersion((BaseFilter*)This);
|
||||
BaseFilterImpl_IncrementPinVersion(&This->filter);
|
||||
This->cStreams = 0;
|
||||
CoTaskMemFree(ppOldPins);
|
||||
|
||||
|
@ -551,7 +561,7 @@ static const IMediaSeekingVtbl Parser_Seeking_Vtbl =
|
|||
|
||||
static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
|
||||
{
|
||||
Parser_OutputPin *This = (Parser_OutputPin *)iface;
|
||||
Parser_OutputPin *This = (Parser_OutputPin*)iface;
|
||||
ALLOCATOR_PROPERTIES actual;
|
||||
|
||||
if (ppropInputRequest->cbAlign && ppropInputRequest->cbAlign != This->allocProps.cbAlign)
|
||||
|
@ -568,7 +578,7 @@ static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(BaseOutputPin *iface, IM
|
|||
|
||||
static HRESULT WINAPI Parser_OutputPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
Parser_OutputPin *This = (Parser_OutputPin *)iface;
|
||||
Parser_OutputPin *This = (Parser_OutputPin*)iface;
|
||||
if (iPosition < 0)
|
||||
return E_INVALIDARG;
|
||||
if (iPosition > 0)
|
||||
|
@ -579,7 +589,7 @@ static HRESULT WINAPI Parser_OutputPin_GetMediaType(BasePin *iface, int iPositio
|
|||
|
||||
static HRESULT WINAPI Parser_OutputPin_DecideAllocator(BaseOutputPin *iface, IMemInputPin *pPin, IMemAllocator **pAlloc)
|
||||
{
|
||||
Parser_OutputPin *This = (Parser_OutputPin *)iface;
|
||||
Parser_OutputPin *This = (Parser_OutputPin*)iface;
|
||||
HRESULT hr;
|
||||
|
||||
*pAlloc = NULL;
|
||||
|
@ -604,7 +614,7 @@ static HRESULT WINAPI Parser_OutputPin_BreakConnect(BaseOutputPin *This)
|
|||
else
|
||||
{
|
||||
hr = IPin_Disconnect(This->pin.pConnectedTo);
|
||||
IPin_Disconnect((IPin *)This);
|
||||
IPin_Disconnect(&This->pin.IPin_iface);
|
||||
}
|
||||
LeaveCriticalSection(This->pin.pCritSec);
|
||||
|
||||
|
@ -626,7 +636,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid,
|
|||
*ppv = iface;
|
||||
/* The Parser filter does not support querying IMediaSeeking, return it directly */
|
||||
else if (IsEqualIID(riid, &IID_IMediaSeeking))
|
||||
*ppv = &((ParserImpl*)This->pin.pin.pinInfo.pFilter)->sourceSeeking;
|
||||
*ppv = &impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter)->sourceSeeking;
|
||||
|
||||
if (*ppv)
|
||||
{
|
||||
|
@ -660,7 +670,7 @@ static ULONG WINAPI Parser_OutputPin_Release(IPin * iface)
|
|||
static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
|
||||
{
|
||||
Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
|
||||
ParserImpl *parser = (ParserImpl *)This->pin.pin.pinInfo.pFilter;
|
||||
ParserImpl *parser = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter);
|
||||
|
||||
/* Set the allocator to our input pin's */
|
||||
EnterCriticalSection(This->pin.pin.pCritSec);
|
||||
|
@ -716,7 +726,7 @@ static HRESULT WINAPI Parser_PullPin_QueryInterface(IPin * iface, REFIID riid, L
|
|||
* querying IMediaSeeking
|
||||
*/
|
||||
if (IsEqualIID(riid, &IID_IMediaSeeking))
|
||||
*ppv = &((ParserImpl*)This->pin.pinInfo.pFilter)->sourceSeeking;
|
||||
*ppv = &impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->sourceSeeking;
|
||||
|
||||
if (*ppv)
|
||||
{
|
||||
|
@ -740,7 +750,7 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
|
|||
if (This->pin.pConnectedTo)
|
||||
{
|
||||
FILTER_STATE state;
|
||||
ParserImpl *Parser = (ParserImpl *)This->pin.pinInfo.pFilter;
|
||||
ParserImpl *Parser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
|
||||
|
||||
LeaveCriticalSection(This->pin.pCritSec);
|
||||
hr = IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state);
|
||||
|
@ -751,7 +761,7 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
|
|||
LeaveCriticalSection(This->pin.pCritSec);
|
||||
PullPin_Disconnect(iface);
|
||||
EnterCriticalSection(This->pin.pCritSec);
|
||||
hr = Parser_RemoveOutputPins((ParserImpl *)This->pin.pinInfo.pFilter);
|
||||
hr = Parser_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter));
|
||||
}
|
||||
else
|
||||
hr = VFW_E_NOT_STOPPED;
|
||||
|
@ -777,7 +787,7 @@ static HRESULT WINAPI Parser_PullPin_ReceiveConnection(IPin * iface, IPin * pRec
|
|||
BasePin *This = (BasePin *)iface;
|
||||
|
||||
EnterCriticalSection(This->pCritSec);
|
||||
Parser_RemoveOutputPins((ParserImpl *)This->pinInfo.pFilter);
|
||||
Parser_RemoveOutputPins(impl_from_IBaseFilter(This->pinInfo.pFilter));
|
||||
LeaveCriticalSection(This->pCritSec);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue