How to set IAMStreamConfig file in DirectShowLib

元气小坏坏 提交于 2019-12-13 04:56:39

问题


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

https://github.com/Iridio/XNADirectShowWebCam

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.

Kindly guide me.

Thanks

Aftab


回答1:


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.



来源:https://stackoverflow.com/questions/22299930/how-to-set-iamstreamconfig-file-in-directshowlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!