Paul Chitescu : qedit: SampleGrabber pins should enumerate a preferred format only after the input pin is connected and a fully defined format is known .
Alexandre Julliard
julliard at winehq.org
Mon Mar 15 12:19:34 CDT 2010
Module: wine
Branch: master
Commit: 2ad03b9b7479c00e9a64a36d7fa1623ddb2c82f3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2ad03b9b7479c00e9a64a36d7fa1623ddb2c82f3
Author: Paul Chitescu <paulc at voip.null.ro>
Date: Fri Mar 12 11:35:27 2010 +0200
qedit: SampleGrabber pins should enumerate a preferred format only after the input pin is connected and a fully defined format is known.
---
dlls/qedit/samplegrabber.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c
index c766cfa..327004e 100644
--- a/dlls/qedit/samplegrabber.c
+++ b/dlls/qedit/samplegrabber.c
@@ -37,7 +37,7 @@ static WCHAR const pin_in_name[] = { 'I', 'n', 0 };
static WCHAR const pin_out_name[] = { 'O', 'u', 't', 0 };
IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount);
-IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype);
+IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype);
/* Fixed pins enumerator, holds filter referenced */
typedef struct _PE_Impl {
@@ -258,7 +258,7 @@ Single_IEnumMediaTypes_Next(IEnumMediaTypes *iface, ULONG nTypes, AM_MEDIA_TYPE
return E_INVALIDARG;
if (!types || ((nTypes != 1) && !fetched))
return E_POINTER;
- if (!This->past) {
+ if (!This->past && !IsEqualGUID(&This->mtype.majortype,&GUID_NULL)) {
AM_MEDIA_TYPE *mtype = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
*mtype = This->mtype;
if (mtype->cbFormat) {
@@ -324,7 +324,7 @@ static const IEnumMediaTypesVtbl IEnumMediaTypes_VTable =
Single_IEnumMediaTypes_Clone,
};
-IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype)
+IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype)
{
ME_Impl *obj = CoTaskMemAlloc(sizeof(ME_Impl));
if (obj) {
@@ -332,14 +332,18 @@ IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype)
obj->me.lpVtbl = &IEnumMediaTypes_VTable;
obj->refCount = 1;
obj->past = FALSE;
- obj->mtype = *mtype;
- obj->mtype.pUnk = NULL;
- if (mtype->cbFormat) {
- obj->mtype.pbFormat = CoTaskMemAlloc(mtype->cbFormat);
- CopyMemory(obj->mtype.pbFormat, mtype->pbFormat, mtype->cbFormat);
+ if (mtype) {
+ obj->mtype = *mtype;
+ obj->mtype.pUnk = NULL;
+ if (mtype->cbFormat) {
+ obj->mtype.pbFormat = CoTaskMemAlloc(mtype->cbFormat);
+ CopyMemory(obj->mtype.pbFormat, mtype->pbFormat, mtype->cbFormat);
+ }
+ else
+ obj->mtype.pbFormat = NULL;
}
else
- obj->mtype.pbFormat = NULL;
+ obj->mtype.majortype = GUID_NULL;
}
return &obj->me;
}
@@ -1212,7 +1216,7 @@ SampleGrabber_IPin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **mtypes)
TRACE("(%p)->(%p)\n", This, mtypes);
if (!mtypes)
return E_POINTER;
- *mtypes = mediaenum_create(&This->sg->mtype);
+ *mtypes = mediaenum_create(This->sg->pin_in.pair ? &This->sg->mtype : (const AM_MEDIA_TYPE *)NULL);
return *mtypes ? S_OK : E_OUTOFMEMORY;
}
More information about the wine-cvs
mailing list