[SCM] libav/experimental: return -1 for errors in ff_mov_iso639_to_lang() to allow for error checking

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:39:39 UTC 2013


The following commit has been merged in the experimental branch:
commit 2904fd398f26f0a2db99dcec54cd009826344c61
Author: Aurelien Jacobs <aurel at gnuage.org>
Date:   Thu Feb 26 13:11:18 2009 +0000

    return -1 for errors in ff_mov_iso639_to_lang() to allow for error checking
    
    Originally committed as revision 17611 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/isom.c b/libavformat/isom.c
index 39c58c6..b78d65e 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -257,7 +257,7 @@ int ff_mov_iso639_to_lang(const char *lang, int mp4)
     }
     /* XXX:can we do that in mov too? */
     if (!mp4)
-        return 0;
+        return -1;
     /* handle undefined as such */
     if (lang[0] == '\0')
         lang = "und";
@@ -265,9 +265,9 @@ int ff_mov_iso639_to_lang(const char *lang, int mp4)
     for (i = 0; i < 3; i++) {
         unsigned char c = (unsigned char)lang[i];
         if (c < 0x60)
-            return 0;
+            return -1;
         if (c > 0x60 + 0x1f)
-            return 0;
+            return -1;
         code <<= 5;
         code |= (c - 0x60);
     }
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ad27850..0a37eb4 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1651,6 +1651,8 @@ static int mov_write_header(AVFormatContext *s)
 
         track->enc = st->codec;
         track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV);
+        if (track->language < 0)
+            track->language = 0;
         track->mode = mov->mode;
         track->tag = mov_find_codec_tag(s, track);
         if (!track->tag) {

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list