Commit 42100068 authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Jean-Baptiste Kempf

demux: mp4: add new language conversion tables

(cherry picked from commit 2a3c52805fe2527c97310c7a7f59178633a1da1e)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 456cb8f0
...@@ -187,7 +187,8 @@ demux_LTLIBRARIES += $(LTLIBmkv) ...@@ -187,7 +187,8 @@ demux_LTLIBRARIES += $(LTLIBmkv)
EXTRA_LTLIBRARIES += libmkv_plugin.la EXTRA_LTLIBRARIES += libmkv_plugin.la
libmp4_plugin_la_SOURCES = demux/mp4/mp4.c demux/mp4/mp4.h \ libmp4_plugin_la_SOURCES = demux/mp4/mp4.c demux/mp4/mp4.h \
demux/mp4/libmp4.c demux/mp4/libmp4.h demux/mp4/id3genres.h demux/mp4/libmp4.c demux/mp4/libmp4.h \
demux/mp4/id3genres.h demux/mp4/languages.h
libmp4_plugin_la_LIBADD = $(LIBM) libmp4_plugin_la_LIBADD = $(LIBM)
libmp4_plugin_la_LDFLAGS = $(AM_LDFLAGS) libmp4_plugin_la_LDFLAGS = $(AM_LDFLAGS)
if HAVE_ZLIB if HAVE_ZLIB
......
/*****************************************************************************
* languages.h: Quicktime language codes and ISO-639-2/T conversion
*****************************************************************************
* Copyright (C) 2014 VLC authors and VideoLAN
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _VLC_MP4_LANGUAGES_H
#define _VLC_MP4_LANGUAGES_H 1
static bool decodeQtLanguageCode( uint16_t i_language_code, char *psz_iso,
bool *b_mactables )
{
static const char * psz_qt_to_iso639_2T_lower =
"eng" "fra" "deu" "ita" "nld"
"swe" "spa" "dan" "por" "nor" /* 5-9 */
"heb" "jpn" "ara" "fin" "gre"
"isl" "mlt" "tur" "hrv" "zho" /* 15-19 */
"urd" "hin" "tha" "kor" "lit"
"pol" "hun" "est" "lav" "sme" /* 25-29 */
"fao" "fas" "rus" "zho" "nld" /* nld==flemish */
"gle" "sqi" "ron" "ces" "slk" /* 35-39 */
"slv" "yid" "srp" "mkd" "bul"
"ukr" "bel" "uzb" "kaz" "aze" /* 45-49 */
"aze" "hye" "kat" "mol" "kir"
"tgk" "tuk" "mon" "mon" "pus" /* 55-59 */
"kur" "kas" "snd" "bod" "nep"
"san" "mar" "ben" "asm" "guj" /* 65-69 */
"pan" "ori" "mal" "kan" "tam"
"tel" "sin" "mya" "khm" "lao" /* 75-79 */
"vie" "ind" "tgl" "msa" "msa"
"amh" "tir" "orm" "som" "swa" /* 85-89 */
"kin" "run" "nya" "mlg" "epo" /* 90-94 */
;
static const char * psz_qt_to_iso639_2T_upper =
"cym" "eus" "cat" "lat" "que" /* 128-132 */
"grn" "aym" "tat" "uig" "dzo"
"jaw" "sun" "glg" "afr" "bre" /* 138-142 */
"iku" "gla" "glv" "gle" "ton"
"gre" /* 148 */
;
if ( i_language_code < 0x400 || i_language_code == 0x7FFF )
{
const void *p_data;
*b_mactables = true;
if ( i_language_code <= 94 )
{
p_data = psz_qt_to_iso639_2T_lower + i_language_code * 3;
}
else if ( i_language_code >= 128 && i_language_code <= 148 )
{
i_language_code -= 128;
p_data = psz_qt_to_iso639_2T_upper + i_language_code * 3;
}
else
return false;
memcpy( psz_iso, p_data, 3 );
}
else
{
*b_mactables = false;
/*
* to build code: ( ( 'f' - 0x60 ) << 10 ) | ( ('r' - 0x60) << 5 ) | ('a' - 0x60)
*/
if( i_language_code == 0x55C4 ) /* "und" */
{
memset( psz_iso, 0, 3 );
return false;
}
for( unsigned i = 0; i < 3; i++ )
psz_iso[i] = ( ( i_language_code >> ( (2-i)*5 ) )&0x1f ) + 0x60;
}
return true;
}
#endif
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#endif #endif
#include "libmp4.h" #include "libmp4.h"
#include "languages.h"
#include <math.h> #include <math.h>
/* Some assumptions: /* Some assumptions:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment