* src/misc/iso-639.def, include/iso_lang.h, src/misc/iso_lang.c: iso-839-[12] tools.

  * include/common.h, src/misc/modules_plugin.h: export the 3 new functions.
  * plugins/dvd/dvd_es.c, plugins/dvd/dvd_summary.c, plugins/dvdread/input_dvdread.c: adapted DecodeLanguage calls to the new behaviour.
  * plugins/mpeg_system/mpeg_ts.c: ISO-639-2 descriptors handling.
parent b3c38ec9
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.104 2002/05/10 02:04:16 fenrir Exp $
* $Id: common.h,v 1.105 2002/05/14 19:33:54 bozo Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -201,6 +201,8 @@ struct input_buffers_s;
struct network_socket_s;
struct intf_subscription_s;
typedef struct iso639_lang_s iso639_lang_t;
/*****************************************************************************
* Macros and inline functions
*****************************************************************************/
......@@ -700,6 +702,9 @@ typedef struct module_symbols_s
void ( * CurrentPTS ) ( struct bit_stream_s *, mtime_t *,
mtime_t * );
iso639_lang_t * ( * GetLang_1 ) ( const char * );
iso639_lang_t * ( * GetLang_2T ) ( const char * );
iso639_lang_t * ( * GetLang_2B ) ( const char * );
char * ( * DecodeLanguage ) ( u16 );
struct module_s * ( * module_Need ) ( int, char *, void * );
......
......@@ -2,9 +2,10 @@
* iso_lang.h: function to decode language code (in dvd or a52 for instance).
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: iso_lang.h,v 1.3 2002/04/24 00:36:24 sam Exp $
* $Id: iso_lang.h,v 1.4 2002/05/14 19:33:54 bozo Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -21,9 +22,24 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
struct iso639_lang_s
{
char * psz_eng_name; /* Description in English */
char * psz_native_name; /* Description in native language */
char * psz_iso639_1; /* ISO-639-1 (2 characters) code */
char * psz_iso639_2T; /* ISO-639-2/T (3 characters) English code */
char * psz_iso639_2B; /* ISO-639-2/B (3 characters) native code */
};
#ifndef __PLUGIN__
iso639_lang_t * GetLang_1( const char * psz_iso639_1 );
iso639_lang_t * GetLang_2T( const char * psz_iso639_2T );
iso639_lang_t * GetLang_2B( const char * psz_iso639_2B );
char * DecodeLanguage( u16 );
#else
# define GetLang_1 p_symbols->GetLang_1
# define GetLang_2T p_symbols->GetLang_2T
# define GetLang_2B p_symbols->GetLang_2B
# define DecodeLanguage p_symbols->DecodeLanguage
#endif
/* dvd_es.c: functions to find and select ES
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_es.c,v 1.9 2002/04/25 21:52:42 sam Exp $
* $Id: dvd_es.c,v 1.10 2002/05/14 19:33:54 bozo Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -76,7 +76,7 @@ void DVDLaunchDecoders( input_thread_t * p_input );
p_es->i_cat = (cat); \
if( lang ) \
{ \
strcpy( p_es->psz_desc, DecodeLanguage( hton16( lang ) ) ); \
strcpy( p_es->psz_desc, DecodeLanguage( lang ) ); \
}
......
......@@ -3,7 +3,7 @@
* found in .ifo.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_summary.c,v 1.17 2002/04/25 21:52:42 sam Exp $
* $Id: dvd_summary.c,v 1.18 2002/05/14 19:33:54 bozo Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -134,7 +134,7 @@ void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
intf_WarnMsg( 5, "dvd info: audio %d (%s) is %s, "
"%d%s channel%s, %dHz, %s", i,
DecodeLanguage( hton16( audio.i_lang_code ) ),
DecodeLanguage( audio.i_lang_code ),
ppsz_mode[audio.i_coding_mode & 0x7],
audio.i_num_channels + 1,
audio.i_multichannel_extension ? " ext." : "",
......@@ -166,7 +166,7 @@ void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
{
intf_WarnMsg( 5, "dvd info: spu %d (%s), caption %d "
"prefix %x, modes [%s%s%s%s ]", i,
DecodeLanguage( hton16( spu.i_lang_code ) ),
DecodeLanguage( spu.i_lang_code ),
spu.i_caption, spu.i_prefix,
spu_status.i_position_43 ? " 4:3" : "",
spu_status.i_position_wide ? " wide" : "",
......
......@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_dvdread.c,v 1.37 2002/04/25 21:52:42 sam Exp $
* $Id: input_dvdread.c,v 1.38 2002/05/14 19:33:54 bozo Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -683,8 +683,8 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
p_es->i_type = AC3_AUDIO_ES;
p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES;
strcpy( p_es->psz_desc, DecodeLanguage( hton16(
p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) ) );
strcpy( p_es->psz_desc, DecodeLanguage(
p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) );
strcat( p_es->psz_desc, " (ac3)" );
break;
......@@ -696,8 +696,8 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
p_es->i_type = MPEG2_AUDIO_ES;
p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES;
strcpy( p_es->psz_desc, DecodeLanguage( hton16(
p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) ) );
strcpy( p_es->psz_desc, DecodeLanguage(
p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) );
strcat( p_es->psz_desc, " (mpeg)" );
break;
......@@ -709,8 +709,8 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
p_es->i_type = LPCM_AUDIO_ES;
p_es->b_audio = 1;
p_es->i_cat = AUDIO_ES;
strcpy( p_es->psz_desc, DecodeLanguage( hton16(
p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) ) );
strcpy( p_es->psz_desc, DecodeLanguage(
p_vts->vtsi_mat->vts_audio_attr[i-1].lang_code ) );
strcat( p_es->psz_desc, " (lpcm)" );
break;
......@@ -772,8 +772,8 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
p_es->i_stream_id = 0xbd;
p_es->i_type = DVD_SPU_ES;
p_es->i_cat = SPU_ES;
strcpy( p_es->psz_desc, DecodeLanguage( hton16(
p_vts->vtsi_mat->vts_subp_attr[i-1].lang_code ) ) );
strcpy( p_es->psz_desc, DecodeLanguage(
p_vts->vtsi_mat->vts_subp_attr[i-1].lang_code ) );
}
}
#undef spu_control
......
......@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: mpeg_ts.c,v 1.10 2002/04/26 20:18:26 jobi Exp $
* $Id: mpeg_ts.c,v 1.11 2002/05/14 19:33:54 bozo Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
......@@ -36,11 +36,14 @@
#include "input_ext-dec.h"
#include "input_ext-plugins.h"
#include "iso_lang.h"
#if defined MODULE_NAME_IS_mpeg_ts_dvbpsi
#include <dvbpsi/dvbpsi.h>
#include <dvbpsi/descriptor.h>
#include <dvbpsi/pat.h>
#include <dvbpsi/pmt.h>
#include <dvbpsi/dr.h>
#endif
/*****************************************************************************
* Constants
......@@ -841,6 +844,51 @@ void TS_DVBPSI_HandlePMT( input_thread_t * p_input, dvbpsi_pmt_t * p_new_pmt )
default:
p_new_es->i_cat = UNKNOWN_ES;
}
if( p_new_es->i_cat == AUDIO_ES )
{
dvbpsi_descriptor_t *p_dr = p_es->p_first_descriptor;
while( p_dr && ( p_dr->i_tag != 0x0a ) )
p_dr = p_dr->p_next;
if( p_dr )
{
dvbpsi_iso639_dr_t *p_decoded =
dvbpsi_DecodeISO639Dr( p_dr );
if( p_decoded->i_code_count > 0 )
{
iso639_lang_t * p_iso;
p_iso = GetLang_2T(p_decoded->i_iso_639_code);
if(p_iso)
{
if(p_iso->psz_native_name[0])
strcpy( p_new_es->psz_desc,
p_iso->psz_native_name );
else
strcpy( p_new_es->psz_desc,
p_iso->psz_eng_name );
}
else
{
strncpy( p_new_es->psz_desc,
p_decoded->i_iso_639_code, 3 );
}
}
}
switch( p_es->i_type )
{
case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES:
strcat( p_new_es->psz_desc, " (mpeg)" );
break;
case LPCM_AUDIO_ES:
strcat( p_new_es->psz_desc, " (lpcm)" );
break;
case AC3_AUDIO_ES:
strcat( p_new_es->psz_desc, " (ac3)" );
break;
}
}
p_es = p_es->p_next;
}
......
/*
* Defines the languages codes and abbreviations according to ISO 639-[12].
* This is used in iso_lang.cpp and is taken from the GNU glibc 2.2.5 tarball.
* It has been partially completed with native language name.
*
* Format is: ("English name", 639-1-code, 639-2/T-code, 639-2/B-code)
* If you find something missing or wrong contact <bug-glibc@gnu.org>
*/
DEFINE_LANGUAGE_CODE ("Afar", "", aa, aar, aar)
DEFINE_LANGUAGE_CODE ("Abkhazian", "", ab, abk, abk)
DEFINE_LANGUAGE_CODE ("Afrikaans", "", af, afr, afr)
DEFINE_LANGUAGE_CODE ("Albanian", "", sq, sqi, alb)
DEFINE_LANGUAGE_CODE ("Amharic", "", am, amh, amh)
DEFINE_LANGUAGE_CODE ("Arabic", "", ar, ara, ara)
DEFINE_LANGUAGE_CODE ("Armenian", "", hy, hye, arm)
DEFINE_LANGUAGE_CODE ("Assamese", "", as, asm, asm)
DEFINE_LANGUAGE_CODE ("Avestan", "", ae, ave, ave)
DEFINE_LANGUAGE_CODE ("Aymara", "", ay, aym, aym)
DEFINE_LANGUAGE_CODE ("Azerbaijani", "", az, aze, aze)
DEFINE_LANGUAGE_CODE ("Bashkir", "", ba, bak, bak)
DEFINE_LANGUAGE_CODE ("Basque", "", eu, eus, baq)
DEFINE_LANGUAGE_CODE ("Belarusian", "", be, bel, bel)
DEFINE_LANGUAGE_CODE ("Bengali", "", bn, ben, ben)
DEFINE_LANGUAGE_CODE ("Bihari", "", bh, bih, bih)
DEFINE_LANGUAGE_CODE ("Bislama", "", bi, bis, bis)
DEFINE_LANGUAGE_CODE ("Bosnian", "", bs, bos, bos)
DEFINE_LANGUAGE_CODE ("Breton", "", br, bre, bre)
DEFINE_LANGUAGE_CODE ("Bulgarian", "", bg, bul, bul)
DEFINE_LANGUAGE_CODE ("Burmese", "", my, mya, bur)
DEFINE_LANGUAGE_CODE ("Catalan", "", ca, cat, cat)
DEFINE_LANGUAGE_CODE ("Chamorro", "", ch, cha, cha)
DEFINE_LANGUAGE_CODE ("Chechen", "", ce, che, che)
DEFINE_LANGUAGE_CODE ("Chinese", "", zh, zho, chi)
DEFINE_LANGUAGE_CODE ("Church Slavic", "", cu, chu, chu)
DEFINE_LANGUAGE_CODE ("Chuvash", "", cv, chv, chv)
DEFINE_LANGUAGE_CODE ("Cornish", "", kw, cor, cor)
DEFINE_LANGUAGE_CODE ("Corsican", "", co, cos, cos)
DEFINE_LANGUAGE_CODE ("Czech", "", cs, ces, cze)
DEFINE_LANGUAGE_CODE ("Danish", "Dansk", da, dan, dan)
DEFINE_LANGUAGE_CODE ("Dutch", "Nederlands", nl, nld, dut)
DEFINE_LANGUAGE_CODE ("Dzongkha", "", dz, dzo, dzo)
DEFINE_LANGUAGE_CODE ("English", "English", en, eng, eng)
DEFINE_LANGUAGE_CODE ("Esperanto", "", eo, epo, epo)
DEFINE_LANGUAGE_CODE ("Estonian", "", et, est, est)
DEFINE_LANGUAGE_CODE ("Faroese", "", fo, fao, fao)
DEFINE_LANGUAGE_CODE ("Fijian", "", fj, fij, fij)
DEFINE_LANGUAGE_CODE ("Finnish", "Suomi", fi, fin, fin)
DEFINE_LANGUAGE_CODE ("French", "Francais", fr, fra, fre)
DEFINE_LANGUAGE_CODE ("Frisian", "", fy, fry, fry)
DEFINE_LANGUAGE_CODE ("Georgian", "", ka, kat, geo)
DEFINE_LANGUAGE_CODE ("German", "Deutsch", de, deu, ger)
DEFINE_LANGUAGE_CODE ("Gaelic (Scots)", "", gd, gla, gla)
DEFINE_LANGUAGE_CODE ("Irish", "", ga, gle, gle)
DEFINE_LANGUAGE_CODE ("Gallegan", "", gl, glg, glg)
DEFINE_LANGUAGE_CODE ("Manx", "", gv, glv, glv)
DEFINE_LANGUAGE_CODE ("Greek, Modern ()", "", el, gre, ell)
DEFINE_LANGUAGE_CODE ("Guarani", "", gn, grn, grn)
DEFINE_LANGUAGE_CODE ("Gujarati", "", gu, guj, guj)
DEFINE_LANGUAGE_CODE ("Hebrew", "", he, heb, heb)
DEFINE_LANGUAGE_CODE ("Herero", "", hz, her, her)
DEFINE_LANGUAGE_CODE ("Hindi", "", hi, hin, hin)
DEFINE_LANGUAGE_CODE ("Hiri Motu", "", ho, hmo, hmo)
DEFINE_LANGUAGE_CODE ("Hungarian", "Magyar", hu, hun, hun)
DEFINE_LANGUAGE_CODE ("Icelandic", "Islenska", is, isl, ice)
DEFINE_LANGUAGE_CODE ("Inuktitut", "", iu, iku, iku)
DEFINE_LANGUAGE_CODE ("Interlingue", "", ie, ile, ile)
DEFINE_LANGUAGE_CODE ("Interlingua", "", ia, ina, ina)
DEFINE_LANGUAGE_CODE ("Indonesian", "", id, ind, ind)
DEFINE_LANGUAGE_CODE ("Inupiaq", "", ik, ipk, ipk)
DEFINE_LANGUAGE_CODE ("Italian", "Italiano", it, ita, ita)
DEFINE_LANGUAGE_CODE ("Javanese", "", jv, jaw, jav)
DEFINE_LANGUAGE_CODE ("Japanese", "", ja, jpn, jpn)
DEFINE_LANGUAGE_CODE ("Kalaallisut (Greenlandic)", "", kl, kal, kal)
DEFINE_LANGUAGE_CODE ("Kannada", "", kn, kan, kan)
DEFINE_LANGUAGE_CODE ("Kashmiri", "", ks, kas, kas)
DEFINE_LANGUAGE_CODE ("Kazakh", "", kk, kaz, kaz)
DEFINE_LANGUAGE_CODE ("Khmer", "", km, khm, khm)
DEFINE_LANGUAGE_CODE ("Kikuyu", "", ki, kik, kik)
DEFINE_LANGUAGE_CODE ("Kinyarwanda", "", rw, kin, kin)
DEFINE_LANGUAGE_CODE ("Kirghiz", "", ky, kir, kir)
DEFINE_LANGUAGE_CODE ("Komi", "", kv, kom, kom)
DEFINE_LANGUAGE_CODE ("Korean", "", ko, kor, kor)
DEFINE_LANGUAGE_CODE ("Kuanyama", "", kj, kua, kua)
DEFINE_LANGUAGE_CODE ("Kurdish", "", ku, kur, kur)
DEFINE_LANGUAGE_CODE ("Lao", "", lo, lao, lao)
DEFINE_LANGUAGE_CODE ("Latin", "", la, lat, lat)
DEFINE_LANGUAGE_CODE ("Latvian", "", lv, lav, lav)
DEFINE_LANGUAGE_CODE ("Lingala", "", ln, lin, lin)
DEFINE_LANGUAGE_CODE ("Lithuanian", "", lt, lit, lit)
DEFINE_LANGUAGE_CODE ("Letzeburgesch", "", lb, ltz, ltz)
DEFINE_LANGUAGE_CODE ("Macedonian", "", mk, mkd, mac)
DEFINE_LANGUAGE_CODE ("Marshall", "", mh, mah, mah)
DEFINE_LANGUAGE_CODE ("Malayalam", "", ml, mal, mal)
DEFINE_LANGUAGE_CODE ("Maori", "", mi, mri, mao)
DEFINE_LANGUAGE_CODE ("Marathi", "", mr, mar, mar)
DEFINE_LANGUAGE_CODE ("Malay", "", ms, msa, may)
DEFINE_LANGUAGE_CODE ("Malagasy", "", mg, mlg, mlg)
DEFINE_LANGUAGE_CODE ("Maltese", "", mt, mlt, mlt)
DEFINE_LANGUAGE_CODE ("Moldavian", "", mo, mol, mol)
DEFINE_LANGUAGE_CODE ("Mongolian", "", mn, mon, mon)
DEFINE_LANGUAGE_CODE ("Nauru", "", na, nau, nau)
DEFINE_LANGUAGE_CODE ("Navajo", "", nv, nav, nav)
DEFINE_LANGUAGE_CODE ("Ndebele, South", "", nr, nbl, nbl)
DEFINE_LANGUAGE_CODE ("Ndebele, North", "", nd, nde, nde)
DEFINE_LANGUAGE_CODE ("Ndonga", "", ng, ndo, ndo)
DEFINE_LANGUAGE_CODE ("Nepali", "", ne, nep, nep)
DEFINE_LANGUAGE_CODE ("Norwegian", "Norsk", no, nor, nor)
DEFINE_LANGUAGE_CODE ("Norwegian Nynorsk", "", nn, nno, nno)
DEFINE_LANGUAGE_CODE ("Norwegian Bokmål", "", nb, nob, nob)
DEFINE_LANGUAGE_CODE ("Chichewa; Nyanja", "", ny, nya, nya)
DEFINE_LANGUAGE_CODE ("Occitan (post 1500); Provençal", "", oc, oci, oci)
DEFINE_LANGUAGE_CODE ("Oriya", "", or, ori, ori)
DEFINE_LANGUAGE_CODE ("Oromo", "", om, orm, orm)
DEFINE_LANGUAGE_CODE ("Ossetian; Ossetic", "", os, oss, oss)
DEFINE_LANGUAGE_CODE ("Panjabi", "", pa, pan, pan)
DEFINE_LANGUAGE_CODE ("Persian", "", fa, fas, per)
DEFINE_LANGUAGE_CODE ("Pali", "", pi, pli, pli)
DEFINE_LANGUAGE_CODE ("Polish", "", pl, pol, pol)
DEFINE_LANGUAGE_CODE ("Portuguese", "Portugues", pt, por, por)
DEFINE_LANGUAGE_CODE ("Pushto", "", ps, pus, pus)
DEFINE_LANGUAGE_CODE ("Quechua", "", qu, que, que)
DEFINE_LANGUAGE_CODE ("Raeto-Romance", "", rm, roh, roh)
DEFINE_LANGUAGE_CODE ("Romanian", "", ro, ron, rum)
DEFINE_LANGUAGE_CODE ("Rundi", "", rn, run, run)
DEFINE_LANGUAGE_CODE ("Russian", "", ru, rus, rus)
DEFINE_LANGUAGE_CODE ("Sango", "", sg, sag, sag)
DEFINE_LANGUAGE_CODE ("Sanskrit", "", sa, san, san)
DEFINE_LANGUAGE_CODE ("Serbian", "", sr, srp, scc)
DEFINE_LANGUAGE_CODE ("Croatian", "Hrvatski", hr, hrv, scr)
DEFINE_LANGUAGE_CODE ("Sinhalese", "", si, sin, sin)
DEFINE_LANGUAGE_CODE ("Slovak", "", sk, slk, slo)
DEFINE_LANGUAGE_CODE ("Slovenian", "", sl, slv, slv)
DEFINE_LANGUAGE_CODE ("Northern Sami", "", se, sme, sme)
DEFINE_LANGUAGE_CODE ("Samoan", "", sm, smo, smo)
DEFINE_LANGUAGE_CODE ("Shona", "", sn, sna, sna)
DEFINE_LANGUAGE_CODE ("Sindhi", "", sd, snd, snd)
DEFINE_LANGUAGE_CODE ("Somali", "", so, som, som)
DEFINE_LANGUAGE_CODE ("Sotho, Southern", "", st, sot, sot)
DEFINE_LANGUAGE_CODE ("Spanish", "Espanol", es, spa, spa)
DEFINE_LANGUAGE_CODE ("Sardinian", "", sc, srd, srd)
DEFINE_LANGUAGE_CODE ("Swati", "", ss, ssw, ssw)
DEFINE_LANGUAGE_CODE ("Sundanese", "", su, sun, sun)
DEFINE_LANGUAGE_CODE ("Swahili", "", sw, swa, swa)
DEFINE_LANGUAGE_CODE ("Swedish", "Svenska", sv, swe, swe)
DEFINE_LANGUAGE_CODE ("Tahitian", "", ty, tah, tah)
DEFINE_LANGUAGE_CODE ("Tamil", "", ta, tam, tam)
DEFINE_LANGUAGE_CODE ("Tatar", "", tt, tat, tat)
DEFINE_LANGUAGE_CODE ("Telugu", "", te, tel, tel)
DEFINE_LANGUAGE_CODE ("Tajik", "", tg, tgk, tgk)
DEFINE_LANGUAGE_CODE ("Tagalog", "", tl, tgl, tgl)
DEFINE_LANGUAGE_CODE ("Thai", "", th, tha, tha)
DEFINE_LANGUAGE_CODE ("Tibetan", "", bo, bod, tib)
DEFINE_LANGUAGE_CODE ("Tigrinya", "", ti, tir, tir)
DEFINE_LANGUAGE_CODE ("Tonga (Tonga Islands)", "", to, ton, ton)
DEFINE_LANGUAGE_CODE ("Tswana", "", tn, tsn, tsn)
DEFINE_LANGUAGE_CODE ("Tsonga", "", ts, tso, tso)
DEFINE_LANGUAGE_CODE ("Turkish", "", tr, tur, tur)
DEFINE_LANGUAGE_CODE ("Turkmen", "", tk, tuk, tuk)
DEFINE_LANGUAGE_CODE ("Twi", "", tw, twi, twi)
DEFINE_LANGUAGE_CODE ("Uighur", "", ug, uig, uig)
DEFINE_LANGUAGE_CODE ("Ukrainian", "", uk, ukr, ukr)
DEFINE_LANGUAGE_CODE ("Urdu", "", ur, urd, urd)
DEFINE_LANGUAGE_CODE ("Uzbek", "", uz, uzb, uzb)
DEFINE_LANGUAGE_CODE ("Vietnamese", "", vi, vie, vie)
DEFINE_LANGUAGE_CODE ("Volapük", "", vo, vol, vol)
DEFINE_LANGUAGE_CODE ("Welsh", "", cy, cym, wel)
DEFINE_LANGUAGE_CODE ("Wolof", "", wo, wol, wol)
DEFINE_LANGUAGE_CODE ("Xhosa", "", xh, xho, xho)
DEFINE_LANGUAGE_CODE ("Yiddish", "", yi, yid, yid)
DEFINE_LANGUAGE_CODE ("Yoruba", "", yo, yor, yor)
DEFINE_LANGUAGE_CODE ("Zhuang", "", za, zha, zha)
DEFINE_LANGUAGE_CODE ("Zulu", "", zu, zul, zul)
......@@ -2,9 +2,10 @@
* iso_lang.c: function to decode language code (in dvd or a52 for instance).
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: iso_lang.c,v 1.3 2001/12/30 07:09:56 sam Exp $
* $Id: iso_lang.c,v 1.4 2002/05/14 19:33:54 bozo Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -28,180 +29,83 @@
#include <videolan/vlc.h>
#include "iso_lang.h"
/*****************************************************************************
* Local tables
*****************************************************************************/
static struct
{
char p_code[3];
char p_lang_long[20];
}
lang_tbl[] =
static iso639_lang_t p_iso_languages[] =
{
/* The ISO 639 language codes.
* Language names with * prefix are not spelled in their own language
*/
{ " ", "Not Specified" },
{ "aa", "*Afar" },
{ "ab", "*Abkhazian" },
{ "af", "*Afrikaans" },
{ "am", "*Amharic" },
{ "ar", "*Arabic" },
{ "as", "*Assamese" },
{ "ay", "*Aymara" },
{ "az", "*Azerbaijani" },
{ "ba", "*Bashkir" },
{ "be", "*Byelorussian" },
{ "bg", "*Bulgarian" },
{ "bh", "*Bihari" },
{ "bi", "*Bislama" },
{ "bn", "*Bengali; Bangla" },
{ "bo", "*Tibetan" },
{ "br", "*Breton" },
{ "ca", "*Catalan" },
{ "co", "*Corsican" },
{ "cs", "*Czech(Ceske)" },
{ "cy", "*Welsh" },
{ "da", "Dansk" },
{ "de", "Deutsch" },
{ "dz", "*Bhutani" },
{ "el", "*Greek" },
{ "en", "English" },
{ "eo", "*Esperanto" },
{ "es", "Espanol" },
{ "et", "*Estonian" },
{ "eu", "*Basque" },
{ "fa", "*Persian" },
{ "fi", "Suomi" },
{ "fj", "*Fiji" },
{ "fo", "*Faroese" },
{ "fr", "Francais" },
{ "fy", "*Frisian" },
{ "ga", "*Irish" },
{ "gd", "*Scots Gaelic" },
{ "gl", "*Galician" },
{ "gn", "*Guarani" },
{ "gu", "*Gujarati" },
{ "ha", "*Hausa" },
{ "he", "*Hebrew" }, /* formerly iw */
{ "hi", "*Hindi" },
{ "hr", "Hrvatski" }, /* Croatian */
{ "hu", "Magyar" },
{ "hy", "*Armenian" },
{ "ia", "*Interlingua" },
{ "id", "*Indonesian" }, /* formerly in */
{ "ie", "*Interlingue" },
{ "ik", "*Inupiak" },
{ "in", "*Indonesian" }, /* replaced by id */
{ "is", "Islenska" },
{ "it", "Italiano" },
{ "iu", "*Inuktitut" },
{ "iw", "*Hebrew" }, /* replaced by he */
{ "ja", "*Japanese" },
{ "ji", "*Yiddish" }, /* replaced by yi */
{ "jw", "*Javanese" },
{ "ka", "*Georgian" },
{ "kk", "*Kazakh" },
{ "kl", "*Greenlandic" },
{ "km", "*Cambodian" },
{ "kn", "*Kannada" },
{ "ko", "*Korean" },
{ "ks", "*Kashmiri" },
{ "ku", "*Kurdish" },
{ "ky", "*Kirghiz" },
{ "la", "*Latin" },
{ "ln", "*Lingala" },
{ "lo", "*Laothian" },
{ "lt", "*Lithuanian" },
{ "lv", "*Latvian, Lettish" },
{ "mg", "*Malagasy" },
{ "mi", "*Maori" },
{ "mk", "*Macedonian" },
{ "ml", "*Malayalam" },
{ "mn", "*Mongolian" },
{ "mo", "*Moldavian" },
{ "mr", "*Marathi" },
{ "ms", "*Malay" },
{ "mt", "*Maltese" },
{ "my", "*Burmese" },
{ "na", "*Nauru" },
{ "ne", "*Nepali" },
{ "nl", "Nederlands" },
{ "no", "Norsk" },
{ "oc", "*Occitan" },
{ "om", "*(Afan) Oromo" },
{ "or", "*Oriya" },
{ "pa", "*Punjabi" },
{ "pl", "*Polish" },
{ "ps", "*Pashto, Pushto" },
{ "pt", "Portugues" },
{ "qu", "*Quechua" },
{ "rm", "*Rhaeto-Romance" },
{ "rn", "*Kirundi" },
{ "ro", "*Romanian" },
{ "ru", "*Russian" },
{ "rw", "*Kinyarwanda" },
{ "sa", "*Sanskrit" },
{ "sd", "*Sindhi" },
{ "sg", "*Sangho" },
{ "sh", "*Serbo-Croatian" },
{ "si", "*Sinhalese" },
{ "sk", "*Slovak" },
{ "sl", "*Slovenian" },
{ "sm", "*Samoan" },
{ "sn", "*Shona" },
{ "so", "*Somali" },
{ "sq", "*Albanian" },
{ "sr", "*Serbian" },
{ "ss", "*Siswati" },
{ "st", "*Sesotho" },
{ "su", "*Sundanese" },
{ "sv", "Svenska" },
{ "sw", "*Swahili" },
{ "ta", "*Tamil" },
{ "te", "*Telugu" },
{ "tg", "*Tajik" },
{ "th", "*Thai" },
{ "ti", "*Tigrinya" },
{ "tk", "*Turkmen" },
{ "tl", "*Tagalog" },
{ "tn", "*Setswana" },
{ "to", "*Tonga" },
{ "tr", "*Turkish" },
{ "ts", "*Tsonga" },
{ "tt", "*Tatar" },
{ "tw", "*Twi" },
{ "ug", "*Uighur" },
{ "uk", "*Ukrainian" },
{ "ur", "*Urdu" },
{ "uz", "*Uzbek" },
{ "vi", "*Vietnamese" },
{ "vo", "*Volapuk" },
{ "wo", "*Wolof" },
{ "xh", "*Xhosa" },
{ "yi", "*Yiddish" }, /* formerly ji */
{ "yo", "*Yoruba" },
{ "za", "*Zhuang" },
{ "zh", "*Chinese" },
{ "zu", "*Zulu" },
{ "\0", "" }
#define DEFINE_LANGUAGE_CODE(engName, nativeName, iso1, iso2T, iso2B) \
{ engName, nativeName, #iso1, #iso2T, #iso2B },
{ "", "", "", "", "" },
#include "iso-639.def"
};
/*****************************************************************************
* DecodeLanguage: gives the long language name from the two-letters
* ISO-639 code
*****************************************************************************/
char * DecodeLanguage( u16 i_code )
{
int i = 0;
u8 code[2];
iso639_lang_t * p_iso;
code[0] = i_code >> 8;
code[1] = i_code;
p_iso = GetLang_1( code );
if( p_iso )
{
if( p_iso->psz_native_name[0] )
return p_iso->psz_native_name;
else
return p_iso->psz_eng_name;
}
return p_iso_languages[sizeof( p_iso_languages ) /
sizeof( iso639_lang_t ) - 1].psz_native_name;
}
iso639_lang_t * GetLang_1( const char * psz_iso639_1 )
{
unsigned int i;
for( i = 0; i < sizeof( p_iso_languages ) / sizeof( iso639_lang_t ); i++ )
{
if( !strncmp( p_iso_languages[i].psz_iso639_1, psz_iso639_1, 2 ) )
break;
}
if( i < sizeof( p_iso_languages ) / sizeof( iso639_lang_t ) )
return &p_iso_languages[i];
else
return NULL;
}
while( memcmp( lang_tbl[i].p_code, &i_code, 2 ) &&
lang_tbl[i].p_lang_long[0] )
iso639_lang_t * GetLang_2T( const char * psz_iso639_2T )
{
unsigned int i;
for( i = 0; i < sizeof( p_iso_languages ) / sizeof( iso639_lang_t ); i++ )
{
i++;
if( !strncmp( p_iso_languages[i].psz_iso639_2T, psz_iso639_2T, 2 ) )
break;
}
if( i < sizeof( p_iso_languages ) / sizeof( iso639_lang_t ) )
return &p_iso_languages[i];
else
return NULL;
}
return lang_tbl[i].p_lang_long;
iso639_lang_t * GetLang_2B( const char * psz_iso639_2B )
{
unsigned int i;
for( i = 0; i < sizeof( p_iso_languages ) / sizeof( iso639_lang_t ); i++ )
{
if( !strncmp( p_iso_languages[i].psz_iso639_2B, psz_iso639_2B, 2 ) )
break;
}
if( i < sizeof( p_iso_languages ) / sizeof( iso639_lang_t ) )
return &p_iso_languages[i];
else
return NULL;
}
......@@ -2,7 +2,7 @@
* modules_plugin.h : Plugin management functions used by the core application.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules_plugin.h,v 1.25 2002/05/10 02:04:17 fenrir Exp $
* $Id: modules_plugin.h,v 1.26 2002/05/14 19:33:54 bozo Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -293,6 +293,9 @@ module_error( char *psz_buffer )
(p_symbols)->UnalignedRemoveBits = UnalignedRemoveBits; \
(p_symbols)->UnalignedShowBits = UnalignedShowBits; \
(p_symbols)->CurrentPTS = CurrentPTS; \
(p_symbols)->GetLang_1 = GetLang_1; \
(p_symbols)->GetLang_2T = GetLang_2T; \
(p_symbols)->GetLang_2B = GetLang_2B; \
(p_symbols)->DecodeLanguage = DecodeLanguage; \
(p_symbols)->module_Need = module_Need; \
(p_symbols)->module_Unneed = module_Unneed;
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