gst/avi/gstavimux.c: Fix padding...

Original commit message from CVS:
* gst/avi/gstavimux.c: (gst_avimux_write_tag):
Fix padding...
This commit is contained in:
Ronald S. Bultje 2005-01-19 20:25:26 +00:00
parent 2b6207564c
commit 5006606231
2 changed files with 11 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2005-01-19 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/avi/gstavimux.c: (gst_avimux_write_tag):
Fix padding...
2005-01-19 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/matroska/ebml-read.c: (gst_ebml_read_buffer):

View file

@ -591,7 +591,7 @@ gst_avimux_write_tag (const GstTagList * list, const gchar * tag, gpointer data)
GST_RIFF_INFO_IARL, GST_TAG_LOCATION}, {
0, NULL}
};
gint n, len;
gint n, len, plen;
GstBuffer *buf = data;
gchar *str;
@ -599,12 +599,15 @@ gst_avimux_write_tag (const GstTagList * list, const gchar * tag, gpointer data)
if (!strcmp (rifftags[n].tag, tag) &&
gst_tag_list_get_string (list, tag, &str)) {
len = strlen (str);
if (GST_BUFFER_MAXSIZE (buf) >= GST_BUFFER_SIZE (buf) + 8 + len + 1) {
plen = len + 1;
if (plen & 1)
plen++;
if (GST_BUFFER_MAXSIZE (buf) >= GST_BUFFER_SIZE (buf) + 8 + plen) {
GST_WRITE_UINT32_LE (GST_BUFFER_DATA (buf), rifftags[n].fcc);
GST_WRITE_UINT32_LE (GST_BUFFER_DATA (buf) + 4, len + 1);
memcpy (GST_BUFFER_DATA (buf) + 8, str, len);
GST_BUFFER_DATA (buf)[8 + len] = 0;
GST_BUFFER_SIZE (buf) += 8 + len + 1;
GST_BUFFER_SIZE (buf) += 8 + plen;
}
}
break;