On 3/31/21 4:30 PM, Giovanni Mascellani wrote:
@@ -1606,7 +1606,7 @@ static HRESULT source_reader_set_compatible_media_type(struct source_reader *rea return MF_E_INVALIDMEDIATYPE;
/* No need for a decoder or type change. */
- if (flags & MF_MEDIATYPE_EQUAL_FORMAT_TYPES)
if (flags & MF_MEDIATYPE_EQUAL_FORMAT_DATA) return S_OK;
if (FAILED(hr = source_reader_get_source_type_handler(reader, index, &type_handler)))
@@ -1614,7 +1614,7 @@ static HRESULT source_reader_set_compatible_media_type(struct source_reader *rea
while (!type_set && IMFMediaTypeHandler_GetMediaTypeByIndex(type_handler, i++, &native_type) == S_OK) {
static const DWORD compare_flags = MF_MEDIATYPE_EQUAL_MAJOR_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_TYPES;
static const DWORD compare_flags = MF_MEDIATYPE_EQUAL_MAJOR_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_DATA; if (SUCCEEDED(IMFMediaType_IsEqual(native_type, type, &flags)) && (flags & compare_flags) == compare_flags) {
I doesn't seem like a right thing to do. This helper is meant to check if decoder is necessary, for that you only need a subtype test. Admittedly existing naming does not make it obvious.
What should happen in general case:
- check major/subtype to see if decoder is necessary at all; - if it's necessary, look for the decoder; - unconditionally compare for format data to see if converter is necessary, and append one.
According to docs it should support local transforms, so registering local dummy converter (that is only able to negotiate types) for 16 -> 32bit resampling, and trying again could potentially succeed instead where it returns MF_E_TOPO_CODEC_NOT_FOUND now. It's possible that on Windows reader is either confused by raw types source returns and skips that part, or fails to find a converter in first place (or conversion is disabled by default despite what docs say).