Windows Phone 7 XNA

May 23, 2012 at 8:50 AM

Can I use this library to play mp4 video with Windows Phone 7 XNA (without Silverlight)?

May 23, 2012 at 5:02 PM

Only if you have some way to decode and play the contained h.264 video and AAC audio bitstreams.  Base Media File Format is a container format and as such it can contain a wide variety of codecs but .mp4 files *usually* contain those two.

Decoding and playback of h.264 is extremely CPU intensive and often uses hand-optimized assembler code and/or hardware acceleration.  Writing that in C# would probably not be a great idea.  You could potentially get decent (but not great) performance in a C# decoder with a combination of unsafe code and compute shaders but neither of those are available on WP7 and it would be a massive undertaking even if they were.

An AAC decoder would probably be doable but still a lot of work -- you'd be able to feed the raw WAV output to DynamicSoundEffectInstance.

Unfortunately, WP7 doesn't have DirectShow like WinMo6 so that makes things very difficult.  I expect it'll be added back at some point but that's just a guess.  Rumor has it that Win8 will have native code support which means optimized codecs in C/Assembler would be doable and you might have access to GPU acceleration but it's anyone's guess when/if all that would be available.