X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fsubtitles%2Fsubsdec.c;h=f6abcd9f3bc3002b7985deae2e2c04190675bffd;hb=6b90843041ecdf3ae0bde9ce27a1d8327de56f48;hp=76114f06ef6e3d6ee747ca86a219f2aff0660cbd;hpb=13ae40b0efc4f1b1ce205d9a057537047fcab3f4;p=vlc diff --git a/modules/codec/subtitles/subsdec.c b/modules/codec/subtitles/subsdec.c index 76114f06ef..f6abcd9f3b 100644 --- a/modules/codec/subtitles/subsdec.c +++ b/modules/codec/subtitles/subsdec.c @@ -49,7 +49,8 @@ static char *CreateHtmlSubtitle ( char * ); /***************************************************************************** * Module descriptor. *****************************************************************************/ -static const char *ppsz_encodings[] = { DEFAULT_NAME, "ASCII", "UTF-8", "", +static const char *const ppsz_encodings[] = { + DEFAULT_NAME, "ASCII", "UTF-8", "", "ISO-8859-1", "CP1252", "MacRoman", "MacIceland","ISO-8859-15", "", "ISO-8859-2", "CP1250", "MacCentralEurope", "MacCroatian", "MacRomania", "", "ISO-8859-5", "CP1251", "MacCyrillic", "MacUkraine", "KOI8-R", "KOI8-U", "KOI8-RU", "", @@ -96,8 +97,9 @@ The following known charsets are used: 254 = PC 437 */ -static int pi_justification[] = { 0, 1, 2 }; -static const char *ppsz_justification_text[] = {N_("Center"),N_("Left"),N_("Right")}; +static const int pi_justification[] = { 0, 1, 2 }; +static const char *const ppsz_justification_text[] = { + N_("Center"),N_("Left"),N_("Right")}; #define ENCODING_TEXT N_("Subtitles text encoding") #define ENCODING_LONGTEXT N_("Set the encoding used in text subtitles") @@ -158,10 +160,7 @@ static int OpenDecoder( vlc_object_t *p_this ) /* Allocate the memory needed to store the decoder's structure */ p_dec->p_sys = p_sys = malloc( sizeof( *p_sys ) ); if( p_sys == NULL ) - { - msg_Err( p_dec, "out of memory" ); return VLC_ENOMEM; - } /* init of p_sys */ memset( p_sys, 0, sizeof( *p_sys ) ); @@ -253,13 +252,19 @@ static int OpenDecoder( vlc_object_t *p_this ) ****************************************************************************/ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) { - subpicture_t *p_spu = NULL; + subpicture_t *p_spu; + block_t *p_block; + + if( !pp_block || *pp_block == NULL ) + return NULL; - if( !pp_block || *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; - p_spu = ParseText( p_dec, *pp_block ); + p_spu = ParseText( p_dec, p_block ); - block_Release( *pp_block ); + block_Release( p_block ); *pp_block = NULL; return p_spu; @@ -299,7 +304,7 @@ static void CloseDecoder( vlc_object_t *p_this ) continue; if( p_sys->pp_images[i]->p_pic ) - p_sys->pp_images[i]->p_pic->pf_release( p_sys->pp_images[i]->p_pic ); + picture_Release( p_sys->pp_images[i]->p_pic ); free( p_sys->pp_images[i]->psz_filename ); free( p_sys->pp_images[i] );