]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/isom.c
Prevent infinite recursion of odml indexes.
[ffmpeg] / libavformat / isom.c
index e54a5c968600e60e8ffcdb42ae8cb6f56037c6b9..bf2d3b1daf04c00e7b593e0b52daba7c72af615c 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include "avformat.h"
-#include "riff.h"
+#include "internal.h"
 #include "isom.h"
 
 /* http://www.mp4ra.org */
@@ -67,6 +67,16 @@ const AVCodecTag codec_movvideo_tags[] = {
     { CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, /* UNCOMPRESSED 8BIT 4:2:2 */
     { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2vuy but byte swapped */
 
+    { CODEC_ID_RAWVIDEO, MKTAG('L', '5', '5', '5') },
+    { CODEC_ID_RAWVIDEO, MKTAG('L', '5', '6', '5') },
+    { CODEC_ID_RAWVIDEO, MKTAG('B', '5', '6', '5') },
+    { CODEC_ID_RAWVIDEO, MKTAG('2', '4', 'B', 'G') },
+    { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 'A') },
+    { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 'A') },
+    { CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
+    { CODEC_ID_RAWVIDEO, MKTAG('b', '1', '6', 'g') },
+    { CODEC_ID_RAWVIDEO, MKTAG('b', '4', '8', 'r') },
+
     { CODEC_ID_R210,   MKTAG('r', '2', '1', '0') }, /* UNCOMPRESSED 10BIT RGB */
     { CODEC_ID_V210,   MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */
 
@@ -244,35 +254,35 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = {
 /* cf. QTFileFormat.pdf p253, qtff.pdf p205 */
 /* http://developer.apple.com/documentation/mac/Text/Text-368.html */
 /* deprecated by putting the code as 3*5bit ascii */
-static const char * const mov_mdhd_language_map[] = {
+static const char mov_mdhd_language_map[][4] = {
     /* 0-9 */
     "eng", "fra", "ger", "ita", "dut", "sve", "spa", "dan", "por", "nor",
     "heb", "jpn", "ara", "fin", "gre", "ice", "mlt", "tur", "hr "/*scr*/, "chi"/*ace?*/,
-    "urd", "hin", "tha", "kor", "lit", "pol", "hun", "est", "lav",  NULL,
-    "fo ",  NULL, "rus", "chi",  NULL, "iri", "alb", "ron", "ces", "slk",
+    "urd", "hin", "tha", "kor", "lit", "pol", "hun", "est", "lav",    "",
+    "fo ",    "", "rus", "chi",    "", "iri", "alb", "ron", "ces", "slk",
     "slv", "yid", "sr ", "mac", "bul", "ukr", "bel", "uzb", "kaz", "aze",
     /*?*/
-    "aze", "arm", "geo", "mol", "kir", "tgk", "tuk", "mon",  NULL, "pus",
+    "aze", "arm", "geo", "mol", "kir", "tgk", "tuk", "mon",    "", "pus",
     "kur", "kas", "snd", "tib", "nep", "san", "mar", "ben", "asm", "guj",
-    "pa ", "ori", "mal", "kan", "tam", "tel",  NULL, "bur", "khm", "lao",
+    "pa ", "ori", "mal", "kan", "tam", "tel",    "", "bur", "khm", "lao",
     /*                   roman? arabic? */
     "vie", "ind", "tgl", "may", "may", "amh", "tir", "orm", "som", "swa",
     /*==rundi?*/
-    NULL, "run",  NULL, "mlg", "epo",  NULL,  NULL,  NULL,  NULL,  NULL,
+       "", "run",    "", "mlg", "epo",    "",    "",    "",    "",    "",
     /* 100 */
-    NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,
-    NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,
-    NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL,  NULL, "wel", "baq",
+       "",    "",    "",    "",    "",    "",    "",    "",    "",    "",
+       "",    "",    "",    "",    "",    "",    "",    "",    "",    "",
+       "",    "",    "",    "",    "",    "",    "",    "", "wel", "baq",
     "cat", "lat", "que", "grn", "aym", "tat", "uig", "dzo", "jav"
 };
 
-int ff_mov_iso639_to_lang(const char *lang, int mp4)
+int ff_mov_iso639_to_lang(const char lang[4], int mp4)
 {
     int i, code = 0;
 
     /* old way, only for QT? */
-    for (i = 0; !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
-        if (mov_mdhd_language_map[i] && !strcmp(lang, mov_mdhd_language_map[i]))
+    for (i = 0; lang[0] && !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
+        if (!strcmp(lang, mov_mdhd_language_map[i]))
             return i;
     }
     /* XXX:can we do that in mov too? */
@@ -293,9 +303,10 @@ int ff_mov_iso639_to_lang(const char *lang, int mp4)
     return code;
 }
 
-int ff_mov_lang_to_iso639(unsigned code, char *to)
+int ff_mov_lang_to_iso639(unsigned code, char to[4])
 {
     int i;
+    memset(to, 0, 4);
     /* is it the mangled iso code? */
     /* see http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt */
     if (code > 138) {
@@ -308,8 +319,8 @@ int ff_mov_lang_to_iso639(unsigned code, char *to)
     /* old fashion apple lang code */
     if (code >= FF_ARRAY_ELEMS(mov_mdhd_language_map))
         return 0;
-    if (!mov_mdhd_language_map[code])
+    if (!mov_mdhd_language_map[code][0])
         return 0;
-    strncpy(to, mov_mdhd_language_map[code], 4);
+    memcpy(to, mov_mdhd_language_map[code], 4);
     return 1;
 }