Commit 9829385c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qedit/samplegrabber: Use the strmbase_passthrough object directly.

parent f55b78df
...@@ -39,8 +39,7 @@ typedef struct _SG_Impl { ...@@ -39,8 +39,7 @@ typedef struct _SG_Impl {
ISampleGrabber ISampleGrabber_iface; ISampleGrabber ISampleGrabber_iface;
struct strmbase_source source; struct strmbase_source source;
/* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */ struct strmbase_passthrough passthrough;
IUnknown *seekthru_unk;
struct strmbase_sink sink; struct strmbase_sink sink;
AM_MEDIA_TYPE filter_mt; AM_MEDIA_TYPE filter_mt;
...@@ -86,8 +85,6 @@ static void SampleGrabber_cleanup(SG_Impl *This) ...@@ -86,8 +85,6 @@ static void SampleGrabber_cleanup(SG_Impl *This)
ISampleGrabberCB_Release(This->grabberIface); ISampleGrabberCB_Release(This->grabberIface);
FreeMediaType(&This->filter_mt); FreeMediaType(&This->filter_mt);
CoTaskMemFree(This->bufferData); CoTaskMemFree(This->bufferData);
if(This->seekthru_unk)
IUnknown_Release(This->seekthru_unk);
} }
static struct strmbase_pin *sample_grabber_get_pin(struct strmbase_filter *iface, unsigned int index) static struct strmbase_pin *sample_grabber_get_pin(struct strmbase_filter *iface, unsigned int index)
...@@ -108,6 +105,7 @@ static void sample_grabber_destroy(struct strmbase_filter *iface) ...@@ -108,6 +105,7 @@ static void sample_grabber_destroy(struct strmbase_filter *iface)
SampleGrabber_cleanup(filter); SampleGrabber_cleanup(filter);
strmbase_sink_cleanup(&filter->sink); strmbase_sink_cleanup(&filter->sink);
strmbase_source_cleanup(&filter->source); strmbase_source_cleanup(&filter->source);
strmbase_passthrough_cleanup(&filter->passthrough);
strmbase_filter_cleanup(&filter->filter); strmbase_filter_cleanup(&filter->filter);
CoTaskMemFree(filter); CoTaskMemFree(filter);
} }
...@@ -550,10 +548,15 @@ static HRESULT sample_grabber_source_query_interface(struct strmbase_pin *iface, ...@@ -550,10 +548,15 @@ static HRESULT sample_grabber_source_query_interface(struct strmbase_pin *iface,
{ {
SG_Impl *filter = impl_from_source_pin(iface); SG_Impl *filter = impl_from_source_pin(iface);
if (IsEqualGUID(iid, &IID_IMediaPosition) || IsEqualGUID(iid, &IID_IMediaSeeking)) if (IsEqualGUID(iid, &IID_IMediaPosition))
return IUnknown_QueryInterface(filter->seekthru_unk, iid, out); *out = &filter->passthrough.IMediaPosition_iface;
else if (IsEqualGUID(iid, &IID_IMediaSeeking))
*out = &filter->passthrough.IMediaSeeking_iface;
else else
return E_NOINTERFACE; return E_NOINTERFACE;
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
} }
static HRESULT sample_grabber_source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt) static HRESULT sample_grabber_source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
...@@ -637,8 +640,6 @@ static const struct strmbase_source_ops source_ops = ...@@ -637,8 +640,6 @@ static const struct strmbase_source_ops source_ops =
HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out) HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out)
{ {
SG_Impl* obj = NULL; SG_Impl* obj = NULL;
ISeekingPassThru *passthru;
HRESULT hr;
obj = CoTaskMemAlloc(sizeof(SG_Impl)); obj = CoTaskMemAlloc(sizeof(SG_Impl));
if (NULL == obj) { if (NULL == obj) {
...@@ -652,7 +653,10 @@ HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out) ...@@ -652,7 +653,10 @@ HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out)
obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable; obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable;
strmbase_sink_init(&obj->sink, &obj->filter, L"In", &sink_ops, NULL); strmbase_sink_init(&obj->sink, &obj->filter, L"In", &sink_ops, NULL);
strmbase_source_init(&obj->source, &obj->filter, L"Out", &source_ops); strmbase_source_init(&obj->source, &obj->filter, L"Out", &source_ops);
strmbase_passthrough_init(&obj->passthrough, (IUnknown *)&obj->source.pin.IPin_iface);
ISeekingPassThru_Init(&obj->passthrough.ISeekingPassThru_iface, FALSE, &obj->sink.pin.IPin_iface);
obj->allocator = NULL; obj->allocator = NULL;
obj->grabberIface = NULL; obj->grabberIface = NULL;
...@@ -661,14 +665,6 @@ HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out) ...@@ -661,14 +665,6 @@ HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out)
obj->bufferLen = -1; obj->bufferLen = -1;
obj->bufferData = NULL; obj->bufferData = NULL;
hr = CoCreateInstance(&CLSID_SeekingPassThru, &obj->filter.IUnknown_inner,
CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&obj->seekthru_unk);
if(hr)
return hr;
IUnknown_QueryInterface(obj->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
ISeekingPassThru_Init(passthru, FALSE, &obj->sink.pin.IPin_iface);
ISeekingPassThru_Release(passthru);
*out = &obj->filter.IUnknown_inner; *out = &obj->filter.IUnknown_inner;
return S_OK; return S_OK;
} }
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