使用PushSource创建虚拟网络摄像头

时间:2017-06-30 13:59:18

标签: c++ windows video camera directshow

我尝试修改directshow中的pushsource示例以接受来自外部程序的字节流。

目前,pushsource程序获取位图图像并将其发送到虚拟网络摄像头。

如何修改以使其接受字节流?

编辑:

我尝试像这样修改PushSource程序:

    // Filter setup data


const AMOVIESETUP_MEDIATYPE sudOpPinTypes2[] =
{
    {
    &MEDIATYPE_Video,       // Major type
    &MEDIASUBTYPE_NULL      // Minor type
    }
};


const AMOVIESETUP_PIN sudOutputPinBitmap2[] =
{
    { L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, 1, &sudOpPinTypes2[0] },
    { L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 1, &sudOpPinTypes2[0] }
};



const AMOVIESETUP_FILTER sudPushSourceBitmap2 =
{
    &CLSID_PushSourceBitmap,// Filter CLSID
    g_wszPushBitmap,        // String name
    MERIT_DO_NOT_USE,       // Filter merit
    2,                      // Number pins
    sudOutputPinBitmap2     // Pin details
};






const AMOVIESETUP_PIN sudOutputPinDesktop = 
{
    L"Output",      // Obsolete, not used.
    FALSE,          // Is this pin rendered?
    TRUE,           // Is it an output pin?
    FALSE,          // Can the filter create zero instances?
    FALSE,          // Does the filter create multiple instances?
    &CLSID_NULL,    // Obsolete.
    NULL,           // Obsolete.
    1,              // Number of media types.
    &sudOpPinTypes  // Pointer to media types.
};

const AMOVIESETUP_FILTER sudPushSourceDesktop =
{
    &CLSID_PushSourceDesktop,// Filter CLSID
    g_wszPushDesktop,       // String name
    MERIT_DO_NOT_USE,       // Filter merit
    1,                      // Number pins
    &sudOutputPinDesktop    // Pin details
};


// List of class IDs and creator functions for the class factory. This
// provides the link between the OLE entry point in the DLL and an object
// being created. The class factory will call the static CreateInstance.
// We provide a set of filters in this one DLL.

CFactoryTemplate g_Templates[3] = 
{
    { 
      g_wszPushBitmap2,                // Name
      &CLSID_PushSourceBitmap,        // CLSID
      CPushSourceBitmap::CreateInstance,  // Method to create an instance of MyComponent
      NULL,                           // Initialization function
      &sudPushSourceBitmap2            // Set-up information (for filters)
    }   
};

当我修改网络摄像头的名称时,我可以在GraphStudio中看到修改,但我仍然只有一个输出。没有输入。

0 个答案:

没有答案