Rebase against 572aa09de1b0e3ba0e8b19f48d5e96539625bb0a.

This commit is contained in:
Alistair Leslie-Hughes
2020-11-10 14:02:03 +11:00
parent e2d9f97b61
commit 009f571ba1
7 changed files with 21 additions and 200 deletions

View File

@@ -1,34 +0,0 @@
From b67e6dbb9a8f772c27a074ac0fa1474b4f0fc8c6 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Tue, 31 Mar 2020 15:15:07 -0500
Subject: [PATCH] winegstreamer: Implement IMFMediaSource::GetCharacteristics.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
---
dlls/winegstreamer/media_source.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index d25e34dec68..dd01cfc4f86 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -1114,12 +1114,14 @@ static HRESULT WINAPI media_source_GetCharacteristics(IMFMediaSource *iface, DWO
{
struct media_source *source = impl_from_IMFMediaSource(iface);
- FIXME("(%p)->(%p): stub\n", source, characteristics);
+ TRACE("(%p)->(%p)\n", source, characteristics);
if (source->state == SOURCE_SHUTDOWN)
return MF_E_SHUTDOWN;
- return E_NOTIMPL;
+ *characteristics = MFMEDIASOURCE_CAN_SEEK;
+
+ return S_OK;
}
static HRESULT WINAPI media_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **descriptor)
--
2.28.0

View File

