diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-10-22 12:30:14 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-10-22 12:32:32 +0200 |
commit | 68176befa2f19bb9f1d35e1a1187e6401ab7ed5e (patch) | |
tree | d4a8b9c58b30057a165f8eaeaea15a4a80832e08 /gst | |
parent | 457ac565ba157aee8f6c4c9795e06d60476fb69a (diff) |
matroskamux: Dirac "muxing" units end on EOS too
A Dirac muxing unit are all non-picture, non-end-of-sequence
packets up to and including the first picture or eos packet.
See http://www.diracvideo.org/wiki/index.php/ContainerFormatMappingGuidelines
Diffstat (limited to 'gst')
-rw-r--r-- | gst/matroska/matroska-mux.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 8fb9d4e1..1d426c75 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -2431,7 +2431,9 @@ gst_matroska_mux_create_buffer_header (GstMatroskaTrackContext * track, return hdr; } -#define DIRAC_PARSE_CODE_SEQUENCE 0x00 +#define DIRAC_PARSE_CODE_SEQUENCE_HEADER 0x00 +#define DIRAC_PARSE_CODE_END_OF_SEQUENCE 0x10 +#define DIRAC_PARSE_CODE_IS_PICTURE(x) ((x & 0x08) != 0) static GstBuffer * gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux, @@ -2444,14 +2446,14 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux, guint8 parse_code; guint32 next_parse_offset; GstBuffer *ret = NULL; - gboolean is_picture = FALSE; + gboolean is_muxing_unit = FALSE; if (GST_BUFFER_SIZE (buf) < 13) { gst_buffer_unref (buf); return ret; } - /* Check if this buffer contains a picture packet */ + /* Check if this buffer contains a picture or end-of-sequence packet */ while (size >= 13) { if (GST_READ_UINT32_BE (data) != 0x42424344 /* 'BBCD' */ ) { gst_buffer_unref (buf); @@ -2459,13 +2461,14 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux, } parse_code = GST_READ_UINT8 (data + 4); - if (parse_code == DIRAC_PARSE_CODE_SEQUENCE) { + if (parse_code == DIRAC_PARSE_CODE_SEQUENCE_HEADER) { if (ctx->dirac_unit) { gst_buffer_unref (ctx->dirac_unit); ctx->dirac_unit = NULL; } - } else if (parse_code & 0x08) { - is_picture = TRUE; + } else if (DIRAC_PARSE_CODE_IS_PICTURE (parse_code) || + parse_code == DIRAC_PARSE_CODE_END_OF_SEQUENCE) { + is_muxing_unit = TRUE; break; } @@ -2483,7 +2486,7 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux, else ctx->dirac_unit = gst_buffer_ref (buf); - if (is_picture) { + if (is_muxing_unit) { ret = gst_buffer_make_metadata_writable (ctx->dirac_unit); ctx->dirac_unit = NULL; gst_buffer_copy_metadata (ret, buf, |