Commit a9cda37f authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

winegstreamer: Implement output media type enumeration in MPEG layer-3 decoder.

parent 0b453697
......@@ -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)),
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment