Derek Lesho : winegstreamer: Set MF_PD_DURATION on source's presentation descriptor.

Alexandre Julliard julliard at winehq.org
Mon Nov 9 15:11:51 CST 2020


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

Author: Derek Lesho <dlesho at codeweavers.com>
Date:   Mon Nov  2 13:34:55 2020 -0600

winegstreamer: Set MF_PD_DURATION on source's presentation descriptor.

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

---

 dlls/winegstreamer/media_source.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 9d7df347dab..66bdf64a669 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -1237,6 +1237,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
 
     struct media_source *object = heap_alloc_zero(sizeof(*object));
     IMFStreamDescriptor **descriptors = NULL;
+    gint64 total_pres_time = 0;
     DWORD bytestream_caps;
     unsigned int i;
     HRESULT hr;
@@ -1357,6 +1358,25 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
     heap_free(descriptors);
     descriptors = NULL;
 
+    for (i = 0; i < object->stream_count; i++)
+    {
+        gint64 stream_pres_time;
+        if (gst_pad_query_duration(object->streams[i]->their_src, GST_FORMAT_TIME, &stream_pres_time))
+        {
+            TRACE("Stream %u has duration %llu\n", i, (unsigned long long int) stream_pres_time);
+
+            if (stream_pres_time > total_pres_time)
+                total_pres_time = stream_pres_time;
+        }
+        else
+        {
+            WARN("Unable to get presentation time of stream %u\n", i);
+        }
+    }
+
+    if (object->stream_count)
+        IMFPresentationDescriptor_SetUINT64(object->pres_desc, &MF_PD_DURATION, total_pres_time / 100);
+
     object->state = SOURCE_STOPPED;
 
     *out_media_source = object;




More information about the wine-cvs mailing list