mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-01 09:21:03 +00:00
gst/matroska/matroska-mux.c: Fix muxing of Dirac streams if the input already has the format we need, i.e. is the out...
Original commit message from CVS: * gst/matroska/matroska-mux.c: (gst_matroska_mux_handle_dirac_packet): Fix muxing of Dirac streams if the input already has the format we need, i.e. is the output of matroskademux.
This commit is contained in:
parent
15649903aa
commit
320e96a27c
2 changed files with 43 additions and 29 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2008-11-11 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
* gst/matroska/matroska-mux.c:
|
||||||
|
(gst_matroska_mux_handle_dirac_packet):
|
||||||
|
Fix muxing of Dirac streams if the input already has the format
|
||||||
|
we need, i.e. is the output of matroskademux.
|
||||||
|
|
||||||
2008-11-11 Stefan Kost <ensonic@users.sf.net>
|
2008-11-11 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* gst/avi/gstavimux.c:
|
* gst/avi/gstavimux.c:
|
||||||
|
|
|
@ -2010,49 +2010,56 @@ gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
||||||
GstMatroskaTrackVideoContext *ctx =
|
GstMatroskaTrackVideoContext *ctx =
|
||||||
(GstMatroskaTrackVideoContext *) collect_pad->track;
|
(GstMatroskaTrackVideoContext *) collect_pad->track;
|
||||||
const guint8 *data = GST_BUFFER_DATA (buf);
|
const guint8 *data = GST_BUFFER_DATA (buf);
|
||||||
|
guint size = GST_BUFFER_SIZE (buf);
|
||||||
guint8 parse_code;
|
guint8 parse_code;
|
||||||
|
guint32 next_parse_offset;
|
||||||
GstBuffer *ret = NULL;
|
GstBuffer *ret = NULL;
|
||||||
|
gboolean is_picture = 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 */
|
||||||
|
while (size >= 13) {
|
||||||
if (GST_READ_UINT32_BE (data) != 0x42424344) {
|
if (GST_READ_UINT32_BE (data) != 0x42424344) {
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_code = GST_READ_UINT8 (data + 4);
|
parse_code = GST_READ_UINT8 (data + 4);
|
||||||
|
if (parse_code == 0x00) {
|
||||||
switch (parse_code) {
|
|
||||||
case 0x00:
|
|
||||||
if (ctx->dirac_unit) {
|
if (ctx->dirac_unit) {
|
||||||
gst_buffer_unref (ctx->dirac_unit);
|
gst_buffer_unref (ctx->dirac_unit);
|
||||||
}
|
|
||||||
ctx->dirac_unit = buf;
|
|
||||||
break;
|
|
||||||
case 0x10:
|
|
||||||
case 0x20:
|
|
||||||
case 0x30:
|
|
||||||
if (ctx->dirac_unit)
|
|
||||||
ctx->dirac_unit = gst_buffer_join (ctx->dirac_unit, buf);
|
|
||||||
else
|
|
||||||
ctx->dirac_unit = buf;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* picture */
|
|
||||||
if (ctx->dirac_unit) {
|
|
||||||
ret = gst_buffer_join (ctx->dirac_unit, gst_buffer_ref (buf));
|
|
||||||
ctx->dirac_unit = NULL;
|
ctx->dirac_unit = NULL;
|
||||||
ret = gst_buffer_make_metadata_writable (ret);
|
}
|
||||||
|
} else if (parse_code & 0x08) {
|
||||||
|
is_picture = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
next_parse_offset = GST_READ_UINT32_BE (data + 5);
|
||||||
|
|
||||||
|
data += next_parse_offset;
|
||||||
|
size -= next_parse_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->dirac_unit)
|
||||||
|
ctx->dirac_unit = gst_buffer_join (ctx->dirac_unit, gst_buffer_ref (buf));
|
||||||
|
else
|
||||||
|
ctx->dirac_unit = gst_buffer_ref (buf);
|
||||||
|
|
||||||
|
if (is_picture) {
|
||||||
|
ret = gst_buffer_make_metadata_writable (ctx->dirac_unit);
|
||||||
|
ctx->dirac_unit = NULL;
|
||||||
gst_buffer_copy_metadata (ret, buf,
|
gst_buffer_copy_metadata (ret, buf,
|
||||||
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS |
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS |
|
||||||
GST_BUFFER_COPY_CAPS);
|
GST_BUFFER_COPY_CAPS);
|
||||||
|
gst_buffer_unref (buf);
|
||||||
} else {
|
} else {
|
||||||
ret = buf;
|
gst_buffer_unref (buf);
|
||||||
}
|
ret = NULL;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue