Zebediah Figura : quartz/filtergraph: Check pin name instead of id in connect_output_pin().
Alexandre Julliard
julliard at winehq.org
Thu Sep 20 13:45:34 CDT 2018
Module: wine
Branch: master
Commit: 009bbfa6a3b67e7d839307aad2c379a3615d92d9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=009bbfa6a3b67e7d839307aad2c379a3615d92d9
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Thu Sep 20 10:36:20 2018 -0500
quartz/filtergraph: Check pin name instead of id in connect_output_pin().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/filtergraph.c | 20 ++++++--------------
dlls/quartz/tests/filtergraph.c | 41 ++++++++++++++++++++++++++++++++++++++---
2 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 4eaed31..c4ba644 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -1041,9 +1041,8 @@ static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPi
static HRESULT connect_output_pin(IFilterGraphImpl *graph, IBaseFilter *filter, IPin *sink)
{
IEnumPins *enumpins;
- PIN_DIRECTION dir;
+ PIN_INFO info;
HRESULT hr;
- WCHAR *id;
IPin *pin;
hr = IBaseFilter_EnumPins(filter, &enumpins);
@@ -1052,20 +1051,13 @@ static HRESULT connect_output_pin(IFilterGraphImpl *graph, IBaseFilter *filter,
while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
{
- IPin_QueryDirection(pin, &dir);
- if (dir == PINDIR_OUTPUT)
+ IPin_QueryPinInfo(pin, &info);
+ IBaseFilter_Release(info.pFilter);
+ if (info.dir == PINDIR_OUTPUT)
{
- hr = IPin_QueryId(pin, &id);
- if (FAILED(hr))
- {
- IPin_Release(pin);
- IEnumPins_Release(enumpins);
- return hr;
- }
-
- if (id[0] == '~')
+ if (info.achName[0] == '~')
{
- TRACE("Skipping non-rendered pin %s.\n", debugstr_w(id));
+ TRACE("Skipping non-rendered pin %s.\n", debugstr_w(info.achName));
IPin_Release(pin);
IEnumPins_Release(enumpins);
return E_FAIL;
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 64705d2..9ef229f 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -768,6 +768,8 @@ struct testpin
IBaseFilter *filter;
IPin *peer;
AM_MEDIA_TYPE *mt;
+ WCHAR name[10];
+ WCHAR id[10];
IEnumMediaTypes IEnumMediaTypes_iface;
const AM_MEDIA_TYPE *types;
@@ -928,7 +930,7 @@ static HRESULT WINAPI testpin_QueryPinInfo(IPin *iface, PIN_INFO *info)
info->pFilter = pin->filter;
IBaseFilter_AddRef(pin->filter);
info->dir = pin->dir;
- info->achName[0] = 0;
+ lstrcpyW(info->achName, pin->name);
return S_OK;
}
@@ -944,9 +946,10 @@ static HRESULT WINAPI testpin_QueryDirection(IPin *iface, PIN_DIRECTION *dir)
static HRESULT WINAPI testpin_QueryId(IPin *iface, WCHAR **id)
{
+ struct testpin *pin = impl_from_IPin(iface);
if (winetest_debug > 1) trace("%p->QueryId()\n", iface);
- *id = CoTaskMemAlloc(1);
- (*id)[0] = 0;
+ *id = CoTaskMemAlloc(11);
+ lstrcpyW(*id, pin->id);
return S_OK;
}
@@ -1770,6 +1773,38 @@ todo_wine
IFilterGraph2_Disconnect(graph, sink_pin.peer);
IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
+ /* A pin whose name (not ID) begins with a tilde is not connected. */
+
+ parser1_pins[1].name[0] = '~';
+ hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
+todo_wine
+ ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
+ ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
+
+ parser1.pin_count = 3;
+ hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
+todo_wine {
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
+ ok(sink_pin.peer == &parser1_pins[2].IPin_iface, "Got peer %p.\n", sink_pin.peer);
+}
+ IFilterGraph2_Disconnect(graph, source_pin.peer);
+ IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
+ IFilterGraph2_Disconnect(graph, sink_pin.peer);
+ IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
+ parser1.pin_count = 2;
+
+ parser1_pins[1].name[0] = 0;
+ parser1_pins[1].id[0] = '~';
+ hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
+ ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
+ IFilterGraph2_Disconnect(graph, source_pin.peer);
+ IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
+ IFilterGraph2_Disconnect(graph, sink_pin.peer);
+ IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
+
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
More information about the wine-cvs
mailing list