Create IMFMediaType using Windows.Media.MediaProperties namespace
See the question and my original answer on StackOverflowThey are IPropertyValue objects.
If you have this:
auto props = AudioEncodingProperties::CreateAac(48'000, 2, 128'000);
auto prop = props.Properties().Lookup(MF_MT_AUDIO_SAMPLES_PER_SECOND); // Mfapi.h
You can get the value behind like this:
auto value = prop.as<Windows::Foundation::IPropertyValue>().GetUInt32();
Or this (C++/WinRT):
auto value = winrt::unbox_value<UINT32>(prop);
And to get an IMFMediaType
reference from that, you can use MFCreateMediaTypeFromProperties like this, here with C++/WinRT:
com_ptr<IMFMediaType> type;
winrt::check_hresult(MFCreateMediaTypeFromProperties(
props.as<IUnknown>().get(),
type.put()));