Commit 36418d8a authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Fix incorrect use of mtCurrent in transform filter.

parent 8291034d
...@@ -248,7 +248,9 @@ static HRESULT ACMWrapper_ConnectInput(TransformFilterImpl* pTransformFilter, co ...@@ -248,7 +248,9 @@ static HRESULT ACMWrapper_ConnectInput(TransformFilterImpl* pTransformFilter, co
(IsEqualIID(&pmt->formattype, &FORMAT_WaveFormatEx))) (IsEqualIID(&pmt->formattype, &FORMAT_WaveFormatEx)))
{ {
HACMSTREAM drv; HACMSTREAM drv;
AM_MEDIA_TYPE* outpmt = &((OutputPin*)This->tf.ppPins[1])->pin.mtCurrent; AM_MEDIA_TYPE* outpmt = &This->tf.pmt;
FreeMediaType(outpmt);
This->pWfIn = (LPWAVEFORMATEX)pmt->pbFormat; This->pWfIn = (LPWAVEFORMATEX)pmt->pbFormat;
/* HACK */ /* HACK */
......
...@@ -213,11 +213,12 @@ static HRESULT AVIDec_ConnectInput(TransformFilterImpl* pTransformFilter, const ...@@ -213,11 +213,12 @@ static HRESULT AVIDec_ConnectInput(TransformFilterImpl* pTransformFilter, const
This->hvid = ICLocate(pmt->majortype.Data1, pmt->subtype.Data1, bmi, NULL, ICMODE_DECOMPRESS); This->hvid = ICLocate(pmt->majortype.Data1, pmt->subtype.Data1, bmi, NULL, ICMODE_DECOMPRESS);
if (This->hvid) if (This->hvid)
{ {
AM_MEDIA_TYPE* outpmt = &((OutputPin*)This->tf.ppPins[1])->pin.mtCurrent; AM_MEDIA_TYPE* outpmt = &This->tf.pmt;
const CLSID* outsubtype; const CLSID* outsubtype;
DWORD bih_size; DWORD bih_size;
DWORD output_depth = bmi->biBitCount; DWORD output_depth = bmi->biBitCount;
DWORD result; DWORD result;
FreeMediaType(outpmt);
switch(bmi->biBitCount) switch(bmi->biBitCount)
{ {
......
...@@ -928,7 +928,7 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI ...@@ -928,7 +928,7 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
/* negotiate media type */ /* negotiate media type */
IEnumMediaTypes * pEnumCandidates; IEnumMediaTypes * pEnumCandidates;
AM_MEDIA_TYPE * pmtCandidate; /* Candidate media type */ AM_MEDIA_TYPE * pmtCandidate = NULL; /* Candidate media type */
if (SUCCEEDED(hr = IPin_EnumMediaTypes(iface, &pEnumCandidates))) if (SUCCEEDED(hr = IPin_EnumMediaTypes(iface, &pEnumCandidates)))
{ {
...@@ -937,6 +937,9 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI ...@@ -937,6 +937,9 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
/* try this filter's media types first */ /* try this filter's media types first */
while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, NULL)) while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, NULL))
{ {
assert(pmtCandidate);
if (!IsEqualGUID(&FORMAT_None, &pmtCandidate->formattype))
assert(pmtCandidate->pbFormat);
if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) && if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) &&
(This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK)) (This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK))
{ {
...@@ -944,7 +947,8 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI ...@@ -944,7 +947,8 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
CoTaskMemFree(pmtCandidate); CoTaskMemFree(pmtCandidate);
break; break;
} }
CoTaskMemFree(pmtCandidate); DeleteMediaType(pmtCandidate);
pmtCandidate = NULL;
} }
IEnumMediaTypes_Release(pEnumCandidates); IEnumMediaTypes_Release(pEnumCandidates);
} }
...@@ -956,6 +960,9 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI ...@@ -956,6 +960,9 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, NULL)) while (S_OK == IEnumMediaTypes_Next(pEnumCandidates, 1, &pmtCandidate, NULL))
{ {
assert(pmtCandidate);
if (!IsEqualGUID(&FORMAT_None, &pmtCandidate->formattype))
assert(pmtCandidate->pbFormat);
if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) && if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) &&
(This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK)) (This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK))
{ {
...@@ -963,7 +970,8 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI ...@@ -963,7 +970,8 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
CoTaskMemFree(pmtCandidate); CoTaskMemFree(pmtCandidate);
break; break;
} }
CoTaskMemFree(pmtCandidate); DeleteMediaType(pmtCandidate);
pmtCandidate = NULL;
} /* while */ } /* while */
IEnumMediaTypes_Release(pEnumCandidates); IEnumMediaTypes_Release(pEnumCandidates);
} /* if not found */ } /* if not found */
......
...@@ -164,6 +164,7 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI ...@@ -164,6 +164,7 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
pTransformFilter->state = State_Stopped; pTransformFilter->state = State_Stopped;
pTransformFilter->pClock = NULL; pTransformFilter->pClock = NULL;
ZeroMemory(&pTransformFilter->filterInfo, sizeof(FILTER_INFO)); ZeroMemory(&pTransformFilter->filterInfo, sizeof(FILTER_INFO));
ZeroMemory(&pTransformFilter->pmt, sizeof(pTransformFilter->pmt));
pTransformFilter->ppPins = CoTaskMemAlloc(2 * sizeof(IPin *)); pTransformFilter->ppPins = CoTaskMemAlloc(2 * sizeof(IPin *));
...@@ -288,6 +289,7 @@ static ULONG WINAPI TransformFilter_Release(IBaseFilter * iface) ...@@ -288,6 +289,7 @@ static ULONG WINAPI TransformFilter_Release(IBaseFilter * iface)
DeleteCriticalSection(&This->csFilter); DeleteCriticalSection(&This->csFilter);
TRACE("Destroying transform filter\n"); TRACE("Destroying transform filter\n");
FreeMediaType(&This->pmt);
CoTaskMemFree(This); CoTaskMemFree(This);
return 0; return 0;
...@@ -603,12 +605,13 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl = ...@@ -603,12 +605,13 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
static HRESULT WINAPI TransformFilter_Output_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum) static HRESULT WINAPI TransformFilter_Output_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
{ {
IPinImpl *This = (IPinImpl *)iface; IPinImpl *This = (IPinImpl *)iface;
TransformFilterImpl *pTransform = (TransformFilterImpl *)This->pinInfo.pFilter;
ENUMMEDIADETAILS emd; ENUMMEDIADETAILS emd;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum); TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
emd.cMediaTypes = 1; emd.cMediaTypes = 1;
emd.pMediaTypes = &This->mtCurrent; emd.pMediaTypes = &pTransform->pmt;
return IEnumMediaTypesImpl_Construct(&emd, ppEnum); return IEnumMediaTypesImpl_Construct(&emd, ppEnum);
} }
......
...@@ -45,6 +45,7 @@ struct TransformFilterImpl ...@@ -45,6 +45,7 @@ struct TransformFilterImpl
struct MediaSeekingImpl mediaSeeking; struct MediaSeekingImpl mediaSeeking;
IPin ** ppPins; IPin ** ppPins;
AM_MEDIA_TYPE pmt;
const TransformFuncsTable * pFuncsTable; const TransformFuncsTable * pFuncsTable;
}; };
......
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