I'm working on a C++ UWP application using the Microsoft Media Foundation library. My app aims to create a virtual camera that can use a video file as its video source.
Virtual camera creation:
winrt::check_hresult(MFCreateVirtualCamera(
MFVirtualCameraType_SoftwareCameraSource,
MFVirtualCameraLifetime_Session,
MFVirtualCameraAccess_CurrentUser,
cameraName,
L"{7B89B92E-FE71-42D0-8A41-E137D06EA184}",
nullptr,
0,
pVirtualCamera.put()
));
I get an "Class not registered" error when I try to start the virtual camera created above. I understand that it's because of the above mentioned CLSID not being registered in the registry. So, how and where exactly in the registry do I register my CLSID?
Secondly,
I understand that there's a IMFMediaSource linked to the virtual camera that I can obtain this way:
winrt::com_ptr<IMFMediaSource> pMediaSource;
pVirtualCamera->GetMediaSource(pMediaSource.put());
So, how do I replace it with a new MediaSource that uses the video file as the actual source? Also, please mention if I'm missing something and there's a completely different way to go about doing this.