[PATCH 2/5] quartz/filtergraph: Implement IFilterGraph2::ReconnectEx().
Zebediah Figura
z.figura12 at gmail.com
Sun Feb 2 15:19:36 CST 2020
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/quartz/filtergraph.c | 54 +++++++++++++++------------------
dlls/quartz/tests/filtergraph.c | 25 +++++++++++++++
2 files changed, 49 insertions(+), 30 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 21c60267311..fde793e6dcb 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -996,33 +996,13 @@ static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface, IPin *ppi
return hr;
}
-static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface, IPin *ppin)
+static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface, IPin *pin)
{
- IFilterGraphImpl *This = impl_from_IFilterGraph2(iface);
- IPin *pConnectedTo = NULL;
- HRESULT hr;
- PIN_DIRECTION pindir;
-
- IPin_QueryDirection(ppin, &pindir);
- hr = IPin_ConnectedTo(ppin, &pConnectedTo);
+ IFilterGraphImpl *graph = impl_from_IFilterGraph2(iface);
- TRACE("(%p/%p)->(%p) -- %p\n", This, iface, ppin, pConnectedTo);
+ TRACE("graph %p, pin %p.\n", graph, pin);
- if (FAILED(hr)) {
- TRACE("Querying connected to failed: %x\n", hr);
- return hr;
- }
- IPin_Disconnect(ppin);
- IPin_Disconnect(pConnectedTo);
- if (pindir == PINDIR_INPUT)
- hr = IFilterGraph2_ConnectDirect(iface, pConnectedTo, ppin, NULL);
- else
- hr = IFilterGraph2_ConnectDirect(iface, ppin, pConnectedTo, NULL);
- IPin_Release(pConnectedTo);
- if (FAILED(hr))
- WARN("Reconnecting pins failed, pins are not connected now..\n");
- TRACE("-> %08x\n", hr);
- return hr;
+ return IFilterGraph2_ReconnectEx(iface, pin, NULL);
}
static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface, IPin *ppin)
@@ -1950,15 +1930,29 @@ static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *ifac
return S_OK;
}
-static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface, IPin *ppin,
- const AM_MEDIA_TYPE *pmt)
+static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface, IPin *pin, const AM_MEDIA_TYPE *mt)
{
- IFilterGraphImpl *This = impl_from_IFilterGraph2(iface);
+ IFilterGraphImpl *graph = impl_from_IFilterGraph2(iface);
+ PIN_DIRECTION dir;
+ HRESULT hr;
+ IPin *peer;
- TRACE("(%p/%p)->(%p %p): stub !!!\n", This, iface, ppin, pmt);
- strmbase_dump_media_type(pmt);
+ TRACE("graph %p, pin %p, mt %p.\n", graph, pin, mt);
- return S_OK;
+ if (FAILED(hr = IPin_ConnectedTo(pin, &peer)))
+ return hr;
+
+ IPin_QueryDirection(pin, &dir);
+ IFilterGraph2_Disconnect(iface, peer);
+ IFilterGraph2_Disconnect(iface, pin);
+
+ if (dir == PINDIR_INPUT)
+ hr = IFilterGraph2_ConnectDirect(iface, peer, pin, mt);
+ else
+ hr = IFilterGraph2_ConnectDirect(iface, pin, peer, mt);
+
+ IPin_Release(peer);
+ return hr;
}
static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface, IPin *pPinOut, DWORD dwFlags,
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index decea5d94cb..5b913d828da 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -2947,6 +2947,31 @@ todo_wine
hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, NULL);
+ ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+ hr = IFilterGraph2_ReconnectEx(graph, &sink_pin.IPin_iface, NULL);
+ ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+
+ hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, NULL);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
+ ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt);
+ ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
+ hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, &mt);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
+ ok(source_pin.mt == &mt, "Got mt %p.\n", source_pin.mt);
+ ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
+ hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
/* ConnectDirect() protects against cyclical connections. */
hr = IFilterGraph2_AddFilter(graph, &parser1.IBaseFilter_iface, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
--
2.25.0
More information about the wine-devel
mailing list