gst/asfdemux/gstasfdemux.c: Fix some odd cases and fix BE metadata parsing of unicode16 text.

Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_comment):
Fix some odd cases and fix BE metadata parsing of unicode16 text.
This commit is contained in:
Ronald S. Bultje 2004-05-11 04:33:48 +00:00
parent eb0d019820
commit 46b01db52e
2 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2004-05-11 Ronald Bultje <rbultje@ronald.bitfreak.net>
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_comment):
Fix some odd cases and fix BE metadata parsing of unicode16 text.
2004-05-11 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/switch/gstswitch.c: (gst_switch_release_pad),

View file

@ -525,7 +525,7 @@ gst_asf_demux_process_comment (GstASFDemux * asf_demux, guint64 * obj_size)
GST_TAG_COMMENT, NULL /* ? */
};
guint16 *lengths = (guint16 *) & object;
gint i;
gint i, n;
gsize in, out;
GstTagList *taglist;
const GList *padlist;
@ -539,7 +539,6 @@ gst_asf_demux_process_comment (GstASFDemux * asf_demux, guint64 * obj_size)
("Comment lengths: title=%d author=%d copyright=%d description=%d rating=%d",
object.title_length, object.author_length, object.copyright_length,
object.description_length, object.rating_length);
g_print ("comment\n");
for (i = 0; i < 5; i++) {
/* might be just '/0', '/0'... */
if (lengths[i] > 2 && lengths[i] % 2 == 0) {
@ -552,8 +551,13 @@ gst_asf_demux_process_comment (GstASFDemux * asf_demux, guint64 * obj_size)
continue;
/* convert to UTF-8 */
for (n = 0; n < lengths[i] / 2 - 1; n++)
((gint16 *) data)[n] = GUINT16_FROM_LE (((gint16 *) data)[n]);
utf8_comments[i] = g_convert (data, lengths[i],
"UTF-8", "Unicode", &in, &out, NULL);
} else {
if (lengths[i] > 0 && !gst_bytestream_flush (bs, lengths[i]))
goto fail;
}
}