Piotr Caban : qcap: Add Avi Mux input pin IMemInputPin::GetAllocator.

Alexandre Julliard julliard at winehq.org
Mon Feb 24 15:42:31 CST 2014


Module: wine
Branch: master
Commit: 151a3eec9ac95fd84599aa2a4e8bddb5788010f0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=151a3eec9ac95fd84599aa2a4e8bddb5788010f0

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Feb 24 12:10:27 2014 +0100

qcap: Add Avi Mux input pin IMemInputPin::GetAllocator.

---

 dlls/qcap/avimux.c     |   18 ++++++++++++++++--
 dlls/qcap/tests/qcap.c |   16 ++++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/dlls/qcap/avimux.c b/dlls/qcap/avimux.c
index fdc0e8e..555cc44 100644
--- a/dlls/qcap/avimux.c
+++ b/dlls/qcap/avimux.c
@@ -1346,8 +1346,15 @@ static HRESULT WINAPI AviMuxIn_MemInputPin_GetAllocator(
 {
     AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface);
     AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface);
-    FIXME("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), ppAllocator);
-    return E_NOTIMPL;
+
+    TRACE("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), ppAllocator);
+
+    if(!ppAllocator)
+        return E_POINTER;
+
+    IMemAllocator_AddRef(avimuxin->pin.pAllocator);
+    *ppAllocator = avimuxin->pin.pAllocator;
+    return S_OK;
 }
 
 static HRESULT WINAPI AviMuxIn_MemInputPin_NotifyAllocator(
@@ -1545,6 +1552,13 @@ static HRESULT create_input_pin(AviMux *avimux)
     avimux->in[avimux->input_pin_no]->IPropertyBag_iface.lpVtbl = &AviMuxIn_PropertyBagVtbl;
     avimux->in[avimux->input_pin_no]->IQualityControl_iface.lpVtbl = &AviMuxIn_QualityControlVtbl;
 
+    hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IMemAllocator, (void**)&avimux->in[avimux->input_pin_no]->pin.pAllocator);
+    if(FAILED(hr)) {
+        BaseInputPinImpl_Release(&avimux->in[avimux->input_pin_no]->pin.pin.IPin_iface);
+        return hr;
+    }
+
     avimux->input_pin_no++;
     return S_OK;
 }
diff --git a/dlls/qcap/tests/qcap.c b/dlls/qcap/tests/qcap.c
index 162b17e..dff5bb8 100644
--- a/dlls/qcap/tests/qcap.c
+++ b/dlls/qcap/tests/qcap.c
@@ -1234,6 +1234,7 @@ static void test_AviMux(void)
     IEnumMediaTypes *emt;
     IMemInputPin *memin;
     ALLOCATOR_PROPERTIES props;
+    IMemAllocator *memalloc;
     HRESULT hr;
 
     init_test_filter(&source_filter, PINDIR_OUTPUT, SOURCE_FILTER);
@@ -1351,6 +1352,21 @@ static void test_AviMux(void)
     ok(props.cbBuffer == 0xdeadbee2, "cbBuffer = %d\n", props.cbBuffer);
     ok(props.cbAlign == 1, "cbAlign = %d\n", props.cbAlign);
     ok(props.cbPrefix == 8, "cbPrefix = %d\n", props.cbPrefix);
+
+    hr = IMemInputPin_GetAllocator(memin, &memalloc);
+    ok(hr == S_OK, "GetAllocator returned %x\n", hr);
+
+    props.cBuffers = 0xdeadbee1;
+    props.cbBuffer = 0xdeadbee2;
+    props.cbAlign = 0xdeadbee3;
+    props.cbPrefix = 0xdeadbee4;
+    hr = IMemAllocator_GetProperties(memalloc, &props);
+    ok(hr == S_OK, "GetProperties returned %x\n", hr);
+    ok(props.cBuffers == 0, "cBuffers = %d\n", props.cBuffers);
+    ok(props.cbBuffer == 0, "cbBuffer = %d\n", props.cbBuffer);
+    ok(props.cbAlign == 0, "cbAlign = %d\n", props.cbAlign);
+    ok(props.cbPrefix == 0, "cbPrefix = %d\n", props.cbPrefix);
+    IMemAllocator_Release(memalloc);
     IMemInputPin_Release(memin);
 
     hr = IPin_Disconnect(avimux_out);




More information about the wine-cvs mailing list