[FFmpeg-devel] [PATCH] encode mov metadata to UTF-8
Reimar Döffinger
Reimar.Doeffinger
Tue Feb 2 19:45:45 CET 2010
Hello,
not sure if it is correct, since it assumes metadata is store in latin-1 for
all the cases that code handles, however it fixes the output for
http://samples.mplayerhq.hu/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov
correctly displaying the (c) sign (on and UTF-8 console at least).
Index: libavformat/mov.c
===================================================================
--- libavformat/mov.c (revision 21597)
+++ libavformat/mov.c (working copy)
@@ -154,13 +154,18 @@
if (atom.size < 0)
return -1;
- str_size = FFMIN3(sizeof(str)-1, str_size, atom.size);
+ str_size = FFMIN(str_size, atom.size);
if (parse)
parse(c, pb, str_size);
else {
- get_buffer(pb, str, str_size);
- str[str_size] = 0;
+ int i;
+ int pos = 0;
+ for (i = 0; i < str_size && pos < sizeof(str) - 3; i++) {
+ uint8_t tmp;
+ PUT_UTF8(get_byte(pb), tmp, str[pos++] = tmp;)
+ }
+ str[pos] = 0;
av_metadata_set(&c->fc->metadata, key, str);
if (*language && strcmp(language, "und")) {
snprintf(key2, sizeof(key2), "%s-%s", key, language);
More information about the ffmpeg-devel
mailing list