Recently I have been experimenting with C++/Cli and, well, one thing has led to another...
Because I never like to throw away code, I give you:
mpeg2_xna.zip, a native (safe) C# port of the free MPEG2 video decoder you can find on mpeg.org (x86 & xbox binaries)
-- The backstory --
I started this as an experiment to investigate how C++/Cli works under the hood, and to see if the resulting .net code could be semi-automatically ported to C#. I thought I'd start with something which seemed simple, yet useful and more than just hello world. Hence the MPEG2 decoder. Long story short, there really isn't any way to autoconvert C++/Cli to C#, but by the time I resigned myself to this, the hacked code was so close that manually porting the missing bits was trivial. All in all this represents is about 6 hours of mucking about on my part, including the C++/Cli stuff.
-- other notes --
I removed a couple of the larger extensions included in the original code, so it won't work for all videos. (I couldn't find one that didn't work)
This is a video decoder, not an audio decoder.
I make absolutely no guarentees it's even going to work. It could quite possibly cause your computer to explode.
Performance wise, you should *just* be able to decode a 640x480 video @ 30fps on a high end single-core CPU. This may sound a bit average, but this is simply because the original implementation is not at all optimised. In fact, the C# decoder runs ~10% FASTER than the original pure C decoder (without pointers!). So on the 360, you will need to look at breaking larger videos into blocks and doing some good-old multithreading (which should be safe.. I think).
(Speaking of the 360, I haven't actually been able to test the 360 .dll, as my 360 is currently getting the red rung out of it.)
Also know there are mpeg licensing requirements if you plan to sell a game that uses this .dll. I think these only come into force after your first $$$$ sales though.
Anyway. Enjoy.
Xen: Graphics API for XNA
www.codeplex.com/xen