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

wineqtdecoder/qtsplitter: Use BaseFilterImpl_Release().

parent 42699ad1
......@@ -233,8 +233,67 @@ static IPin *qt_splitter_get_pin(BaseFilter *base, unsigned int index)
return NULL;
}
static void qt_splitter_destroy(BaseFilter *iface)
{
QTSplitter *filter = impl_from_BaseFilter(iface);
IPin *peer = NULL;
ULONG pinref;
EnterCriticalSection(&filter->csReceive);
/* Don't need to clean up output pins, disconnecting input pin will do that */
IPin_ConnectedTo(&filter->pInputPin.pin.IPin_iface, &peer);
if (peer)
{
IPin_Disconnect(peer);
IPin_Release(peer);
}
pinref = IPin_Release(&filter->pInputPin.pin.IPin_iface);
if (pinref)
{
ERR("pinref should be null, is %u, destroying anyway\n", pinref);
assert((LONG)pinref > 0);
while (pinref)
pinref = IPin_Release(&filter->pInputPin.pin.IPin_iface);
}
if (filter->pQTMovie)
{
DisposeMovie(filter->pQTMovie);
filter->pQTMovie = NULL;
}
if (filter->vContext)
QTVisualContextRelease(filter->vContext);
if (filter->aSession)
MovieAudioExtractionEnd(filter->aSession);
ExitMoviesOnThread();
LeaveCriticalSection(&filter->csReceive);
if (filter->loaderThread)
{
WaitForSingleObject(filter->loaderThread, INFINITE);
CloseHandle(filter->loaderThread);
}
if (filter->splitterThread)
{
SetEvent(filter->runEvent);
WaitForSingleObject(filter->splitterThread, INFINITE);
CloseHandle(filter->splitterThread);
}
CloseHandle(filter->runEvent);
filter->csReceive.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&filter->csReceive);
strmbase_filter_cleanup(&filter->filter);
CoTaskMemFree(filter);
}
static const BaseFilterFuncTable BaseFuncTable = {
.filter_get_pin = qt_splitter_get_pin,
.filter_destroy = qt_splitter_destroy,
};
IUnknown * CALLBACK QTSplitter_create(IUnknown *punkout, HRESULT *phr)
......@@ -283,65 +342,6 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *punkout, HRESULT *phr)
return obj;
}
static void QT_Destroy(QTSplitter *This)
{
IPin *connected = NULL;
ULONG pinref;
TRACE("Destroying\n");
EnterCriticalSection(&This->csReceive);
/* Don't need to clean up output pins, disconnecting input pin will do that */
IPin_ConnectedTo(&This->pInputPin.pin.IPin_iface, &connected);
if (connected)
{
IPin_Disconnect(connected);
IPin_Release(connected);
}
pinref = IPin_Release(&This->pInputPin.pin.IPin_iface);
if (pinref)
{
ERR("pinref should be null, is %u, destroying anyway\n", pinref);
assert((LONG)pinref > 0);
while (pinref)
pinref = IPin_Release(&This->pInputPin.pin.IPin_iface);
}
if (This->pQTMovie)
{
DisposeMovie(This->pQTMovie);
This->pQTMovie = NULL;
}
if (This->vContext)
QTVisualContextRelease(This->vContext);
if (This->aSession)
MovieAudioExtractionEnd(This->aSession);
ExitMoviesOnThread();
LeaveCriticalSection(&This->csReceive);
if (This->loaderThread)
{
WaitForSingleObject(This->loaderThread, INFINITE);
CloseHandle(This->loaderThread);
}
if (This->splitterThread)
{
SetEvent(This->runEvent);
WaitForSingleObject(This->splitterThread, INFINITE);
CloseHandle(This->splitterThread);
}
CloseHandle(This->runEvent);
This->csReceive.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->csReceive);
strmbase_filter_cleanup(&This->filter);
CoTaskMemFree(This);
}
static HRESULT WINAPI QT_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID *ppv)
{
QTSplitter *This = impl_from_IBaseFilter(iface);
......@@ -373,19 +373,6 @@ static HRESULT WINAPI QT_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID
return E_NOINTERFACE;
}
static ULONG WINAPI QT_Release(IBaseFilter *iface)
{
QTSplitter *This = impl_from_IBaseFilter(iface);
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
TRACE("(%p)->() Release from %d\n", This, refCount + 1);
if (!refCount)
QT_Destroy(This);
return refCount;
}
static HRESULT WINAPI QT_Stop(IBaseFilter *iface)
{
QTSplitter *This = impl_from_IBaseFilter(iface);
......@@ -791,7 +778,7 @@ static HRESULT WINAPI QT_GetState(IBaseFilter *iface, DWORD dwMilliSecsTimeout,
static const IBaseFilterVtbl QT_Vtbl = {
QT_QueryInterface,
BaseFilterImpl_AddRef,
QT_Release,
BaseFilterImpl_Release,
BaseFilterImpl_GetClassID,
QT_Stop,
QT_Pause,
......
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