Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 27 +++++++++++++++++++++++++-- dlls/mf/main.c | 1 - dlls/mf/mf_private.h | 1 + dlls/mf/samplegrabber.c | 1 - dlls/mf/sar.c | 1 - dlls/mf/session.c | 1 - dlls/mf/tests/mf.c | 2 -- dlls/mf/topology.c | 1 - 8 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index a5a39fe7786..64944673d5a 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -22,11 +22,18 @@
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
+enum video_renderer_flags +{ + EVR_SHUT_DOWN = 0x1, +}; + struct video_renderer { IMFMediaSink IMFMediaSink_iface; IMFMediaSinkPreroll IMFMediaSinkPreroll_iface; LONG refcount; + unsigned int flags; + CRITICAL_SECTION cs; };
static struct video_renderer *impl_from_IMFMediaSink(IMFMediaSink *iface) @@ -83,6 +90,7 @@ static ULONG WINAPI video_renderer_sink_Release(IMFMediaSink *iface)
if (!refcount) { + DeleteCriticalSection(&renderer->cs); heap_free(renderer); }
@@ -91,8 +99,13 @@ static ULONG WINAPI video_renderer_sink_Release(IMFMediaSink *iface)
static HRESULT WINAPI video_renderer_sink_GetCharacteristics(IMFMediaSink *iface, DWORD *flags) { + struct video_renderer *renderer = impl_from_IMFMediaSink(iface); + TRACE("%p, %p.\n", iface, flags);
+ if (renderer->flags & EVR_SHUT_DOWN) + return MF_E_SHUTDOWN; + *flags = MEDIASINK_CLOCK_REQUIRED | MEDIASINK_CAN_PREROLL;
return S_OK; @@ -152,9 +165,18 @@ static HRESULT WINAPI video_renderer_sink_GetPresentationClock(IMFMediaSink *ifa
static HRESULT WINAPI video_renderer_sink_Shutdown(IMFMediaSink *iface) { - FIXME("%p.\n", iface); + struct video_renderer *renderer = impl_from_IMFMediaSink(iface);
- return E_NOTIMPL; + TRACE("%p.\n", iface); + + if (renderer->flags & EVR_SHUT_DOWN) + return MF_E_SHUTDOWN; + + EnterCriticalSection(&renderer->cs); + renderer->flags |= EVR_SHUT_DOWN; + LeaveCriticalSection(&renderer->cs); + + return S_OK; }
static const IMFMediaSinkVtbl video_renderer_sink_vtbl = @@ -218,6 +240,7 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, object->IMFMediaSink_iface.lpVtbl = &video_renderer_sink_vtbl; object->IMFMediaSinkPreroll_iface.lpVtbl = &video_renderer_preroll_vtbl; object->refcount = 1; + InitializeCriticalSection(&object->cs);
*obj = (IUnknown *)&object->IMFMediaSink_iface;
diff --git a/dlls/mf/main.c b/dlls/mf/main.c index 4d9f5a7ea39..8656c6cddf2 100644 --- a/dlls/mf/main.c +++ b/dlls/mf/main.c @@ -27,7 +27,6 @@ #include "rpcproxy.h"
#include "mfapi.h" -#include "mferror.h"
#include "mf_private.h"
diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index 14f7288c9bb..f4356219731 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#include "mferror.h" #include "mfidl.h"
#include "wine/heap.h" diff --git a/dlls/mf/samplegrabber.c b/dlls/mf/samplegrabber.c index 92330abc9fe..cbf7453d04d 100644 --- a/dlls/mf/samplegrabber.c +++ b/dlls/mf/samplegrabber.c @@ -20,7 +20,6 @@
#include "mfapi.h" #include "mfidl.h" -#include "mferror.h" #include "mf_private.h"
#include "wine/debug.h" diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index 89a517b1358..8a27c0658c3 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -20,7 +20,6 @@
#include "mfapi.h" #include "mfidl.h" -#include "mferror.h" #include "mf_private.h" #include "initguid.h" #include "mmdeviceapi.h" diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 39b5e1a5377..d0365ea8564 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -25,7 +25,6 @@ #include "winbase.h" #include "mfidl.h" #include "mfapi.h" -#include "mferror.h"
#include "wine/debug.h" #include "wine/heap.h" diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index c274c3263d3..691734aa9a9 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3265,7 +3265,6 @@ static void test_evr(void) ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
hr = IMFMediaSink_GetCharacteristics(sink, &flags); -todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
/* Activate again. */ @@ -3279,7 +3278,6 @@ todo_wine ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
hr = IMFMediaSink_GetCharacteristics(sink, &flags); -todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFActivate_ActivateObject(activate, &IID_IMFMediaSink, (void **)&sink2); diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index 432979206ba..f4cc30a9fc6 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -27,7 +27,6 @@ #undef INITGUID #include <guiddef.h> #include "mfapi.h" -#include "mferror.h" #include "mfidl.h"
#include "wine/debug.h"