]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/avlanguage.c
vf_gradfun: move x86 init code to x86/gradfun.c
[ffmpeg] / libavformat / avlanguage.c
index 6a2045a713c2d7bc0956cfdc830c3f8fae89737a..e606ef22f9bc46c10640d655342ac5d4527ae346 100644 (file)
@@ -1,38 +1,39 @@
 /*
  * Cyril Comparon, Larbi Joubala, Resonate-MP4 2009
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "avlanguage.h"
 #include "libavutil/avstring.h"
+#include "libavutil/common.h"
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
 
 typedef struct LangEntry {
     const char str[4];
-    uint16_t nextEquivalent;
+    uint16_t next_equivalent;
 } LangEntry;
 
-const uint16_t langTableCounts[] = { 484, 20, 184 };
-const uint16_t langTableOffsets[] = { 0, 484, 504 };
+static const uint16_t lang_table_counts[] = { 484, 20, 184 };
+static const uint16_t lang_table_offsets[] = { 0, 484, 504 };
 
-static LangEntry langTable[] = {
+static const LangEntry lang_table[] = {
     /*----- AV_LANG_ISO639_2_BIBL entries (484) -----*/
     /*0000*/ { "aar",  504 },
     /*0001*/ { "abk",  505 },
@@ -727,38 +728,38 @@ static LangEntry langTable[] = {
     { "", 0 }
 };
 
-static int langTable_compare(const void *lhs, const void *rhs)
+static int lang_table_compare(const void *lhs, const void *rhs)
 {
     return strcmp(lhs, ((const LangEntry *)rhs)->str);
 }
 
-const char *av_convertLangTo(const char *lang, enum AV_LangCodespace targetCodespace)
+const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace)
 {
     int i;
     const LangEntry *entry = NULL;
-    const int NB_CODESPACES = sizeof(langTableCounts)/sizeof(*langTableCounts);
+    const int NB_CODESPACES = FF_ARRAY_ELEMS(lang_table_counts);
 
-    if (targetCodespace < 0 || targetCodespace >= NB_CODESPACES)
+    if (target_codespace >= NB_CODESPACES)
         return NULL;
 
     for (i=0; !entry && i<NB_CODESPACES; i++)
         entry = bsearch(lang,
-                        langTable + langTableOffsets[i],
-                        langTableCounts[i],
+                        lang_table + lang_table_offsets[i],
+                        lang_table_counts[i],
                         sizeof(LangEntry),
-                        langTable_compare);
+                        lang_table_compare);
     if (!entry)
         return NULL;
 
     for (i=0; i<NB_CODESPACES; i++)
-        if (entry >= langTable + langTableOffsets[targetCodespace] &&
-            entry < langTable + langTableOffsets[targetCodespace] + langTableCounts[targetCodespace])
+        if (entry >= lang_table + lang_table_offsets[target_codespace] &&
+            entry < lang_table + lang_table_offsets[target_codespace] + lang_table_counts[target_codespace])
             return entry->str;
         else
-            entry = langTable + entry->nextEquivalent;
+            entry = lang_table + entry->next_equivalent;
 
-    if (targetCodespace == AV_LANG_ISO639_2_TERM)
-        return av_convertLangTo(lang, AV_LANG_ISO639_2_BIBL);
+    if (target_codespace == AV_LANG_ISO639_2_TERM)
+        return av_convert_lang_to(lang, AV_LANG_ISO639_2_BIBL);
 
     return NULL;
 }