MediaFoundation找不到视频捕获模拟器驱动程序。但是DirectShow确实 [英] MediaFoundation can´t find video capture emulator driver. But DirectShow does

查看:315
本文介绍了MediaFoundation找不到视频捕获模拟器驱动程序。但是DirectShow确实的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发一个软件,在其中可以预览和记录从视频捕获卡捕获的输入视频源。预览是通过DirectShow实现的,录制是通过Media Foundation实现的(这是一个缓慢升级到MediaFoundation的旧软件)



MediaFoundation的问题在于:它似乎可以正确找到发行机上的视频捕获卡,而不是我们在测试机上使用的屏幕捕获视频模拟器。
另一方面,DirectShow代码可以正确找到视频捕获设备模拟器和屏幕捕获设备模拟器。



所以,为什么不能MediaFoundation可以找到仿真器驱动程序吗?



注意:仿真器是在DirectShow中制作的...它是 VHScrCap



这是MediaFoundation代码:

  HRESULT DeviceList :: EnumerateVideoDevices(){
HRESULT hr = S_OK;
IMFAttributes * pAttributes = NULL;

ClearVideo();

//初始化属性存储。我们将用它来
//指定枚举参数。

hr = MFCreateAttributes(& pAttributes,1);

//要求来源类型=视频捕获设备
if(SUCCEEDED(hr))
{
hr = pAttributes-> SetGUID(
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID
);
}

//枚举设备。
if(SUCCEEDED(hr))
{
hr = MFEnumDeviceSources(pAttributes,& m_ppVideoDevices,& m_cVideoDevices);
}

SafeRelease(& pAttributes);

返程时间;

}



hr = MFEnumDeviceSources(pAttributes,& m_ppVideoDevices,& m_cVideoDevices); 找不到设备。



谢谢!

解决方案

Media Foundation不应选择所谓的虚拟 DirectShow视频源。 DirectShow通过视频输入类别提供视频源,其中包括由WDM驱动程序设备支持的过滤器,然后包括已注册到该类别的任何其他过滤器。 Media Foundation拥有自己的适配器来公开WDM捕获设备,但是DirectShow过滤器在此处不可见。基本上,您需要一个单独的Media Foundation模拟器。



从MSDN


从Windows 7开始,Media Foundation自动支持音频
和视频捕获设备。 对于视频,设备必须在视频捕获类别中提供内核
流(KS)微型驱动程序。
媒体
Foundation使用PnP路径枚举设备。对于音频,Media
Foundation使用Windows多媒体设备(MMDevice)API来枚举
音频端点设备。如果设备满足这些条件,则
无需实现自定义媒体源。



但是,您可能希望实现自定义媒体


blockquote>

We are developing a software in which we preview and record an input video source captured from a video-capture card. The preview is implemented with DirectShow and the recording with Media Foundation (it´s an old software slowly upgrading to MediaFoundation)

The problem is with MediaFoundation: it seems to find correctly the video-capture card at our release machine, but not the "screen-capture" video emulator that we use at the testing machines. At the other hand, the DirectShow code finds correctly both, the video-capture device and the screen-capture device emulator.

So, why can´t MediaFoundation find the emulator driver?

Note: The emulator is made in DirectShow... It is VHScrCap

Here is the MediaFoundation code:

HRESULT DeviceList::EnumerateVideoDevices(){
HRESULT hr = S_OK;
IMFAttributes *pAttributes = NULL;

ClearVideo();

// Initialize an attribute store. We will use this to 
// specify the enumeration parameters.

hr = MFCreateAttributes(&pAttributes, 1);

// Ask for source type = video capture devices
if (SUCCEEDED(hr))
{
    hr = pAttributes->SetGUID(
        MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, 
        MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID
        );
}

// Enumerate devices.
if (SUCCEEDED(hr))
{
    hr = MFEnumDeviceSources(pAttributes, &m_ppVideoDevices, &m_cVideoDevices);
}

SafeRelease(&pAttributes);

return hr;

}

At hr = MFEnumDeviceSources(pAttributes, &m_ppVideoDevices, &m_cVideoDevices); no devices are found.

Thanks!

解决方案

Media Foundation is not supposed to pick so called "virtual" DirectShow video sources. DirectShow offers video sources through the Video Input category, which includes filters backed by WDM driver devices and then any other filters registered into this category. Media Foundation has its own adapter to expose WDM capture devices, but DirectShow filters are invisible there. Basically you want a separate emulator for Media Foundation.

From MSDN:

Starting in Windows 7, Media Foundation automatically supports audio and video capture devices. For video, the device must provide a kernel streaming (KS) minidriver in the video capture category. Media Foundation uses the PnP path to enumerate the device. For audio, Media Foundation uses the Windows Multimedia Device (MMDevice) API to enumerate audio endpoint devices. If the device meets these criteria, there is no need to implement a custom media source.

However, you might want to implement a custom media source for some other type of device or other live data source. There are only a few differences between a live source and other media sources:

这篇关于MediaFoundation找不到视频捕获模拟器驱动程序。但是DirectShow确实的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