0

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

Aftab Aamir
  • 175
  • 1
  • 4
  • 12

1 Answers1

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.

Dee Mon
  • 1,016
  • 6
  • 7
  • Thank you so much for your help. I am unable to find out `DirectShowGraph`, `IPin` in my code. Kindly check my code and guide where to write this. I download the complete class from `github` – Aftab Aamir Mar 11 '14 at 07:49
  • 1
    No-no-no, I've never mentioned DirectShowGraph, I said DirectShow graph and now you need to open the Windows SDK or MSDN and learn some DirectShow basics. Go read what is DirectShow, what graph means there and what are pins. You won't complete your task without this basic knowledge. – Dee Mon Mar 11 '14 at 07:53
  • is there any way i can download the implemented class of IAmMediaConfig and use it in my project? – Aftab Aamir Mar 13 '14 at 10:24