Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/avidec.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c index 97566679068..8d38b89e992 100644 --- a/dlls/quartz/avidec.c +++ b/dlls/quartz/avidec.c @@ -43,7 +43,7 @@ typedef struct AVIDecImpl
struct strmbase_source source; IQualityControl source_IQualityControl_iface; - IUnknown *seeking; + struct strmbase_passthrough passthrough;
struct strmbase_sink sink;
@@ -300,7 +300,7 @@ static HRESULT avi_decompressor_source_query_interface(struct strmbase_pin *ifac if (IsEqualGUID(iid, &IID_IQualityControl)) *out = &filter->source_IQualityControl_iface; else if (IsEqualGUID(iid, &IID_IMediaSeeking)) - return IUnknown_QueryInterface(filter->seeking, iid, out); + *out = &filter->passthrough.IMediaSeeking_iface; else return E_NOINTERFACE;
@@ -548,10 +548,10 @@ static void avi_decompressor_destroy(struct strmbase_filter *iface)
strmbase_sink_cleanup(&filter->sink); strmbase_source_cleanup(&filter->source); + strmbase_passthrough_cleanup(&filter->passthrough);
filter->stream_cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&filter->stream_cs); - IUnknown_Release(filter->seeking); strmbase_filter_cleanup(&filter->filter); free(filter);
@@ -603,8 +603,6 @@ static const struct strmbase_filter_ops filter_ops = HRESULT avi_dec_create(IUnknown *outer, IUnknown **out) { AVIDecImpl *object; - ISeekingPassThru *passthrough; - HRESULT hr;
if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -618,21 +616,9 @@ HRESULT avi_dec_create(IUnknown *outer, IUnknown **out)
strmbase_source_init(&object->source, &object->filter, L"Out", &source_ops); object->source_IQualityControl_iface.lpVtbl = &source_qc_vtbl; - - if (FAILED(hr = CoCreateInstance(&CLSID_SeekingPassThru, - (IUnknown *)&object->source.pin.IPin_iface, CLSCTX_INPROC_SERVER, - &IID_IUnknown, (void **)&object->seeking))) - { - strmbase_sink_cleanup(&object->sink); - strmbase_source_cleanup(&object->source); - strmbase_filter_cleanup(&object->filter); - free(object); - return hr; - } - - IUnknown_QueryInterface(object->seeking, &IID_ISeekingPassThru, (void **)&passthrough); - ISeekingPassThru_Init(passthrough, FALSE, &object->sink.pin.IPin_iface); - ISeekingPassThru_Release(passthrough); + strmbase_passthrough_init(&object->passthrough, (IUnknown *)&object->source.pin.IPin_iface); + ISeekingPassThru_Init(&object->passthrough.ISeekingPassThru_iface, FALSE, + &object->sink.pin.IPin_iface);
TRACE("Created AVI decompressor %p.\n", object); *out = &object->filter.IUnknown_inner;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/acmwrapper.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c index 7c511471ff0..b116f98ef01 100644 --- a/dlls/quartz/acmwrapper.c +++ b/dlls/quartz/acmwrapper.c @@ -43,7 +43,7 @@ typedef struct ACMWrapperImpl struct strmbase_source source; IQualityControl source_IQualityControl_iface; IQualityControl *source_qc_sink; - IUnknown *seeking; + struct strmbase_passthrough passthrough;
struct strmbase_sink sink;
@@ -337,7 +337,7 @@ static HRESULT acm_wrapper_source_query_interface(struct strmbase_pin *iface, RE if (IsEqualGUID(iid, &IID_IQualityControl)) *out = &filter->source_IQualityControl_iface; else if (IsEqualGUID(iid, &IID_IMediaSeeking)) - return IUnknown_QueryInterface(filter->seeking, iid, out); + *out = &filter->passthrough.IMediaSeeking_iface; else return E_NOINTERFACE;
@@ -486,11 +486,11 @@ static void acm_wrapper_destroy(struct strmbase_filter *iface)
strmbase_sink_cleanup(&filter->sink); strmbase_source_cleanup(&filter->source); + strmbase_passthrough_cleanup(&filter->passthrough);
filter->stream_cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&filter->stream_cs); FreeMediaType(&filter->mt); - IUnknown_Release(filter->seeking); strmbase_filter_cleanup(&filter->filter); free(filter);
@@ -523,9 +523,7 @@ static const struct strmbase_filter_ops filter_ops =
HRESULT acm_wrapper_create(IUnknown *outer, IUnknown **out) { - ISeekingPassThru *passthrough; ACMWrapperImpl *object; - HRESULT hr;
if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -539,21 +537,9 @@ HRESULT acm_wrapper_create(IUnknown *outer, IUnknown **out)
strmbase_source_init(&object->source, &object->filter, L"Out", &source_ops); object->source_IQualityControl_iface.lpVtbl = &source_qc_vtbl; - - if (FAILED(hr = CoCreateInstance(&CLSID_SeekingPassThru, - (IUnknown *)&object->source.pin.IPin_iface, CLSCTX_INPROC_SERVER, - &IID_IUnknown, (void **)&object->seeking))) - { - strmbase_sink_cleanup(&object->sink); - strmbase_source_cleanup(&object->source); - strmbase_filter_cleanup(&object->filter); - free(object); - return hr; - } - - IUnknown_QueryInterface(object->seeking, &IID_ISeekingPassThru, (void **)&passthrough); - ISeekingPassThru_Init(passthrough, FALSE, &object->sink.pin.IPin_iface); - ISeekingPassThru_Release(passthrough); + strmbase_passthrough_init(&object->passthrough, (IUnknown *)&object->source.pin.IPin_iface); + ISeekingPassThru_Init(&object->passthrough.ISeekingPassThru_iface, FALSE, + &object->sink.pin.IPin_iface);
object->lasttime_real = object->lasttime_sent = -1;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qasf/Makefile.in | 2 +- dlls/qasf/dmowrapper.c | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/dlls/qasf/Makefile.in b/dlls/qasf/Makefile.in index c1d34a42dab..dd02f5a344e 100644 --- a/dlls/qasf/Makefile.in +++ b/dlls/qasf/Makefile.in @@ -1,5 +1,5 @@ MODULE = qasf.dll -IMPORTS = strmbase dmoguids strmiids uuid ole32 +IMPORTS = strmbase dmoguids strmiids uuid ole32 oleaut32
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/qasf/dmowrapper.c b/dlls/qasf/dmowrapper.c index cba9023e13f..e2d40638283 100644 --- a/dlls/qasf/dmowrapper.c +++ b/dlls/qasf/dmowrapper.c @@ -32,7 +32,7 @@ struct dmo_wrapper_source { struct strmbase_source pin; struct buffer buffer; - IUnknown *seeking; + struct strmbase_passthrough passthrough; };
struct dmo_wrapper @@ -405,10 +405,15 @@ static HRESULT dmo_wrapper_source_query_interface(struct strmbase_pin *iface, RE { struct dmo_wrapper_source *pin = impl_source_from_strmbase_pin(iface);
- if (IsEqualGUID(iid, &IID_IMediaSeeking) || IsEqualGUID(iid, &IID_IMediaPosition)) - return IUnknown_QueryInterface(pin->seeking, iid, out); + if (IsEqualGUID(iid, &IID_IMediaPosition)) + *out = &pin->passthrough.IMediaPosition_iface; + else if (IsEqualGUID(iid, &IID_IMediaSeeking)) + *out = &pin->passthrough.IMediaSeeking_iface; + else + return E_NOINTERFACE;
- return E_NOINTERFACE; + IUnknown_AddRef((IUnknown *)*out); + return S_OK; }
static HRESULT dmo_wrapper_source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt) @@ -568,20 +573,13 @@ static HRESULT WINAPI dmo_wrapper_filter_Init(IDMOWrapperFilter *iface, REFCLSID
for (i = 0; i < output_count; ++i) { - ISeekingPassThru *passthrough; - swprintf(id, ARRAY_SIZE(id), L"out%u", i); strmbase_source_init(&sources[i].pin, &filter->filter, id, &source_ops); sources[i].buffer.IMediaBuffer_iface.lpVtbl = &buffer_vtbl;
- if (FAILED(hr = CoCreateInstance(&CLSID_SeekingPassThru, - (IUnknown *)&sources[i].pin.pin.IPin_iface, CLSCTX_INPROC_SERVER, - &IID_IUnknown, (void **)&sources[i].seeking))) - ERR("Failed to create SeekingPassThru object, hr %#x.\n", hr); - - IUnknown_QueryInterface(sources[i].seeking, &IID_ISeekingPassThru, (void **)&passthrough); - ISeekingPassThru_Init(passthrough, FALSE, &sinks[0].pin.IPin_iface); - ISeekingPassThru_Release(passthrough); + strmbase_passthrough_init(&sources[i].passthrough, (IUnknown *)&sources[i].pin.pin.IPin_iface); + ISeekingPassThru_Init(&sources[i].passthrough.ISeekingPassThru_iface, + FALSE, &sinks[0].pin.IPin_iface); }
EnterCriticalSection(&filter->filter.csFilter); @@ -630,7 +628,7 @@ static void dmo_wrapper_destroy(struct strmbase_filter *iface) strmbase_sink_cleanup(&filter->sinks[i]); for (i = 0; i < filter->source_count; ++i) { - IUnknown_Release(filter->sources[i].seeking); + strmbase_passthrough_cleanup(&filter->sources[i].passthrough); strmbase_source_cleanup(&filter->sources[i].pin); } free(filter->sinks);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/samplegrabber.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c index 7e29154762b..afb48bf84df 100644 --- a/dlls/qedit/samplegrabber.c +++ b/dlls/qedit/samplegrabber.c @@ -39,8 +39,7 @@ typedef struct _SG_Impl { ISampleGrabber ISampleGrabber_iface;
struct strmbase_source source; - /* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */ - IUnknown *seekthru_unk; + struct strmbase_passthrough passthrough;
struct strmbase_sink sink; AM_MEDIA_TYPE filter_mt; @@ -86,8 +85,6 @@ static void SampleGrabber_cleanup(SG_Impl *This) ISampleGrabberCB_Release(This->grabberIface); FreeMediaType(&This->filter_mt); 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) @@ -108,6 +105,7 @@ static void sample_grabber_destroy(struct strmbase_filter *iface) SampleGrabber_cleanup(filter); strmbase_sink_cleanup(&filter->sink); strmbase_source_cleanup(&filter->source); + strmbase_passthrough_cleanup(&filter->passthrough); strmbase_filter_cleanup(&filter->filter); CoTaskMemFree(filter); } @@ -550,10 +548,15 @@ static HRESULT sample_grabber_source_query_interface(struct strmbase_pin *iface, { SG_Impl *filter = impl_from_source_pin(iface);
- if (IsEqualGUID(iid, &IID_IMediaPosition) || IsEqualGUID(iid, &IID_IMediaSeeking)) - return IUnknown_QueryInterface(filter->seekthru_unk, iid, out); + if (IsEqualGUID(iid, &IID_IMediaPosition)) + *out = &filter->passthrough.IMediaPosition_iface; + else if (IsEqualGUID(iid, &IID_IMediaSeeking)) + *out = &filter->passthrough.IMediaSeeking_iface; else 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) @@ -637,8 +640,6 @@ static const struct strmbase_source_ops source_ops = HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out) { SG_Impl* obj = NULL; - ISeekingPassThru *passthru; - HRESULT hr;
obj = CoTaskMemAlloc(sizeof(SG_Impl)); if (NULL == obj) { @@ -652,7 +653,10 @@ HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out) obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable;
strmbase_sink_init(&obj->sink, &obj->filter, L"In", &sink_ops, NULL); + 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->grabberIface = NULL; @@ -661,14 +665,6 @@ HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out) obj->bufferLen = -1; 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; return S_OK; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/nullrenderer.c | 9 ++------- dlls/quartz/dsoundrender.c | 8 ++------ dlls/quartz/videorenderer.c | 5 +---- dlls/quartz/vmr9.c | 4 +--- dlls/strmbase/renderer.c | 4 +--- include/wine/strmbase.h | 2 +- 6 files changed, 8 insertions(+), 24 deletions(-)
diff --git a/dlls/qedit/nullrenderer.c b/dlls/qedit/nullrenderer.c index cbebadfd180..9f29ab78283 100644 --- a/dlls/qedit/nullrenderer.c +++ b/dlls/qedit/nullrenderer.c @@ -64,20 +64,15 @@ static const struct strmbase_renderer_ops renderer_ops =
HRESULT null_renderer_create(IUnknown *outer, IUnknown **out) { - HRESULT hr; NullRendererImpl *pNullRenderer;
*out = NULL;
pNullRenderer = CoTaskMemAlloc(sizeof(NullRendererImpl));
- hr = strmbase_renderer_init(&pNullRenderer->renderer, outer, + strmbase_renderer_init(&pNullRenderer->renderer, outer, &CLSID_NullRenderer, L"In", &renderer_ops);
- if (FAILED(hr)) - CoTaskMemFree(pNullRenderer); - else - *out = &pNullRenderer->renderer.filter.IUnknown_inner; - + *out = &pNullRenderer->renderer.filter.IUnknown_inner; return S_OK; } diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index fc319644c60..6ed714c5899 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -806,12 +806,8 @@ HRESULT dsound_render_create(IUnknown *outer, IUnknown **out) return E_OUTOFMEMORY; memset(object, 0, sizeof(*object));
- if (FAILED(hr = strmbase_renderer_init(&object->renderer, outer, - &CLSID_DSoundRender, L"Audio Input pin (rendered)", &renderer_ops))) - { - CoTaskMemFree(object); - return hr; - } + strmbase_renderer_init(&object->renderer, outer, + &CLSID_DSoundRender, L"Audio Input pin (rendered)", &renderer_ops);
if (FAILED(hr = system_clock_create(&object->renderer.filter.IUnknown_inner, &object->system_clock))) { diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 37227bfa210..9301e8d769c 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -716,12 +716,9 @@ HRESULT video_renderer_create(IUnknown *outer, IUnknown **out)
pVideoRenderer->IOverlay_iface.lpVtbl = &overlay_vtbl;
- hr = strmbase_renderer_init(&pVideoRenderer->renderer, outer, + strmbase_renderer_init(&pVideoRenderer->renderer, outer, &CLSID_VideoRenderer, L"In", &renderer_ops);
- if (FAILED(hr)) - goto fail; - hr = video_window_init(&pVideoRenderer->baseControlWindow, &IVideoWindow_VTable, &pVideoRenderer->renderer.filter, &pVideoRenderer->renderer.sink.pin, &renderer_BaseWindowFuncTable); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index b2217547cdc..c44607b3ef2 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2326,9 +2326,7 @@ static HRESULT vmr_create(IUnknown *outer, IUnknown **out, const CLSID *clsid) pVMR->IVMRWindowlessControl9_iface.lpVtbl = &VMR9_WindowlessControl_Vtbl; pVMR->IOverlay_iface.lpVtbl = &overlay_vtbl;
- hr = strmbase_renderer_init(&pVMR->renderer, outer, clsid, L"VMR Input0", &renderer_ops); - if (FAILED(hr)) - goto fail; + strmbase_renderer_init(&pVMR->renderer, outer, clsid, L"VMR Input0", &renderer_ops);
hr = video_window_init(&pVMR->baseControlWindow, &IVideoWindow_VTable, &pVMR->renderer.filter, &pVMR->renderer.sink.pin, &renderer_BaseWindowFuncTable); diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 57e0d2041ca..fd999d3ae96 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -388,7 +388,7 @@ HRESULT WINAPI BaseRendererImpl_Receive(struct strmbase_renderer *This, IMediaSa return hr; }
-HRESULT WINAPI strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer, +void strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, const struct strmbase_renderer_ops *ops) { memset(filter, 0, sizeof(*filter)); @@ -408,6 +408,4 @@ HRESULT WINAPI strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown
QualityControlImpl_Create(&filter->sink.pin, &filter->qcimpl); filter->qcimpl->IQualityControl_iface.lpVtbl = &Renderer_QualityControl_Vtbl; - - return S_OK; } diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 732ba1be269..6789957e50a 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -327,6 +327,6 @@ struct strmbase_renderer_ops
HRESULT WINAPI BaseRendererImpl_Receive(struct strmbase_renderer *filter, IMediaSample *sample);
-HRESULT WINAPI strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer, +void strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, const struct strmbase_renderer_ops *ops); void strmbase_renderer_cleanup(struct strmbase_renderer *filter);