summaryrefslogtreecommitdiff
path: root/gst/isomp4/qtdemux_lang.c
blob: 0c7a5d9f52563eba246eeef4328ec958024ed2c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/* GStreamer Quicktime/ISO demuxer language utility functions
 * Copyright (C) 2010 Tim-Philipp Müller <tim centricular net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#include "qtdemux.h"
#include "qtdemux_lang.h"

#include <string.h>

/* http://developer.apple.com/mac/library/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html */

static const gchar qt_lang_map[][4] = {

/* 000 English
 * 001 French
 * 002 German
 * 003 Italian
 * 004 Dutch
 * 005 Swedish
 * 006 Spanish
 * 007 Danish
 * 008 Portuguese
 * 009 Norwegian
 */
  "eng", "fre", "deu", "ita", "nld", "swe", "spa", "dan", "por", "nor",

/* 010 Hebrew
 * 011 Japanese
 * 012 Arabic
 * 013 Finnish
 * 014 Greek
 * 015 Icelandic
 * 016 Maltese
 * 017 Turkish
 * 018 Croatian
 * 019 Traditional Chinese (ISO 639-2 can't express script differences, so zho)
 */
  "heb", "jpn", "ara", "fin", "ell", "isl", "mlt", "tur", "hrv", "zho",

/* 020 Urdu
 * 021 Hindi
 * 022 Thai
 * 023 Korean
 * 024 Lithuanian
 * 025 Polish
 * 026 Hungarian
 * 027 Estonian
 * 028 Latvian / Lettish
 * 029 Lappish / Saamish (used code for Nothern Sami)
 */
  "urd", "hin", "tha", "kor", "lit", "pol", "hun", "est", "lav", "sme",

/* 030 Faeroese
 * 031 Farsi
 * 032 Russian
 * 033 Simplified Chinese (ISO 639-2 can't express script differences, so zho)
 * 034 Flemish (no ISO 639-2 code, used Dutch code)
 * 035 Irish
 * 036 Albanian
 * 037 Romanian
 * 038 Czech
 * 039 Slovak
 */
  "fao", "fas", "rus", "zho", "nld", "gle", "sqi", "ron", "ces", "slk",

/* 040 Slovenian
 * 041 Yiddish
 * 042 Serbian
 * 043 Macedonian
 * 044 Bulgarian
 * 045 Ukrainian
 * 046 Byelorussian
 * 047 Uzbek
 * 048 Kazakh
 * 049 Azerbaijani
 */
  "slv", "yid", "srp", "mkd", "bul", "ukr", "bel", "uzb", "kaz", "aze",

/* 050 AzerbaijanAr (presumably script difference? used aze here)
 * 051 Armenian
 * 052 Georgian
 * 053 Moldavian
 * 054 Kirghiz
 * 055 Tajiki
 * 056 Turkmen
 * 057 Mongolian
 * 058 MongolianCyr (presumably script difference? used mon here)
 * 059 Pashto
 */

  "aze", "hye", "kat", "mol", "kir", "tgk", "tuk", "mon", "mon", "pus",


/* 060 Kurdish
 * 061 Kashmiri
 * 062 Sindhi
 * 063 Tibetan
 * 064 Nepali
 * 065 Sanskrit
 * 066 Marathi
 * 067 Bengali
 * 068 Assamese
 * 069 Gujarati
 */
  "kur", "kas", "snd", "bod", "nep", "san", "mar", "ben", "asm", "guj",

/* 070 Punjabi
 * 071 Oriya
 * 072 Malayalam
 * 073 Kannada
 * 074 Tamil
 * 075 Telugu
 * 076 Sinhalese
 * 077 Burmese
 * 078 Khmer
 * 079 Lao
 */
  "pan", "ori", "mal", "kan", "tam", "tel", "sin", "mya", "khm", "lao",

/* 080 Vietnamese
 * 081 Indonesian
 * 082 Tagalog
 * 083 MalayRoman
 * 084 MalayArabic
 * 085 Amharic
 * 087 Galla (same as Oromo?)
 * 087 Oromo
 * 088 Somali
 * 089 Swahili
 */
  "vie", "ind", "tgl", "msa", "msa", "amh", "orm", "orm", "som", "swa",

/* 090 Ruanda
 * 091 Rundi
 * 092 Chewa
 * 093 Malagasy
 * 094 Esperanto
 * 095 ---
 * 096 ---
 * 097 ---
 * 098 ---
 * 099 ---
 */
  "kin", "run", "nya", "mlg", "ep", "und", "und", "und", "und", "und",

/* 100-109 ---
 * 110-119 ---
 */
  "und", "und", "und", "und", "und", "und", "und", "und", "und", "und",
  "und", "und", "und", "und", "und", "und", "und", "und", "und", "und",

/* 120-127 ---
 * 128 Welsh
 * 129 Basque
 */
  "und", "und", "und", "und", "und", "und", "und", "und", "cym", "eus",

/* 130 Catalan
 * 131 Latin
 * 132 Quechua
 * 133 Guarani
 * 134 Aymara
 * 135 Tatar
 * 136 Uighur
 * 137 Dzongkha
 * 138 JavaneseRom
 */
  "cat", "lat", "que", "grn", "aym", "tat", "uig", "dzo", "jav"
};

/* map quicktime language code to ISO-639-2T id, returns "und" if unknown */
void
qtdemux_lang_map_qt_code_to_iso (gchar id[4], guint16 qt_lang_code)
{
  const gchar *iso_code;

  g_assert (qt_lang_code < 0x800);

  if (qt_lang_code < G_N_ELEMENTS (qt_lang_map))
    iso_code = qt_lang_map[qt_lang_code];
  else
    iso_code = "und";

  GST_DEBUG ("mapped quicktime language code %u to ISO 639-2T code '%s'",
      qt_lang_code, iso_code);

  memcpy (id, iso_code, 4);

  g_assert (id[3] == '\0');
}