Reputation: 175
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
Upvotes: 0
Views: 1311
Reputation: 1046
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.
Upvotes: 1