DirectShowLib中设置IAMStreamConfig文

DirectShowLib中设置IAMStreamConfig文

本文介绍了如何在DirectShowLib中设置IAMStreamConfig文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#XNA项目中使用DirectShowLib来显示网络摄像头视频。我已经从下面的链接下载了完整的代码。

I am using DirectShowLib in my C# XNA project to show webcam video. I have downloaded the complete code from the following link.

我正在使用Logitech 1080p网络摄像头,但是在我的程序输出中我没有得到高清效果。我用谷歌搜索,发现了各种结果。许多专家说要编辑 IAMStreamConfig 方法来设置分辨率和帧速率。我无法理解如何编辑。

I am using Logitech 1080p webcam, but in my program output i am not getting the HD result. I google it and found various results. Many experts are saying to edit IAMStreamConfig method to set the resolution and Frame rate. I am unable to understand how to edit it.

请引导我。

谢谢

Aftab

推荐答案

您的网络摄像头由DirectShow图中的过滤器表示,滤波器具有一个输出引脚,数据从该输出引脚流出。此输出引脚由具有IPin接口的对象表示,但通常也支持IAMStreamConfig接口。在您的代码中,您应该枚举网络摄像头过滤器的针脚,找到合适的针脚(通常称为捕获),然后将其投射到该接口上(C#将为您完成查询COM接口的工作)。然后,使用该界面可以枚举相机可以提供的所有媒体类型,找到该媒体后,您需要调用SetFormat来选择它。我的帖子。

Your webcam is represented by a filter in the DirectShow graph, and this filter has an output pin from which the data flows. This output pin is represented by an object with IPin interface but it also usually supports IAMStreamConfig interface. In your code you should enumerate pins of the webcam filter, find the proper one (usually called "Capture") and just cast it to this interface (C# will do the work of querying COM interface for you). Then using this interface you can enumerate all media types that your camera can provide and after you've found the one you need you call SetFormat to select it. Some more details and code samples in my post here.

这篇关于如何在DirectShowLib中设置IAMStreamConfig文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:53