]> git.sesse.net Git - vlc/blobdiff - modules/codec/telx.c
Fix menu removal of accelerators. This has yet to be more FIXMEd (jpeg :D)
[vlc] / modules / codec / telx.c
index 1d36118d1f0156d6f4ed392f2265895aaaf81f2b..e361760c46b0273fad893a0d9494d15629133009 100644 (file)
  * http://pdc.ro.nu/teletext.html
  *
  *****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 #include <assert.h>
 #include <stdint.h>
 
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_input.h>
+
 #include "vlc_vout.h"
 #include "vlc_bits.h"
 #include "vlc_codec.h"
@@ -64,7 +70,7 @@ static subpicture_t *Decode( decoder_t *, block_t ** );
         "your subtitles don't appear.")
 
 vlc_module_begin();
-    set_description( _("Teletext subtitles decoder") );
+    set_description( N_("Teletext subtitles decoder") );
     set_shortname( "Teletext" );
     set_capability( "decoder", 50 );
     set_category( CAT_INPUT );
@@ -72,11 +78,11 @@ vlc_module_begin();
     set_callbacks( Open, Close );
 
     add_integer( "telx-override-page", -1, NULL,
-                 OVERRIDE_PAGE_TEXT, OVERRIDE_PAGE_LONGTEXT, VLC_TRUE );
+                 OVERRIDE_PAGE_TEXT, OVERRIDE_PAGE_LONGTEXT, true );
     add_bool( "telx-ignore-subtitle-flag", 0, NULL,
-              IGNORE_SUB_FLAG_TEXT, IGNORE_SUB_FLAG_LONGTEXT, VLC_TRUE );
+              IGNORE_SUB_FLAG_TEXT, IGNORE_SUB_FLAG_LONGTEXT, true );
     add_bool( "telx-french-workaround", 0, NULL,
-              FRENCH_WORKAROUND_TEXT, FRENCH_WORKAROUND_LONGTEXT, VLC_TRUE );
+              FRENCH_WORKAROUND_TEXT, FRENCH_WORKAROUND_LONGTEXT, true );
 
 vlc_module_end();
 
@@ -87,15 +93,15 @@ vlc_module_end();
 struct decoder_sys_t
 {
   int         i_align;
-  vlc_bool_t  b_is_subtitle[9];
+  bool  b_is_subtitle[9];
   char        ppsz_lines[32][128];
   char        psz_prev_text[512];
   mtime_t     prev_pts;
   int         i_page[9];
-  vlc_bool_t  b_erase[9];
+  bool  b_erase[9];
   uint16_t *  pi_active_national_set[9];
   int         i_wanted_page, i_wanted_magazine;
-  vlc_bool_t  b_ignore_sub_flag;
+  bool  b_ignore_sub_flag;
 };
 
 /****************************************************************************
@@ -178,10 +184,7 @@ static int Open( vlc_object_t *p_this )
     p_dec->pf_decode_sub = Decode;
     p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
     if( p_sys == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     memset( p_sys, 0, sizeof(decoder_sys_t) );
 
@@ -446,13 +449,16 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
     int i_wanted_page = 0x10 * ((i_conf_wanted_page % 100) / 10)
                          | (i_conf_wanted_page % 10);
 #endif
-    vlc_bool_t b_update = VLC_FALSE;
+    bool b_update = false;
     char psz_text[512], *pt = psz_text;
     char psz_line[256];
     int i, total;
 
-    if( pp_block == NULL || *pp_block == NULL ) return NULL;
+    if( pp_block == NULL || *pp_block == NULL )
+        return NULL;
     p_block = *pp_block;
+    if( p_block->i_rate != 0 )
+        p_block->i_length = p_block->i_length * p_block->i_rate / INPUT_RATE_DEFAULT;
     *pp_block = NULL;
 
     dbg((p_dec, "start of telx packet with header %2x\n",
@@ -556,7 +562,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
                 for ( i = 1; i < 32; i++ )
                 {
                     if ( !p_sys->ppsz_lines[i][0] ) continue;
-                    /* b_update = VLC_TRUE; */
+                    /* b_update = true; */
                     p_sys->ppsz_lines[i][0] = 0;
                 }
             }
@@ -567,7 +573,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
                 strncpy( p_sys->ppsz_lines[row], psz_line,
                          sizeof(p_sys->ppsz_lines[row]) - 1);
             }
-            b_update = VLC_TRUE;
+            b_update = true;
 
         }
         else if ( row < 24 )
@@ -599,7 +605,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
             {
                 strncpy( p_sys->ppsz_lines[row], t,
                          sizeof(p_sys->ppsz_lines[row]) - 1 );
-                b_update = VLC_TRUE;
+                b_update = true;
             }
 
             if (t[0])
@@ -645,7 +651,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
             {
                 strncpy( p_sys->ppsz_lines[0], psz_line,
                          sizeof(p_sys->ppsz_lines[0]) - 1 );
-                /* b_update = VLC_TRUE; */
+                /* b_update = true; */
             }
         }
 /*       else if (row == 26) { */
@@ -717,8 +723,8 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
     p_spu->i_start = p_block->i_pts;
     p_spu->i_stop = p_block->i_pts + p_block->i_length;
     p_spu->b_ephemer = (p_block->i_length == 0);
-    p_spu->b_absolute = VLC_FALSE;
-    p_spu->b_pausable = VLC_TRUE;
+    p_spu->b_absolute = false;
+    p_spu->b_pausable = true;
     dbg((p_dec, "%ld --> %ld\n", (long int) p_block->i_pts/100000, (long int)p_block->i_length/100000));
 
     block_Release( p_block );