I am trying to create a virtual webcam DirectShow filter with multiple virtual devices.
The cameras are defined as follows:
CFactoryTemplate g_Templates[] =
{
{
SUB_DEVICE_NAME_0,
&CLSID_VirtualCam_0,
CVCam::CreateInstance0,
NULL,
&AMSFilterVCam_0
},
{
SUB_DEVICE_NAME_1,
&CLSID_VirtualCam_1,
CVCam::CreateInstance1,
NULL,
&AMSFilterVCam_1
}
};
The initialization is done with these static
methods:
CUnknown * WINAPI CVCam::CreateInstance0(LPUNKNOWN lpunk, HRESULT *phr)
{
return new CVCam(NAME(DEVICE_NAME_0), lpunk, phr, CLSID_VirtualCam_0, 0);
}
CUnknown * WINAPI CVCam::CreateInstance1(LPUNKNOWN lpunk, HRESULT *phr)
{
return new CVCam(NAME(DEVICE_NAME_1), lpunk, phr, CLSID_VirtualCam_1, 1);
}
Is it possible to do this more dynamically so that we do not have to hard code each camera but can pass a parameter during runtime?
Regards,