Directshow .NET
So I started playing around with streaming video from a webcam in my .NET application at home and I found a library that encapsulates the functionality that DirectShow provides within a .NET library. Coding with un-managed assemblies is certainly interesting, there are a ton of things that don’t come naturally and in large there don’t seem to be any books out there. Which would make sense since there aren’t a whole lot of people who do this kind of stuff anymore. Most development these days is: Grab user input, Store user input, Retrieve user input, Show user input.
At any rate I found one book on DirectShow that explains the thought patterns behind the design of the framework but it is out of print and roughly $200.00 on Amazon:
Programming Microsoft DirectShow for Digital Video and Television (Pro-Developer)
There are other places that you can find the book that are cheaper, but it is a shame that a book that is obviously needed by some and abused by others, price, is out of print. Sure would be nifty if they had a digital download or something.
Anyway, back to the DirectShow .NET library… The traditional “documentation” isn’t really that full, but they provide a ton of code samples with the download. The only thing that would be nice is something that explained filters, graphs, etc. for noobs like me. That book mentioned above does, and if you pair that up with the library mentioned here you can cut your way through the muck.
I took a sample the good folks at DirectShow .NET had and put the meat into it’s own class / project, even figured out how to capture mouse events in the video window and flush them to my panel that I have the thing sitting in. I’ll put up the code samples in a day or two when I get a chance, I’m still learning myself. If you’re reading this and really can’t wait….
IVideoWindow has a method called put_MessageDrain, if your video is sitting inside of panel1 for example you’d set this up as such:
this.myVideoWindow.put_MessageDrain(panel1.Handle);
Then you just need to handle the events it “drains” to you, for example:
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
this.textBox1.Text = "CAM 1: " + e.X.ToString() + "," + e.Y.ToString() + "\r\n";
}
There are other events you can capture but that’s a simple example of how you would capture mouse clicks on your video window. You can find all this stuff online somewhere … I’m sure… however I had a beast of a time doing so, thus I decided to start blogging about my experiences with these libraries.
That’s all for now…

