Over the last 2 weeks, Rob and I have been working hard to get custom video streams into WPF without using WinForms. The issue with WPF is that the application has no access to the lower-level DirectShow stuff to control how the filter graph is built. This leaves the programmer with 2 choices: (1) build a custom WinForms user control and build the filter graph manually (2) register a custom protocol type that will allow DirectShow’s Intelligent Connect to build the graph you want via a specially formed URL.

Option #1 works, but doesn’t allow WPF to do any overlays on the video. This means that all overlays (text, timestamps, images, controls, etc) must be drawn at the DirectShow layer. This is difficult, inflexible, and bypasses all the visual effects power of WPF (not to mention to loose hardware acceleration).

Option #2 is the optimal solution, and was what we set out to prove. This option allows WPF to control the render surface, and thus provide all the overlay functionality the UI designer can expect from WPF. We succeed this week in proving that option #2 is possible, and one of our UI guys went off and used it to create a custom list box for choosing video (good job Brent). The video clips below are live and displayed in real time:

Custom List Box

The videos are displayed using WPF MediaElement objects, and passing in a URL with our custom protocol type and the id of the camera to connect to. The great thing about WPF is that we get all the scaling, reflection, and overlays you see above for free. Another one of our UI guys (Nick) did a demo with live video playing on a 3D cube that can be rotated by the mouse. (UPDATED) Check it out:

Cube Test Application

You can find information about registering custom protocols at http://msdn2.microsoft.com/en-us/library/ms787558.aspx. The DirectShow documentation is at http://msdn2.microsoft.com/en-us/library/ms783323%28VS.85%29.aspx. We downloaded the Windows Vista Platform SDK and built off of the Push Source Filters sample.

Tagged with:  

Crazy Old Print Ads

On January 18, 2008, in Oh So Random, by Tom

Oddee had a post on some crazy old-time print ads, and I thought 2 of them were worthy of posting here. The first ones for you Stuart. Enjoy!

Old Camel Ad

Old Cola Ad