quartz: Fix incorrect use of mtCurrent in transform filter.

This commit is contained in:
Maarten Lankhorst 2008-07-10 21:41:35 -07:00 committed by Alexandre Julliard
parent 8291034d01
commit 36418d8ad1
5 changed files with 21 additions and 6 deletions

View File

@ -248,7 +248,9 @@ static HRESULT ACMWrapper_ConnectInput(TransformFilterImpl* pTransformFilter, co
(IsEqualIID(&pmt->formattype, &FORMAT_WaveFormatEx)))
{
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;
/* HACK */

View File

@ -213,11 +213,12 @@ static HRESULT AVIDec_ConnectInput(TransformFilterImpl* pTransformFilter, const
This->hvid = ICLocate(pmt->majortype.Data1, pmt->subtype.Data1, bmi, NULL, ICMODE_DECOMPRESS);
if (This->hvid)
{
AM_MEDIA_TYPE* outpmt = &((OutputPin*)This->tf.ppPins[1])->pin.mtCurrent;
AM_MEDIA_TYPE* outpmt = &This->tf.pmt;
const CLSID* outsubtype;
DWORD bih_size;
DWORD output_depth = bmi->biBitCount;
DWORD result;
FreeMediaType(outpmt);
switch(bmi->biBitCount)
{

View File

@ -928,7 +928,7 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
/* negotiate media type */
IEnumMediaTypes * pEnumCandidates;
AM_MEDIA_TYPE * pmtCandidate; /* Candidate media type */
AM_MEDIA_TYPE * pmtCandidate = NULL; /* Candidate media type */
if (SUCCEEDED(hr = IPin_EnumMediaTypes(iface, &pEnumCandidates)))
{
@ -937,6 +937,9 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
/* try this filter's media types first */
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) ) &&
(This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK))
{
@ -944,7 +947,8 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
CoTaskMemFree(pmtCandidate);
break;
}
CoTaskMemFree(pmtCandidate);
DeleteMediaType(pmtCandidate);
pmtCandidate = NULL;
}
IEnumMediaTypes_Release(pEnumCandidates);
}
@ -956,6 +960,9 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
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) ) &&
(This->pConnectSpecific(iface, pReceivePin, pmtCandidate) == S_OK))
{
@ -963,7 +970,8 @@ HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDI
CoTaskMemFree(pmtCandidate);
break;
}
CoTaskMemFree(pmtCandidate);
DeleteMediaType(pmtCandidate);
pmtCandidate = NULL;
} /* while */
IEnumMediaTypes_Release(pEnumCandidates);
} /* if not found */

View File

@ -164,6 +164,7 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
pTransformFilter->state = State_Stopped;
pTransformFilter->pClock = NULL;
ZeroMemory(&pTransformFilter->filterInfo, sizeof(FILTER_INFO));
ZeroMemory(&pTransformFilter->pmt, sizeof(pTransformFilter->pmt));
pTransformFilter->ppPins = CoTaskMemAlloc(2 * sizeof(IPin *));
@ -288,6 +289,7 @@ static ULONG WINAPI TransformFilter_Release(IBaseFilter * iface)
DeleteCriticalSection(&This->csFilter);
TRACE("Destroying transform filter\n");
FreeMediaType(&This->pmt);
CoTaskMemFree(This);
return 0;
@ -603,12 +605,13 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
static HRESULT WINAPI TransformFilter_Output_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
{
IPinImpl *This = (IPinImpl *)iface;
TransformFilterImpl *pTransform = (TransformFilterImpl *)This->pinInfo.pFilter;
ENUMMEDIADETAILS emd;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
emd.cMediaTypes = 1;
emd.pMediaTypes = &This->mtCurrent;
emd.pMediaTypes = &pTransform->pmt;
return IEnumMediaTypesImpl_Construct(&emd, ppEnum);
}

View File

@ -45,6 +45,7 @@ struct TransformFilterImpl
struct MediaSeekingImpl mediaSeeking;
IPin ** ppPins;
AM_MEDIA_TYPE pmt;
const TransformFuncsTable * pFuncsTable;
};