1

I'm using Windows Media Foundation to read data from a video capture card and I'm finding that on certain machines ActivateObject returns MF_E_INVALIDMEDIATYPE. The code is pretty straightforward:

CComPtr<IMFAttributes> pAttributes = nullptr;        
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
hr = MFStartup(MF_VERSION);
if (hr != S_OK)
{
    return false;
}
// Create an attribute store to specify the enumeration parameters.
hr = MFCreateAttributes(&pAttributes, 1);
if (hr != S_OK)
{
    return false;
}

// Source type: video capture devices
hr = pAttributes->SetGUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID);
if (hr != S_OK)
{
    return false;
}
IMFActivate** ppDevices = nullptr;
bool success = true;
UINT32 count = 0;
// Enumerate devices.
HRESULT hr = MFEnumDeviceSources(pAttributes, &ppDevices, &count);
//Returns MF_E_INVALIDMEDIATYPE on some machines (using the same device/drivers)
hr = ppDevices[0]->ActivateObject(IID_PPV_ARGS(&m_pMediaSource));
Erin Bz
  • 33
  • 5
  • Maybe this device doesn't work properly with Media Foundation. That could be a driver issue. Is this a special hardware? – Simon Mourier Aug 19 '21 at 05:20
  • Blackmagic Design hardware, for example, is known to have this behavior (something with their driver). – Roman R. Aug 19 '21 at 13:39
  • Yes, it's an Osprey Raptor Series 935 PCIe Capture Card. If this didn't work on any machines I would be inclined to agree that it just isn't supported. It's the fact that it works just fine on one machine that has me puzzled (that one machine happens to be running a different version of windows - windows LTSB, the other machines are running windows 10 Pro). – Erin Bz Aug 19 '21 at 15:05
  • 1
    You should contact the vendor, if they support MF, it should work. – Simon Mourier Aug 19 '21 at 15:58
  • I've contacted the vendor, they do not support MF. – Erin Bz Aug 20 '21 at 17:05
  • It's mentioned here for all "raptor" product line: https://www.ospreyvideo.com/raptor-driver-features "API Support: Medialooks SDK | DirectShow | **Microsoft Media Foundation**". Sounds more like a support issue, or they are liars. You should recontact them :-) – Simon Mourier Aug 22 '21 at 06:26

1 Answers1

2

I've contacted the vendor, they do not support MF

I believe this requires a translation to normal language.

Media Foundation is the only "current" API in Windows to work with video acquisition hardware. Failure to support Media Foudantion from hardware vendor means failure to supply the hardware with a valid compatible driver for the platform.

Similar to another vendor (see here and here) it seems that Osprey Video made a decision to not supply their hardware with Windows integration, not just Media Foundation.

The hardware is likely to be supplied with vendor specific SDK and so the burden of Windows integration (such as developing a Media Foundation wrapper over the SDK, or customized integration) is passed to developers.

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