From 68c50a8fb4cbb402a2cd22b48b58852437104bd2 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sun, 16 Aug 2020 14:43:27 +1000 Subject: [PATCH] Updated mfplat-streaming-support patchset Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=49708 --- ...e-the-demuxer-to-establish-IMFMediaS.patch | 37 ++++++++------ ...r-Translate-H.264-caps-to-attributes.patch | 15 +++--- ...plement-IMFMediaSource-CreatePresent.patch | 32 +++++++----- ...eamer-Implement-IMFMediaSource-Start.patch | 26 +++++----- ...plement-IMFMediaStream-RequestSample.patch | 32 ++++++------ ...lculate-the-MF_PD_DURATION-of-the-me.patch | 12 ++--- ...roduce-IMFSample-GstBuffer-converter.patch | 15 +++--- ...r-Implement-decoder-MFT-on-gstreamer.patch | 30 ++++++------ .../0035-Miscellaneous.patch | 49 +++++++++---------- .../0039-Rewrite-branch-resolver.patch | 23 ++++----- ...reamer-Implement-Color-Converter-MFT.patch | 23 +++++---- ...to-allow-other-streams-to-continue-w.patch | 10 ++-- ...ackwards-and-only-select-one-of-each.patch | 16 +++--- ...reamer-Implement-IMFMediaSource-Stop.patch | 20 ++++---- 14 files changed, 183 insertions(+), 157 deletions(-) diff --git a/patches/mfplat-streaming-support/0011-winegstreamer-Use-the-demuxer-to-establish-IMFMediaS.patch b/patches/mfplat-streaming-support/0011-winegstreamer-Use-the-demuxer-to-establish-IMFMediaS.patch index 260ada1d..07777e5b 100644 --- a/patches/mfplat-streaming-support/0011-winegstreamer-Use-the-demuxer-to-establish-IMFMediaS.patch +++ b/patches/mfplat-streaming-support/0011-winegstreamer-Use-the-demuxer-to-establish-IMFMediaS.patch @@ -1,15 +1,14 @@ -From 9a688b8b82d57f2fcf482b2aff30a28c2acf13bb Mon Sep 17 00:00:00 2001 +From ebb9f982f78533993b773b896cf8b542a301b104 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Mon, 20 Apr 2020 13:02:23 -0500 -Subject: [PATCH 11/54] winegstreamer: Use the demuxer to establish - IMFMediaStreams. +Subject: [PATCH] winegstreamer: Use the demuxer to establish IMFMediaStreams. Signed-off-by: Derek Lesho --- dlls/winegstreamer/gst_cbs.c | 44 ++++ dlls/winegstreamer/gst_cbs.h | 13 + - dlls/winegstreamer/media_source.c | 404 ++++++++++++++++++++++++++++++ - 3 files changed, 461 insertions(+) + dlls/winegstreamer/media_source.c | 407 ++++++++++++++++++++++++++++++ + 3 files changed, 464 insertions(+) diff --git a/dlls/winegstreamer/gst_cbs.c b/dlls/winegstreamer/gst_cbs.c index cf49745f1d..d2d36aeb86 100644 @@ -102,7 +101,7 @@ index 0d7acaf0b8..106368a064 100644 #endif diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index e1f5c77375..8335c64338 100644 +index e1f5c77375..192550688d 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -5,6 +5,7 @@ @@ -173,7 +172,7 @@ index e1f5c77375..8335c64338 100644 GstFlowReturn pull_from_bytestream(GstPad *pad, GstObject *parent, guint64 ofs, guint len, GstBuffer **buf) { -@@ -238,6 +278,314 @@ GstBusSyncReply watch_source_bus(GstBus *bus, GstMessage *message, gpointer user +@@ -238,6 +278,315 @@ GstBusSyncReply watch_source_bus(GstBus *bus, GstMessage *message, gpointer user return GST_BUS_PASS; } @@ -185,6 +184,7 @@ index e1f5c77375..8335c64338 100644 + struct media_stream *stream; + gchar *g_stream_id; + DWORD stream_id; ++ unsigned int i; + + /* Most/All seen randomly calculate the initial part of the stream id, the last three digits are the only deterministic part */ + g_stream_id = gst_pad_get_stream_id(pad); @@ -194,7 +194,7 @@ index e1f5c77375..8335c64338 100644 + TRACE("stream-id: %u\n", stream_id); + + /* find existing stream */ -+ for (unsigned int i = 0; i < source->stream_count; i++) ++ for (i = 0; i < source->stream_count; i++) + { + DWORD existing_stream_id; + IMFStreamDescriptor *descriptor = source->streams[i]->descriptor; @@ -488,11 +488,20 @@ index e1f5c77375..8335c64338 100644 static HRESULT WINAPI media_source_QueryInterface(IMFMediaSource *iface, REFIID riid, void **out) { struct media_source *source = impl_from_IMFMediaSource(iface); -@@ -412,6 +760,18 @@ static HRESULT media_source_teardown(struct media_source *source) +@@ -398,6 +747,8 @@ static HRESULT WINAPI media_source_Pause(IMFMediaSource *iface) + + static HRESULT media_source_teardown(struct media_source *source) + { ++ unsigned int i; ++ + if (source->my_src) + gst_object_unref(GST_OBJECT(source->my_src)); + if (source->their_sink) +@@ -412,6 +763,18 @@ static HRESULT media_source_teardown(struct media_source *source) if (source->byte_stream) IMFByteStream_Release(source->byte_stream); -+ for (unsigned int i = 0; i < source->stream_count; i++) ++ for (i = 0; i < source->stream_count; i++) + { + source->streams[i]->state = STREAM_SHUTDOWN; + IMFMediaStream_Release(&source->streams[i]->IMFMediaStream_iface); @@ -507,7 +516,7 @@ index e1f5c77375..8335c64338 100644 return S_OK; } -@@ -464,6 +824,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -464,6 +827,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t object->type = type; object->byte_stream = bytestream; IMFByteStream_AddRef(bytestream); @@ -515,7 +524,7 @@ index e1f5c77375..8335c64338 100644 if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) goto fail; -@@ -509,6 +870,10 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -509,6 +873,10 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t } gst_bin_add(GST_BIN(object->container), object->demuxer); @@ -526,7 +535,7 @@ index e1f5c77375..8335c64338 100644 object->their_sink = gst_element_get_static_pad(object->demuxer, "sink"); if ((ret = gst_pad_link(object->my_src, object->their_sink)) < 0) -@@ -518,6 +883,21 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -518,6 +886,21 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t goto fail; } @@ -548,7 +557,7 @@ index e1f5c77375..8335c64338 100644 object->state = SOURCE_STOPPED; *out_media_source = object; -@@ -1032,6 +1412,30 @@ void perform_cb_media_source(struct cb_data *cbdata) +@@ -1032,6 +1415,30 @@ void perform_cb_media_source(struct cb_data *cbdata) cbdata->u.watch_bus_data.ret = watch_source_bus(data->bus, data->msg, data->user); break; } diff --git a/patches/mfplat-streaming-support/0013-winegstreamer-Translate-H.264-caps-to-attributes.patch b/patches/mfplat-streaming-support/0013-winegstreamer-Translate-H.264-caps-to-attributes.patch index ae6f003e..ce3de3dd 100644 --- a/patches/mfplat-streaming-support/0013-winegstreamer-Translate-H.264-caps-to-attributes.patch +++ b/patches/mfplat-streaming-support/0013-winegstreamer-Translate-H.264-caps-to-attributes.patch @@ -1,15 +1,15 @@ -From a3c30ab707ba1b3216cdad1a8543839d0b04568a Mon Sep 17 00:00:00 2001 +From 483ebc1d94c11b675fa17d22c7b5fe04d3d3381f Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 24 Mar 2020 16:00:26 -0500 -Subject: [PATCH 13/54] winegstreamer: Translate H.264 caps to attributes. +Subject: [PATCH] winegstreamer: Translate H.264 caps to attributes. Signed-off-by: Derek Lesho --- - dlls/winegstreamer/mfplat.c | 67 +++++++++++++++++++++++++++++++++++++ - 1 file changed, 67 insertions(+) + dlls/winegstreamer/mfplat.c | 68 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 68 insertions(+) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c -index 90eb583c4a..1b37e1cc90 100644 +index 90eb583c4a..e0ef5e16db 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -26,6 +26,7 @@ @@ -20,13 +20,14 @@ index 90eb583c4a..1b37e1cc90 100644 #include "wine/debug.h" #include "wine/heap.h" -@@ -525,6 +526,72 @@ static IMFMediaType* transform_to_media_type(GstCaps *caps) +@@ -525,6 +526,73 @@ static IMFMediaType* transform_to_media_type(GstCaps *caps) FIXME("Unrecognized format.\n"); } } + else if (!(strcmp(mime_type, "video/x-h264"))) + { + const char *profile, *level; ++ unsigned int i; + + IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_H264); + IMFMediaType_SetUINT32(media_type, &MF_MT_COMPRESSED, TRUE); @@ -84,7 +85,7 @@ index 90eb583c4a..1b37e1cc90 100644 + } + gst_caps_set_simple(caps, "stream-format", G_TYPE_STRING, "byte-stream", NULL); + gst_caps_set_simple(caps, "alignment", G_TYPE_STRING, "au", NULL); -+ for (unsigned int i = 0; i < gst_caps_get_size(caps); i++) ++ for (i = 0; i < gst_caps_get_size(caps); i++) + { + GstStructure *structure = gst_caps_get_structure (caps, i); + gst_structure_remove_field(structure, "codec_data"); diff --git a/patches/mfplat-streaming-support/0018-winegstreamer-Implement-IMFMediaSource-CreatePresent.patch b/patches/mfplat-streaming-support/0018-winegstreamer-Implement-IMFMediaSource-CreatePresent.patch index b96caa66..6af947c9 100644 --- a/patches/mfplat-streaming-support/0018-winegstreamer-Implement-IMFMediaSource-CreatePresent.patch +++ b/patches/mfplat-streaming-support/0018-winegstreamer-Implement-IMFMediaSource-CreatePresent.patch @@ -1,14 +1,14 @@ -From 1357055cc0aeb862a74426b12188236bde82bfd1 Mon Sep 17 00:00:00 2001 +From 9aad2524a0610d3df313e508617831415a0f5f02 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 31 Mar 2020 11:21:21 -0500 -Subject: [PATCH 18/54] winegstreamer: Implement +Subject: [PATCH] winegstreamer: Implement IMFMediaSource::CreatePresentationDescriptor. Signed-off-by: Derek Lesho --- dlls/mfplat/tests/mfplat.c | 8 +++---- - dlls/winegstreamer/media_source.c | 36 +++++++++++++++++++++++++++++-- - 2 files changed, 38 insertions(+), 6 deletions(-) + dlls/winegstreamer/media_source.c | 37 +++++++++++++++++++++++++++++-- + 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index af7e0d0459..8fef44181c 100644 @@ -49,7 +49,7 @@ index af7e0d0459..8fef44181c 100644 ok(hr == S_OK, "Unexpected hr %#x.\n", hr); diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index a654d555bc..04b3b9f6c7 100644 +index f0acfa2830..33af1a6068 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -61,6 +61,7 @@ struct media_source @@ -60,7 +60,7 @@ index a654d555bc..04b3b9f6c7 100644 GstBus *bus; GstElement *container; GstElement *demuxer; -@@ -742,12 +743,19 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource * +@@ -743,12 +744,19 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource * { struct media_source *source = impl_from_IMFMediaSource(iface); @@ -82,7 +82,7 @@ index a654d555bc..04b3b9f6c7 100644 } static HRESULT WINAPI media_source_Start(IMFMediaSource *iface, IMFPresentationDescriptor *descriptor, -@@ -798,6 +806,8 @@ static HRESULT media_source_teardown(struct media_source *source) +@@ -801,6 +809,8 @@ static HRESULT media_source_teardown(struct media_source *source) gst_element_set_state(source->container, GST_STATE_NULL); gst_object_unref(GST_OBJECT(source->container)); } @@ -91,7 +91,15 @@ index a654d555bc..04b3b9f6c7 100644 if (source->event_queue) IMFMediaEventQueue_Release(source->event_queue); if (source->byte_stream) -@@ -856,6 +866,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -850,6 +860,7 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = + + static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_type type, struct media_source **out_media_source) + { ++ unsigned int i; + GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( + "mf_src", + GST_PAD_SRC, +@@ -859,6 +870,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t struct media_source *object = heap_alloc_zero(sizeof(*object)); GList *demuxer_list_one, *demuxer_list_two; GstElementFactory *demuxer_factory = NULL; @@ -99,14 +107,14 @@ index a654d555bc..04b3b9f6c7 100644 HRESULT hr; int ret; -@@ -939,6 +950,25 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -942,6 +954,25 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t WaitForSingleObject(object->all_streams_event, INFINITE); + /* init presentation descriptor */ + + descriptors = heap_alloc(object->stream_count * sizeof(IMFStreamDescriptor*)); -+ for (unsigned int i = 0; i < object->stream_count; i++) ++ for (i = 0; i < object->stream_count; i++) + { + IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, &descriptors[i]); + } @@ -114,7 +122,7 @@ index a654d555bc..04b3b9f6c7 100644 + if (FAILED(MFCreatePresentationDescriptor(object->stream_count, descriptors, &object->pres_desc))) + goto fail; + -+ for (unsigned int i = 0; i < object->stream_count; i++) ++ for (i = 0; i < object->stream_count; i++) + { + IMFPresentationDescriptor_SelectStream(object->pres_desc, i); + IMFStreamDescriptor_Release(descriptors[i]); @@ -125,7 +133,7 @@ index a654d555bc..04b3b9f6c7 100644 gst_element_set_state(object->container, GST_STATE_READY); object->state = SOURCE_STOPPED; -@@ -951,6 +981,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -954,6 +985,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t if (demuxer_factory) gst_object_unref(demuxer_factory); diff --git a/patches/mfplat-streaming-support/0019-winegstreamer-Implement-IMFMediaSource-Start.patch b/patches/mfplat-streaming-support/0019-winegstreamer-Implement-IMFMediaSource-Start.patch index b616497d..9b6fa36f 100644 --- a/patches/mfplat-streaming-support/0019-winegstreamer-Implement-IMFMediaSource-Start.patch +++ b/patches/mfplat-streaming-support/0019-winegstreamer-Implement-IMFMediaSource-Start.patch @@ -1,13 +1,13 @@ -From 1771f2861fc08035e0baa768b15fd4b1083573f9 Mon Sep 17 00:00:00 2001 +From 5de8cd0751587ad6efe73f6b8cde6829a14d1203 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 31 Mar 2020 15:10:03 -0500 -Subject: [PATCH 19/54] winegstreamer: Implement IMFMediaSource::Start. +Subject: [PATCH] winegstreamer: Implement IMFMediaSource::Start. Signed-off-by: Derek Lesho --- dlls/mfplat/tests/mfplat.c | 8 +- - dlls/winegstreamer/media_source.c | 283 +++++++++++++++++++++++++++++- - 2 files changed, 284 insertions(+), 7 deletions(-) + dlls/winegstreamer/media_source.c | 285 +++++++++++++++++++++++++++++- + 2 files changed, 286 insertions(+), 7 deletions(-) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 8fef44181c..c26c40d531 100644 @@ -52,7 +52,7 @@ index 8fef44181c..c26c40d531 100644 IMFPresentationDescriptor_Release(descriptor); diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 04b3b9f6c7..abf0cfd56f 100644 +index 33af1a6068..e5bf4d2b5d 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -50,12 +50,36 @@ struct media_stream @@ -92,7 +92,7 @@ index 04b3b9f6c7..abf0cfd56f 100644 enum source_type type; IMFMediaEventQueue *event_queue; IMFByteStream *byte_stream; -@@ -87,6 +111,236 @@ static inline struct media_source *impl_from_IMFMediaSource(IMFMediaSource *ifac +@@ -87,6 +111,238 @@ static inline struct media_source *impl_from_IMFMediaSource(IMFMediaSource *ifac return CONTAINING_RECORD(iface, struct media_source, IMFMediaSource_iface); } @@ -202,11 +202,12 @@ index 04b3b9f6c7..abf0cfd56f 100644 +{ + ULONG sd_count; + IMFStreamDescriptor *ret; ++ unsigned int i; + + if (FAILED(IMFPresentationDescriptor_GetStreamDescriptorCount(pres_desc, &sd_count))) + return NULL; + -+ for (unsigned int i = 0; i < sd_count; i++) ++ for (i = 0; i < sd_count; i++) + { + DWORD stream_id; + @@ -225,6 +226,7 @@ index 04b3b9f6c7..abf0cfd56f 100644 +{ + PROPVARIANT *position = &command->u.start.position; + BOOL seek_message = source->state != SOURCE_STOPPED && position->vt != VT_EMPTY; ++ unsigned int i; + + /* we can't seek until the pipeline is in a valid state */ + gst_element_set_state(source->container, GST_STATE_PAUSED); @@ -234,7 +236,7 @@ index 04b3b9f6c7..abf0cfd56f 100644 + WaitForSingleObject(source->all_streams_event, INFINITE); + } + -+ for (unsigned int i = 0; i < source->stream_count; i++) ++ for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream; + IMFStreamDescriptor *sd; @@ -329,7 +331,7 @@ index 04b3b9f6c7..abf0cfd56f 100644 /* inactive stream sample discarder */ static GstFlowReturn stream_new_sample(GstElement *appsink, gpointer user) { -@@ -759,16 +1013,32 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource * +@@ -760,16 +1016,32 @@ static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource * } static HRESULT WINAPI media_source_Start(IMFMediaSource *iface, IMFPresentationDescriptor *descriptor, @@ -365,7 +367,7 @@ index 04b3b9f6c7..abf0cfd56f 100644 } static HRESULT WINAPI media_source_Stop(IMFMediaSource *iface) -@@ -825,6 +1095,9 @@ static HRESULT media_source_teardown(struct media_source *source) +@@ -828,6 +1100,9 @@ static HRESULT media_source_teardown(struct media_source *source) if (source->all_streams_event) CloseHandle(source->all_streams_event); @@ -375,7 +377,7 @@ index 04b3b9f6c7..abf0cfd56f 100644 return S_OK; } -@@ -874,6 +1147,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -878,6 +1153,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t return E_OUTOFMEMORY; object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl; @@ -383,7 +385,7 @@ index 04b3b9f6c7..abf0cfd56f 100644 object->ref = 1; object->type = type; object->byte_stream = bytestream; -@@ -883,6 +1157,9 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -887,6 +1163,9 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) goto fail; diff --git a/patches/mfplat-streaming-support/0021-winegstreamer-Implement-IMFMediaStream-RequestSample.patch b/patches/mfplat-streaming-support/0021-winegstreamer-Implement-IMFMediaStream-RequestSample.patch index 5c3a9cf1..b9933a59 100644 --- a/patches/mfplat-streaming-support/0021-winegstreamer-Implement-IMFMediaStream-RequestSample.patch +++ b/patches/mfplat-streaming-support/0021-winegstreamer-Implement-IMFMediaStream-RequestSample.patch @@ -1,15 +1,15 @@ -From 7e99ccd002a6923c6cabad58d9691bf1f64e30ae Mon Sep 17 00:00:00 2001 +From 0911c65f0087651e7d84b447783dd48f50218450 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 25 Mar 2020 10:43:03 -0500 -Subject: [PATCH 21/54] winegstreamer: Implement IMFMediaStream::RequestSample. +Subject: [PATCH] winegstreamer: Implement IMFMediaStream::RequestSample. Signed-off-by: Derek Lesho --- dlls/mfplat/tests/mfplat.c | 4 - dlls/winegstreamer/gst_private.h | 1 + - dlls/winegstreamer/media_source.c | 117 ++++++++++++++++++++++++++++-- - dlls/winegstreamer/mfplat.c | 90 +++++++++++++++++++++++ - 4 files changed, 203 insertions(+), 9 deletions(-) + dlls/winegstreamer/media_source.c | 118 ++++++++++++++++++++++++++++-- + dlls/winegstreamer/mfplat.c | 91 +++++++++++++++++++++++ + 4 files changed, 205 insertions(+), 9 deletions(-) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index c26c40d531..a9408c998c 100644 @@ -50,7 +50,7 @@ index 780cf1b02f..823e023f52 100644 enum source_type { diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index cb247adcef..b6f2fcc8fa 100644 +index a412786d33..46e85626a0 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -56,6 +56,7 @@ struct media_stream @@ -73,16 +73,17 @@ index cb247adcef..b6f2fcc8fa 100644 } u; }; -@@ -304,6 +310,77 @@ static HRESULT start_pipeline(struct media_source *source, struct source_async_c +@@ -306,6 +312,78 @@ static HRESULT start_pipeline(struct media_source *source, struct source_async_c return S_OK; } +static void dispatch_end_of_presentation(struct media_source *source) +{ + PROPVARIANT empty = {.vt = VT_EMPTY}; ++ unsigned int i; + + /* A stream has ended, check whether all have */ -+ for (unsigned int i = 0; i < source->stream_count; i++) ++ for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream = source->streams[i]; + @@ -151,7 +152,7 @@ index cb247adcef..b6f2fcc8fa 100644 static HRESULT WINAPI source_async_commands_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result) { struct media_source *source = impl_from_async_commands_callback_IMFAsyncCallback(iface); -@@ -323,6 +400,9 @@ static HRESULT WINAPI source_async_commands_Invoke(IMFAsyncCallback *iface, IMFA +@@ -325,6 +403,9 @@ static HRESULT WINAPI source_async_commands_Invoke(IMFAsyncCallback *iface, IMFA case SOURCE_ASYNC_START: start_pipeline(source, command); break; @@ -161,7 +162,7 @@ index cb247adcef..b6f2fcc8fa 100644 default: ; } -@@ -345,12 +425,14 @@ static const IMFAsyncCallbackVtbl source_async_commands_callback_vtbl = +@@ -347,12 +428,14 @@ static const IMFAsyncCallbackVtbl source_async_commands_callback_vtbl = static GstFlowReturn stream_new_sample(GstElement *appsink, gpointer user) { struct media_stream *stream = (struct media_stream *) user; @@ -180,7 +181,7 @@ index cb247adcef..b6f2fcc8fa 100644 return GST_FLOW_OK; } -@@ -770,13 +852,37 @@ static HRESULT WINAPI media_stream_GetStreamDescriptor(IMFMediaStream* iface, IM +@@ -773,13 +856,37 @@ static HRESULT WINAPI media_stream_GetStreamDescriptor(IMFMediaStream* iface, IM static HRESULT WINAPI media_stream_RequestSample(IMFMediaStream *iface, IUnknown *token) { struct media_stream *stream = impl_from_IMFMediaStream(iface); @@ -219,7 +220,7 @@ index cb247adcef..b6f2fcc8fa 100644 } static const IMFMediaStreamVtbl media_stream_vtbl = -@@ -898,6 +1004,7 @@ static HRESULT media_stream_constructor(struct media_source *source, GstPad *pad +@@ -901,6 +1008,7 @@ static HRESULT media_stream_constructor(struct media_source *source, GstPad *pad object->their_src = pad; object->state = STREAM_INACTIVE; @@ -228,10 +229,10 @@ index cb247adcef..b6f2fcc8fa 100644 if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) goto fail; diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c -index fe187e6cd1..e09309fd4d 100644 +index fa24bcb8d9..5ba9495939 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c -@@ -902,4 +902,94 @@ GstCaps *make_mf_compatible_caps(GstCaps *caps) +@@ -903,4 +903,95 @@ GstCaps *make_mf_compatible_caps(GstCaps *caps) } return ret; @@ -252,6 +253,7 @@ index fe187e6cd1..e09309fd4d 100644 + LONGLONG duration, time; + int buffer_count; + HRESULT hr; ++ unsigned int i; + + if (FAILED(hr = MFCreateSample(&out))) + goto fail; @@ -267,7 +269,7 @@ index fe187e6cd1..e09309fd4d 100644 + + buffer_count = gst_buffer_n_memory(gst_buffer); + -+ for (unsigned int i = 0; i < buffer_count; i++) ++ for (i = 0; i < buffer_count; i++) + { + GstMemory *memory = gst_buffer_get_memory(gst_buffer, i); + IMFMediaBuffer *mf_buffer = NULL; diff --git a/patches/mfplat-streaming-support/0023-winegstreamer-Calculate-the-MF_PD_DURATION-of-the-me.patch b/patches/mfplat-streaming-support/0023-winegstreamer-Calculate-the-MF_PD_DURATION-of-the-me.patch index 7725d518..af444129 100644 --- a/patches/mfplat-streaming-support/0023-winegstreamer-Calculate-the-MF_PD_DURATION-of-the-me.patch +++ b/patches/mfplat-streaming-support/0023-winegstreamer-Calculate-the-MF_PD_DURATION-of-the-me.patch @@ -1,8 +1,8 @@ -From 27d73f359d729bc5ad06f251d398d81a01298eb2 Mon Sep 17 00:00:00 2001 +From 1d89dafdbc1c1d4df93121e41354d4607811a27b Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 31 Mar 2020 15:15:50 -0500 -Subject: [PATCH 23/54] winegstreamer: Calculate the MF_PD_DURATION of the - media source's PD. +Subject: [PATCH] winegstreamer: Calculate the MF_PD_DURATION of the media + source's PD. Signed-off-by: Derek Lesho --- @@ -10,10 +10,10 @@ Signed-off-by: Derek Lesho 1 file changed, 40 insertions(+) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 675ee9bd20..5811baf0c0 100644 +index 230aa8a9f6..2039115dfe 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c -@@ -1423,6 +1423,46 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -1430,6 +1430,46 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t heap_free(descriptors); descriptors = NULL; @@ -34,7 +34,7 @@ index 675ee9bd20..5811baf0c0 100644 + IMFAttributes_Release(byte_stream_attributes); + } + -+ for (unsigned int i = 0; i < object->stream_count; i++) ++ for (i = 0; i < object->stream_count; i++) + { + GstQuery *query = gst_query_new_duration(GST_FORMAT_TIME); + if (gst_pad_query(object->streams[i]->their_src, query)) diff --git a/patches/mfplat-streaming-support/0032-Introduce-IMFSample-GstBuffer-converter.patch b/patches/mfplat-streaming-support/0032-Introduce-IMFSample-GstBuffer-converter.patch index d6b1c9be..a0fd11db 100644 --- a/patches/mfplat-streaming-support/0032-Introduce-IMFSample-GstBuffer-converter.patch +++ b/patches/mfplat-streaming-support/0032-Introduce-IMFSample-GstBuffer-converter.patch @@ -1,13 +1,13 @@ -From 21cfe494d559a7d10e065d830d1d7a90c71da69b Mon Sep 17 00:00:00 2001 +From e7f979743dec4e3753b7625a728c003625c24af2 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Wed, 25 Mar 2020 10:43:27 -0500 -Subject: [PATCH 32/54] Introduce IMFSample -> GstBuffer converter. +Subject: [PATCH] Introduce IMFSample -> GstBuffer converter. Signed-off-by: Derek Lesho --- dlls/winegstreamer/gst_private.h | 1 + - dlls/winegstreamer/mfplat.c | 74 ++++++++++++++++++++++++++++++++ - 2 files changed, 75 insertions(+) + dlls/winegstreamer/mfplat.c | 75 ++++++++++++++++++++++++++++++++ + 2 files changed, 76 insertions(+) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 20d3beef02..258df0d040 100644 @@ -22,10 +22,10 @@ index 20d3beef02..258df0d040 100644 enum source_type { diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c -index 86f0f79630..6499c39a8f 100644 +index 8bffb6387e..fe8ba885e9 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c -@@ -1297,4 +1297,78 @@ IMFSample* mf_sample_from_gst_buffer(GstBuffer *gst_buffer) +@@ -1299,4 +1299,79 @@ IMFSample* mf_sample_from_gst_buffer(GstBuffer *gst_buffer) ERR("Failed to copy IMFSample to GstBuffer, hr = %#x\n", hr); IMFSample_Release(out); return NULL; @@ -38,6 +38,7 @@ index 86f0f79630..6499c39a8f 100644 + LONGLONG duration, time; + DWORD buffer_count; + HRESULT hr; ++ unsigned int i; + + if (FAILED(hr = IMFSample_GetSampleDuration(mf_sample, &duration))) + goto fail; @@ -51,7 +52,7 @@ index 86f0f79630..6499c39a8f 100644 + if (FAILED(hr = IMFSample_GetBufferCount(mf_sample, &buffer_count))) + goto fail; + -+ for (unsigned int i = 0; i < buffer_count; i++) ++ for (i = 0; i < buffer_count; i++) + { + DWORD buffer_max_size, buffer_size; + GstMapInfo map_info; diff --git a/patches/mfplat-streaming-support/0033-winegstreamer-Implement-decoder-MFT-on-gstreamer.patch b/patches/mfplat-streaming-support/0033-winegstreamer-Implement-decoder-MFT-on-gstreamer.patch index 75271bb6..c041de1c 100644 --- a/patches/mfplat-streaming-support/0033-winegstreamer-Implement-decoder-MFT-on-gstreamer.patch +++ b/patches/mfplat-streaming-support/0033-winegstreamer-Implement-decoder-MFT-on-gstreamer.patch @@ -1,7 +1,7 @@ -From 0c33d653e5c481bec56a2d1ebd6a0b2ae53774d1 Mon Sep 17 00:00:00 2001 +From 57240613380e0ea13b3adb0d2beada6e6528a0d5 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Mon, 16 Mar 2020 12:09:39 -0500 -Subject: [PATCH 33/54] winegstreamer: Implement decoder MFT on gstreamer. +Subject: [PATCH] winegstreamer: Implement decoder MFT on gstreamer. --- dlls/winegstreamer/Makefile.in | 1 + @@ -9,10 +9,10 @@ Subject: [PATCH 33/54] winegstreamer: Implement decoder MFT on gstreamer. dlls/winegstreamer/gst_cbs.h | 18 +++ dlls/winegstreamer/gst_private.h | 7 ++ dlls/winegstreamer/main.c | 3 +- - dlls/winegstreamer/mfplat.c | 118 ++++++++++++++++++- + dlls/winegstreamer/mfplat.c | 120 ++++++++++++++++++- dlls/winegstreamer/winegstreamer_classes.idl | 12 ++ include/mfidl.idl | 4 +- - 8 files changed, 225 insertions(+), 3 deletions(-) + 8 files changed, 227 insertions(+), 3 deletions(-) diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index f2e8749445..e2af408582 100644 @@ -198,7 +198,7 @@ index 2872710b3e..12ca11fa6c 100644 HRESULT WINAPI DllUnregisterServer(void) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c -index 6499c39a8f..aaef966a5b 100644 +index fe8ba885e9..31881399a9 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -404,6 +404,16 @@ failed: @@ -227,7 +227,7 @@ index 6499c39a8f..aaef966a5b 100644 { &CLSID_MPEG4ByteStreamHandler, &mp4_stream_handler_create }, }; -@@ -449,6 +461,111 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj) +@@ -449,6 +461,113 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj) return CLASS_E_CLASSNOTAVAILABLE; } @@ -302,23 +302,25 @@ index 6499c39a8f..aaef966a5b 100644 +HRESULT mfplat_DllRegisterServer(void) +{ + HRESULT hr; ++ unsigned int i; + -+ for (unsigned int i = 0; i < ARRAY_SIZE(mfts); i++) ++ for (i = 0; i < ARRAY_SIZE(mfts); i++) + { + const struct mft *cur = &mfts[i]; ++ unsigned int j, k; + + MFT_REGISTER_TYPE_INFO *input_types, *output_types; + input_types = heap_alloc(cur->input_types_count * sizeof(input_types[0])); + output_types = heap_alloc(cur->output_types_count * sizeof(output_types[0])); -+ for (unsigned int i = 0; i < cur->input_types_count; i++) ++ for (j = 0; j < cur->input_types_count; j++) + { -+ input_types[i].guidMajorType = *(cur->major_type); -+ input_types[i].guidSubtype = *(cur->input_types[i]); ++ input_types[j].guidMajorType = *(cur->major_type); ++ input_types[j].guidSubtype = *(cur->input_types[i]); + } -+ for (unsigned int i = 0; i < cur->output_types_count; i++) ++ for (k = 0; k < cur->output_types_count; k++) + { -+ output_types[i].guidMajorType = *(cur->major_type); -+ output_types[i].guidSubtype = *(cur->output_types[i]); ++ output_types[k].guidMajorType = *(cur->major_type); ++ output_types[k].guidSubtype = *(cur->output_types[i]); + } + + hr = MFTRegister(*(cur->clsid), *(cur->category), cur->name, cur->flags, cur->input_types_count, @@ -339,7 +341,7 @@ index 6499c39a8f..aaef966a5b 100644 const static struct { const GUID *subtype; -@@ -467,7 +584,6 @@ struct aac_user_data +@@ -467,7 +586,6 @@ struct aac_user_data { WORD payload_type; WORD profile_level_indication; diff --git a/patches/mfplat-streaming-support/0035-Miscellaneous.patch b/patches/mfplat-streaming-support/0035-Miscellaneous.patch index 5d2f02f9..55eee08a 100644 --- a/patches/mfplat-streaming-support/0035-Miscellaneous.patch +++ b/patches/mfplat-streaming-support/0035-Miscellaneous.patch @@ -1,4 +1,4 @@ -From 5bf7f55be7af43c1770d83af0c89c431c1f1064e Mon Sep 17 00:00:00 2001 +From 8d1b452fa4bd1967187eb82e12b95f3289ab514b Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Mon, 16 Mar 2020 15:27:27 -0500 Subject: [PATCH] Miscellaneous @@ -6,13 +6,13 @@ Subject: [PATCH] Miscellaneous --- dlls/mfreadwrite/reader.c | 12 +- dlls/winegstreamer/gst_cbs.c | 9 + - dlls/winegstreamer/media_source.c | 115 ++- - dlls/winegstreamer/mf_decode.c | 1321 +++++++++++++++++++++++++++++ - 4 files changed, 1454 insertions(+), 3 deletions(-) + dlls/winegstreamer/media_source.c | 114 ++- + dlls/winegstreamer/mf_decode.c | 1324 +++++++++++++++++++++++++++++ + 4 files changed, 1456 insertions(+), 3 deletions(-) create mode 100644 dlls/winegstreamer/mf_decode.c diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c -index 3b1dcbb9636..f8c03e62d35 100644 +index 3b1dcbb963..f8c03e62d3 100644 --- a/dlls/mfreadwrite/reader.c +++ b/dlls/mfreadwrite/reader.c @@ -1596,6 +1596,7 @@ static HRESULT source_reader_create_decoder_for_stream(struct source_reader *rea @@ -47,7 +47,7 @@ index 3b1dcbb9636..f8c03e62d35 100644 static HRESULT WINAPI src_reader_SetCurrentMediaType(IMFSourceReader *iface, DWORD index, DWORD *reserved, diff --git a/dlls/winegstreamer/gst_cbs.c b/dlls/winegstreamer/gst_cbs.c -index e392f4526ff..598cd85c1e2 100644 +index e392f4526f..598cd85c1e 100644 --- a/dlls/winegstreamer/gst_cbs.c +++ b/dlls/winegstreamer/gst_cbs.c @@ -18,6 +18,9 @@ @@ -74,7 +74,7 @@ index e392f4526ff..598cd85c1e2 100644 pthread_mutex_lock(&cbdata->lock); cbdata->finished = 1; diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 869bcf6fefa..4e46ff10bd0 100644 +index e0a1624951..40f7828e50 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -84,6 +84,8 @@ struct source_async_command @@ -103,7 +103,7 @@ index 869bcf6fefa..4e46ff10bd0 100644 static inline struct media_source *impl_from_async_commands_callback_IMFAsyncCallback(IMFAsyncCallback *iface) { return CONTAINING_RECORD(iface, struct media_source, async_commands_callback); -@@ -1072,6 +1084,10 @@ static HRESULT WINAPI media_source_QueryInterface(IMFMediaSource *iface, REFIID +@@ -1076,6 +1088,10 @@ static HRESULT WINAPI media_source_QueryInterface(IMFMediaSource *iface, REFIID { *out = &source->IMFMediaSource_iface; } @@ -114,7 +114,7 @@ index 869bcf6fefa..4e46ff10bd0 100644 else { FIXME("(%s, %p)\n", debugstr_guid(riid), out); -@@ -1166,7 +1182,7 @@ static HRESULT WINAPI media_source_GetCharacteristics(IMFMediaSource *iface, DWO +@@ -1170,7 +1186,7 @@ static HRESULT WINAPI media_source_GetCharacteristics(IMFMediaSource *iface, DWO if (source->state == SOURCE_SHUTDOWN) return MF_E_SHUTDOWN; @@ -123,7 +123,7 @@ index 869bcf6fefa..4e46ff10bd0 100644 return S_OK; } -@@ -1306,6 +1322,99 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = +@@ -1312,6 +1328,99 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = media_source_Shutdown, }; @@ -222,8 +222,8 @@ index 869bcf6fefa..4e46ff10bd0 100644 + static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_type type, struct media_source **out_media_source) { - GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( -@@ -1325,6 +1434,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t + unsigned int i; +@@ -1332,6 +1441,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t return E_OUTOFMEMORY; object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl; @@ -232,7 +232,7 @@ index 869bcf6fefa..4e46ff10bd0 100644 object->async_commands_callback.lpVtbl = &source_async_commands_callback_vtbl; object->ref = 1; object->type = type; -@@ -1424,7 +1535,6 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -1431,7 +1542,6 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t heap_free(descriptors); descriptors = NULL; @@ -240,20 +240,12 @@ index 869bcf6fefa..4e46ff10bd0 100644 { IMFAttributes *byte_stream_attributes; gint64 total_pres_time = 0; -@@ -1441,6 +1551,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t - IMFAttributes_Release(byte_stream_attributes); - } - -+ /* TODO: consider streams which don't start at T=0 */ - for (unsigned int i = 0; i < object->stream_count; i++) - { - GstQuery *query = gst_query_new_duration(GST_FORMAT_TIME); diff --git a/dlls/winegstreamer/mf_decode.c b/dlls/winegstreamer/mf_decode.c new file mode 100644 -index 00000000000..751efe9d663 +index 0000000000..60ec6fc20b --- /dev/null +++ b/dlls/winegstreamer/mf_decode.c -@@ -0,0 +1,1321 @@ +@@ -0,0 +1,1324 @@ +#include "config.h" + +#include @@ -905,6 +897,7 @@ index 00000000000..751efe9d663 + { + GUID major_type, subtype; + UINT64 unused; ++ unsigned int i; + + if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major_type))) + return hr; @@ -920,7 +913,7 @@ index 00000000000..751efe9d663 + return hr; + } + -+ for (unsigned int i = 0; i < decoder_descs[decoder->type].input_types_count; i++) ++ for (i = 0; i < decoder_descs[decoder->type].input_types_count; i++) + { + if (IsEqualGUID(&subtype, decoder_descs[decoder->type].input_types[i])) + break; @@ -973,6 +966,7 @@ index 00000000000..751efe9d663 + { + GUID major_type, subtype; + UINT64 unused; ++ unsigned int i; + + /* validate the type */ + if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major_type))) @@ -989,7 +983,7 @@ index 00000000000..751efe9d663 + return MF_E_INVALIDTYPE; + } + -+ for (unsigned int i = 0; i < decoder_descs[decoder->type].output_types_count; i++) ++ for (i = 0; i < decoder_descs[decoder->type].output_types_count; i++) + { + if (IsEqualGUID(&subtype, decoder_descs[decoder->type].output_types[i])) + break; @@ -1302,6 +1296,7 @@ index 00000000000..751efe9d663 + struct mf_decoder *decoder = impl_mf_decoder_from_IMFTransform(iface); + MFT_OUTPUT_DATA_BUFFER *relevant_buffer = NULL; + GstSample *buffer; ++ unsigned int i; + + TRACE("%p, %#x, %u, %p, %p,\n", iface, flags, count, samples, status); + @@ -1311,7 +1306,7 @@ index 00000000000..751efe9d663 + if (!decoder->valid_state) + return MF_E_TRANSFORM_TYPE_NOT_SET; + -+ for (unsigned int i = 0; i < count; i++) ++ for (i = 0; i < count; i++) + { + MFT_OUTPUT_DATA_BUFFER *out_buffer = &samples[i]; + @@ -1576,5 +1571,5 @@ index 00000000000..751efe9d663 + } +} -- -2.27.0 +2.28.0 diff --git a/patches/mfplat-streaming-support/0039-Rewrite-branch-resolver.patch b/patches/mfplat-streaming-support/0039-Rewrite-branch-resolver.patch index ececec30..1a92fcda 100644 --- a/patches/mfplat-streaming-support/0039-Rewrite-branch-resolver.patch +++ b/patches/mfplat-streaming-support/0039-Rewrite-branch-resolver.patch @@ -1,18 +1,18 @@ -From 5f7531a377c92c3491b2701108801e7e57f6f475 Mon Sep 17 00:00:00 2001 +From f60e21e99a3cddea383792307c4b8c8278e887b8 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Thu, 2 Apr 2020 15:45:52 -0500 -Subject: [PATCH 39/54] Rewrite branch resolver. +Subject: [PATCH] Rewrite branch resolver. and a HACK: Set output type of found decoder, this should probably happen somewhere else. --- - dlls/mf/topology.c | 279 +++++++++++++++++++++++++++------------------ - 1 file changed, 171 insertions(+), 108 deletions(-) + dlls/mf/topology.c | 280 ++++++++++++++++++++++++++++----------------- + 1 file changed, 172 insertions(+), 108 deletions(-) diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c -index 2e84920434..94c9d63094 100644 +index 2e84920434..5a00fe7ea3 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c -@@ -1948,135 +1948,194 @@ static void topology_loader_add_branch(struct topology *topology, IMFTopologyNod +@@ -1948,135 +1948,195 @@ static void topology_loader_add_branch(struct topology *topology, IMFTopologyNod } } @@ -29,6 +29,7 @@ index 2e84920434..94c9d63094 100644 + IMFActivate **activates; + UINT32 num_activates; + HRESULT hr; ++ unsigned int i; + + if (FAILED(hr = IMFMediaType_GetMajorType(input_type, &major_type))) + return hr; @@ -44,7 +45,7 @@ index 2e84920434..94c9d63094 100644 + + hr = E_FAIL; + -+ for (unsigned int i = 0; i < num_activates; i++) ++ for (i = 0; i < num_activates; i++) + { + IMFTransform *mft; + @@ -309,7 +310,7 @@ index 2e84920434..94c9d63094 100644 IMFAttributes *attrs_src; IMFStreamSink *strm_sink; IMFMediaType *mtype_src; -@@ -2084,6 +2143,7 @@ static HRESULT topology_loader_resolve_partial_topology(struct topology_node *sr +@@ -2084,6 +2144,7 @@ static HRESULT topology_loader_resolve_partial_topology(struct topology_node *sr HRESULT hr; int i; @@ -317,7 +318,7 @@ index 2e84920434..94c9d63094 100644 attrs_src = src->attributes; if (FAILED(hr = IMFAttributes_GetUnknown(attrs_src, &MF_TOPONODE_STREAM_DESCRIPTOR, &IID_IMFStreamDescriptor, (void **)&desc))) return hr; -@@ -2137,12 +2197,15 @@ static HRESULT topology_loader_resolve_partial_topology(struct topology_node *sr +@@ -2137,12 +2198,15 @@ static HRESULT topology_loader_resolve_partial_topology(struct topology_node *sr if (FAILED(IMFTopologyNode_GetUINT32(clone_sink, &MF_TOPONODE_STREAMID, &streamid))) IMFTopologyNode_SetUINT32(clone_sink, &MF_TOPONODE_STREAMID, 0); @@ -336,7 +337,7 @@ index 2e84920434..94c9d63094 100644 for (i = 0; i < num_media_types; i++) if (SUCCEEDED(topology_loader_resolve_branch(clone_src, src_mediatypes[i], clone_sink, method))) { -@@ -2154,7 +2217,7 @@ static HRESULT topology_loader_resolve_partial_topology(struct topology_node *sr +@@ -2154,7 +2218,7 @@ static HRESULT topology_loader_resolve_partial_topology(struct topology_node *sr else { for (i = 0; i < num_media_types; i++) @@ -345,7 +346,7 @@ index 2e84920434..94c9d63094 100644 if (SUCCEEDED(topology_loader_resolve_branch(clone_src, src_mediatypes[i], clone_sink, method))) { topology_loader_add_branch(*full_topology, clone_src, clone_sink); -@@ -2165,10 +2228,10 @@ static HRESULT topology_loader_resolve_partial_topology(struct topology_node *sr +@@ -2165,10 +2229,10 @@ static HRESULT topology_loader_resolve_partial_topology(struct topology_node *sr } else { diff --git a/patches/mfplat-streaming-support/0044-winegstreamer-Implement-Color-Converter-MFT.patch b/patches/mfplat-streaming-support/0044-winegstreamer-Implement-Color-Converter-MFT.patch index 7b8b3376..132d9778 100644 --- a/patches/mfplat-streaming-support/0044-winegstreamer-Implement-Color-Converter-MFT.patch +++ b/patches/mfplat-streaming-support/0044-winegstreamer-Implement-Color-Converter-MFT.patch @@ -1,16 +1,16 @@ -From e8fa967f34edbe26f323498ad2a2b0ef313a01eb Mon Sep 17 00:00:00 2001 +From 532b311a83c2796e3014c11fe45f9f60e39736ee Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 1 May 2020 13:20:49 -0500 -Subject: [PATCH 44/54] winegstreamer: Implement Color Converter MFT. +Subject: [PATCH] winegstreamer: Implement Color Converter MFT. Signed-off-by: Derek Lesho --- dlls/winegstreamer/Makefile.in | 1 + - dlls/winegstreamer/colorconvert.c | 704 +++++++++++++++++++ + dlls/winegstreamer/colorconvert.c | 707 +++++++++++++++++++ dlls/winegstreamer/gst_private.h | 2 + dlls/winegstreamer/mfplat.c | 35 + dlls/winegstreamer/winegstreamer_classes.idl | 8 +- - 5 files changed, 749 insertions(+), 1 deletion(-) + 5 files changed, 752 insertions(+), 1 deletion(-) create mode 100644 dlls/winegstreamer/colorconvert.c diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in @@ -27,10 +27,10 @@ index e2af408582..a266b0a95e 100644 gstdemux.c \ diff --git a/dlls/winegstreamer/colorconvert.c b/dlls/winegstreamer/colorconvert.c new file mode 100644 -index 0000000000..f149ab553f +index 0000000000..502ff52e56 --- /dev/null +++ b/dlls/winegstreamer/colorconvert.c -@@ -0,0 +1,704 @@ +@@ -0,0 +1,707 @@ +#include "config.h" +#include + @@ -349,6 +349,7 @@ index 0000000000..f149ab553f + { + GUID major_type, subtype; + BOOL found = FALSE; ++ unsigned int i; + + if (FAILED(IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major_type))) + return MF_E_INVALIDTYPE; @@ -358,7 +359,7 @@ index 0000000000..f149ab553f + if (!(IsEqualGUID(&major_type, &MFMediaType_Video))) + return MF_E_INVALIDTYPE; + -+ for (unsigned int i = 0; i < ARRAY_SIZE(raw_types); i++) ++ for (i = 0; i < ARRAY_SIZE(raw_types); i++) + { + UINT64 unused; + @@ -421,6 +422,7 @@ index 0000000000..f149ab553f + + if (type) + { ++ unsigned int i; + /* validate the type */ + + if (FAILED(IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major_type))) @@ -433,7 +435,7 @@ index 0000000000..f149ab553f + if (!(IsEqualGUID(&major_type, &MFMediaType_Video))) + return MF_E_INVALIDTYPE; + -+ for (unsigned int i = 0; i < ARRAY_SIZE(raw_types); i++) ++ for (i = 0; i < ARRAY_SIZE(raw_types); i++) + { + if (IsEqualGUID(&subtype, raw_types[i])) + break; @@ -582,13 +584,14 @@ index 0000000000..f149ab553f + MFT_OUTPUT_DATA_BUFFER *relevant_buffer = NULL; + GstSample *sample; + HRESULT hr = S_OK; ++ unsigned int i; + + TRACE("%p, %#x, %u, %p, %p.\n", iface, flags, count, samples, status); + + if (flags) + WARN("Unsupported flags %#x\n", flags); + -+ for (unsigned int i = 0; i < count; i++) ++ for (i = 0; i < count; i++) + { + MFT_OUTPUT_DATA_BUFFER *out_buffer = &samples[i]; + @@ -748,7 +751,7 @@ index 0b61bc9e3c..b855d650dc 100644 + #endif /* __GST_PRIVATE_INCLUDED__ */ diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c -index 780008face..161c8032a7 100644 +index 68071fccf9..e63b4dcb2f 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -429,6 +429,8 @@ static HRESULT asf_stream_handler_create(REFIID riid, void **ret) diff --git a/patches/mfplat-streaming-support/0046-Set-wait-on-eos-to-allow-other-streams-to-continue-w.patch b/patches/mfplat-streaming-support/0046-Set-wait-on-eos-to-allow-other-streams-to-continue-w.patch index 3a31afdb..8bbb6929 100644 --- a/patches/mfplat-streaming-support/0046-Set-wait-on-eos-to-allow-other-streams-to-continue-w.patch +++ b/patches/mfplat-streaming-support/0046-Set-wait-on-eos-to-allow-other-streams-to-continue-w.patch @@ -1,18 +1,18 @@ -From 1a9c319df408558561b503743f64061df204b237 Mon Sep 17 00:00:00 2001 +From c68cf22e60e000f279ab7f2cc8c707447d9795f3 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Mon, 4 May 2020 12:40:56 -0500 -Subject: [PATCH 46/54] Set "wait-on-eos" to allow other streams to continue - while appsink buffers. +Subject: [PATCH] Set "wait-on-eos" to allow other streams to continue while + appsink buffers. --- dlls/winegstreamer/media_source.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 11b28176fd..1ce9b06b8c 100644 +index a3f76518eb..0165ea1570 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c -@@ -1038,6 +1038,7 @@ static HRESULT media_stream_constructor(struct media_source *source, GstPad *pad +@@ -1042,6 +1042,7 @@ static HRESULT media_stream_constructor(struct media_source *source, GstPad *pad g_object_set(object->appsink, "emit-signals", TRUE, NULL); g_object_set(object->appsink, "sync", FALSE, NULL); g_object_set(object->appsink, "async", FALSE, NULL); /* <- This allows us interact with the bin w/o prerolling */ diff --git a/patches/mfplat-streaming-support/0047-Report-streams-backwards-and-only-select-one-of-each.patch b/patches/mfplat-streaming-support/0047-Report-streams-backwards-and-only-select-one-of-each.patch index 679f9510..38633bbd 100644 --- a/patches/mfplat-streaming-support/0047-Report-streams-backwards-and-only-select-one-of-each.patch +++ b/patches/mfplat-streaming-support/0047-Report-streams-backwards-and-only-select-one-of-each.patch @@ -1,18 +1,18 @@ -From 541db537f1af37c69cc03d024114930e69dd7239 Mon Sep 17 00:00:00 2001 +From cffa1c6ab7784bc9a7d7c411e204d2abb7bbb501 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 5 May 2020 15:35:16 -0500 -Subject: [PATCH 47/54] Report streams backwards and only select one of each - stream type. +Subject: [PATCH] Report streams backwards and only select one of each stream + type. --- dlls/winegstreamer/media_source.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 1ce9b06b8c..3052c0393a 100644 +index 0165ea1570..3807a37555 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c -@@ -1431,6 +1431,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -1438,6 +1438,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t source_descs[type].bytestream_caps); struct media_source *object = heap_alloc_zero(sizeof(*object)); @@ -20,9 +20,9 @@ index 1ce9b06b8c..3052c0393a 100644 GList *demuxer_list_one, *demuxer_list_two; GstElementFactory *demuxer_factory = NULL; IMFStreamDescriptor **descriptors = NULL; -@@ -1528,15 +1529,34 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t +@@ -1535,15 +1536,34 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, enum source_t descriptors = heap_alloc(object->stream_count * sizeof(IMFStreamDescriptor*)); - for (unsigned int i = 0; i < object->stream_count; i++) + for (i = 0; i < object->stream_count; i++) { - IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, &descriptors[i]); + IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, &descriptors[object->stream_count - 1 - i]); @@ -32,7 +32,7 @@ index 1ce9b06b8c..3052c0393a 100644 goto fail; + /* Select one of each major type. */ - for (unsigned int i = 0; i < object->stream_count; i++) + for (i = 0; i < object->stream_count; i++) { - IMFPresentationDescriptor_SelectStream(object->pres_desc, i); + IMFMediaTypeHandler *handler; diff --git a/patches/mfplat-streaming-support/0048-winegstreamer-Implement-IMFMediaSource-Stop.patch b/patches/mfplat-streaming-support/0048-winegstreamer-Implement-IMFMediaSource-Stop.patch index 2e7b655d..0b976f15 100644 --- a/patches/mfplat-streaming-support/0048-winegstreamer-Implement-IMFMediaSource-Stop.patch +++ b/patches/mfplat-streaming-support/0048-winegstreamer-Implement-IMFMediaSource-Stop.patch @@ -1,15 +1,15 @@ -From 23fc1309973d818a608a54d3ac0c04bc731aa32a Mon Sep 17 00:00:00 2001 +From fac27f9bb91686dddfc85d367514b21db135b6a8 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Thu, 7 May 2020 13:09:47 -0500 -Subject: [PATCH 48/54] winegstreamer: Implement IMFMediaSource::Stop. +Subject: [PATCH] winegstreamer: Implement IMFMediaSource::Stop. Signed-off-by: Derek Lesho --- - dlls/winegstreamer/media_source.c | 30 ++++++++++++++++++++++++++++-- - 1 file changed, 28 insertions(+), 2 deletions(-) + dlls/winegstreamer/media_source.c | 32 +++++++++++++++++++++++++++++-- + 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 3052c0393a..78395f9dcd 100644 +index 3807a37555..517e5ee677 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -60,6 +60,7 @@ struct media_stream @@ -20,13 +20,15 @@ index 3052c0393a..78395f9dcd 100644 SOURCE_ASYNC_REQUEST_SAMPLE, }; -@@ -326,6 +327,23 @@ static HRESULT start_pipeline(struct media_source *source, struct source_async_c +@@ -328,6 +329,25 @@ static HRESULT start_pipeline(struct media_source *source, struct source_async_c return S_OK; } +static void stop_pipeline(struct media_source *source) +{ -+ for (unsigned int i = 0; i < source->stream_count; i++) ++ unsigned int i; ++ ++ for (i = 0; i < source->stream_count; i++) + { + struct media_stream *stream = source->streams[i]; + if (stream->state != STREAM_INACTIVE) @@ -44,7 +46,7 @@ index 3052c0393a..78395f9dcd 100644 static void dispatch_end_of_presentation(struct media_source *source) { PROPVARIANT empty = {.vt = VT_EMPTY}; -@@ -416,6 +434,9 @@ static HRESULT WINAPI source_async_commands_Invoke(IMFAsyncCallback *iface, IMFA +@@ -419,6 +439,9 @@ static HRESULT WINAPI source_async_commands_Invoke(IMFAsyncCallback *iface, IMFA case SOURCE_ASYNC_START: start_pipeline(source, command); break; @@ -54,7 +56,7 @@ index 3052c0393a..78395f9dcd 100644 case SOURCE_ASYNC_REQUEST_SAMPLE: wait_on_sample(command->u.request_sample.stream, command->u.request_sample.token); break; -@@ -1245,13 +1266,18 @@ static HRESULT WINAPI media_source_Start(IMFMediaSource *iface, IMFPresentationD +@@ -1249,13 +1272,18 @@ static HRESULT WINAPI media_source_Start(IMFMediaSource *iface, IMFPresentationD static HRESULT WINAPI media_source_Stop(IMFMediaSource *iface) { struct media_source *source = impl_from_IMFMediaSource(iface);