X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fcodec%2Fdvbsub.c;h=677c4012d00565ffb41df977f54346a4081c4aff;hb=62e75b3f5989547873d9a0bd1daf5b2a2b000e93;hp=841a94b1bbb607c2a8cacb50ce4ccedac91f5ccb;hpb=97897eeeb22b1238e56632b16cda1a0375ae7708;p=vlc diff --git a/modules/codec/dvbsub.c b/modules/codec/dvbsub.c index 841a94b1bb..677c4012d0 100644 --- a/modules/codec/dvbsub.c +++ b/modules/codec/dvbsub.c @@ -43,7 +43,8 @@ # include "config.h" #endif -#include +#include +#include #include #include #include @@ -69,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") }; @@ -87,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 ); @@ -100,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 ); @@ -109,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 @@ -302,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; @@ -331,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 ) ) @@ -633,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; } @@ -771,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; @@ -868,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 */ @@ -1595,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; @@ -1667,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;