How to determine what content a MCE Extender supports...

So your a Media Center add-in and you want to determine if a file is a supported format for the playback device that is being used at any given time, here is what you do:

First things first you should detect if your on a Extender or not you should make sure the Capabilities.IsConsole is false.

At this point you know your on a extender, the next thing need to do is check to see that the file you are about to play is supported by the the Extender, to do that you can use DeviceInfo.ProtocolInfo (), this will either return null which means you can assume a base set of capabilities (documented on here) or return a string which can be parsed to find out what "Content Types" the Extender supports.

What is a "Content Type" you ask? its a string that gives you a basic idea of what sort of content your looking at (obvious eh?) for a mpeg file it will be "video/mpeg".

You can determine the "Content Type" for a given file extension by looking in the registry under "HKEY_CLASSES_ROOT\.{FileExtension}" where {FileExtension} is the extension of the file in question, the value of "Content Type" will have what you need.

Another useful thing to know is the "PercievedType" for a given file, its very similar to "Content Type" in purpose but the king thing to understand is that the Videos Library in MCE uses this to determine if a given file is a "Video" or not, as such if you were to build a Video library of sorts what you would likely want to do is:

  1. Find all content that has a PercievedType of Video
  2. Identity which of those files are supported by the device being used at the time by checking the ProtocolInfo method.
  3. Either filter out or disable content that is not supported by the current playback device.

As I said this approach isn't perfect, it has a couple short comings:

  1. You are not guaranteed that a device will return you a ProtocolInfo string so you have to special case that with the default content types called out in the ProtocolInfo documentation.
  2. Content Type, while useful isn't enough to tell you for sure the content will play, for example bit rate and other encoding options can make content not playable.

With that being said this is a fairly reliably means for you to filter out the cruft that will cause users of your add-ins problems, and you should consider implementing it if you create a library view in your application.

Print | posted on Sunday, July 06, 2008 3:12 PM

Feedback

No comments posted yet.
Title  
Name  
Email
Url
Comments   
Please add 4 and 1 and type the answer here: