1

As an offshoot question from: IMFTransform SetInputType()/SetOutputType() fails

When I try to enumerate MP3 decoders on Windows 7 it fails to find any MP3 decoders? However it appears to find one when I set a partial media type for a IMFSourceReader for an MP3 file created by MFCreateSourceReaderFromURL.

I have tried:

MFT_REGISTER_TYPE_INFO outType{ MFMediaType_Audio, MFAudioFormat_Float };   //  And MFAudioFormat_PCM, MFAudioFormat_Float
MFT_REGISTER_TYPE_INFO inType{ MFMediaType_Audio, MFAudioFormat_MP3 };
IMFActivate** decoders;
UINT32 decoderCount;
HRESULT hr;

hr = MFTEnumEx(MFT_CATEGORY_AUDIO_DECODER, MFT_ENUM_FLAG_SYNCMFT, &inType, &outType, &decoders, &decoderCount);
SUCCEEDED(hr);

I believe I have tried all the different flags to MFTEnumEx but decoderCount still gives zero?

Roman R.
  • 68,205
  • 6
  • 94
  • 158
iam
  • 1,623
  • 1
  • 14
  • 28
  • 1
    You requested float output format. Windows 7 decoder might do PCM only perhaps. Also you can omit it too, just asking for input type. – Roman R. Oct 31 '20 at 08:23
  • I tried with both PCM and float (the comment in my code was mean to indicate that). When I try with a NULL output type it does find one decoder though as you suspected! I guess in my IMFSourceReader case its wiring up some conversion behind the scenes from whatever output format it does do then. So you would recommend creating that decoder via MFTEnum instead of the IMFSourceReader partial media type trick - because then it's possible to list a config choice to the user I guess? – iam Oct 31 '20 at 08:33
  • Partial media type is a well documented way so it's not bad. A trick with standalone decoder is to find it and obtain a fully specified media type from it, then use with with Source Reader. This generally looks preferable to me because this way you have more control and more strictness around pipeline building. However it's just a role of thumb and in your case partial can work or even might be preferable for other possible reasons omitted here. So you have choices. – Roman R. Oct 31 '20 at 08:47
  • Both of your comments together make a great answer for this – iam Oct 31 '20 at 08:55

1 Answers1

1

Windows 7 SP1 decoder:

MP3 Decoder MFT

  • MFT_TRANSFORM_CLSID_Attribute: {BBEEA841-0A63-4F52-A7AB-A9B3A84ED38A} (Type VT_CLSID)
  • MF_TRANSFORM_FLAGS_Attribute: MFT_ENUM_FLAG_SYNCMFT
  • MFT_INPUT_TYPES_Attributes: MFAudioFormat_MP3
  • MFT_OUTPUT_TYPES_Attributes: MFAudioFormat_PCM

The decoder does not advertise support for MFAudioFormat_Float for decoding (even tough it can support it too once instantiated). When you enumerate decoders limiting output to MFAudioFormat_Float the decoder is excluded. Newer versions of OS might either have updated decoder with more output format options.

If you did it this way:

MFT_REGISTER_TYPE_INFO outType { MFMediaType_Audio, MFAudioFormat_PCM };

or nullptr output media type, the decoder would be enumerated.

Also Source Reader API, generally speaking, uses the same MFTEnum logic in order to fit actual source media type to requested media type.

When enumerating also pay attention to flags: it might be not so important to you to pick exactly synchronous MFT, but your API call suggests you are requesting to skip asynchronous.

Roman R.
  • 68,205
  • 6
  • 94
  • 158