]> git.sesse.net Git - vlc/commitdiff
zvbi: Added a table with language -> zvbi default_region mappings. Far from perfect...
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 11 Sep 2008 11:34:09 +0000 (13:34 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 11 Sep 2008 11:35:56 +0000 (13:35 +0200)
modules/codec/zvbi.c

index 9405834cb9208d1fe8f62f51e3c90f561b5f270d..8218fe6f422cd6198626b6f8d6ce9aa465bc2fc2 100644 (file)
@@ -102,6 +102,27 @@ vlc_module_end();
 
 // #define ZVBI_DEBUG
 
+//Guessing table for missing "default region triplet"
+static const int pi_default_triplet[] = {
+ 0, 0,           // slo cze
+ 8,              // pol
+ 24,24,24,24,    //ssc scr slv rum
+ 32,32,32,32,32, //est lit rus bul ukr
+ 48,48,          //gre ell
+ 64,             //ara
+ 88,             //heb
+ 16 };           //default
+static const char *const ppsz_default_triplet[] = {
+ "slo", "cze",
+ "pol",
+ "ssc", "scr", "slv", "rum",
+ "est", "lit", "rus", "bul", "ukr",
+ "gre", "ell",
+ "ara",
+ "heb",
+ NULL
+};
+
 typedef enum {
     DATA_UNIT_EBU_TELETEXT_NON_SUBTITLE     = 0x02,
     DATA_UNIT_EBU_TELETEXT_SUBTITLE         = 0x03,
@@ -187,6 +208,19 @@ static int Open( vlc_object_t *p_this )
         return VLC_ENOMEM;
     }
 
+    /* Some broadcasters in countries with level 1 and level 1.5 still not send a G0 to do 
+     * matches against table 32 of ETSI 300 706. We try to do some best effort guessing
+     * This is not perfect, but might handle some cases where we know the vbi language 
+     * is known. It would be better if people started sending G0 */
+    for( int i = 0; ppsz_default_triplet[i] != NULL; i++ )
+    {
+        if( p_dec->fmt_in.psz_language && !strcmp( p_dec->fmt_in.psz_language, ppsz_default_triplet[i] ) )
+        {
+            vbi_teletext_set_default_region( p_sys->p_vbi_dec, pi_default_triplet[i]);
+            msg_Dbg( p_dec, "overwriting default zvbi region: %d", pi_default_triplet[i] );
+        }
+    }
+
     vbi_event_handler_register( p_sys->p_vbi_dec, VBI_EVENT_TTX_PAGE |
                                 VBI_EVENT_CAPTION | VBI_EVENT_NETWORK |
                                 VBI_EVENT_ASPECT | VBI_EVENT_PROG_INFO,