From: Derek Lesho dlesho@codeweavers.com
Unfortunately this causes a small regression in mfreadwrite tests. In an ideal world we would implement everything as in Windows, letting the media source just emit a compressed stream and having the stream reader decompress it to whatever the client is asking for. Since currently the source reader is unable to handle compressed streams, it makes sense to have winegstreamer's media source offer both PCM and floating point streams.
The patch is originally by Derek Lesho, with some changes by Giovanni Mascellani.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/mfreadwrite/tests/mfplat.c | 1 + dlls/winegstreamer/media_source.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+)
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c index 8ea4e5038f6..1967015e865 100644 --- a/dlls/mfreadwrite/tests/mfplat.c +++ b/dlls/mfreadwrite/tests/mfplat.c @@ -751,6 +751,7 @@ static void test_source_reader(void) IMFMediaType_Release(mediatype);
hr = IMFSourceReader_GetNativeMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 1, &mediatype); +todo_wine ok(hr == MF_E_NO_MORE_TYPES, "Unexpected hr %#x.\n", hr);
/* Current media type. */ diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index eb5b9e366ec..626e273780b 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -806,6 +806,34 @@ 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. */ + stream_types = malloc( sizeof(IMFMediaType *) * 2 ); + + stream_types[0] = mf_media_type_from_wg_format(&format); + if (stream_types[0]) + { + stream_types[1] = mf_media_type_from_wg_format(&format); + if (stream_types[1]) + { + GUID base_subtype; + IMFMediaType_GetGUID(stream_types[1], &MF_MT_SUBTYPE, &base_subtype); + if (IsEqualGUID(&base_subtype, &MFAudioFormat_Float)) + { + IMFMediaType_SetGUID(stream_types[1], &MF_MT_SUBTYPE, &MFAudioFormat_PCM); + IMFMediaType_SetUINT32(stream_types[1], &MF_MT_AUDIO_BITS_PER_SAMPLE, 16); + } + else + { + IMFMediaType_SetGUID(stream_types[1], &MF_MT_SUBTYPE, &MFAudioFormat_Float); + IMFMediaType_SetUINT32(stream_types[1], &MF_MT_AUDIO_BITS_PER_SAMPLE, 32); + } + type_count = 2; + } + } + } else { stream_type = mf_media_type_from_wg_format(&format);