Adding codec support

Topics: Windows 8 Xaml, Windows Phone 8
Aug 26, 2013 at 12:12 PM
Edited Aug 26, 2013 at 12:15 PM

Is there an example showing how to add support for different codecs or file containers?

I would like to add MJPG and FLV support, particularly on Windows Phone 8.
Aug 26, 2013 at 7:09 PM
Here's a sample on MSDN that demonstrates building an MPEG1 decoder for Windows 8. For Windows Phone, it is a bit different because you need to build an MSS (MediaStreamSource) instead of a Media Foundation Extension to accomplish this. There may be 3rd party options out there that have already done this for FLV and MJPG but I'm not sure.
Aug 26, 2013 at 7:58 PM
If you only need to support other containers, then you may want to take a look at my Windows Phone Streaming Media project. It plays many HLS streams (MPEG-2 transport streams referenced from M3U8 files) on WP7 and WP8, but the general idea should be similar for, say, F4V (XML files referencing MP4 fragments, IIRC).
Aug 26, 2013 at 9:17 PM
Great, thanks for the replies.

So I need to implement a MediaStreamSource for WP8, and henric has pointed to an example of that, albeit for different containers but not new codecs.
Aug 27, 2013 at 1:08 AM
Win 8.1 is adding MediaStreamSource, but if you need support a custom codec, it is probably better to focus on the C++ side of things (native code should save battery for what is likely to be math heavy, bit-twiddling, vectorization friendly work). I assume the 3vix folks are doing something Media Foundation-based for their WP8 HLS solution, so that approach may be a reasonable option.

A disadvantage of the MSS approach is that one takes over responsibility for everything. The existing Smooth Streaming stuff handles things like reading from the web, bandwidth management (bitrate selection), flow control, and what-not. That code seems to be organized around interfaces; if one could plug into the right places there, much of the Smooth Streaming code might be reusable for handling custom media containers. For example, one could perhaps use the custom DRM stuff to trick it into thinking that an M3U8 file is an "encrypted" smooth streaming manifest file and an MPEG-2 transport stream segment is an "encrypted" MP4 segment...?