mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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
This commit is contained in:
parent
457ac565ba
commit
68176befa2
1 changed files with 10 additions and 7 deletions
|
@ -2431,7 +2431,9 @@ gst_matroska_mux_create_buffer_header (GstMatroskaTrackContext * track,
|
||||||
return hdr;
|
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 *
|
static GstBuffer *
|
||||||
gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
||||||
|
@ -2444,14 +2446,14 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
||||||
guint8 parse_code;
|
guint8 parse_code;
|
||||||
guint32 next_parse_offset;
|
guint32 next_parse_offset;
|
||||||
GstBuffer *ret = NULL;
|
GstBuffer *ret = NULL;
|
||||||
gboolean is_picture = FALSE;
|
gboolean is_muxing_unit = FALSE;
|
||||||
|
|
||||||
if (GST_BUFFER_SIZE (buf) < 13) {
|
if (GST_BUFFER_SIZE (buf) < 13) {
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
return ret;
|
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) {
|
while (size >= 13) {
|
||||||
if (GST_READ_UINT32_BE (data) != 0x42424344 /* 'BBCD' */ ) {
|
if (GST_READ_UINT32_BE (data) != 0x42424344 /* 'BBCD' */ ) {
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
@ -2459,13 +2461,14 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_code = GST_READ_UINT8 (data + 4);
|
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) {
|
if (ctx->dirac_unit) {
|
||||||
gst_buffer_unref (ctx->dirac_unit);
|
gst_buffer_unref (ctx->dirac_unit);
|
||||||
ctx->dirac_unit = NULL;
|
ctx->dirac_unit = NULL;
|
||||||
}
|
}
|
||||||
} else if (parse_code & 0x08) {
|
} else if (DIRAC_PARSE_CODE_IS_PICTURE (parse_code) ||
|
||||||
is_picture = TRUE;
|
parse_code == DIRAC_PARSE_CODE_END_OF_SEQUENCE) {
|
||||||
|
is_muxing_unit = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2483,7 +2486,7 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
||||||
else
|
else
|
||||||
ctx->dirac_unit = gst_buffer_ref (buf);
|
ctx->dirac_unit = gst_buffer_ref (buf);
|
||||||
|
|
||||||
if (is_picture) {
|
if (is_muxing_unit) {
|
||||||
ret = gst_buffer_make_metadata_writable (ctx->dirac_unit);
|
ret = gst_buffer_make_metadata_writable (ctx->dirac_unit);
|
||||||
ctx->dirac_unit = NULL;
|
ctx->dirac_unit = NULL;
|
||||||
gst_buffer_copy_metadata (ret, buf,
|
gst_buffer_copy_metadata (ret, buf,
|
||||||
|
|
Loading…
Reference in a new issue