From: Anton Baskanov baskanov@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=18773 Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/quartz/tests/mpeglayer3.c | 2 +- dlls/winegstreamer/quartz_transform.c | 34 ++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/tests/mpeglayer3.c b/dlls/quartz/tests/mpeglayer3.c index a9d2c397093..11b4f3d59ea 100644 --- a/dlls/quartz/tests/mpeglayer3.c +++ b/dlls/quartz/tests/mpeglayer3.c @@ -1002,7 +1002,7 @@ static void test_connect_pin(void) expect_mt.lSampleSize = 2304;
hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); if (hr == S_OK) { ok(!memcmp(pmt, &expect_mt, offsetof(AM_MEDIA_TYPE, cbFormat)), diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c index db2c5f69a5b..05b22c8e754 100644 --- a/dlls/winegstreamer/quartz_transform.c +++ b/dlls/winegstreamer/quartz_transform.c @@ -766,7 +766,39 @@ static HRESULT mpeg_layer3_decoder_source_query_accept(struct transform *filter,
static HRESULT mpeg_layer3_decoder_source_get_media_type(struct transform *filter, unsigned int index, AM_MEDIA_TYPE *mt) { - return VFW_S_NO_MORE_ITEMS; + const MPEGLAYER3WAVEFORMAT *input_format; + WAVEFORMATEX *output_format; + + if (!filter->sink.pin.peer) + return VFW_S_NO_MORE_ITEMS; + + if (index > 0) + return VFW_S_NO_MORE_ITEMS; + + input_format = (const MPEGLAYER3WAVEFORMAT *)filter->sink.pin.mt.pbFormat; + + output_format = CoTaskMemAlloc(sizeof(*output_format)); + if (!output_format) + return E_OUTOFMEMORY; + + memset(output_format, 0, sizeof(*output_format)); + output_format->wFormatTag = WAVE_FORMAT_PCM; + output_format->nSamplesPerSec = input_format->wfx.nSamplesPerSec; + output_format->nChannels = input_format->wfx.nChannels; + output_format->wBitsPerSample = 16; + output_format->nBlockAlign = output_format->nChannels * output_format->wBitsPerSample / 8; + output_format->nAvgBytesPerSec = output_format->nBlockAlign * output_format->nSamplesPerSec; + + memset(mt, 0, sizeof(*mt)); + mt->majortype = MEDIATYPE_Audio; + mt->subtype = MEDIASUBTYPE_PCM; + mt->bFixedSizeSamples = TRUE; + mt->lSampleSize = 1152 * output_format->nBlockAlign; + mt->formattype = FORMAT_WaveFormatEx; + mt->cbFormat = sizeof(*output_format); + mt->pbFormat = (BYTE *)output_format; + + return S_OK; }
static HRESULT mpeg_layer3_decoder_source_decide_buffer_size(struct transform *filter, IMemAllocator *allocator, ALLOCATOR_PROPERTIES *props)