1 /* GStreamer Quicktime/ISO demuxer language utility functions
2 * Copyright (C) 2010 Tim-Philipp Müller <tim centricular net>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #include "qtdemux_debug.h"
21 #include "qtdemux_lang.h"
25 #define GST_CAT_DEFAULT qtdemux_debug
27 /* http://developer.apple.com/mac/library/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html */
29 static const gchar qt_lang_map[][4] = {
42 "eng", "fre", "deu", "ita", "nld", "swe", "spa", "dan", "por", "nor",
53 * 019 Traditional Chinese (ISO 639-2 can't express script differences, so zho)
55 "heb", "jpn", "ara", "fin", "ell", "isl", "mlt", "tur", "hrv", "zho",
65 * 028 Latvian / Lettish
66 * 029 Lappish / Saamish (used code for Nothern Sami)
68 "urd", "hin", "tha", "kor", "lit", "pol", "hun", "est", "lav", "sme",
73 * 033 Simplified Chinese (ISO 639-2 can't express script differences, so zho)
74 * 034 Flemish (no ISO 639-2 code, used Dutch code)
81 "fao", "fas", "rus", "zho", "nld", "gle", "sqi", "ron", "ces", "slk",
94 "slv", "yid", "srp", "mkd", "bul", "ukr", "bel", "uzb", "kaz", "aze",
96 /* 050 AzerbaijanAr (presumably script difference? used aze here)
104 * 058 MongolianCyr (presumably script difference? used mon here)
108 "aze", "hye", "kat", "mol", "kir", "tgk", "tuk", "mon", "mon", "pus",
122 "kur", "kas", "snd", "bod", "nep", "san", "mar", "ben", "asm", "guj",
135 "pan", "ori", "mal", "kan", "tam", "tel", "sin", "mya", "khm", "lao",
143 * 087 Galla (same as Oromo?)
148 "vie", "ind", "tgl", "msa", "msa", "amh", "orm", "orm", "som", "swa",
161 "kin", "run", "nya", "mlg", "ep", "und", "und", "und", "und", "und",
166 "und", "und", "und", "und", "und", "und", "und", "und", "und", "und",
167 "und", "und", "und", "und", "und", "und", "und", "und", "und", "und",
173 "und", "und", "und", "und", "und", "und", "und", "und", "cym", "eus",
185 "cat", "lat", "que", "grn", "aym", "tat", "uig", "dzo", "jav"
188 /* map quicktime language code to ISO-639-2T id, returns "und" if unknown */
190 qtdemux_lang_map_qt_code_to_iso (gchar id[4], guint16 qt_lang_code)
192 const gchar *iso_code;
194 g_assert (qt_lang_code < 0x400);
196 if (qt_lang_code < G_N_ELEMENTS (qt_lang_map))
197 iso_code = qt_lang_map[qt_lang_code];
201 GST_DEBUG ("mapped quicktime language code %u to ISO 639-2T code '%s'",
202 qt_lang_code, iso_code);
204 memcpy (id, iso_code, 4);
206 g_assert (id[3] == '\0');