Nikolay Sivov : mf/evr: Implement NotifyPreroll().

Alexandre Julliard julliard at winehq.org
Fri Oct 16 15:55:39 CDT 2020


Module: wine
Branch: master
Commit: 4e11368295174a7dc39647b19fb172bb0770e9b3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4e11368295174a7dc39647b19fb172bb0770e9b3

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Oct 16 16:38:10 2020 +0300

mf/evr: Implement NotifyPreroll().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mf/evr.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c
index ac80193ddd6..0cd13c25501 100644
--- a/dlls/mf/evr.c
+++ b/dlls/mf/evr.c
@@ -35,6 +35,12 @@ enum video_renderer_flags
     EVR_PRESENTER_INITED_SERVICES = 0x8,
 };
 
+enum video_stream_flags
+{
+    EVR_STREAM_PREROLLING = 0x1,
+    EVR_STREAM_PREROLLED = 0x2,
+};
+
 struct video_renderer;
 
 struct video_stream
@@ -44,6 +50,7 @@ struct video_stream
     IMFGetService IMFGetService_iface;
     LONG refcount;
     unsigned int id;
+    unsigned int flags;
     struct video_renderer *parent;
     IMFMediaEventQueue *event_queue;
     IMFVideoSampleAllocator *allocator;
@@ -318,8 +325,19 @@ static HRESULT WINAPI video_stream_sink_GetMediaTypeHandler(IMFStreamSink *iface
 
 static HRESULT WINAPI video_stream_sink_ProcessSample(IMFStreamSink *iface, IMFSample *sample)
 {
+    struct video_stream *stream = impl_from_IMFStreamSink(iface);
+
     FIXME("%p, %p.\n", iface, sample);
 
+    EnterCriticalSection(&stream->cs);
+    if (stream->flags & EVR_STREAM_PREROLLING)
+    {
+        IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamSinkPrerolled, &GUID_NULL, S_OK, NULL);
+        stream->flags &= ~EVR_STREAM_PREROLLING;
+        stream->flags |= EVR_STREAM_PREROLLED;
+    }
+    LeaveCriticalSection(&stream->cs);
+
     return E_NOTIMPL;
 }
 
@@ -958,9 +976,34 @@ static ULONG WINAPI video_renderer_preroll_Release(IMFMediaSinkPreroll *iface)
 
 static HRESULT WINAPI video_renderer_preroll_NotifyPreroll(IMFMediaSinkPreroll *iface, MFTIME start_time)
 {
-    FIXME("%p, %s.\n", iface, debugstr_time(start_time));
+    struct video_renderer *renderer = impl_from_IMFMediaSinkPreroll(iface);
+    HRESULT hr = S_OK;
+    size_t i;
 
-    return E_NOTIMPL;
+    TRACE("%p, %s.\n", iface, debugstr_time(start_time));
+
+    EnterCriticalSection(&renderer->cs);
+    if (renderer->flags & EVR_SHUT_DOWN)
+        hr = MF_E_SHUTDOWN;
+    else
+    {
+        for (i = 0; i < renderer->stream_count; ++i)
+        {
+            struct video_stream *stream = renderer->streams[i];
+
+            EnterCriticalSection(&stream->cs);
+            if (!(stream->flags & (EVR_STREAM_PREROLLING | EVR_STREAM_PREROLLED)))
+            {
+                IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEStreamSinkRequestSample,
+                        &GUID_NULL, S_OK, NULL);
+                stream->flags |= EVR_STREAM_PREROLLING;
+            }
+            LeaveCriticalSection(&stream->cs);
+        }
+    }
+    LeaveCriticalSection(&renderer->cs);
+
+    return hr;
 }
 
 static const IMFMediaSinkPrerollVtbl video_renderer_preroll_vtbl =




More information about the wine-cvs mailing list