locked
ASF Sink: IMFFinalizableMediaSink RRS feed

  • Question

  • Dear all

    I've got yet another question regarding the writing of ASF files . I managed to write such a media file with my own minimalistic Media Sink.

    When analyzing the created file with ASF View, it says that some header information is missing:
    "Data Object does not have a packet count", "Data object packet count (3463) != Properties object packet count (0)", "Data object size not set!".

    Also, the video duration is 00:00.00. Those errors might be the reason why I can't play my created files using my own decoder.

    The frames are actually written into the file and they look fairly good in ASF View. Also the file size could be correct.

    I wonder whether I must implement IMFFinalizableMediaSink , and what exactly must be done in its methods to make sure that the media header is updated and complete . I was not able to find the corresponding information for ASF on MSDN.

    Could someone give me a hint on this?

    Thanks a lot! All the best,
    Stefan

    Thursday, June 3, 2010 7:59 AM

Answers

  • Again, I found the solution by myself after hours of visiting MSDN.

    Since the header (IMFContentInfo) is being updated with information such as size and duration by the Multiplexer it's vital that one writes the Header Object at the very end of the Stream into the filestream. I didn't do this and this was the cause of the failure.

    The Finalizable Interface is not necessary, since a Marker with the Event type ENDOFSEGMENT should be sent by the caller (call to method PlaceMarker()). One can easily check for this event type and then finishing the writing:

    • ContentInfo->GenerateHeader()
    • Create output File
    • Write Header into file
    • Append the effective user data to the file

    The tutorial for copying ASF - to - ASF was a good inspiration for me. Thanks for your time, probably this will help somebody in the future...

    Regards,
    Stefan

    Monday, June 7, 2010 6:44 PM

All replies

  • Hey all

    *push*

    Do I need to set those Presentation Descriptor Values: http://msdn.microsoft.com/en-us/library/bb970440%28VS.85%29.aspx
    I see everywhere on MSDN that Presentation Descriptors are for reading only and not for writing.

    The properties that exist for the File Properties Object (in the posted link) look like they could fix the above mentioned errors though...

    There must be somebody out there that has written ASF files successfully with a selfmade sink, right?

    Thanks to all,
    Stefan

    Saturday, June 5, 2010 9:47 AM
  • Again, I found the solution by myself after hours of visiting MSDN.

    Since the header (IMFContentInfo) is being updated with information such as size and duration by the Multiplexer it's vital that one writes the Header Object at the very end of the Stream into the filestream. I didn't do this and this was the cause of the failure.

    The Finalizable Interface is not necessary, since a Marker with the Event type ENDOFSEGMENT should be sent by the caller (call to method PlaceMarker()). One can easily check for this event type and then finishing the writing:

    • ContentInfo->GenerateHeader()
    • Create output File
    • Write Header into file
    • Append the effective user data to the file

    The tutorial for copying ASF - to - ASF was a good inspiration for me. Thanks for your time, probably this will help somebody in the future...

    Regards,
    Stefan

    Monday, June 7, 2010 6:44 PM