locked
Custom Media Sink RRS feed

  • Question

  • Dear all

    I'm currently implementing a simple video codec with an image format called PGF, based on Microsoft Media Foundation.
    I already managed to get a Encoder and Decoder MFT running in a topology with TopoEdit (based on the Grayscale example).

    My next goal is to be able to read and save PGF-encoded video data in a media container like ASF. Therefore I started implementing my own ASF writer by implementing the following interfaces:
    - IMFMediaSink, IMFClockStateSink, IMFStreamSink, IMFMediaTypeHandler

    Sadly, I was not yet able to insert the implemented sink into TopoEdit. How do I get the GUID in the correct format to insert in TopoEdit? Now when I enter the GUID in the requested form, the "Invalid GUID" message appears.
    Is this even the right way to go? Is there any sample code available for such purposes? Is it even possible to create an ASF container around my own media format?

    Regards,

    Stefan

    Tuesday, May 18, 2010 7:21 AM

Answers

  • Hi

     

    I actually made some progress with the implementation. There was a huge bug in my factory code, that destroyed the created object after the factory function.

    Now I have to look into the implementation details, but at least its being loaded so I can test effectively.

     

    Thanks everyone.

    Thursday, May 20, 2010 7:37 AM

All replies

  • Did you register the media sink DLL? This feature in TopoEdit requires that the media sink support creation via CoCreateInstance. (Note that this is a requirement for using the sink in TopoEdit, not for Media Foundation in general.)

     

    - Mike

    ----------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2010 Microsoft Corporation. All rights reserved.


    Mike Wasson (SDK Documentation)
    Tuesday, May 18, 2010 6:27 PM
  • Hi Mike

    Thanks for your answer.

    In the dllmain.cpp's function DllRegisterServer() I register my CLSID like that:

    hr = RegisterObject(g_hModule, CLSID_ASFFileWriter, TEXT("PGF ASF Writer"), TEXT("Both"));

    This code is executed when running regsvr32.

     

    CLSID_ASFFileWriter being the name of my defined GUID for the sink:

    DEFINE_GUID(CLSID_ASFFileWriter, 0x2f3dbc05, 0xc001, 0x4a8f, 0xb2, 0x64, 0xe4, 0x1e, 0x36, 0xc5, 0x7b, 0xf4);
    Is it correct to enter the following notation for the GUID into Topoedit with the above defined GUID?
    2F3DBC05-C001-4A8F-B264-E41E36C57BF4


    // Edit: Since I registered the DLL also with MFTRegister during regsvr32, it's available in TopoEdit under the "OTHER" category. TopoEdit queries for the IMFTransform Interface when I try to add the MFT into the topology.
    This call to QueryInterface() fails, since my implementation is a Sink and not a Transform. How can I add that badboy into my Topology? :S

    Thanks again.
    Cheers

    Tuesday, May 18, 2010 7:52 PM
  • Hi

     

    I actually made some progress with the implementation. There was a huge bug in my factory code, that destroyed the created object after the factory function.

    Now I have to look into the implementation details, but at least its being loaded so I can test effectively.

     

    Thanks everyone.

    Thursday, May 20, 2010 7:37 AM