From: R��mi Bernon rbernon@codeweavers.com
--- dlls/mf/sar.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index 5504cc17472..b22a3a53479 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -1747,6 +1747,8 @@ static HRESULT audio_renderer_collect_supported_types(struct audio_renderer *ren }
IMFMediaType_DeleteItem(renderer->media_type, &MF_MT_AUDIO_PREFER_WAVEFORMATEX); + IMFMediaType_DeleteItem(renderer->media_type, &MF_MT_AUDIO_VALID_BITS_PER_SAMPLE); + IMFMediaType_DeleteItem(renderer->media_type, &MF_MT_AUDIO_CHANNEL_MASK);
return hr; }
From: R��mi Bernon rbernon@codeweavers.com
--- dlls/mf/sar.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index b22a3a53479..e57613ba016 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -1531,12 +1531,11 @@ static HRESULT WINAPI audio_renderer_stream_type_handler_GetMediaTypeByIndex(IMF
TRACE("%p, %lu, %p.\n", iface, index, media_type);
- if (index == 0) - { - *media_type = renderer->media_type; - IMFMediaType_AddRef(*media_type); - } + if (index > 0) + return MF_E_NO_MORE_TYPES;
+ *media_type = renderer->media_type; + IMFMediaType_AddRef(*media_type); return S_OK; }
From: R��mi Bernon rbernon@codeweavers.com
This is required by the Resampler transform, and will be used in next patch as well as for session buffer size heuristic. --- dlls/winegstreamer/mfplat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 33557211243..9c27c5c7d60 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -698,8 +698,8 @@ static inline UINT64 make_uint64(UINT32 high, UINT32 low)
static IMFMediaType *mf_media_type_from_wg_format_audio(const struct wg_format *format) { + unsigned int i, block_align; IMFMediaType *type; - unsigned int i;
for (i = 0; i < ARRAY_SIZE(audio_formats); ++i) { @@ -715,7 +715,10 @@ static IMFMediaType *mf_media_type_from_wg_format_audio(const struct wg_format * IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, format->u.audio.channels); IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_CHANNEL_MASK, format->u.audio.channel_mask); IMFMediaType_SetUINT32(type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); - IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, format->u.audio.channels * audio_formats[i].depth / 8); + + block_align = format->u.audio.channels * audio_formats[i].depth / 8; + IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, block_align); + IMFMediaType_SetUINT32(type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, block_align * format->u.audio.rate);
return type; }
From: R��mi Bernon rbernon@codeweavers.com
When it is specified. The Resampler transform exposes the block alignment in its output stream info cbSize, and the session then otherwise reads data one audio frame at a time. --- dlls/mf/session.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index a78e7cfc473..87fe77a730f 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -1438,6 +1438,7 @@ static HRESULT session_set_transform_stream_info(struct topo_node *node) struct transform_stream *streams; unsigned int block_alignment; IMFMediaType *media_type; + UINT32 bytes_per_second; GUID major = { 0 }; HRESULT hr;
@@ -1479,6 +1480,8 @@ static HRESULT session_set_transform_stream_info(struct topo_node *node) && SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_AUDIO_BLOCK_ALIGNMENT, &block_alignment))) { streams[i].min_buffer_size = block_alignment; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_AUDIO_AVG_BYTES_PER_SECOND, &bytes_per_second))) + streams[i].min_buffer_size = max(streams[i].min_buffer_size, bytes_per_second); } IMFMediaType_Release(media_type); }
From: R��mi Bernon rbernon@codeweavers.com
--- dlls/mf/tests/mf.c | 1 - dlls/winegstreamer/main.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 996829c5e9a..f3c0b181236 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -125,7 +125,6 @@ static void check_dmo(const GUID *class_id, const WCHAR *expect_name, const GUID
hr = DMOGetName(class_id, name); ok(hr == S_OK, "DMOGetName returned %#lx\n", hr); - todo_wine_if(!wcscmp(expect_name, L"WMAudio Decoder DMO")) ok(!wcscmp(name, expect_name), "got name %s\n", debugstr_w(name));
hr = DMOGetTypes(class_id, ARRAY_SIZE(input), &input_count, input, diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 20dcdccc606..189790db155 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -759,7 +759,7 @@ HRESULT WINAPI DllRegisterServer(void)
IFilterMapper2_Release(mapper);
- if (FAILED(hr = DMORegister(L"WMA Decoder DMO", &CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER, + if (FAILED(hr = DMORegister(L"WMAudio Decoder DMO", &CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER, 0, ARRAY_SIZE(wma_decoder_input), wma_decoder_input, ARRAY_SIZE(wma_decoder_output), wma_decoder_output))) return hr; if (FAILED(hr = DMORegister(L"Resampler DMO", &CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT,
Nikolay Sivov (@nsivov) commented about dlls/mf/sar.c:
TRACE("%p, %lu, %p.\n", iface, index, media_type);
- if (index == 0)
- {
*media_type = renderer->media_type;
IMFMediaType_AddRef(*media_type);
- }
- if (index > 0)
return MF_E_NO_MORE_TYPES;
Could you add a test for this, by just calling it with type count for index?
Nikolay Sivov (@nsivov) commented about dlls/mf/sar.c:
} IMFMediaType_DeleteItem(renderer->media_type, &MF_MT_AUDIO_PREFER_WAVEFORMATEX);
- IMFMediaType_DeleteItem(renderer->media_type, &MF_MT_AUDIO_VALID_BITS_PER_SAMPLE);
- IMFMediaType_DeleteItem(renderer->media_type, &MF_MT_AUDIO_CHANNEL_MASK);
Same here regarding the tests, verifying that what we remove is actually meant to be missing. As I recall renderer returns several possible types on Windows, including spatial one. We don't currently, but it's possible MFInitMediaTypeFromWaveFormatEx() was an overkill and we only need to set a few attributes instead.