mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
qtmux: fix subtitle buffer duration and strip null termination
Strip the \0 off the subtitle as we already know the size and also remember to set the duration as buffer copying doesn't do it. https://bugzilla.gnome.org/show_bug.cgi?id=737095
This commit is contained in:
parent
f57e9c4516
commit
6695341583
1 changed files with 8 additions and 3 deletions
|
@ -561,10 +561,11 @@ gst_qt_mux_prepare_tx3g_buffer (GstQTPad * qtpad, GstBuffer * buf,
|
|||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
size = gst_buffer_get_size (buf);
|
||||
gst_buffer_map (buf, &frommap, GST_MAP_READ);
|
||||
|
||||
size = (gint16) strnlen ((const char *) frommap.data, frommap.size);
|
||||
newbuf = gst_buffer_new_and_alloc (size + 2);
|
||||
|
||||
gst_buffer_map (buf, &frommap, GST_MAP_READ);
|
||||
gst_buffer_map (newbuf, &tomap, GST_MAP_WRITE);
|
||||
|
||||
GST_WRITE_UINT16_BE (tomap.data, size);
|
||||
|
@ -575,6 +576,10 @@ gst_qt_mux_prepare_tx3g_buffer (GstQTPad * qtpad, GstBuffer * buf,
|
|||
|
||||
gst_buffer_copy_into (newbuf, buf, GST_BUFFER_COPY_METADATA, 0, size);
|
||||
|
||||
/* gst_buffer_copy_into is trying to be too clever and
|
||||
* won't copy duration when size is different */
|
||||
GST_BUFFER_DURATION (newbuf) = GST_BUFFER_DURATION (buf);
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
return newbuf;
|
||||
|
@ -588,7 +593,7 @@ gst_qt_mux_create_empty_tx3g_buffer (GstQTPad * qtpad, gint64 duration)
|
|||
data = g_malloc (2);
|
||||
GST_WRITE_UINT16_BE (data, 0);
|
||||
|
||||
return gst_buffer_new_wrapped (data, 2);;
|
||||
return gst_buffer_new_wrapped (data, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue