Commit 7f57286d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase/renderer: Use base sink connection methods.

parent 67a6af77
...@@ -1392,7 +1392,7 @@ static void test_connect_pin(void) ...@@ -1392,7 +1392,7 @@ static void test_connect_pin(void)
hr = IFilterGraph2_Disconnect(graph, pin); hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IFilterGraph2_Disconnect(graph, pin); hr = IFilterGraph2_Disconnect(graph, pin);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(source.source.pin.peer == pin, "Got peer %p.\n", peer); ok(source.source.pin.peer == pin, "Got peer %p.\n", peer);
IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface); IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
......
...@@ -901,7 +901,8 @@ static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface ...@@ -901,7 +901,8 @@ static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface
if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt))) if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt)))
{ {
ok(hr == VFW_E_TYPE_NOT_ACCEPTED || hr == E_FAIL, "Got hr %#x.\n", hr); todo_wine_if (((VIDEOINFOHEADER *)mt->pbFormat)->bmiHeader.biBitCount == 24)
ok(hr == VFW_E_TYPE_NOT_ACCEPTED || hr == E_FAIL, "Got hr %#x.\n", hr);
IPin_Release(peer); IPin_Release(peer);
iface->pin.peer = NULL; iface->pin.peer = NULL;
FreeMediaType(&iface->pin.mt); FreeMediaType(&iface->pin.mt);
...@@ -1315,13 +1316,17 @@ static void test_connect_pin(void) ...@@ -1315,13 +1316,17 @@ static void test_connect_pin(void)
skip("Got E_FAIL when connecting.\n"); skip("Got E_FAIL when connecting.\n");
goto out; goto out;
} }
ok(hr == S_OK, "Got hr %#x for subtype %s and bpp %u.\n", hr, todo_wine_if (bpp_tests[j] == 24)
wine_dbgstr_guid(subtype_tests[i]), bpp_tests[j]); ok(hr == S_OK, "Got hr %#x for subtype %s and bpp %u.\n", hr,
wine_dbgstr_guid(subtype_tests[i]), bpp_tests[j]);
hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface); if (hr == S_OK)
ok(hr == S_OK, "Got hr %#x.\n", hr); {
hr = IFilterGraph2_Disconnect(graph, pin); hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
}
} }
} }
...@@ -1391,7 +1396,7 @@ static void test_connect_pin(void) ...@@ -1391,7 +1396,7 @@ static void test_connect_pin(void)
hr = IFilterGraph2_Disconnect(graph, pin); hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IFilterGraph2_Disconnect(graph, pin); hr = IFilterGraph2_Disconnect(graph, pin);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(source.source.pin.peer == pin, "Got peer %p.\n", source.source.pin.peer); ok(source.source.pin.peer == pin, "Got peer %p.\n", source.source.pin.peer);
IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface); IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
......
...@@ -356,7 +356,7 @@ static HRESULT VMR9_maybe_init(struct quartz_vmr *This, BOOL force) ...@@ -356,7 +356,7 @@ static HRESULT VMR9_maybe_init(struct quartz_vmr *This, BOOL force)
HRESULT hr; HRESULT hr;
TRACE("my mode: %u, my window: %p, my last window: %p\n", This->mode, This->baseControlWindow.baseWindow.hWnd, This->hWndClippingWindow); TRACE("my mode: %u, my window: %p, my last window: %p\n", This->mode, This->baseControlWindow.baseWindow.hWnd, This->hWndClippingWindow);
if (This->num_surfaces || !This->renderer.sink.pin.peer) if (This->num_surfaces)
return S_OK; return S_OK;
if (This->mode == VMR9Mode_Windowless && !This->hWndClippingWindow) if (This->mode == VMR9Mode_Windowless && !This->hWndClippingWindow)
...@@ -410,7 +410,8 @@ static void vmr_start_stream(struct strmbase_renderer *iface) ...@@ -410,7 +410,8 @@ static void vmr_start_stream(struct strmbase_renderer *iface)
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
VMR9_maybe_init(This, TRUE); if (This->renderer.sink.pin.peer)
VMR9_maybe_init(This, TRUE);
IVMRImagePresenter9_StartPresenting(This->presenter, This->cookie); IVMRImagePresenter9_StartPresenting(This->presenter, This->cookie);
SetWindowPos(This->baseControlWindow.baseWindow.hWnd, NULL, SetWindowPos(This->baseControlWindow.baseWindow.hWnd, NULL,
This->source_rect.left, This->source_rect.left,
...@@ -1760,7 +1761,8 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowles ...@@ -1760,7 +1761,8 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowles
EnterCriticalSection(&This->renderer.filter.csFilter); EnterCriticalSection(&This->renderer.filter.csFilter);
This->hWndClippingWindow = hwnd; This->hWndClippingWindow = hwnd;
VMR9_maybe_init(This, FALSE); if (This->renderer.sink.pin.peer)
VMR9_maybe_init(This, FALSE);
if (!hwnd) if (!hwnd)
IVMRSurfaceAllocatorEx9_TerminateDevice(This->allocator, This->cookie); IVMRSurfaceAllocatorEx9_TerminateDevice(This->allocator, This->cookie);
LeaveCriticalSection(&This->renderer.filter.csFilter); LeaveCriticalSection(&This->renderer.filter.csFilter);
......
...@@ -40,46 +40,6 @@ static inline struct strmbase_renderer *impl_from_IPin(IPin *iface) ...@@ -40,46 +40,6 @@ static inline struct strmbase_renderer *impl_from_IPin(IPin *iface)
return CONTAINING_RECORD(iface, struct strmbase_renderer, sink.pin.IPin_iface); return CONTAINING_RECORD(iface, struct strmbase_renderer, sink.pin.IPin_iface);
} }
static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
{
struct strmbase_renderer *filter = impl_from_IPin(iface);
HRESULT hr;
TRACE("iface %p, peer %p, mt %p.\n", iface, peer, mt);
strmbase_dump_media_type(mt);
EnterCriticalSection(&filter->filter.csFilter);
hr = BaseInputPinImpl_ReceiveConnection(iface, peer, mt);
if (SUCCEEDED(hr))
{
if (filter->pFuncsTable->renderer_connect)
hr = filter->pFuncsTable->renderer_connect(filter, mt);
}
LeaveCriticalSection(&filter->filter.csFilter);
return hr;
}
static HRESULT WINAPI BaseRenderer_InputPin_Disconnect(IPin * iface)
{
struct strmbase_renderer *filter = impl_from_IPin(iface);
HRESULT hr;
TRACE("iface %p.\n", iface);
EnterCriticalSection(&filter->filter.csFilter);
hr = BaseInputPinImpl_Disconnect(iface);
if (SUCCEEDED(hr))
{
if (filter->pFuncsTable->pfnBreakConnect)
hr = filter->pFuncsTable->pfnBreakConnect(filter);
}
BaseRendererImpl_ClearPendingSample(filter);
LeaveCriticalSection(&filter->filter.csFilter);
return hr;
}
static HRESULT WINAPI BaseRenderer_InputPin_EndOfStream(IPin * iface) static HRESULT WINAPI BaseRenderer_InputPin_EndOfStream(IPin * iface)
{ {
struct strmbase_renderer *filter = impl_from_IPin(iface); struct strmbase_renderer *filter = impl_from_IPin(iface);
...@@ -157,8 +117,8 @@ static const IPinVtbl BaseRenderer_InputPin_Vtbl = ...@@ -157,8 +117,8 @@ static const IPinVtbl BaseRenderer_InputPin_Vtbl =
BasePinImpl_AddRef, BasePinImpl_AddRef,
BasePinImpl_Release, BasePinImpl_Release,
BaseInputPinImpl_Connect, BaseInputPinImpl_Connect,
BaseRenderer_InputPin_ReceiveConnection, BaseInputPinImpl_ReceiveConnection,
BaseRenderer_InputPin_Disconnect, BaseInputPinImpl_Disconnect,
BasePinImpl_ConnectedTo, BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType, BasePinImpl_ConnectionMediaType,
BasePinImpl_QueryPinInfo, BasePinImpl_QueryPinInfo,
...@@ -312,12 +272,31 @@ static HRESULT WINAPI BaseRenderer_Receive(struct strmbase_sink *pin, IMediaSamp ...@@ -312,12 +272,31 @@ static HRESULT WINAPI BaseRenderer_Receive(struct strmbase_sink *pin, IMediaSamp
return BaseRendererImpl_Receive(filter, sample); return BaseRendererImpl_Receive(filter, sample);
} }
static HRESULT sink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
{
struct strmbase_renderer *filter = impl_from_IPin(&iface->pin.IPin_iface);
if (filter->pFuncsTable->renderer_connect)
return filter->pFuncsTable->renderer_connect(filter, mt);
return S_OK;
}
static void sink_disconnect(struct strmbase_sink *iface)
{
struct strmbase_renderer *filter = impl_from_IPin(&iface->pin.IPin_iface);
if (filter->pFuncsTable->pfnBreakConnect)
filter->pFuncsTable->pfnBreakConnect(filter);
}
static const struct strmbase_sink_ops sink_ops = static const struct strmbase_sink_ops sink_ops =
{ {
.base.pin_query_accept = sink_query_accept, .base.pin_query_accept = sink_query_accept,
.base.pin_query_interface = sink_query_interface, .base.pin_query_interface = sink_query_interface,
.base.pin_get_media_type = strmbase_pin_get_media_type, .base.pin_get_media_type = strmbase_pin_get_media_type,
.pfnReceive = BaseRenderer_Receive, .pfnReceive = BaseRenderer_Receive,
.sink_connect = sink_connect,
.sink_disconnect = sink_disconnect,
}; };
void strmbase_renderer_cleanup(struct strmbase_renderer *filter) void strmbase_renderer_cleanup(struct strmbase_renderer *filter)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment