*Move function that translates language codes into country name in src/misc
authorStéphane Borel <stef@videolan.org>
Wed, 7 Nov 2001 17:37:16 +0000 (17:37 +0000)
committerStéphane Borel <stef@videolan.org>
Wed, 7 Nov 2001 17:37:16 +0000 (17:37 +0000)
so that every plugin can use it

*Change the name of a function in dvd_udf.c to fit with the forthcoming
 libdvdread plugin.

Makefile
include/iso_lang.h [new file with mode: 0644]
plugins/dvd/dvd_ifo.c
plugins/dvd/dvd_summary.c
plugins/dvd/dvd_summary.h
plugins/dvd/dvd_udf.c
plugins/dvd/input_dvd.c
src/misc/iso_lang.c [new file with mode: 0644]

index 10e0ea8..6dc765c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,12 +13,82 @@ endif
 # 
 # All possible plugin directories, needed for make clean
 #
-PLUGINS_DIR := alsa beos darwin directx dsp dummy dvd esd fb ggi glide gtk downmix idct imdct kde macosx mga motion mpeg qt sdl text vcd x11 yuv
+PLUGINS_DIR := alsa \
+               beos \
+               darwin \
+               directx \
+               dsp \
+               dummy \
+               dvd \
+               esd \
+               fb \
+               ggi \
+               glide \
+               gtk \
+               downmix \
+               idct \
+               imdct \
+               kde \
+               macosx \
+               mga \
+               motion \
+               mpeg \
+               qt \
+               sdl \
+               text \
+               vcd \
+               x11 \
+               yuv
 
 #
 # All possible plugin objects
 #
-PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin directx/directx dsp/dsp dummy/dummy dummy/null dvd/dvd esd/esd fb/fb ggi/ggi glide/glide gtk/gnome gtk/gtk downmix/downmix downmix/downmixsse downmix/downmix3dn idct/idct idct/idctclassic idct/idctmmx idct/idctmmxext idct/idctaltivec imdct/imdct imdct/imdct3dn imdct/imdctsse kde/kde macosx/macosx macosx/macosx_qt mga/mga motion/motion motion/motionmmx motion/motionmmxext motion/motion3dnow motion/motionaltivec mpeg/es mpeg/ps mpeg/ts qt/qt sdl/sdl text/ncurses text/rc vcd/vcd x11/x11 x11/xvideo yuv/yuv yuv/yuvmmx
+PLUGINS_TARGETS := alsa/alsa \
+               beos/beos \
+               darwin/darwin \
+               directx/directx \
+               dsp/dsp \
+               dummy/dummy \
+               dummy/null \
+               dvd/dvd \
+               esd/esd \
+               fb/fb \
+               ggi/ggi \
+               glide/glide \
+               gtk/gnome \
+               gtk/gtk \
+               downmix/downmix \
+               downmix/downmixsse \
+               downmix/downmix3dn \
+               idct/idct \
+               idct/idctclassic \
+               idct/idctmmx \
+               idct/idctmmxext \
+               idct/idctaltivec \
+               imdct/imdct \
+               imdct/imdct3dn \
+               imdct/imdctsse \
+               kde/kde \
+               macosx/macosx \
+               macosx/macosx_qt \
+               mga/mga \
+               motion/motion \
+               motion/motionmmx \
+               motion/motionmmxext \
+               motion/motion3dnow \
+               motion/motionaltivec \
+               mpeg/es \
+               mpeg/ps \
+               mpeg/ts \
+               qt/qt \
+               sdl/sdl \
+               text/ncurses \
+               text/rc \
+               vcd/vcd \
+               x11/x11 \
+               x11/xvideo \
+               yuv/yuv \
+               yuv/yuvmmx
 
 #
 # C Objects
@@ -33,7 +103,7 @@ LPCM_DECODER := lpcm_decoder_thread
 AUDIO_DECODER := audio_decoder adec_generic adec_layer1 adec_layer2 adec_math
 SPU_DECODER := spu_decoder
 VIDEO_DECODER := video_parser vpar_headers vpar_blocks vpar_synchro vpar_pool video_decoder
-MISC := mtime tests modules netutils
+MISC := mtime tests modules netutils iso_lang
 
 C_OBJ :=       $(INTERFACE:%=src/interface/%.o) \
                $(INPUT:%=src/input/%.o) \
@@ -406,4 +476,3 @@ $(BUILTIN_OBJ): FORCE
 #
 libdvdcss: Makefile.opts
        cd extras/libdvdcss && $(MAKE)
-
diff --git a/include/iso_lang.h b/include/iso_lang.h
new file mode 100644 (file)
index 0000000..1858c8d
--- /dev/null
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * 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.1 2001/11/07 17:37:16 stef Exp $
+ *
+ * Author: Stéphane Borel <stef@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
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+char * DecodeLanguage( u16 );
index 56491d8..4e1793d 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_ifo.c: Functions for ifo parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_ifo.c,v 1.39 2001/11/07 03:37:27 stef Exp $
+ * $Id: dvd_ifo.c,v 1.40 2001/11/07 17:37:16 stef Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          German Tischler <tanis@gaspode.franken.de>
@@ -124,7 +124,7 @@ int IfoInit( ifo_t * p_ifo )
     int                 i_start;
 
     /* find the start sector of video information on the dvd */
-    p_ifo->i_start = UDFFindFile( p_ifo->dvdhandle, "/VIDEO_TS/VIDEO_TS.IFO" );
+    p_ifo->i_start = DVDUDFFindFile( p_ifo->dvdhandle, "/VIDEO_TS/VIDEO_TS.IFO" );
     if( !p_ifo->i_start ) return -1;
 
     p_tmp = FillBuffer( p_ifo, p_buf, p_ifo->i_start );
@@ -1328,7 +1328,7 @@ static int ReadCellInf( ifo_t * p_ifo, cell_inf_t * p_cell_inf, int i_block )
 
     p_tmp = FillBuffer( p_ifo, p_buf, i_block );
     i_start = p_ifo->i_pos;
-    //fprintf( stderr, "CELL ADD\n" );
+//    fprintf( stderr, "CELL ADD\n" );
 
     p_cell_inf->i_vob_nb = ReadWord( p_ifo, p_buf, &p_tmp );
     DumpBytes( p_ifo, p_buf, &p_tmp, 2 );
@@ -1336,8 +1336,8 @@ static int ReadCellInf( ifo_t * p_ifo, cell_inf_t * p_cell_inf, int i_block )
 
     p_cell_inf->i_cell_nb = (p_cell_inf->i_end_byte/* - 7*/) / sizeof(cell_map_t);
 
-    //fprintf( stderr, "Cell inf: vob %d end %d cell %d\n", p_cell_inf->i_vob_nb, p_cell_inf->i_end_byte,  p_cell_inf->i_cell_nb );
-
+/*    fprintf( stderr, "Cell inf: vob %d end %d cell %d\n", p_cell_inf->i_vob_nb, p_cell_inf->i_end_byte,  p_cell_inf->i_cell_nb );
+*/
     p_cell_inf->p_cell_map =
                 malloc( p_cell_inf->i_cell_nb *sizeof(cell_map_t) );
     if( p_cell_inf->p_cell_map == NULL )
@@ -1353,7 +1353,7 @@ static int ReadCellInf( ifo_t * p_ifo, cell_inf_t * p_cell_inf, int i_block )
         MAP.i_cell_id = ReadByte( p_ifo, p_buf, &p_tmp );
         DumpBytes( p_ifo, p_buf, &p_tmp, 1 );
         MAP.i_start_sector = ReadDouble( p_ifo, p_buf, &p_tmp );
-        //fprintf(stderr, "sector[%d] %d (%d)\n", i,ntohl(*(u32*)(p_tmp)), p_ifo->i_pos);
+/*        fprintf(stderr, "sector[%d] %d (%d)\n", i,ntohl(*(u32*)(p_tmp)), p_ifo->i_pos);*/
         MAP.i_end_sector = ReadDouble( p_ifo, p_buf, &p_tmp );
 #undef MAP
     }
index e684bf5..7469652 100644 (file)
@@ -3,7 +3,7 @@
  * found in .ifo.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: dvd_summary.c,v 1.8 2001/08/06 13:28:00 sam Exp $
+ * $Id: dvd_summary.c,v 1.9 2001/11/07 17:37:16 stef Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -60,6 +60,7 @@
 #include "common.h"
 #include "threads.h"
 #include "mtime.h"
+#include "iso_lang.h"
 #include "tests.h"
 
 #include "intf_msg.h"
 #include "modules.h"
 #include "modules_export.h"
 
-/*****************************************************************************
- * Local tables
- *****************************************************************************/
-static struct
-{
-    char    p_code[3];
-    char    p_lang_long[20];
-}
-
-lang_tbl[] =
-{
-    /* 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", "" }
-};
 
 /*
  * Local tools to decode some data in ifo
  */
 
-/*****************************************************************************
- * IfoLanguage: gives the long language name from the two-letters
- *              ISO-639 code
- *****************************************************************************/
-char * IfoLanguage( u16 i_code )
-{
-    int     i = 0;
-
-    while( memcmp( lang_tbl[i].p_code, &i_code, 2 ) &&
-           lang_tbl[i].p_lang_long[0] )
-    {
-        i++;
-    }
-
-    return lang_tbl[i].p_lang_long;
-}
-
-
 /****************************************************************************
  * IfoPrintTitle
  ****************************************************************************/
@@ -345,7 +169,7 @@ void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
     
         intf_WarnMsg( 5, "dvd info: audio %d" , i );
         intf_WarnMsg( 5, "    language: %s", 
-                         IfoLanguage( hton16( audio.i_lang_code ) ) );
+                         DecodeLanguage( hton16( audio.i_lang_code ) ) );
         intf_WarnMsg( 5, "    mode: %s", ppsz_mode[audio.i_coding_mode & 0x7] );
         intf_WarnMsg( 5, "    channel(s): %d %s",
                          audio.i_num_channels + 1,
@@ -392,7 +216,7 @@ void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
         intf_WarnMsg( 5, "dvd info: spu %d", i );
         intf_WarnMsg( 5, "    caption: %d", spu.i_caption );
         intf_WarnMsg( 5, "    language: %s",
-                         IfoLanguage( hton16( spu.i_lang_code ) ) );
+                         DecodeLanguage( hton16( spu.i_lang_code ) ) );
         intf_WarnMsg( 5, "    prefix: %x", spu.i_prefix );
 
         intf_WarnMsg( 5, "    status: 4:3 %x wide %x letter %x pan %x",
index f680f22..e47b8bd 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_summary.h: prototype of functions that print out current options.
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_summary.h,v 1.1 2001/05/19 00:39:30 stef Exp $
+ * $Id: dvd_summary.h,v 1.2 2001/11/07 17:37:16 stef Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -23,7 +23,6 @@
 
 struct thread_dvd_data_s;
 
-char * IfoLanguage( u16 );
 void IfoPrintTitle( struct thread_dvd_data_s * );
 void IfoPrintVideo( struct thread_dvd_data_s * );
 void IfoPrintAudio( struct thread_dvd_data_s *, int );
index 880f1b4..9549f60 100644 (file)
@@ -5,7 +5,7 @@
  * contains the basic udf handling functions
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: dvd_udf.c,v 1.14 2001/10/13 15:34:21 stef Exp $
+ * $Id: dvd_udf.c,v 1.15 2001/11/07 17:37:16 stef Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -648,13 +648,13 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition )
 
 
 /*****************************************************************************
- * UDFFindFile: looks for a file on the UDF disc/imagefile
+ * DVDUDFFindFile: looks for a file on the UDF disc/imagefile
  *****************************************************************************
  * Path has to be the absolute pathname on the UDF filesystem,
  * starting with '/'.
  * returns absolute LB number, or 0 on error
  *****************************************************************************/
-u32 UDFFindFile( dvdcss_handle dvdhandle, char * psz_path )
+u32 DVDUDFFindFile( dvdcss_handle dvdhandle, char * psz_path )
 {
     struct partition_s  partition;
     struct ad_s         root_icb;
index 614f2ca..3874caf 100644 (file)
@@ -10,7 +10,7 @@
  *  -dvd_udf to find files
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.91 2001/10/16 16:51:28 stef Exp $
+ * $Id: input_dvd.c,v 1.92 2001/11/07 17:37:16 stef Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -69,6 +69,7 @@
 #include "common.h"
 #include "threads.h"
 #include "mtime.h"
+#include "iso_lang.h"
 #include "tests.h"
 
 #if defined( WIN32 )
@@ -582,7 +583,7 @@ static int DVDSetArea( 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, IfoLanguage( hton16(
+                    strcpy( p_es->psz_desc, DecodeLanguage( hton16(
                         vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); 
                     strcat( p_es->psz_desc, " (ac3)" );
     
@@ -596,7 +597,7 @@ static int DVDSetArea( 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, IfoLanguage( hton16(
+                    strcpy( p_es->psz_desc, DecodeLanguage( hton16(
                         vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); 
                     strcat( p_es->psz_desc, " (mpeg)" );
     
@@ -610,7 +611,7 @@ static int DVDSetArea( 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, IfoLanguage( hton16(
+                    strcpy( p_es->psz_desc, DecodeLanguage( hton16(
                         vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); 
                     strcat( p_es->psz_desc, " (lpcm)" );
     
@@ -672,7 +673,7 @@ static int DVDSetArea( 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, IfoLanguage( hton16(
+                strcpy( p_es->psz_desc, DecodeLanguage( hton16(
                     vts.manager_inf.p_spu_attr[i-1].i_lang_code ) ) ); 
             }
         }
@@ -1153,7 +1154,7 @@ static int DVDFindCell( thread_dvd_data_t * p_dvd )
     }
 
 /*
-intf_WarnMsg( 7, "FindCell: i_cell %d i_index %d found %d nb %d",
+intf_WarnMsg( 12, "FindCell: i_cell %d i_index %d found %d nb %d",
                     p_dvd->i_cell,
                     p_dvd->i_prg_cell,
                     i_cell,
@@ -1189,7 +1190,7 @@ static int DVDFindSector( thread_dvd_data_t * p_dvd )
         intf_ErrMsg( "dvd error: can't find sector" );
         return -1;
     }
-
+    
     /* Find start and end sectors of new cell */
 #if 1
     p_dvd->i_sector = MAX(
@@ -1204,7 +1205,7 @@ static int DVDFindSector( thread_dvd_data_t * p_dvd )
 #endif
 
 /*
-    intf_WarnMsg( 7, "cell: %d sector1: 0x%x end1: 0x%x\n"
+    intf_WarnMsg( 12, "cell: %d sector1: 0x%x end1: 0x%x\n"
                    "index: %d sector2: 0x%x end2: 0x%x\n"
                    "category: 0x%x ilvu end: 0x%x vobu start 0x%x", 
         p_dvd->i_cell,
diff --git a/src/misc/iso_lang.c b/src/misc/iso_lang.c
new file mode 100644 (file)
index 0000000..67783a8
--- /dev/null
@@ -0,0 +1,210 @@
+/*****************************************************************************
+ * 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.1 2001/11/07 17:37:16 stef Exp $
+ *
+ * Author: Stéphane Borel <stef@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
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdio.h>
+
+#include "config.h"
+#include "common.h"
+
+/*****************************************************************************
+ * Local tables
+ *****************************************************************************/
+static struct
+{
+    char    p_code[3];
+    char    p_lang_long[20];
+}
+
+lang_tbl[] =
+{
+    /* 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", "" }
+};
+
+/*****************************************************************************
+ * DecodeLanguage: gives the long language name from the two-letters
+ *                 ISO-639 code
+ *****************************************************************************/
+char * DecodeLanguage( u16 i_code )
+{
+    int     i = 0;
+
+    while( memcmp( lang_tbl[i].p_code, &i_code, 2 ) &&
+           lang_tbl[i].p_lang_long[0] )
+    {
+        i++;
+    }
+
+    return lang_tbl[i].p_lang_long;
+}
+