ts.c: Current libdvbpsi is buggy so wait for 0.1.6 to activate the teletext detection...
authorChristophe Mutricy <xtophe@videolan.org>
Sat, 20 Jan 2007 20:21:12 +0000 (20:21 +0000)
committerChristophe Mutricy <xtophe@videolan.org>
Sat, 20 Jan 2007 20:21:12 +0000 (20:21 +0000)
ts.c, telx.c: Fallback to teletext detection if TS detection wasn't possible

modules/codec/telx.c
modules/demux/ts.c

index ac2b843..7444bf3 100644 (file)
@@ -49,7 +49,9 @@ static subpicture_t *Decode( decoder_t *, block_t ** );
 
 #define OVERRIDE_PAGE_TEXT N_("Override page")
 #define OVERRIDE_PAGE_LONGTEXT N_("Override the indicated page, try this if " \
-        "your subtitles don't appear (0 = autodetect, usually 888 or 889).")
+        "your subtitles don't appear (-1 = autodetect from TS, " \
+        "0 = autodetect from teletext, " \
+        ">0 = actual page number, usually 888 or 889).")
 
 #define IGNORE_SUB_FLAG_TEXT N_("Ignore subtitle flag")
 #define IGNORE_SUB_FLAG_LONGTEXT N_("Ignore the subtitle flag, try this if " \
@@ -173,6 +175,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_ENOMEM;
     }
 
+
     memset( p_sys, 0, sizeof(decoder_sys_t) );
 
     p_sys->i_align = 0;
@@ -182,14 +185,14 @@ static int Open( vlc_object_t *p_this )
     var_Create( p_dec, "telx-override-page",
                 VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     var_Get( p_dec, "telx-override-page", &val );
-    if( val.i_int == -1 )
+    if( val.i_int == -1 && p_dec->fmt_in.subs.dvb.i_id != -1 )
     {
         p_sys->i_wanted_magazine = p_dec->fmt_in.subs.dvb.i_id >> 16;
         if( p_sys->i_wanted_magazine == 0 )
             p_sys->i_wanted_magazine = 8;
         p_sys->i_wanted_page = p_dec->fmt_in.subs.dvb.i_id & 0xff;
     }
-    else if( val.i_int == 0 )
+    else if( val.i_int <= 0 )
     {
         p_sys->i_wanted_magazine = -1;
         p_sys->i_wanted_page = -1;
@@ -200,7 +203,6 @@ static int Open( vlc_object_t *p_this )
         p_sys->i_wanted_page = (((val.i_int % 100) / 10) << 4)
                                 | ((val.i_int % 100) % 10);
     }
-
     var_Create( p_dec, "telx-ignore-subtitle-flag",
                 VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     var_Get( p_dec, "telx-ignore-subtitle-flag", &val );
index 8cb2c82..2b505a6 100644 (file)
@@ -3021,7 +3021,8 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
                     memcpy( pid->es->fmt.p_extra, p_dr->p_data,
                             p_dr->i_length );
 
-#ifdef _DVBPSI_DR_56_H_
+#if defined _DVBPSI_DR_56_H_ && defined DVBPSI_VERSION \
+                    && DVBPSI_VERSION_INT > ((0<<16)+(1<<8)+5)
                     pid->es->fmt.i_group = p_pmt->i_program_number;
 
                     /* If i_dvb_program == -1 it means the user specified
@@ -3110,8 +3111,9 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
                             pid->es->fmt.i_cat = UNKNOWN_ES;
                     }
 #else
+                    pid->es->fmt.subs.dvb.i_id = -1;
                     pid->es->fmt.psz_description = strdup( "Teletext" );
-#endif
+#endif  /* defined _DVBPSI_DR_56_H_  && DVBPSI_VERSION(0,1,6) */
                 }
                 else if( p_dr->i_tag == 0x59 )
                 {