Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/capture.h | 2 +- dlls/qcap/v4l.c | 26 +++--- dlls/qcap/vfwcapture.c | 190 +++++++++++++++-------------------------- 3 files changed, 80 insertions(+), 138 deletions(-)
diff --git a/dlls/qcap/capture.h b/dlls/qcap/capture.h index aed88893e5d..82f5eb2461c 100644 --- a/dlls/qcap/capture.h +++ b/dlls/qcap/capture.h @@ -23,7 +23,7 @@ struct _Capture; typedef struct _Capture Capture;
-Capture *qcap_driver_init(IPin*,USHORT) DECLSPEC_HIDDEN; +Capture *qcap_driver_init(BaseOutputPin*,USHORT) DECLSPEC_HIDDEN; HRESULT qcap_driver_destroy(Capture*) DECLSPEC_HIDDEN; HRESULT qcap_driver_check_format(Capture*,const AM_MEDIA_TYPE*) DECLSPEC_HIDDEN; HRESULT qcap_driver_set_format(Capture*,AM_MEDIA_TYPE*) DECLSPEC_HIDDEN; diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c index 10b28b350a2..b308f14786e 100644 --- a/dlls/qcap/v4l.c +++ b/dlls/qcap/v4l.c @@ -60,8 +60,8 @@ #include "wine/debug.h" #include "wine/library.h"
-#include "capture.h" #include "qcap_main.h" +#include "capture.h"
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
@@ -101,7 +101,7 @@ struct _Capture
CRITICAL_SECTION CritSect;
- IPin *pOut; + BaseOutputPin *pin; int fd, mmap; BOOL iscommitted, stopped;
@@ -409,7 +409,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam) EnterCriticalSection(&capBox->CritSect); if (capBox->stopped) break; - hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin *)capBox->pOut, &pSample, NULL, NULL, 0); + hr = BaseOutputPinImpl_GetDeliveryBuffer(capBox->pin, &pSample, NULL, NULL, 0); if (SUCCEEDED(hr)) { int len; @@ -435,7 +435,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam) }
Resize(capBox, pTarget, image_data); - hr = BaseOutputPinImpl_Deliver((BaseOutputPin *)capBox->pOut, pSample); + hr = BaseOutputPinImpl_Deliver(capBox->pin, pSample); TRACE("%p -> Frame %u: %x\n", capBox, ++framecount, hr); IMediaSample_Release(pSample); } @@ -473,7 +473,6 @@ HRESULT qcap_driver_run(Capture *capBox, FILTER_STATE *state) if (!capBox->iscommitted) { ALLOCATOR_PROPERTIES ap, actual; - BaseOutputPin *out;
capBox->iscommitted = TRUE;
@@ -486,12 +485,10 @@ HRESULT qcap_driver_run(Capture *capBox, FILTER_STATE *state) ap.cbAlign = 1; ap.cbPrefix = 0;
- out = (BaseOutputPin *)capBox->pOut; - - hr = IMemAllocator_SetProperties(out->pAllocator, &ap, &actual); + hr = IMemAllocator_SetProperties(capBox->pin->pAllocator, &ap, &actual);
if (SUCCEEDED(hr)) - hr = IMemAllocator_Commit(out->pAllocator); + hr = IMemAllocator_Commit(capBox->pin->pAllocator);
TRACE("Committing allocator: %x\n", hr); } @@ -549,14 +546,11 @@ HRESULT qcap_driver_stop(Capture *capBox, FILTER_STATE *state) capBox->thread = 0; if (capBox->iscommitted) { - BaseOutputPin *out; HRESULT hr;
capBox->iscommitted = FALSE;
- out = (BaseOutputPin*)capBox->pOut; - - hr = IMemAllocator_Decommit(out->pAllocator); + hr = IMemAllocator_Decommit(capBox->pin->pAllocator);
if (hr != S_OK && hr != VFW_E_NOT_COMMITTED) WARN("Decommitting allocator: %x\n", hr); @@ -568,7 +562,7 @@ HRESULT qcap_driver_stop(Capture *capBox, FILTER_STATE *state) return S_OK; }
-Capture * qcap_driver_init( IPin *pOut, USHORT card ) +Capture * qcap_driver_init(BaseOutputPin *pin, USHORT card) { struct v4l2_capability caps = {{0}}; struct v4l2_format format = {0}; @@ -649,7 +643,7 @@ Capture * qcap_driver_init( IPin *pOut, USHORT card ) device->outputheight = device->height = format.fmt.pix.height; device->swresize = FALSE; device->bitDepth = 24; - device->pOut = pOut; + device->pin = pin; device->fps = 3; device->stopped = FALSE; device->iscommitted = FALSE; @@ -665,7 +659,7 @@ error:
#else
-Capture * qcap_driver_init( IPin *pOut, USHORT card ) +Capture * qcap_driver_init(BaseOutputPin *pin, USHORT card) { static const char msg[] = "The v4l headers were not available at compile time,\n" diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 660f44d4171..83682b89597 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -44,14 +44,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
-static const IBaseFilterVtbl VfwCapture_Vtbl; -static const IAMStreamConfigVtbl IAMStreamConfig_VTable; -static const IAMVideoProcAmpVtbl IAMVideoProcAmp_VTable; -static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable; -static const IPinVtbl VfwPin_Vtbl; - -static HRESULT VfwPin_Construct( IBaseFilter *, LPCRITICAL_SECTION, IPin ** ); - typedef struct VfwCapture { BaseFilter filter; @@ -61,7 +53,8 @@ typedef struct VfwCapture BOOL init; Capture *driver_info;
- IPin * pOutputPin; + BaseOutputPin source; + IKsPropertySet IKsPropertySet_iface; } VfwCapture;
static inline VfwCapture *impl_from_BaseFilter(BaseFilter *iface) @@ -89,17 +82,9 @@ static inline VfwCapture *impl_from_IPersistPropertyBag(IPersistPropertyBag *ifa return CONTAINING_RECORD(iface, VfwCapture, IPersistPropertyBag_iface); }
-/* VfwPin implementation */ -typedef struct VfwPinImpl -{ - BaseOutputPin pin; - IKsPropertySet IKsPropertySet_iface; - VfwCapture *parent; -} VfwPinImpl; - -static inline VfwPinImpl *impl_from_IPin(IPin *iface) +static inline VfwCapture *impl_from_IPin(IPin *iface) { - return CONTAINING_RECORD(iface, VfwPinImpl, pin.pin.IPin_iface); + return CONTAINING_RECORD(iface, VfwCapture, source.pin.IPin_iface); }
static IPin *vfw_capture_get_pin(BaseFilter *iface, unsigned int index) @@ -109,13 +94,12 @@ static IPin *vfw_capture_get_pin(BaseFilter *iface, unsigned int index) if (index >= 1) return NULL;
- return This->pOutputPin; + return &This->source.pin.IPin_iface; }
static void vfw_capture_destroy(BaseFilter *iface) { VfwCapture *filter = impl_from_BaseFilter(iface); - IPin *peer = NULL;
if (filter->init) { @@ -123,14 +107,13 @@ static void vfw_capture_destroy(BaseFilter *iface) qcap_driver_stop(filter->driver_info, &filter->filter.state); qcap_driver_destroy(filter->driver_info); } - IPin_ConnectedTo(filter->pOutputPin, &peer); - if (peer) + + if (filter->source.pin.pConnectedTo) { - IPin_Disconnect(peer); - IPin_Disconnect(filter->pOutputPin); - IPin_Release(peer); + IPin_Disconnect(filter->source.pin.pConnectedTo); + IPin_Disconnect(&filter->source.pin.IPin_iface); } - BaseOutputPin_Destroy(&impl_from_IPin(filter->pOutputPin)->pin); + strmbase_source_cleanup(&filter->source); strmbase_filter_cleanup(&filter->filter); CoTaskMemFree(filter); ObjectRefCount(FALSE); @@ -159,38 +142,6 @@ static const BaseFilterFuncTable BaseFuncTable = { .filter_query_interface = vfw_capture_query_interface, };
-IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr) -{ - VfwCapture *pVfwCapture; - HRESULT hr; - - *phr = E_OUTOFMEMORY; - pVfwCapture = CoTaskMemAlloc( sizeof(VfwCapture) ); - if (!pVfwCapture) - return NULL; - - strmbase_filter_init(&pVfwCapture->filter, &VfwCapture_Vtbl, outer, &CLSID_VfwCapture, - (DWORD_PTR)(__FILE__ ": VfwCapture.csFilter"), &BaseFuncTable); - - pVfwCapture->IAMStreamConfig_iface.lpVtbl = &IAMStreamConfig_VTable; - pVfwCapture->IAMVideoProcAmp_iface.lpVtbl = &IAMVideoProcAmp_VTable; - pVfwCapture->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable; - pVfwCapture->init = FALSE; - - hr = VfwPin_Construct(&pVfwCapture->filter.IBaseFilter_iface, - &pVfwCapture->filter.csFilter, &pVfwCapture->pOutputPin); - if (FAILED(hr)) - { - CoTaskMemFree(pVfwCapture); - return NULL; - } - TRACE("-- created at %p\n", pVfwCapture); - - ObjectRefCount(TRUE); - *phr = S_OK; - return &pVfwCapture->filter.IUnknown_inner; -} - /** IMediaFilter methods **/
static HRESULT WINAPI VfwCapture_Stop(IBaseFilter * iface) @@ -263,7 +214,6 @@ AMStreamConfig_SetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE *pmt) { HRESULT hr; VfwCapture *This = impl_from_IAMStreamConfig(iface); - BasePin *pin;
TRACE("(%p): %p->%p\n", iface, pmt, pmt ? pmt->pbFormat : NULL);
@@ -281,19 +231,18 @@ AMStreamConfig_SetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE *pmt)
dump_AM_MEDIA_TYPE(pmt);
- pin = (BasePin *)This->pOutputPin; - if (pin->pConnectedTo != NULL) + if (This->source.pin.pConnectedTo) { - hr = IPin_QueryAccept(pin->pConnectedTo, pmt); + hr = IPin_QueryAccept(This->source.pin.pConnectedTo, pmt); TRACE("Would accept: %d\n", hr); if (hr == S_FALSE) return VFW_E_INVALIDMEDIATYPE; }
hr = qcap_driver_set_format(This->driver_info, pmt); - if (SUCCEEDED(hr) && This->filter.filterInfo.pGraph && pin->pConnectedTo ) + if (SUCCEEDED(hr) && This->filter.filterInfo.pGraph && This->source.pin.pConnectedTo) { - hr = IFilterGraph_Reconnect(This->filter.filterInfo.pGraph, This->pOutputPin); + hr = IFilterGraph_Reconnect(This->filter.filterInfo.pGraph, &This->source.pin.IPin_iface); if (SUCCEEDED(hr)) TRACE("Reconnection completed, with new media format..\n"); } @@ -454,14 +403,9 @@ PPB_Load( IPersistPropertyBag * iface, IPropertyBag *pPropBag,
if (SUCCEEDED(hr)) { - VfwPinImpl *pin; - - This->driver_info = qcap_driver_init( This->pOutputPin, - var.__VARIANT_NAME_1.__VARIANT_NAME_2.__VARIANT_NAME_3.ulVal ); + This->driver_info = qcap_driver_init(&This->source, V_I4(&var)); if (This->driver_info) { - pin = (VfwPinImpl *)This->pOutputPin; - pin->parent = This; This->init = TRUE; hr = S_OK; } @@ -493,30 +437,27 @@ static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable = };
/* IKsPropertySet interface */ -static inline VfwPinImpl *impl_from_IKsPropertySet(IKsPropertySet *iface) +static inline VfwCapture *impl_from_IKsPropertySet(IKsPropertySet *iface) { - return CONTAINING_RECORD(iface, VfwPinImpl, IKsPropertySet_iface); + return CONTAINING_RECORD(iface, VfwCapture, IKsPropertySet_iface); }
static HRESULT WINAPI KSP_QueryInterface(IKsPropertySet * iface, REFIID riid, void **ret_iface) { - VfwPinImpl *This = impl_from_IKsPropertySet(iface); - - return IPin_QueryInterface(&This->pin.pin.IPin_iface, riid, ret_iface); + VfwCapture *filter = impl_from_IKsPropertySet(iface); + return IPin_QueryInterface(&filter->source.pin.IPin_iface, riid, ret_iface); }
static ULONG WINAPI KSP_AddRef(IKsPropertySet * iface) { - VfwPinImpl *This = impl_from_IKsPropertySet(iface); - - return IPin_AddRef(&This->pin.pin.IPin_iface); + VfwCapture *filter = impl_from_IKsPropertySet(iface); + return IPin_AddRef(&filter->source.pin.IPin_iface); }
static ULONG WINAPI KSP_Release(IKsPropertySet * iface) { - VfwPinImpl *This = impl_from_IKsPropertySet(iface); - - return IPin_Release(&This->pin.pin.IPin_iface); + VfwCapture *filter = impl_from_IKsPropertySet(iface); + return IPin_Release(&filter->source.pin.IPin_iface); }
static HRESULT WINAPI @@ -571,20 +512,20 @@ static const IKsPropertySetVtbl IKsPropertySet_VTable = KSP_QuerySupported };
-static inline VfwPinImpl *impl_from_BasePin(BasePin *pin) +static inline VfwCapture *impl_from_BasePin(BasePin *pin) { - return CONTAINING_RECORD(pin, VfwPinImpl, pin.pin); + return CONTAINING_RECORD(pin, VfwCapture, source.pin); }
static HRESULT WINAPI VfwPin_CheckMediaType(BasePin *pin, const AM_MEDIA_TYPE *mt) { - VfwPinImpl *filter = impl_from_BasePin(pin); - return qcap_driver_check_format(filter->parent->driver_info, mt); + VfwCapture *filter = impl_from_BasePin(pin); + return qcap_driver_check_format(filter->driver_info, mt); }
static HRESULT WINAPI VfwPin_GetMediaType(BasePin *pin, int iPosition, AM_MEDIA_TYPE *pmt) { - VfwPinImpl *This = impl_from_BasePin(pin); + VfwCapture *filter = impl_from_BasePin(pin); AM_MEDIA_TYPE *vfw_pmt; HRESULT hr;
@@ -593,7 +534,7 @@ static HRESULT WINAPI VfwPin_GetMediaType(BasePin *pin, int iPosition, AM_MEDIA_ if (iPosition > 0) return VFW_S_NO_MORE_ITEMS;
- hr = qcap_driver_get_format(This->parent->driver_info, &vfw_pmt); + hr = qcap_driver_get_format(filter->driver_info, &vfw_pmt); if (SUCCEEDED(hr)) { CopyMediaType(pmt, vfw_pmt); DeleteMediaType(vfw_pmt); @@ -627,45 +568,19 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { BaseOutputPinImpl_DecideAllocator, };
-static HRESULT -VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, - IPin ** ppPin ) -{ - static const WCHAR wszOutputPinName[] = { 'O','u','t','p','u','t',0 }; - PIN_INFO piOutput; - HRESULT hr; - - *ppPin = NULL; - - piOutput.dir = PINDIR_OUTPUT; - piOutput.pFilter = pBaseFilter; - lstrcpyW(piOutput.achName, wszOutputPinName); - - hr = BaseOutputPin_Construct(&VfwPin_Vtbl, sizeof(VfwPinImpl), &piOutput, &output_BaseOutputFuncTable, pCritSec, ppPin); - - if (SUCCEEDED(hr)) - { - VfwPinImpl *pPinImpl = (VfwPinImpl*)*ppPin; - pPinImpl->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable; - ObjectRefCount(TRUE); - } - - return hr; -} - static HRESULT WINAPI VfwPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv) { - VfwPinImpl *This = impl_from_IPin(iface); + VfwCapture *filter = impl_from_IPin(iface);
TRACE("%s %p\n", debugstr_guid(riid), ppv);
*ppv = NULL; if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin)) - *ppv = This; + *ppv = &filter->source.pin.IPin_iface; else if (IsEqualIID(riid, &IID_IKsPropertySet)) - *ppv = &This->IKsPropertySet_iface; + *ppv = &filter->IKsPropertySet_iface; else if (IsEqualIID(riid, &IID_IAMStreamConfig)) - return IUnknown_QueryInterface((IUnknown *)This->parent, riid, ppv); + return IUnknown_QueryInterface(&filter->filter.IBaseFilter_iface, riid, ppv);
if (*ppv) { @@ -680,16 +595,15 @@ static HRESULT WINAPI VfwPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * static HRESULT WINAPI VfwPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum) { - VfwPinImpl *This = impl_from_IPin(iface); + VfwCapture *filter = impl_from_IPin(iface); AM_MEDIA_TYPE *pmt; HRESULT hr;
- hr = qcap_driver_get_format(This->parent->driver_info, &pmt); + hr = qcap_driver_get_format(filter->driver_info, &pmt); if (SUCCEEDED(hr)) { hr = BasePinImpl_EnumMediaTypes(iface, ppEnum); DeleteMediaType(pmt); } - TRACE("%p -- %x\n", This, hr); return hr; }
@@ -721,3 +635,37 @@ static const IPinVtbl VfwPin_Vtbl = BaseOutputPinImpl_EndFlush, BasePinImpl_NewSegment }; + +IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr) +{ + static const WCHAR source_name[] = {'O','u','t','p','u','t',0}; + VfwCapture *object; + PIN_INFO pin_info; + + if (!(object = CoTaskMemAlloc(sizeof(*object)))) + { + *phr = E_OUTOFMEMORY; + return NULL; + } + + strmbase_filter_init(&object->filter, &VfwCapture_Vtbl, outer, &CLSID_VfwCapture, + (DWORD_PTR)(__FILE__ ": VfwCapture.csFilter"), &BaseFuncTable); + + object->IAMStreamConfig_iface.lpVtbl = &IAMStreamConfig_VTable; + object->IAMVideoProcAmp_iface.lpVtbl = &IAMVideoProcAmp_VTable; + object->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable; + object->init = FALSE; + + pin_info.dir = PINDIR_OUTPUT; + pin_info.pFilter = &object->filter.IBaseFilter_iface; + lstrcpyW(pin_info.achName, source_name); + strmbase_source_init(&object->source, &VfwPin_Vtbl, &pin_info, + &output_BaseOutputFuncTable, &object->filter.csFilter); + + object->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable; + + TRACE("Created VFW capture filter %p.\n", object); + ObjectRefCount(TRUE); + *phr = S_OK; + return &object->filter.IUnknown_inner; +}
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/qcap.c | 2 +- dlls/qcap/vfwcapture.c | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/dlls/qcap/tests/qcap.c b/dlls/qcap/tests/qcap.c index d880a26a671..df26b5469dc 100644 --- a/dlls/qcap/tests/qcap.c +++ b/dlls/qcap/tests/qcap.c @@ -1809,7 +1809,7 @@ static void test_COM_vfwcapture(void)
/* Unsupported interfaces */ hr = IBaseFilter_QueryInterface(bf, &IID_IAMStreamConfig, (void**)&unk); - todo_wine ok(hr == E_NOINTERFACE, "QueryInterface for IID_IAMStreamConfig failed: %08x\n", hr); + ok(hr == E_NOINTERFACE, "QueryInterface for IID_IAMStreamConfig failed: %08x\n", hr); hr = IBaseFilter_QueryInterface(bf, &IID_IAMVideoProcAmp, (void**)&unk); todo_wine ok(hr == E_NOINTERFACE, "QueryInterface for IID_IAMVideoProcAmp failed: %08x\n", hr); hr = IBaseFilter_QueryInterface(bf, &IID_IOverlayNotify, (void**)&unk); diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 83682b89597..519543e1478 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -125,8 +125,6 @@ static HRESULT vfw_capture_query_interface(BaseFilter *iface, REFIID iid, void *
if (IsEqualGUID(iid, &IID_IPersistPropertyBag)) *out = &filter->IPersistPropertyBag_iface; - else if (IsEqualGUID(iid, &IID_IAMStreamConfig)) - *out = &filter->IAMStreamConfig_iface; else if (IsEqualGUID(iid, &IID_IAMVideoProcAmp)) *out = &filter->IAMVideoProcAmp_iface; else @@ -187,26 +185,22 @@ static const IBaseFilterVtbl VfwCapture_Vtbl = };
/* AMStreamConfig interface, we only need to implement {G,S}etFormat */ -static HRESULT WINAPI AMStreamConfig_QueryInterface(IAMStreamConfig *iface, REFIID riid, - void **ret_iface) +static HRESULT WINAPI AMStreamConfig_QueryInterface(IAMStreamConfig *iface, REFIID iid, void **out) { - VfwCapture *This = impl_from_IAMStreamConfig(iface); - - return IUnknown_QueryInterface(This->filter.outer_unk, riid, ret_iface); + VfwCapture *filter = impl_from_IAMStreamConfig(iface); + return IPin_QueryInterface(&filter->source.pin.IPin_iface, iid, out); }
-static ULONG WINAPI AMStreamConfig_AddRef( IAMStreamConfig * iface ) +static ULONG WINAPI AMStreamConfig_AddRef(IAMStreamConfig *iface) { - VfwCapture *This = impl_from_IAMStreamConfig(iface); - - return IUnknown_AddRef(This->filter.outer_unk); + VfwCapture *filter = impl_from_IAMStreamConfig(iface); + return IPin_AddRef(&filter->source.pin.IPin_iface); }
-static ULONG WINAPI AMStreamConfig_Release( IAMStreamConfig * iface ) +static ULONG WINAPI AMStreamConfig_Release(IAMStreamConfig *iface) { - VfwCapture *This = impl_from_IAMStreamConfig(iface); - - return IUnknown_Release(This->filter.outer_unk); + VfwCapture *filter = impl_from_IAMStreamConfig(iface); + return IPin_Release(&filter->source.pin.IPin_iface); }
static HRESULT WINAPI @@ -580,7 +574,7 @@ static HRESULT WINAPI VfwPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * else if (IsEqualIID(riid, &IID_IKsPropertySet)) *ppv = &filter->IKsPropertySet_iface; else if (IsEqualIID(riid, &IID_IAMStreamConfig)) - return IUnknown_QueryInterface(&filter->filter.IBaseFilter_iface, riid, ppv); + *ppv = &filter->IAMStreamConfig_iface;
if (*ppv) {
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/avisplit.c | 8 ++++---- dlls/quartz/mpegsplit.c | 4 ++-- dlls/quartz/parser.c | 38 +++++++++++++++++++------------------- dlls/quartz/waveparser.c | 10 +++++----- 4 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c index 1fbaaf63ba3..aa43e0131e8 100644 --- a/dlls/quartz/avisplit.c +++ b/dlls/quartz/avisplit.c @@ -137,7 +137,7 @@ static HRESULT AVISplitter_SendEndOfFile(AVISplitterImpl *This, DWORD streamnumb
TRACE("End of file reached\n");
- hr = IPin_ConnectedTo(This->Parser.ppPins[streamnumber+1], &ppin); + hr = IPin_ConnectedTo(This->Parser.ppPins[streamnumber], &ppin); if (SUCCEEDED(hr)) { hr = IPin_EndOfStream(ppin); @@ -297,7 +297,7 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample, DWORD streamnumber) { - Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1+streamnumber]); + Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[streamnumber]); HRESULT hr; LONGLONG start, stop, rtstart, rtstop; StreamData *stream = &This->streams[streamnumber]; @@ -571,7 +571,7 @@ static HRESULT AVISplitter_ProcessIndex(AVISplitterImpl *This, AVISTDINDEX **ind if (!pIndex) return E_OUTOFMEMORY;
- IAsyncReader_SyncRead((impl_PullPin_from_IPin(This->Parser.ppPins[0]))->pReader, qwOffset, cb, (BYTE *)pIndex); + IAsyncReader_SyncRead(This->Parser.pInputPin->pReader, qwOffset, cb, (BYTE *)pIndex); rest = cb - sizeof(AVISUPERINDEX) + sizeof(RIFFCHUNK) + sizeof(pIndex->aIndex);
TRACE("FOURCC: %s\n", debugstr_an((char *)&pIndex->fcc, 4)); @@ -1292,7 +1292,7 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface) EnterCriticalSection(&This->Parser.filter.csFilter); for (x = 0; x < This->Parser.cStreams; ++x) { - Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1+x]); + Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[x]); StreamData *stream = This->streams + x; LONGLONG wanted_frames; DWORD last_keyframe = 0, last_keyframeidx = 0, preroll = 0; diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c index 80c714cec75..f80ab1cb210 100644 --- a/dlls/quartz/mpegsplit.c +++ b/dlls/quartz/mpegsplit.c @@ -168,7 +168,7 @@ static HRESULT parse_header(BYTE *header, LONGLONG *plen, LONGLONG *pduration)
static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample) { - Parser_OutputPin * pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]); + Parser_OutputPin * pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]); LONGLONG length = 0; LONGLONG pos = BYTES_FROM_MEDIATIME(This->Parser.pInputPin->rtNext); LONGLONG time = This->position, rtstop, rtstart; @@ -322,7 +322,7 @@ static HRESULT MPEGSplitter_process_sample(LPVOID iface, IMediaSample * pSample, { IPin* ppin;
- hr = IPin_ConnectedTo(This->Parser.ppPins[i+1], &ppin); + hr = IPin_ConnectedTo(This->Parser.ppPins[i], &ppin); if (SUCCEEDED(hr)) { hr = IPin_EndOfStream(ppin); diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 652d4109f41..6c8ddf80f47 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -66,8 +66,10 @@ IPin *parser_get_pin(BaseFilter *iface, unsigned int index) { ParserImpl *filter = impl_from_BaseFilter(iface);
- if (index <= filter->cStreams) - return filter->ppPins[index]; + if (!index) + return &filter->pInputPin->pin.IPin_iface; + else if (index <= filter->cStreams) + return filter->ppPins[index - 1]; return NULL; }
@@ -87,7 +89,7 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown pParser->fnDisconnect = fnDisconnect;
pParser->cStreams = 0; - pParser->ppPins = CoTaskMemAlloc(1 * sizeof(IPin *)); + pParser->ppPins = CoTaskMemAlloc(0 * sizeof(IPin *));
/* construct input pin */ piInput.dir = PINDIR_INPUT; @@ -109,7 +111,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown
if (SUCCEEDED(hr)) { - pParser->ppPins[0] = &pParser->pInputPin->pin.IPin_iface; pParser->pInputPin->fnPreConnect = fnPreConnect; } else @@ -184,7 +185,7 @@ void Parser_Destroy(ParserImpl *This) HRESULT WINAPI Parser_Stop(IBaseFilter * iface) { ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin; ULONG i;
TRACE("%p->()\n", This); @@ -204,7 +205,7 @@ HRESULT WINAPI Parser_Stop(IBaseFilter * iface)
This->filter.state = State_Stopped;
- for (i = 1; i < (This->cStreams + 1); i++) + for (i = 0; i < This->cStreams; ++i) { BaseOutputPinImpl_Inactive((BaseOutputPin *)This->ppPins[i]); } @@ -223,7 +224,7 @@ HRESULT WINAPI Parser_Pause(IBaseFilter * iface) { HRESULT hr = S_OK; ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin;
TRACE("%p->()\n", This);
@@ -257,7 +258,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart) { HRESULT hr = S_OK; ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin;
ULONG i;
@@ -277,7 +278,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart) return S_OK; }
- for (i = 1; i < (This->cStreams + 1); i++) + for (i = 0; i < This->cStreams; ++i) { hr = BaseOutputPinImpl_Active((BaseOutputPin *)This->ppPins[i]); if (SUCCEEDED(hr)) @@ -304,7 +305,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart) HRESULT WINAPI Parser_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState) { ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin; HRESULT hr = S_OK;
TRACE("%p->(%d, %p)\n", This, dwMilliSecsTimeout, pState); @@ -326,7 +327,7 @@ HRESULT WINAPI Parser_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FI HRESULT WINAPI Parser_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock) { ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin;
TRACE("%p->(%p)\n", This, pClock);
@@ -354,14 +355,15 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
ppOldPins = This->ppPins;
- This->ppPins = CoTaskMemAlloc((This->cStreams + 2) * sizeof(IPin *)); - memcpy(This->ppPins, ppOldPins, (This->cStreams + 1) * sizeof(IPin *)); + This->ppPins = CoTaskMemAlloc((This->cStreams + 1) * sizeof(IPin *)); + memcpy(This->ppPins, ppOldPins, This->cStreams * sizeof(IPin *));
- hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, &output_BaseOutputFuncTable, &This->filter.csFilter, This->ppPins + (This->cStreams + 1)); + hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, + &output_BaseOutputFuncTable, &This->filter.csFilter, &This->ppPins[This->cStreams]);
if (SUCCEEDED(hr)) { - IPin *pPin = This->ppPins[This->cStreams + 1]; + IPin *pPin = This->ppPins[This->cStreams]; Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(pPin); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); CopyMediaType(pin->pmt, amt); @@ -409,12 +411,10 @@ static HRESULT Parser_RemoveOutputPins(ParserImpl * This)
TRACE("(%p)\n", This);
- /* reduce the pin array down to 1 (just our input pin) */ - This->ppPins = CoTaskMemAlloc(sizeof(IPin *) * 1); - memcpy(This->ppPins, ppOldPins, sizeof(IPin *) * 1); + This->ppPins = CoTaskMemAlloc(0);
for (i = 0; i < This->cStreams; i++) - free_source_pin(ppOldPins[i + 1]); + free_source_pin(ppOldPins[i]);
BaseFilterImpl_IncrementPinVersion(&This->filter); This->cStreams = 0; diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c index 1767adf2352..5b2608ac88e 100644 --- a/dlls/quartz/waveparser.c +++ b/dlls/quartz/waveparser.c @@ -102,7 +102,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR return S_OK; }
- pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]); + pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]);
if (SUCCEEDED(hr)) hr = IMemAllocator_GetBuffer(pin->pAlloc, &newsample, NULL, NULL, 0); @@ -161,7 +161,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR
TRACE("Send End Of Stream to output pin %u\n", i);
- hr = IPin_ConnectedTo(This->Parser.ppPins[i+1], &ppin); + hr = IPin_ConnectedTo(This->Parser.ppPins[i], &ppin); if (SUCCEEDED(hr)) { hr = IPin_EndOfStream(ppin); @@ -225,7 +225,7 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface)
/* Make sure this is done while stopped, BeginFlush takes care of this */ EnterCriticalSection(&This->Parser.filter.csFilter); - IPin_ConnectedTo(This->Parser.ppPins[1], &victim); + IPin_ConnectedTo(This->Parser.ppPins[0], &victim); if (victim) { IPin_NewSegment(victim, newpos, endpos, pPin->dRate); @@ -233,7 +233,7 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface) }
pPin->rtStart = pPin->rtCurrent = bytepos; - unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1])->dwSamplesProcessed = 0; + unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0])->dwSamplesProcessed = 0; LeaveCriticalSection(&This->Parser.filter.csFilter);
TRACE("Done flushing\n"); @@ -364,7 +364,7 @@ static HRESULT WAVEParser_first_request(LPVOID iface) LONGLONG rtSampleStart = pin->rtNext; /* Add 4 for the next header, which should hopefully work */ LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(sample)); - Parser_OutputPin *outpin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]); + Parser_OutputPin *outpin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]);
if (rtSampleStop > pin->rtStop) rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign));
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/avisplit.c | 18 +++------ dlls/quartz/mpegsplit.c | 12 ++---- dlls/quartz/parser.c | 82 ++++++++++++++++++---------------------- dlls/quartz/parser.h | 24 ++++++------ dlls/quartz/waveparser.c | 20 ++++------ 5 files changed, 66 insertions(+), 90 deletions(-)
diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c index aa43e0131e8..dcaefc528b9 100644 --- a/dlls/quartz/avisplit.c +++ b/dlls/quartz/avisplit.c @@ -130,20 +130,14 @@ static inline AVISplitterImpl *impl_from_IBaseFilter(IBaseFilter *iface) * != S_OK occurs. This means that any error is fatal to processing. */
-static HRESULT AVISplitter_SendEndOfFile(AVISplitterImpl *This, DWORD streamnumber) +static HRESULT AVISplitter_SendEndOfFile(AVISplitterImpl *filter, DWORD index) { - IPin* ppin = NULL; - HRESULT hr; + IPin *peer;
TRACE("End of file reached\n");
- hr = IPin_ConnectedTo(This->Parser.ppPins[streamnumber], &ppin); - if (SUCCEEDED(hr)) - { - hr = IPin_EndOfStream(ppin); - IPin_Release(ppin); - } - TRACE("--> %x\n", hr); + if ((peer = filter->Parser.sources[index]->pin.pin.pConnectedTo)) + IPin_EndOfStream(peer);
/* Force the pullpin thread to stop */ return S_FALSE; @@ -297,7 +291,7 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample, DWORD streamnumber) { - Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[streamnumber]); + Parser_OutputPin *pin = This->Parser.sources[streamnumber]; HRESULT hr; LONGLONG start, stop, rtstart, rtstop; StreamData *stream = &This->streams[streamnumber]; @@ -1292,7 +1286,7 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface) EnterCriticalSection(&This->Parser.filter.csFilter); for (x = 0; x < This->Parser.cStreams; ++x) { - Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[x]); + Parser_OutputPin *pin = This->Parser.sources[x]; StreamData *stream = This->streams + x; LONGLONG wanted_frames; DWORD last_keyframe = 0, last_keyframeidx = 0, preroll = 0; diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c index f80ab1cb210..3bfff9f7b44 100644 --- a/dlls/quartz/mpegsplit.c +++ b/dlls/quartz/mpegsplit.c @@ -168,7 +168,7 @@ static HRESULT parse_header(BYTE *header, LONGLONG *plen, LONGLONG *pduration)
static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample) { - Parser_OutputPin * pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]); + Parser_OutputPin *pOutputPin = This->Parser.sources[0]; LONGLONG length = 0; LONGLONG pos = BYTES_FROM_MEDIATIME(This->Parser.pInputPin->rtNext); LONGLONG time = This->position, rtstop, rtstart; @@ -320,14 +320,10 @@ static HRESULT MPEGSplitter_process_sample(LPVOID iface, IMediaSample * pSample,
for (i = 0; i < This->Parser.cStreams; i++) { - IPin* ppin; + IPin *peer;
- hr = IPin_ConnectedTo(This->Parser.ppPins[i], &ppin); - if (SUCCEEDED(hr)) - { - hr = IPin_EndOfStream(ppin); - IPin_Release(ppin); - } + if ((peer = This->Parser.sources[i]->pin.pin.pConnectedTo)) + hr = IPin_EndOfStream(peer); if (FAILED(hr)) WARN("Error sending EndOfStream to pin %u (%x)\n", i, hr); } diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 6c8ddf80f47..ca3a94f1740 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -69,7 +69,7 @@ IPin *parser_get_pin(BaseFilter *iface, unsigned int index) if (!index) return &filter->pInputPin->pin.IPin_iface; else if (index <= filter->cStreams) - return filter->ppPins[index - 1]; + return &filter->sources[index - 1]->pin.pin.IPin_iface; return NULL; }
@@ -89,7 +89,7 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown pParser->fnDisconnect = fnDisconnect;
pParser->cStreams = 0; - pParser->ppPins = CoTaskMemAlloc(0 * sizeof(IPin *)); + pParser->sources = CoTaskMemAlloc(0 * sizeof(IPin *));
/* construct input pin */ piInput.dir = PINDIR_INPUT; @@ -115,7 +115,7 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown } else { - CoTaskMemFree(pParser->ppPins); + CoTaskMemFree(pParser->sources); strmbase_filter_cleanup(&pParser->filter); CoTaskMemFree(pParser); } @@ -173,7 +173,7 @@ void Parser_Destroy(ParserImpl *This)
PullPin_destroy(This->pInputPin);
- CoTaskMemFree(This->ppPins); + CoTaskMemFree(This->sources); strmbase_filter_cleanup(&This->filter);
TRACE("Destroying parser\n"); @@ -207,7 +207,7 @@ HRESULT WINAPI Parser_Stop(IBaseFilter * iface)
for (i = 0; i < This->cStreams; ++i) { - BaseOutputPinImpl_Inactive((BaseOutputPin *)This->ppPins[i]); + BaseOutputPinImpl_Inactive(&This->sources[i]->pin); }
LeaveCriticalSection(&This->filter.csFilter); @@ -280,7 +280,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
for (i = 0; i < This->cStreams; ++i) { - hr = BaseOutputPinImpl_Active((BaseOutputPin *)This->ppPins[i]); + hr = BaseOutputPinImpl_Active(&This->sources[i]->pin); if (SUCCEEDED(hr)) hr_any = hr; } @@ -348,58 +348,48 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { Parser_OutputPin_DecideAllocator, };
-HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PROPERTIES * props, const AM_MEDIA_TYPE * amt) +HRESULT Parser_AddPin(ParserImpl *filter, const PIN_INFO *pin_info, + ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *mt) { - IPin ** ppOldPins; - HRESULT hr; + Parser_OutputPin **old_sources; + Parser_OutputPin *object;
- ppOldPins = This->ppPins; + if (!(object = CoTaskMemAlloc(sizeof(*object)))) + return E_OUTOFMEMORY;
- This->ppPins = CoTaskMemAlloc((This->cStreams + 1) * sizeof(IPin *)); - memcpy(This->ppPins, ppOldPins, This->cStreams * sizeof(IPin *)); + old_sources = filter->sources;
- hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, - &output_BaseOutputFuncTable, &This->filter.csFilter, &This->ppPins[This->cStreams]); + filter->sources = CoTaskMemAlloc((filter->cStreams + 1) * sizeof(filter->sources[0])); + memcpy(filter->sources, old_sources, filter->cStreams * sizeof(filter->sources[0])); + filter->sources[filter->cStreams] = object;
- if (SUCCEEDED(hr)) - { - IPin *pPin = This->ppPins[This->cStreams]; - Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(pPin); - pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); - CopyMediaType(pin->pmt, amt); - pin->dwSamplesProcessed = 0; - - pin->pin.pin.pinInfo.pFilter = &This->filter.IBaseFilter_iface; - pin->allocProps = *props; - This->cStreams++; - BaseFilterImpl_IncrementPinVersion(&This->filter); - CoTaskMemFree(ppOldPins); - } - else - { - CoTaskMemFree(This->ppPins); - This->ppPins = ppOldPins; - ERR("Failed with error %x\n", hr); - } + strmbase_source_init(&object->pin, &Parser_OutputPin_Vtbl, pin_info, + &output_BaseOutputFuncTable, &filter->filter.csFilter);
- return hr; + object->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); + CopyMediaType(object->pmt, mt); + object->dwSamplesProcessed = 0; + + object->pin.pin.pinInfo.pFilter = &filter->filter.IBaseFilter_iface; + object->allocProps = *props; + filter->cStreams++; + BaseFilterImpl_IncrementPinVersion(&filter->filter); + CoTaskMemFree(old_sources); + + return S_OK; }
-static void free_source_pin(IPin *iface) +static void free_source_pin(Parser_OutputPin *pin) { - Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(iface); - if (pin->pin.pin.pConnectedTo) { IPin_Disconnect(pin->pin.pin.pConnectedTo); - IPin_Disconnect(iface); + IPin_Disconnect(&pin->pin.pin.IPin_iface); }
FreeMediaType(pin->pmt); CoTaskMemFree(pin->pmt); - FreeMediaType(&pin->pin.pin.mtCurrent); - if (pin->pin.pAllocator) - IMemAllocator_Release(pin->pin.pAllocator); + strmbase_source_cleanup(&pin->pin); CoTaskMemFree(pin); }
@@ -407,18 +397,18 @@ static HRESULT Parser_RemoveOutputPins(ParserImpl * This) { /* NOTE: should be in critical section when calling this function */ ULONG i; - IPin ** ppOldPins = This->ppPins; + Parser_OutputPin **old_sources = This->sources;
TRACE("(%p)\n", This);
- This->ppPins = CoTaskMemAlloc(0); + This->sources = CoTaskMemAlloc(0);
for (i = 0; i < This->cStreams; i++) - free_source_pin(ppOldPins[i]); + free_source_pin(old_sources[i]);
BaseFilterImpl_IncrementPinVersion(&This->filter); This->cStreams = 0; - CoTaskMemFree(ppOldPins); + CoTaskMemFree(old_sources);
return S_OK; } diff --git a/dlls/quartz/parser.h b/dlls/quartz/parser.h index 8909c4da798..95b98d1f74d 100644 --- a/dlls/quartz/parser.h +++ b/dlls/quartz/parser.h @@ -26,18 +26,6 @@ typedef HRESULT (*PFN_PRE_CONNECT) (IPin * iface, IPin * pConnectPin, ALLOCATOR_ typedef HRESULT (*PFN_CLEANUP) (LPVOID iface); typedef HRESULT (*PFN_DISCONNECT) (LPVOID iface);
-struct ParserImpl -{ - BaseFilter filter; - - PFN_DISCONNECT fnDisconnect; - - PullPin * pInputPin; - IPin ** ppPins; - ULONG cStreams; - SourceSeeking sourceSeeking; -}; - typedef struct Parser_OutputPin { BaseOutputPin pin; @@ -50,6 +38,18 @@ typedef struct Parser_OutputPin BOOL readonly; } Parser_OutputPin;
+struct ParserImpl +{ + BaseFilter filter; + + PFN_DISCONNECT fnDisconnect; + + PullPin *pInputPin; + Parser_OutputPin **sources; + ULONG cStreams; + SourceSeeking sourceSeeking; +}; + extern HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PROPERTIES * props, const AM_MEDIA_TYPE * amt);
HRESULT Parser_Create(ParserImpl *parser, const IBaseFilterVtbl *vtbl, IUnknown *outer, diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c index 5b2608ac88e..0ab2388da45 100644 --- a/dlls/quartz/waveparser.c +++ b/dlls/quartz/waveparser.c @@ -102,7 +102,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR return S_OK; }
- pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]); + pOutputPin = This->Parser.sources[0];
if (SUCCEEDED(hr)) hr = IMemAllocator_GetBuffer(pin->pAlloc, &newsample, NULL, NULL, 0); @@ -161,7 +161,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR
TRACE("Send End Of Stream to output pin %u\n", i);
- hr = IPin_ConnectedTo(This->Parser.ppPins[i], &ppin); + hr = IPin_ConnectedTo(&This->Parser.sources[i]->pin.pin.IPin_iface, &ppin); if (SUCCEEDED(hr)) { hr = IPin_EndOfStream(ppin); @@ -196,8 +196,8 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface) { WAVEParserImpl *This = impl_from_IMediaSeeking(iface); PullPin *pPin = This->Parser.pInputPin; - IPin *victim = NULL; LONGLONG newpos, curpos, endpos, bytepos; + IPin *peer;
newpos = This->Parser.sourceSeeking.llCurrent; curpos = bytepos_to_duration(This, pPin->rtCurrent); @@ -225,15 +225,12 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface)
/* Make sure this is done while stopped, BeginFlush takes care of this */ EnterCriticalSection(&This->Parser.filter.csFilter); - IPin_ConnectedTo(This->Parser.ppPins[0], &victim); - if (victim) - { - IPin_NewSegment(victim, newpos, endpos, pPin->dRate); - IPin_Release(victim); - } + + if ((peer = This->Parser.sources[0]->pin.pin.pConnectedTo)) + IPin_NewSegment(peer, newpos, endpos, pPin->dRate);
pPin->rtStart = pPin->rtCurrent = bytepos; - unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0])->dwSamplesProcessed = 0; + This->Parser.sources[0]->dwSamplesProcessed = 0; LeaveCriticalSection(&This->Parser.filter.csFilter);
TRACE("Done flushing\n"); @@ -364,7 +361,6 @@ static HRESULT WAVEParser_first_request(LPVOID iface) LONGLONG rtSampleStart = pin->rtNext; /* Add 4 for the next header, which should hopefully work */ LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(sample)); - Parser_OutputPin *outpin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]);
if (rtSampleStop > pin->rtStop) rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign)); @@ -375,7 +371,7 @@ static HRESULT WAVEParser_first_request(LPVOID iface) pin->rtNext = rtSampleStop;
IMediaSample_SetPreroll(sample, FALSE); - if (!outpin->dwSamplesProcessed++) + if (!This->Parser.sources[0]->dwSamplesProcessed++) IMediaSample_SetDiscontinuity(sample, TRUE); else IMediaSample_SetDiscontinuity(sample, FALSE);
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47291 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 38c708b14e8..e5efc1659dc 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -1354,11 +1354,11 @@ static HRESULT WINAPI VMR9FilterConfig_SetImageCompositor(IVMRFilterConfig9 *ifa return E_NOTIMPL; }
-static HRESULT WINAPI VMR9FilterConfig_SetNumberOfStreams(IVMRFilterConfig9 *iface, DWORD max) +static HRESULT WINAPI VMR9FilterConfig_SetNumberOfStreams(IVMRFilterConfig9 *iface, DWORD count) { - struct quartz_vmr *This = impl_from_IVMRFilterConfig9(iface); - - FIXME("(%p/%p)->(%u) stub\n", iface, This, max); + FIXME("iface %p, count %u, stub!\n", iface, count); + if (count == 1) + return S_OK; return E_NOTIMPL; }