diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c index e90035d5fca..20bfe927a62 100644 --- a/dlls/quartz/avisplit.c +++ b/dlls/quartz/avisplit.c @@ -594,7 +594,7 @@ HRESULT AVISplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) This->pCurrentSample = NULL; - hr = Parser_Create(&(This->Parser), &CLSID_AviSplitter, AVISplitter_Sample, AVISplitter_QueryAccept, AVISplitter_InputPin_PreConnect); + hr = Parser_Create(&(This->Parser), &CLSID_AviSplitter, AVISplitter_Sample, AVISplitter_QueryAccept, AVISplitter_InputPin_PreConnect, NULL); if (FAILED(hr)) return hr; diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 01d215f3936..8e85456118e 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -60,7 +60,7 @@ static inline Parser_OutputPin *impl_from_IMediaSeeking( IMediaSeeking *iface ) } -HRESULT Parser_Create(ParserImpl* pParser, const CLSID* pClsid, PFN_PROCESS_SAMPLE fnProcessSample, PFN_QUERY_ACCEPT fnQueryAccept, PFN_PRE_CONNECT fnPreConnect) +HRESULT Parser_Create(ParserImpl* pParser, const CLSID* pClsid, PFN_PROCESS_SAMPLE fnProcessSample, PFN_QUERY_ACCEPT fnQueryAccept, PFN_PRE_CONNECT fnPreConnect, PFN_CLEANUP fnCleanup) { HRESULT hr; PIN_INFO piInput; @@ -74,6 +74,7 @@ HRESULT Parser_Create(ParserImpl* pParser, const CLSID* pClsid, PFN_PROCESS_SAMP pParser->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ParserImpl.csFilter"); pParser->state = State_Stopped; pParser->pClock = NULL; + pParser->fnCleanup = fnCleanup; ZeroMemory(&pParser->filterInfo, sizeof(FILTER_INFO)); pParser->cStreams = 0; @@ -187,6 +188,9 @@ static ULONG WINAPI Parser_Release(IBaseFilter * iface) { ULONG i; + if (This->fnCleanup) + This->fnCleanup(This); + if (This->pClock) IReferenceClock_Release(This->pClock); diff --git a/dlls/quartz/parser.h b/dlls/quartz/parser.h index fec1d3731fd..25f1d6dd0fb 100644 --- a/dlls/quartz/parser.h +++ b/dlls/quartz/parser.h @@ -23,6 +23,7 @@ typedef struct ParserImpl ParserImpl; typedef HRESULT (*PFN_PROCESS_SAMPLE) (LPVOID iface, IMediaSample * pSample); typedef HRESULT (*PFN_QUERY_ACCEPT) (LPVOID iface, const AM_MEDIA_TYPE * pmt); typedef HRESULT (*PFN_PRE_CONNECT) (IPin * iface, IPin * pConnectPin); +typedef HRESULT (*PFN_CLEANUP) (LPVOID iface); struct ParserImpl { @@ -33,6 +34,7 @@ struct ParserImpl FILTER_STATE state; REFERENCE_TIME rtStreamStart; IReferenceClock * pClock; + PFN_CLEANUP fnCleanup; FILTER_INFO filterInfo; CLSID clsid; @@ -54,4 +56,4 @@ typedef struct Parser_OutputPin } Parser_OutputPin; HRESULT Parser_AddPin(ParserImpl * This, PIN_INFO * piOutput, ALLOCATOR_PROPERTIES * props, AM_MEDIA_TYPE * amt, float fSamplesPerSec, DWORD dwSampleSize, DWORD dwLength); -HRESULT Parser_Create(ParserImpl*, const CLSID*, PFN_PROCESS_SAMPLE, PFN_QUERY_ACCEPT, PFN_PRE_CONNECT); +HRESULT Parser_Create(ParserImpl*, const CLSID*, PFN_PROCESS_SAMPLE, PFN_QUERY_ACCEPT, PFN_PRE_CONNECT, PFN_CLEANUP); diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c index 5cd979fadcb..7feeadf71ee 100644 --- a/dlls/quartz/waveparser.c +++ b/dlls/quartz/waveparser.c @@ -318,7 +318,7 @@ HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv) This->pCurrentSample = NULL; - hr = Parser_Create(&(This->Parser), &CLSID_WAVEParser, WAVEParser_Sample, WAVEParser_QueryAccept, WAVEParser_InputPin_PreConnect); + hr = Parser_Create(&(This->Parser), &CLSID_WAVEParser, WAVEParser_Sample, WAVEParser_QueryAccept, WAVEParser_InputPin_PreConnect, NULL); if (FAILED(hr)) return hr;