]> git.sesse.net Git - vlc/blobdiff - modules/codec/dvbsub.c
hotkeys: Properly set seekable.
[vlc] / modules / codec / dvbsub.c
index 6874006fafdc1af2ae34be197f7cb94e3b33c64e..677c4012d00565ffb41df977f54346a4081c4aff 100644 (file)
@@ -43,7 +43,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_vout.h>
 #include <vlc_codec.h>
@@ -70,8 +70,8 @@
 #define ENC_POSY_TEXT N_("Encoding Y coordinate")
 #define ENC_POSY_LONGTEXT N_("Y coordinate of the encoded subtitle" )
 
-static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-static const char *ppsz_pos_descriptions[] =
+static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
+static const char *const ppsz_pos_descriptions[] =
 { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
   N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
 
@@ -88,7 +88,7 @@ static block_t *Encode  ( encoder_t *, subpicture_t * );
 
 vlc_module_begin();
 #   define DVBSUB_CFG_PREFIX "dvbsub-"
-    set_description( _("DVB subtitles decoder") );
+    set_description( N_("DVB subtitles decoder") );
     set_capability( "decoder", 50 );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_SCODEC );
@@ -101,7 +101,7 @@ vlc_module_begin();
 
 #   define ENC_CFG_PREFIX "sout-dvbsub-"
     add_submodule();
-    set_description( _("DVB subtitles encoder") );
+    set_description( N_("DVB subtitles encoder") );
     set_capability( "encoder", 100 );
     set_callbacks( OpenEncoder, CloseEncoder );
 
@@ -110,7 +110,7 @@ vlc_module_begin();
     add_obsolete_integer( ENC_CFG_PREFIX "timeout" ); /* Suppressed since 0.8.5 */
 vlc_module_end();
 
-static const char *ppsz_enc_options[] = { "x", "y", NULL };
+static const char *const ppsz_enc_options[] = { "x", "y", NULL };
 
 /****************************************************************************
  * Local structures
@@ -303,10 +303,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 )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
     memset( p_sys, 0, sizeof(decoder_sys_t) );
 
     p_sys->i_pts          = (mtime_t) 0;
@@ -332,7 +329,7 @@ static int Open( vlc_object_t *p_this )
     i_posy = val.i_int;
 
     /* Check if subpicture position was overridden */
-    p_sys->b_absolute = false;
+    p_sys->b_absolute = true;
     p_sys->i_spu_x = p_sys->i_spu_y = 0;
 
     if( ( i_posx >= 0 ) && ( i_posy >= 0 ) )
@@ -634,7 +631,9 @@ static void decode_clut( decoder_t *p_dec, bs_t *s )
 #ifdef DEBUG_DVBSUB
         msg_Dbg( p_dec, "new clut: %i", i_id );
 #endif
-        p_clut = malloc( sizeof(dvbsub_clut_t) );
+        p_clut = malloc( sizeof( dvbsub_clut_t ) );
+        if( !p_clut )
+            return;
         p_clut->p_next = p_sys->p_cluts;
         p_sys->p_cluts = p_clut;
     }
@@ -772,6 +771,8 @@ static void decode_page_composition( decoder_t *p_dec, bs_t *s )
 #endif
         /* Allocate a new page */
         p_sys->p_page = malloc( sizeof(dvbsub_page_t) );
+        if( !p_sys->p_page )
+            return;
     }
 
     p_sys->p_page->i_version = i_version;
@@ -869,14 +870,9 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s )
 
     /* Free old object defs */
     while( p_region->i_object_defs )
-    {
-        int i = p_region->i_object_defs - 1;
-        free( p_region->p_object_defs[i].psz_text );
-        if( !i )
-            free( p_region->p_object_defs );
+        free( p_region->p_object_defs[--p_region->i_object_defs].psz_text );
 
-        p_region->i_object_defs--;
-    }
+    free( p_region->p_object_defs );
     p_region->p_object_defs = NULL;
 
     /* Extra sanity checks */
@@ -1596,7 +1592,6 @@ static subpicture_t *render( decoder_t *p_dec )
 
     /* Correct positioning of SPU */
     p_spu->b_absolute = p_sys->b_absolute;
-    p_spu->i_flags = p_sys->i_spu_position;
     p_spu->i_x = p_sys->i_spu_x;
     p_spu->i_y = p_sys->i_spu_y;
     p_spu->i_original_picture_width = 720;
@@ -1668,10 +1663,7 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
         return VLC_ENOMEM;
-    }
     p_enc->p_sys = p_sys;
 
     p_enc->pf_encode_sub = Encode;