locked
How to support private media format (special file ext like ".aaa") playback

    Question

  • Hi Dear Expert,


    I want to add a plugin to support a private new media format, the file extension name is for example ".aaa".

    I have written a customized source filter based on MediaFoundation, but in my test program, when I try to play a ".aaa" file, it will fail to load my source MFT.

    By my analyze, the problem is very likely on the file extension name.

     

    I have done a simple test on the "Media Plugins Sample" from below link,

    http://code.msdn.microsoft.com/windowsapps/Media-Plugins-Sample-8913a7e9

    I can play a MPEG1/PS file (test.mpg) well with this test sample.

    And now I rename test.mpg as test.aaa, and modify below code


    _extensions->RegisterByteStreamHandler("Microsoft.Samples.MPEG1ByteStreamHandler", ".mpg", "video/mpeg");

    to

    _extensions->RegisterByteStreamHandler("Microsoft.Samples.MPEG1ByteStreamHandler", ".aaa", "video/mpeg");

    and add one line code: v->Append(".aaa");

    The modified sample program can't play the test.aaa


    As analyze, the MPEG1Source.dll is not loaded when trying to playback a ".aaa" file.

    It looks like in the system media engine, it can't recognize the ".aaa" file ext, so it refuses to build MF graph and playback.


    so my question is:

    Is it possible to extend the capability of media playback engine to support private ext like ".aaa"? of course we will provide according source MFT.

    if yes, how?

    in upper test, what is wrong?

    I have looked through the source code of MPEG1Source.dll, I found it has nothing related with ext.

    the problem is if we specify as ".mpg" in test app, it is ok, if we specify as other ext like ".aaa", it will fail.


    thanks in advance!
    - Matt

    Monday, October 24, 2011 6:52 AM

Answers

  • Hi David,

     

    now i find what is wrong.

    the StorageFile^ object will have a invalid ContentType property after picking a ".aaa" file.

    while picking a ".mpg" file, it will have a correct ContentType,"video/mpeg", even the file is a fake mpg file, renamed from a .doc file.

    It looks like the FilePicker just simply decides the ContentType by file extension, right?

     

    -Matt

     

    Saturday, October 29, 2011 2:36 PM

All replies

  • Hi Matt,

     

    Interesting find. I'm seeing an exception thrown in the output window when attempting this.

    First-chance exception at 0x7573070C in MediaPluginsCPP.exe: Microsoft C++ exception: Platform::COMException ^ at memory location 0x02E6F3CC

    I'm looking into to this to see if we can get some clarification on supporting your particular scenario.

    Thanks,

    -David

    Thursday, October 27, 2011 12:04 AM
    Moderator
  • Hi David,

    Really appreciate your help!

    yes, I also saw the exception, the exception is thrown out during executing this code: media->SetSource(strm, file->ContentType);

    I am looking forward to your more information about this issue, thanks a lot.

    - Matt

     

    Thursday, October 27, 2011 6:18 AM
  • Hi David,

     

    now i find what is wrong.

    the StorageFile^ object will have a invalid ContentType property after picking a ".aaa" file.

    while picking a ".mpg" file, it will have a correct ContentType,"video/mpeg", even the file is a fake mpg file, renamed from a .doc file.

    It looks like the FilePicker just simply decides the ContentType by file extension, right?

     

    -Matt

     

    Saturday, October 29, 2011 2:36 PM
  • Hi Matt,

     

    After some investigation, this is something we should look into changing. Could you please file a bug on this thru Connect? Let me know if you have any trouble submitting it and I'll create it for you. Thanks so much for letting us know about this!

    -David

     

    Bug / feedback filing instructions:

    Thank you for posting your feedback, we want to make sure we get the right info including your log files.  Can you also submit feedback using the Windows Feedback Tool from the Connect Site associated with your Windows Developer Preview program? If you’re an MSDN subscriber, the information on how to join the Connect program is included on the download page where you installed Windows Developer Preview.  There’s a link to the Connect site and an invitation code that you can click on to join using a Windows Live ID account. If you’re not an MSDN subscriber follow this limited use link to join the Connect program and then follow the steps here

    Tuesday, November 01, 2011 7:51 PM
    Moderator
  • Hello Yaguang,

    This is the expected behavior. MF doesn't have a byte code registration system like DirectShow does. However MF does have a much more complex and robust Source Resolver mechinism. Since you are trying to piggy back on an existing MIME type you are running into problems with the source resolver. Unfortunately witout wrighting a custom source resolver for your media type you won't get the funcaitonality that you are lookign for. The recomendation is that you define a custom content type / MIME type for your file association.

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Friday, April 13, 2012 12:18 AM
    Moderator