How to get hardware ID when enumerating with Windows Media Foundation

2

I am using MFEnumDeviceSources() to enumerate attached devices and I am looking for a specific web camera of which I have two connected. The enumeration works fine and I can print the Friendly Name which is FLIR Video for both my cameras.

I am struggling to figure out how to go from Media Foundation device source to a specific camera serial number so I can tell which camera is which.

My example program writes the available attributes on the IMFActivate devices and the output is as follows:

Info: Found 2 devices
Info: [  0] Found device FLIR Video
    MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK: \\?\usb#vid_09cb&pid_4007&mi_00#8&13fab685&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
    MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME: FLIR Video
    MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_CATEGORY: KSCATEGORY_VIDEO_CAMERA
    MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE: MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID
    MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_HW_SOURCE: 4 0x00000004

Info: [  1] Found device Microsoft Camera Front
    MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK: \\?\display#int3470#4&1d31cc69&0&uid13424#{e5323777-f976-4f5b-9b55-b94699c46e44}\{3374b006-18e6-49a1-a5b7-f00d17acbf1f}
    MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME: Microsoft Camera Front
    MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_CATEGORY: KSCATEGORY_VIDEO_CAMERA
    MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE: MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID
    MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_HW_SOURCE: 4 0x00000004

In order to get the USB device descriptor I tried to open the device MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK and query using WinUsb_GetDescriptor or DeviceIoControl(IOCTL_USB_GET_NODE_CONNECTION_INFORMATION) but both fail with ERROR_INVALID_FUNCTION.

windows
ms-media-foundation
asked on Stack Overflow Oct 2, 2019 by mauve

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0