Maarten Lankhorst : quartz: Fix incorrect use of mtCurrent in transform filter.
Alexandre Julliard
julliard at winehq.org
Mon Jul 14 05:57:07 CDT 2008
Module: wine
Branch: master
Commit: 36418d8ad162df4ff237853adf5c048e830ef016
URL: http://source.winehq.org/git/wine.git/?a=commit;h=36418d8ad162df4ff237853adf5c048e830ef016
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Thu Jul 10 21:41:35 2008 -0700
quartz: Fix incorrect use of mtCurrent in transform filter.
---
dlls/quartz/acmwrapper.c | 4 +++-
dlls/quartz/avidec.c | 3 ++-
dlls/quartz/pin.c | 14 +++++++++++---
dlls/quartz/transform.c | 5 ++++-
dlls/quartz/transform.h | 1 +
5 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c
index 8a63554..2dc49da 100644
--- a/dlls/quartz/acmwrapper.c
+++ b/dlls/quartz/acmwrapper.c
@@ -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 */
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index 84cb296..476e0d3 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -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)
{
diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c
index e45db96..0abeb13 100644
--- a/dlls/quartz/pin.c
+++ b/dlls/quartz/pin.c
@@ -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 */
diff --git a/dlls/quartz/transform.c b/dlls/quartz/transform.c
index 9df01f2..97812bd 100644
--- a/dlls/quartz/transform.c
+++ b/dlls/quartz/transform.c
@@ -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);
}
diff --git a/dlls/quartz/transform.h b/dlls/quartz/transform.h
index 89d7dfb..0f20b6e 100644
--- a/dlls/quartz/transform.h
+++ b/dlls/quartz/transform.h
@@ -45,6 +45,7 @@ struct TransformFilterImpl
struct MediaSeekingImpl mediaSeeking;
IPin ** ppPins;
+ AM_MEDIA_TYPE pmt;
const TransformFuncsTable * pFuncsTable;
};
More information about the wine-cvs
mailing list