I have code that activates the Intel M-JPEG Decoder MFT. Calling SetInputType on the MFT return E_FAIL. Is there another attribute that must be set on the MFT? This code works on synchronous MFT from Microsoft. For clarity, I've removed looking at the hr return, and dealing with errors.
MFTEnumEx(MFT_CATEGORY_VIDEO_DECODER, MFT_ENUM_FLAG_HARDWARE, &inputTypeGUID, &outputTypeGUID, &availableMFTs, &numMFTsAvailable);
availableMFTs[0]->ActivateObject(IID_PPV_ARGS(&m_mjpegMFT));
UnlockAsyncMFT( m_mjpegMFT ); // Comment this out for MFT_ENUM_FLAG_SYNCFMT
mfVideoFormat.dwSize = sizeof(mfVideoFormat);
mfVideoFormat.guidFormat = MFVideoFormat_MJPG;
mfVideoFormat.videoInfo.dwWidth = m_imageWidth;
mfVideoFormat.videoInfo.dwHeight = m_imageHeight;
MFCreateVideoMediaType(&mfVideoFormat, &pVideoMediaTypeInput);
// This next call fails, hr = E_FAIL
hr = m_mjpegMFT->SetInputType(0, pVideoMediaTypeInput, 0); // FAILS
======================
I've queried the MFT for it's attributes, and it is indeed a video decoder. I've added this code after activating the MFT ...
IMFMediaType* pMediaType;
hr = m_mjpegMFT->GetInputAvailableType( 0, 0, &pMediaType );
And pMediaType shows in the debugger
MF_MT_MAJOR_TYPE=MFMediaType_Video
MF_MT_SUBTYPE = CLSID = 0x01cb9e38 {47504A4D-0000-0010-8000-00AA00389B71} "MJPG"}
=============================
It seems like there is some other piece of state that needs to be set. Does anyone know what is missing?
Thanks.