gstreamer/gst/asfdemux
Edward Hervey 804f65e6db asfpacket: Fix pull-mode timestamping handling.
The problem that happens is the following:
* A packet with multiple payloads comes in
* Those payloads get handled one by one
* The first payload contains the first audio payload with timestamp A
* The second payload contains the first video (key)frame with timestamp V (where V < A)

With the previous code, the following would happen:
* the first payload gets processed, then passed to queue_for_stream
* queue_for_stream detects it's the first valid timestamp received and stores
  first_ts = A
* the second payload gets processed, then pass to queue_for_stream
* queue_for_stream detects the timestamp is lower than first_ts... and
  discards it... resulting in losing the first keyframe of the video stream

We've been having this issue for *ages*... it's just that nobody noticed it
that much with playbin. But with playbin2's aggresive multiqueue handling, this
will result in multiqueue not being able to preroll (because the video decoder will
be dropping a ton of buffers before (maybe) receiving the next keyframe).

Tested with over 200 asf files, and they all play the first frame correctly now,
even the most braindead ones.
2009-04-23 09:04:41 +02:00
..
.gitignore gst/asfdemux/.cvsignore: More ignore 2006-06-12 13:27:18 +00:00
asf.vcproj more working plugins 2004-07-27 21:41:30 +00:00
asfheaders.c gst/asfdemux/: Implement payload extension system/extended replicated data parsing, so we can extract payload duratio... 2007-04-30 15:36:00 +00:00
asfheaders.h gst/asfdemux/: Implement payload extension system/extended replicated data parsing, so we can extract payload duratio... 2007-04-30 15:36:00 +00:00
asfpacket.c asfpacket: Fix pull-mode timestamping handling. 2009-04-23 09:04:41 +02:00
asfpacket.h gst/asfdemux/: Implement payload extension system/extended replicated data parsing, so we can extract payload duratio... 2007-04-30 15:36:00 +00:00
gstasf.c Fix indentation. 2009-02-22 14:22:30 +01:00
gstasfdemux.c asfdemux: Initialize flow for a corner case. 2009-04-19 14:03:58 +02:00
gstasfdemux.h Remove redundant push_mode struct member 2009-01-30 14:38:23 +01:00
gstasfmux.c Fix leaks some more. 2007-06-22 10:57:06 +00:00
gstasfmux.h Fix more gobject macros: obj<->klass, GstXXX<->GstXXXClass 2006-06-01 21:11:41 +00:00
gstrtpasfdepay.c asfdepay: fix a comment 2009-04-14 10:53:51 +02:00
gstrtpasfdepay.h Add ASF depayloader 2009-02-20 13:52:29 +01:00
gstrtspwms.c remove empty method implementations. 2009-04-19 13:55:24 +02:00
gstrtspwms.h gst/asfdemux/: Move WMS RTSP extension from -good to here. 2007-07-25 18:38:42 +00:00
Makefile.am asfdemux: link to all required libraries including indirectly used ones. 2009-04-08 11:44:53 -07:00
README ext/jpeg/gstjpegdec.c: Make jpegdec quiet on MJPEG decoding 2005-01-10 22:00:15 +00:00

ASF Demuxer Plugin
==================

Overview
--------

This plugin is a demuxer for Microsoft's ASF Advanced Streaming Format
or ASF [1]. This demuxer only supports ASF v1.0 since the vast
majority of existing ASF files use that version. The specification
has been derived from a third party source [2] without reference to
the original.

Design
------

The ASF format can carry any combination of audio, video or
'ASF_Command_Media' streams. For simplicity it is assumed that each
file can carry up to 16 audio streams and 16 video streams. These are
implemented as dynamic pads and appear as appropriate once the file
headers have been parsed.

    (-------------------------)
    ! asfdemux                !
    !                    (video/raw0)---
    !                    (video/raw1)---
    !                    (video/raw...
  --- src                     !
    !                    (audio/raw0)---
    !                    (audio/raw1)---
    !                    (audio/raw...
    !                         !
    (-------------------------)


Known stream fourccs are:

Type		Tags		MIME type
------------------------------------------
H263		H263 I263	video/x-h263
MJPEG		MJPG		image/jpeg	
MPEG4		DIVX divx DX50	video/mpeg
		XVID xvid mp4s	
		MP4S M4S2 m4s2
		0x04000000
MSMPEG4V1	MPG4		video/mpeg
MSMPEG4V2	MP42		video/mpeg
MSMPEG4V3	MP43 DIV3	video/mpeg
WMV1		WMV1		video/x-wmv, wmvversion = (int) 1
WMV2		WMV2		video/x-wmv, wmvversion = (int) 2
WMV3		WMV3		video/x-wmv, wmvversion = (int) 3
WMA1		WMA1		audio/x-wma, wmaversion = (int) 1
WMA2		WMA2		audio/x-wma, wmaversion = (int) 2
				audio/x-wma, wmaversion = (int) 3

These video stream headers is very similar to that used in the AVI
format as are the audio stream headers. In addition the content types
are basically the same also so, for compatibility with existing
plugins the src pads are set up as video/x-msvideo. This enables
compatibility with the ffmpeg plugin.

The demuxing process begins with the loop function gst_asf_demux_loop
and parses the file in a recursive tree as follows:

	gst_asf_demux_loop()
	+-> gst_asf_demux_process_object()   <----
	    +-> gst_asf_demux_process_stream()    \
	    |-> gst_asf_demux_process_file()      |
	    |-> gst_asf_demux_process_header()  --+
	    |-> gst_asf_demux_process_data()
		+-> gst_asf_demux_process_segment()
		    +-> gst_asf_demux_process_chunk()

Todo
----

- Support for ASF v2.0
- Support for command media streams



References
----------

[1] Microsoft. ASF Specification - Windows Media Technologies. 
http://www.microsoft.com/windows/windowsmedia/format/asfspec.aspx (v01.20.01e, September 2003)

[2] divx at euro.ru. ASF format version 1.0,
reconstruction. http://avifile.sourceforge.net/asf-1.0.htm