Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/avisplit.c | 4 ++-- dlls/strmbase/pin.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index e3c20140bc1..fa10f54a7c4 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -1191,12 +1191,12 @@ static void test_connect_pin(void)
req_mt.majortype = MEDIATYPE_Stream; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); req_mt.majortype = MEDIATYPE_Video;
req_mt.subtype = MEDIASUBTYPE_RGB32; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 18631410b77..305310fbc4d 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -735,8 +735,8 @@ HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(struct strmbase_source *This,
TRACE("(%p)->(%p, %p)\n", This, pReceivePin, pmt);
- if ((hr = This->pFuncsTable->base.pin_query_accept(&This->pin, pmt)) != S_OK) - return hr; + if (This->pFuncsTable->base.pin_query_accept(&This->pin, pmt) != S_OK) + return VFW_E_TYPE_NOT_ACCEPTED;
This->pin.peer = pReceivePin; IPin_AddRef(pReceivePin);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/samplegrabber.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-)
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index 7652f70d958..398a5bb815b 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -575,16 +575,12 @@ static HRESULT sample_grabber_source_get_media_type(struct strmbase_pin *iface, return VFW_S_NO_MORE_ITEMS; }
-static HRESULT WINAPI sample_grabber_source_AttemptConnection(struct strmbase_source *iface, - IPin *peer, const AM_MEDIA_TYPE *mt) +static HRESULT WINAPI sample_grabber_source_DecideAllocator(struct strmbase_source *iface, + IMemInputPin *peer, IMemAllocator **allocator) { SG_Impl *filter = impl_from_source_pin(&iface->pin); - HRESULT hr; + const AM_MEDIA_TYPE *mt = &iface->pin.mt;
- if (filter->source.pin.peer) - return VFW_E_ALREADY_CONNECTED; - if (filter->filter.state != State_Stopped) - return VFW_E_NOT_STOPPED; if (!IsEqualGUID(&mt->majortype, &filter->mtype.majortype)) return VFW_E_TYPE_NOT_ACCEPTED; if (!IsEqualGUID(&mt->subtype, &filter->mtype.subtype)) @@ -598,19 +594,7 @@ static HRESULT WINAPI sample_grabber_source_AttemptConnection(struct strmbase_so && !mt->pbFormat) return VFW_E_TYPE_NOT_ACCEPTED;
- IPin_AddRef(filter->source.pin.peer = peer); - CopyMediaType(&filter->source.pin.mt, mt); - if (SUCCEEDED(hr = IPin_ReceiveConnection(peer, &filter->source.pin.IPin_iface, mt))) - hr = IPin_QueryInterface(peer, &IID_IMemInputPin, (void **)&filter->source.pMemInputPin); - - if (FAILED(hr)) - { - IPin_Release(filter->source.pin.peer); - filter->source.pin.peer = NULL; - FreeMediaType(&filter->source.pin.mt); - } - - return hr; + return S_OK; }
static const struct strmbase_source_ops source_ops = @@ -618,7 +602,8 @@ static const struct strmbase_source_ops source_ops = .base.pin_query_interface = sample_grabber_source_query_interface, .base.pin_query_accept = sample_grabber_source_query_accept, .base.pin_get_media_type = sample_grabber_source_get_media_type, - .pfnAttemptConnection = sample_grabber_source_AttemptConnection, + .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection, + .pfnDecideAllocator = sample_grabber_source_DecideAllocator, };
HRESULT SampleGrabber_create(IUnknown *outer, void **out)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/samplegrabber.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index 398a5bb815b..6a9dea0b9fb 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -519,12 +519,11 @@ static HRESULT sample_grabber_sink_connect(struct strmbase_sink *iface, && !IsEqualGUID(&filter->mtype.majortype, &mt->majortype)) return VFW_E_TYPE_NOT_ACCEPTED;
- if (!IsEqualGUID(&filter->mtype.subtype,&MEDIASUBTYPE_None) + if (!IsEqualGUID(&filter->mtype.subtype, &GUID_NULL) && !IsEqualGUID(&filter->mtype.subtype, &mt->subtype)) return VFW_E_TYPE_NOT_ACCEPTED;
if (!IsEqualGUID(&filter->mtype.formattype, &GUID_NULL) - && !IsEqualGUID(&filter->mtype.formattype, &FORMAT_None) && !IsEqualGUID(&filter->mtype.formattype, &mt->formattype)) return VFW_E_TYPE_NOT_ACCEPTED;
@@ -626,9 +625,6 @@ HRESULT SampleGrabber_create(IUnknown *outer, void **out) strmbase_sink_init(&obj->sink, &obj->filter, L"In", &sink_ops, NULL); strmbase_source_init(&obj->source, &obj->filter, L"Out", &source_ops);
- obj->mtype.majortype = GUID_NULL; - obj->mtype.subtype = MEDIASUBTYPE_None; - obj->mtype.formattype = FORMAT_None; obj->allocator = NULL; obj->grabberIface = NULL; obj->grabberMethod = -1;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/samplegrabber.c | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index 6a9dea0b9fb..8f30ebe46e3 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -43,7 +43,7 @@ typedef struct _SG_Impl { IUnknown *seekthru_unk;
struct strmbase_sink sink; - AM_MEDIA_TYPE mtype; + AM_MEDIA_TYPE filter_mt; IMemInputPin IMemInputPin_iface; IMemAllocator *allocator;
@@ -84,7 +84,7 @@ static void SampleGrabber_cleanup(SG_Impl *This) IMemAllocator_Release(This->allocator); if (This->grabberIface) ISampleGrabberCB_Release(This->grabberIface); - CoTaskMemFree(This->mtype.pbFormat); + CoTaskMemFree(This->filter_mt.pbFormat); CoTaskMemFree(This->bufferData); if(This->seekthru_unk) IUnknown_Release(This->seekthru_unk); @@ -236,15 +236,15 @@ SampleGrabber_ISampleGrabber_SetMediaType(ISampleGrabber *iface, const AM_MEDIA_ debugstr_guid(&type->majortype), debugstr_guid(&type->subtype), type->lSampleSize, debugstr_guid(&type->formattype), type->cbFormat); - CoTaskMemFree(This->mtype.pbFormat); - This->mtype = *type; - This->mtype.pUnk = NULL; + CoTaskMemFree(This->filter_mt.pbFormat); + This->filter_mt = *type; + This->filter_mt.pUnk = NULL; if (type->cbFormat) { - This->mtype.pbFormat = CoTaskMemAlloc(type->cbFormat); - CopyMemory(This->mtype.pbFormat, type->pbFormat, type->cbFormat); + This->filter_mt.pbFormat = CoTaskMemAlloc(type->cbFormat); + CopyMemory(This->filter_mt.pbFormat, type->pbFormat, type->cbFormat); } else - This->mtype.pbFormat = NULL; + This->filter_mt.pbFormat = NULL; return S_OK; }
@@ -258,10 +258,10 @@ SampleGrabber_ISampleGrabber_GetConnectedMediaType(ISampleGrabber *iface, AM_MED return E_POINTER; if (!This->sink.pin.peer) return VFW_E_NOT_CONNECTED; - *type = This->mtype; + *type = This->filter_mt; if (type->cbFormat) { type->pbFormat = CoTaskMemAlloc(type->cbFormat); - CopyMemory(type->pbFormat, This->mtype.pbFormat, type->cbFormat); + CopyMemory(type->pbFormat, This->filter_mt.pbFormat, type->cbFormat); } return S_OK; } @@ -500,7 +500,7 @@ static HRESULT sample_grabber_sink_get_media_type(struct strmbase_pin *iface,
if (!index) { - CopyMediaType(mt, &filter->mtype); + CopyMediaType(mt, &filter->filter_mt); return S_OK; } return VFW_S_NO_MORE_ITEMS; @@ -515,20 +515,20 @@ static HRESULT sample_grabber_sink_connect(struct strmbase_sink *iface, && !IsEqualGUID(&mt->formattype, &GUID_NULL) && !mt->pbFormat) return VFW_E_INVALIDMEDIATYPE;
- if (!IsEqualGUID(&filter->mtype.majortype, &GUID_NULL) - && !IsEqualGUID(&filter->mtype.majortype, &mt->majortype)) + if (!IsEqualGUID(&filter->filter_mt.majortype, &GUID_NULL) + && !IsEqualGUID(&filter->filter_mt.majortype, &mt->majortype)) return VFW_E_TYPE_NOT_ACCEPTED;
- if (!IsEqualGUID(&filter->mtype.subtype, &GUID_NULL) - && !IsEqualGUID(&filter->mtype.subtype, &mt->subtype)) + if (!IsEqualGUID(&filter->filter_mt.subtype, &GUID_NULL) + && !IsEqualGUID(&filter->filter_mt.subtype, &mt->subtype)) return VFW_E_TYPE_NOT_ACCEPTED;
- if (!IsEqualGUID(&filter->mtype.formattype, &GUID_NULL) - && !IsEqualGUID(&filter->mtype.formattype, &mt->formattype)) + if (!IsEqualGUID(&filter->filter_mt.formattype, &GUID_NULL) + && !IsEqualGUID(&filter->filter_mt.formattype, &mt->formattype)) return VFW_E_TYPE_NOT_ACCEPTED;
- FreeMediaType(&filter->mtype); - CopyMediaType(&filter->mtype, mt); + FreeMediaType(&filter->filter_mt); + CopyMediaType(&filter->filter_mt, mt);
return S_OK; } @@ -568,7 +568,7 @@ static HRESULT sample_grabber_source_get_media_type(struct strmbase_pin *iface,
if (!index) { - CopyMediaType(mt, &filter->mtype); + CopyMediaType(mt, &filter->filter_mt); return S_OK; } return VFW_S_NO_MORE_ITEMS; @@ -580,13 +580,13 @@ static HRESULT WINAPI sample_grabber_source_DecideAllocator(struct strmbase_sour SG_Impl *filter = impl_from_source_pin(&iface->pin); const AM_MEDIA_TYPE *mt = &iface->pin.mt;
- if (!IsEqualGUID(&mt->majortype, &filter->mtype.majortype)) + if (!IsEqualGUID(&mt->majortype, &filter->filter_mt.majortype)) return VFW_E_TYPE_NOT_ACCEPTED; - if (!IsEqualGUID(&mt->subtype, &filter->mtype.subtype)) + if (!IsEqualGUID(&mt->subtype, &filter->filter_mt.subtype)) return VFW_E_TYPE_NOT_ACCEPTED; if (!IsEqualGUID(&mt->formattype, &FORMAT_None) && !IsEqualGUID(&mt->formattype, &GUID_NULL) - && !IsEqualGUID(&mt->formattype, &filter->mtype.formattype)) + && !IsEqualGUID(&mt->formattype, &filter->filter_mt.formattype)) return VFW_E_TYPE_NOT_ACCEPTED; if (!IsEqualGUID(&mt->formattype, &FORMAT_None) && !IsEqualGUID(&mt->formattype, &GUID_NULL)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/samplegrabber.c | 50 ++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 29 deletions(-)
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index 8f30ebe46e3..f0fa70708a1 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -84,7 +84,7 @@ static void SampleGrabber_cleanup(SG_Impl *This) IMemAllocator_Release(This->allocator); if (This->grabberIface) ISampleGrabberCB_Release(This->grabberIface); - CoTaskMemFree(This->filter_mt.pbFormat); + FreeMediaType(&This->filter_mt); CoTaskMemFree(This->bufferData); if(This->seekthru_unk) IUnknown_Release(This->seekthru_unk); @@ -225,44 +225,36 @@ SampleGrabber_ISampleGrabber_SetOneShot(ISampleGrabber *iface, BOOL oneShot) }
/* ISampleGrabber */ -static HRESULT WINAPI -SampleGrabber_ISampleGrabber_SetMediaType(ISampleGrabber *iface, const AM_MEDIA_TYPE *type) +static HRESULT WINAPI SampleGrabber_ISampleGrabber_SetMediaType(ISampleGrabber *iface, const AM_MEDIA_TYPE *mt) { - SG_Impl *This = impl_from_ISampleGrabber(iface); - TRACE("(%p)->(%p)\n", This, type); - if (!type) + SG_Impl *filter = impl_from_ISampleGrabber(iface); + + TRACE("filter %p, mt %p.\n", filter, mt); + strmbase_dump_media_type(mt); + + if (!mt) return E_POINTER; - TRACE("Media type: %s/%s ssize: %u format: %s (%u bytes)\n", - debugstr_guid(&type->majortype), debugstr_guid(&type->subtype), - type->lSampleSize, - debugstr_guid(&type->formattype), type->cbFormat); - CoTaskMemFree(This->filter_mt.pbFormat); - This->filter_mt = *type; - This->filter_mt.pUnk = NULL; - if (type->cbFormat) { - This->filter_mt.pbFormat = CoTaskMemAlloc(type->cbFormat); - CopyMemory(This->filter_mt.pbFormat, type->pbFormat, type->cbFormat); - } - else - This->filter_mt.pbFormat = NULL; + + FreeMediaType(&filter->filter_mt); + CopyMediaType(&filter->filter_mt, mt); return S_OK; }
/* ISampleGrabber */ static HRESULT WINAPI -SampleGrabber_ISampleGrabber_GetConnectedMediaType(ISampleGrabber *iface, AM_MEDIA_TYPE *type) +SampleGrabber_ISampleGrabber_GetConnectedMediaType(ISampleGrabber *iface, AM_MEDIA_TYPE *mt) { - SG_Impl *This = impl_from_ISampleGrabber(iface); - TRACE("(%p)->(%p)\n", This, type); - if (!type) + SG_Impl *filter = impl_from_ISampleGrabber(iface); + + TRACE("filter %p, mt %p.\n", filter, mt); + + if (!mt) return E_POINTER; - if (!This->sink.pin.peer) + + if (!filter->sink.pin.peer) return VFW_E_NOT_CONNECTED; - *type = This->filter_mt; - if (type->cbFormat) { - type->pbFormat = CoTaskMemAlloc(type->cbFormat); - CopyMemory(type->pbFormat, This->filter_mt.pbFormat, type->cbFormat); - } + + CopyMediaType(mt, &filter->filter_mt); return S_OK; }