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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 #include "qtdemux_lang.h"
25 /* http://developer.apple.com/mac/library/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html */
27 static const gchar qt_lang_map[][4] = {
40 "eng", "fre", "deu", "ita", "nld", "swe", "spa", "dan", "por", "nor",
51 * 019 Traditional Chinese (ISO 639-2 can't express script differences, so zho)
53 "heb", "jpn", "ara", "fin", "ell", "isl", "mlt", "tur", "hrv", "zho",
63 * 028 Latvian / Lettish
64 * 029 Lappish / Saamish (used code for Nothern Sami)
66 "urd", "hin", "tha", "kor", "lit", "pol", "hun", "est", "lav", "sme",
71 * 033 Simplified Chinese (ISO 639-2 can't express script differences, so zho)
72 * 034 Flemish (no ISO 639-2 code, used Dutch code)
79 "fao", "fas", "rus", "zho", "nld", "gle", "sqi", "ron", "ces", "slk",
92 "slv", "yid", "srp", "mkd", "bul", "ukr", "bel", "uzb", "kaz", "aze",
94 /* 050 AzerbaijanAr (presumably script difference? used aze here)
102 * 058 MongolianCyr (presumably script difference? used mon here)
106 "aze", "hye", "kat", "mol", "kir", "tgk", "tuk", "mon", "mon", "pus",
120 "kur", "kas", "snd", "bod", "nep", "san", "mar", "ben", "asm", "guj",
133 "pan", "ori", "mal", "kan", "tam", "tel", "sin", "mya", "khm", "lao",
141 * 087 Galla (same as Oromo?)
146 "vie", "ind", "tgl", "msa", "msa", "amh", "orm", "orm", "som", "swa",
159 "kin", "run", "nya", "mlg", "ep", "und", "und", "und", "und", "und",
164 "und", "und", "und", "und", "und", "und", "und", "und", "und", "und",
165 "und", "und", "und", "und", "und", "und", "und", "und", "und", "und",
171 "und", "und", "und", "und", "und", "und", "und", "und", "cym", "eus",
183 "cat", "lat", "que", "grn", "aym", "tat", "uig", "dzo", "jav"
186 /* map quicktime language code to ISO-639-2T id, returns "und" if unknown */
188 qtdemux_lang_map_qt_code_to_iso (gchar id[4], guint16 qt_lang_code)
190 const gchar *iso_code;
192 g_assert (qt_lang_code < 0x800);
194 if (qt_lang_code < G_N_ELEMENTS (qt_lang_map))
195 iso_code = qt_lang_map[qt_lang_code];
199 GST_DEBUG ("mapped quicktime language code %u to ISO 639-2T code '%s'",
200 qt_lang_code, iso_code);
202 memcpy (id, iso_code, 4);
204 g_assert (id[3] == '\0');