Derek Lesho : winegstreamer: Ensure that the source reports both PCM and floating point audio formats.
Alexandre Julliard
julliard at winehq.org
Fri May 14 15:47:04 CDT 2021
Module: wine
Branch: master
Commit: 865bbff0d984403fc608ec63bdd8dd6500240cf3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=865bbff0d984403fc608ec63bdd8dd6500240cf3
Author: Derek Lesho <dlesho at codeweavers.com>
Date: Thu May 13 15:53:47 2021 +0200
winegstreamer: Ensure that the source reports both PCM and floating point audio formats.
The patch is originally by Derek Lesho, with some changes by
Giovanni Mascellani and Nikolay Sivov.
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfreadwrite/tests/mfplat.c | 3 ---
dlls/winegstreamer/media_source.c | 25 +++++++++++++++++++++++++
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c
index ded45afe771..e3ff7f6e7aa 100644
--- a/dlls/mfreadwrite/tests/mfplat.c
+++ b/dlls/mfreadwrite/tests/mfplat.c
@@ -752,9 +752,6 @@ static void test_source_reader(void)
if (SUCCEEDED(hr))
IMFMediaType_Release(mediatype);
- hr = IMFSourceReader_GetNativeMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 1, &mediatype);
- ok(hr == MF_E_NO_MORE_TYPES, "Unexpected hr %#x.\n", hr);
-
/* Current media type. */
hr = IMFSourceReader_GetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, &mediatype);
ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr);
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index eb5b9e366ec..7f308973270 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -806,6 +806,31 @@ static HRESULT media_stream_init_desc(struct media_stream *stream)
goto done;
}
}
+ else if (format.major_type == WG_MAJOR_TYPE_AUDIO)
+ {
+ /* Expose at least one PCM and one floating point type for the
+ consumer to pick from. */
+ static const enum wg_audio_format audio_types[] =
+ {
+ WG_AUDIO_FORMAT_S16LE,
+ WG_AUDIO_FORMAT_F32LE,
+ };
+
+ stream_types = malloc( sizeof(IMFMediaType *) * (ARRAY_SIZE(audio_types) + 1) );
+
+ stream_types[0] = mf_media_type_from_wg_format(&format);
+ type_count = 1;
+
+ for (i = 0; i < ARRAY_SIZE(audio_types); i++)
+ {
+ struct wg_format new_format;
+ if (format.u.audio.format == audio_types[i])
+ continue;
+ new_format = format;
+ new_format.u.audio.format = audio_types[i];
+ stream_types[type_count++] = mf_media_type_from_wg_format(&new_format);
+ }
+ }
else
{
stream_type = mf_media_type_from_wg_format(&format);
More information about the wine-cvs
mailing list