@@ -1,65 +0,0 @@
From f8037812ce48a4fc1b6b0a85de543e66f57063b6 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Tue, 31 Mar 2020 15:15:50 -0500
Subject: [PATCH] winegstreamer: Calculate the MF_PD_DURATION of the media
source's PD.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
---
dlls/winegstreamer/media_source.c | 40 +++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index dd01cfc4f86..6873b4e7844 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -1445,6 +1445,46 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
heap_free(descriptors);
descriptors = NULL;
+ /* miscelaneous presentation descriptor setup */
+ {
+ IMFAttributes *byte_stream_attributes;
+ gint64 total_pres_time = 0;
+
+ if (SUCCEEDED(IMFByteStream_QueryInterface(object->byte_stream, &IID_IMFAttributes, (void **)&byte_stream_attributes)))
+ {
+ WCHAR *mimeW = NULL;
+ DWORD length;
+ if (SUCCEEDED(IMFAttributes_GetAllocatedString(byte_stream_attributes, &MF_BYTESTREAM_CONTENT_TYPE, &mimeW, &length)))
+ {
+ IMFPresentationDescriptor_SetString(object->pres_desc, &MF_PD_MIME_TYPE, mimeW);
+ CoTaskMemFree(mimeW);
+ }
+ IMFAttributes_Release(byte_stream_attributes);
+ }
+
+ for (unsigned int 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))
+ {
+ gint64 stream_pres_time;
+ gst_query_parse_duration(query, NULL, &stream_pres_time);
+
+ TRACE("Stream %u has duration %lu\n", i, 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;
--
2.28.0

View File

@@ -1,4 +1,4 @@
From 8ab005d36300ac40431a1cde96344d2649143a91 Mon Sep 17 00:00:00 2001
From b7c1863e4ed928c15a8a1c7ef631369911958e08 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Mon, 16 Mar 2020 15:27:27 -0500
Subject: [PATCH] Miscellaneous
@@ -7,11 +7,11 @@ Subject: [PATCH] Miscellaneous
dlls/mfreadwrite/reader.c | 12 ++-
dlls/winegstreamer/gst_cbs.c | 20 ++---
dlls/winegstreamer/gst_cbs.h | 1 -
dlls/winegstreamer/media_source.c | 137 +++++++++++++++++++++++++++++-
4 files changed, 155 insertions(+), 15 deletions(-)
dlls/winegstreamer/media_source.c | 135 +++++++++++++++++++++++++++++-
4 files changed, 154 insertions(+), 14 deletions(-)
diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c
index 93858840940..097921a4cc4 100644
index 935074d62f9..9d86a5a0f8f 100644
--- a/dlls/mfreadwrite/reader.c
+++ b/dlls/mfreadwrite/reader.c
@@ -1597,6 +1597,7 @@ static HRESULT source_reader_create_decoder_for_stream(struct source_reader *rea
@@ -102,7 +102,7 @@ index 6659aedefa5..825b46d13bb 100644
#endif
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 66aa7d92ed8..f372e178b68 100644
index 3c423f6d758..5e4691295f0 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -92,6 +92,8 @@ struct source_async_command
@@ -131,7 +131,7 @@ index 66aa7d92ed8..f372e178b68 100644
static inline struct media_source *impl_from_async_commands_callback_IMFAsyncCallback(IMFAsyncCallback *iface)
{
return CONTAINING_RECORD(iface, struct media_source, async_commands_callback);
@@ -518,6 +530,11 @@ static gboolean bytestream_query(GstPad *pad, GstObject *parent, GstQuery *query
@@ -520,6 +532,11 @@ static gboolean bytestream_query(GstPad *pad, GstObject *parent, GstQuery *query
gst_query_add_scheduling_mode(query, GST_PAD_MODE_PULL);
return TRUE;
}
@@ -143,7 +143,7 @@ index 66aa7d92ed8..f372e178b68 100644
default:
{
WARN("Unhandled query type %s\n", GST_QUERY_TYPE_NAME(query));
@@ -580,6 +597,23 @@ GstBusSyncReply bus_watch(GstBus *bus, GstMessage *message, gpointer user)
@@ -582,6 +599,23 @@ GstBusSyncReply bus_watch(GstBus *bus, GstMessage *message, gpointer user)
g_error_free(err);
g_free(dbg_info);
break;
@@ -167,7 +167,7 @@ index 66aa7d92ed8..f372e178b68 100644
default:
break;
}
@@ -1036,6 +1070,10 @@ static HRESULT WINAPI media_source_QueryInterface(IMFMediaSource *iface, REFIID
@@ -1041,6 +1075,10 @@ static HRESULT WINAPI media_source_QueryInterface(IMFMediaSource *iface, REFIID
{
*out = &source->IMFMediaSource_iface;
}
@@ -178,7 +178,7 @@ index 66aa7d92ed8..f372e178b68 100644
else
{
FIXME("(%s, %p)\n", debugstr_guid(riid), out);
@@ -1120,7 +1158,7 @@ static HRESULT WINAPI media_source_GetCharacteristics(IMFMediaSource *iface, DWO
@@ -1125,7 +1163,7 @@ static HRESULT WINAPI media_source_GetCharacteristics(IMFMediaSource *iface, DWO
if (source->state == SOURCE_SHUTDOWN)
return MF_E_SHUTDOWN;
@@ -187,7 +187,7 @@ index 66aa7d92ed8..f372e178b68 100644
return S_OK;
}
@@ -1265,6 +1303,99 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl =
@@ -1270,6 +1308,99 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl =
media_source_Shutdown,
};
@@ -287,8 +287,8 @@ index 66aa7d92ed8..f372e178b68 100644
/* If this callback is extended to use any significant win32 APIs, a wrapper function
should be added */
gboolean stream_found(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer user)
@@ -1342,6 +1473,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
return E_OUTOFMEMORY;
@@ -1358,6 +1489,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
}
object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl;
+ object->IMFGetService_iface.lpVtbl = &IMFGetService_vtbl;
@@ -296,22 +296,6 @@ index 66aa7d92ed8..f372e178b68 100644
object->async_commands_callback.lpVtbl = &source_async_commands_callback_vtbl;
object->ref = 1;
object->byte_stream = bytestream;
@@ -1446,7 +1579,6 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
heap_free(descriptors);
descriptors = NULL;
- /* miscelaneous presentation descriptor setup */
{
IMFAttributes *byte_stream_attributes;
gint64 total_pres_time = 0;
@@ -1463,6 +1595,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
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);
--
2.28.0

View File

@@ -1,4 +1,4 @@
From 478e50712170c56dece0226f42b2d605e94949b2 Mon Sep 17 00:00:00 2001
From d4ed09c6230669d7617e411f6e8fa02a3f27da68 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Tue, 5 May 2020 15:35:16 -0500
Subject: [PATCH] Report streams backwards and only select one of each stream
@@ -9,18 +9,18 @@ Subject: [PATCH] Report streams backwards and only select one of each stream
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 46b290d040c..9fa8b106ba2 100644
index 5e4691295f0..f42f13b50b4 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -1467,6 +1467,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
@@ -1469,6 +1469,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
GST_STATIC_PAD_TEMPLATE("mf_src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
struct media_source *object = heap_alloc_zero(sizeof(*object));
+ BOOL video_selected = FALSE, audio_selected = FALSE;
IMFStreamDescriptor **descriptors = NULL;
unsigned int i;
HRESULT hr;
@@ -1568,15 +1569,34 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
gint64 total_pres_time = 0;
DWORD bytestream_caps;
@@ -1581,15 +1582,34 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
descriptors = heap_alloc(object->stream_count * sizeof(IMFStreamDescriptor*));
for (i = 0; i < object->stream_count; i++)
{

View File

@@ -1 +1,2 @@
Fixes: [49692] Multiple applications need a Media Foundation media source implementation
Disabled: True