X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fcodec%2Fcinepak.c;h=b7642ec24911bb3240bfc7db3d6aa194f99b9c93;hb=4e6bc3609e9a346b87faaaddf77ed382451e8e6c;hp=75d103a6d7bd23e683e159e831fcd6aced01afb8;hpb=d7e6e4afcecea38831282152d6e7af9a62989985;p=vlc diff --git a/modules/codec/cinepak.c b/modules/codec/cinepak.c index 75d103a6d7..b7642ec249 100644 --- a/modules/codec/cinepak.c +++ b/modules/codec/cinepak.c @@ -28,7 +28,8 @@ # include "config.h" #endif -#include +#include +#include #include #include @@ -39,8 +40,8 @@ static int OpenDecoder ( vlc_object_t * ); static void CloseDecoder( vlc_object_t * ); vlc_module_begin(); - set_description( _("Cinepak video decoder") ); - set_capability( "decoder", 100 ); + set_description( N_("Cinepak video decoder") ); + set_capability( "decoder", 50 ); set_category( CAT_INPUT ); set_subcategory( SUBCAT_INPUT_VCODEC ); set_callbacks( OpenDecoder, CloseDecoder ); @@ -115,10 +116,7 @@ static int OpenDecoder( vlc_object_t *p_this ) /* Allocate the memory needed to store the decoder's structure */ if( ( p_dec->p_sys = p_sys = malloc(sizeof(decoder_sys_t)) ) == NULL ) - { - msg_Err( p_dec, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; memset( &p_sys->context, 0, sizeof( cinepak_context_t ) ); var_Create( p_dec, "grayscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); @@ -156,7 +154,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) p_block->p_buffer ); if( i_status < 0 ) { - msg_Warn( p_dec, "cannot decode one frame (%d bytes)", + msg_Warn( p_dec, "cannot decode one frame (%zu bytes)", p_block->i_buffer ); block_Release( p_block ); return NULL; @@ -447,6 +445,8 @@ static int cinepak_decode_frame( cinepak_context_t *p_context, { p_context->p_pix[i] = malloc( p_context->i_stride[i] * p_context->i_lines[i] ); + if( p_context->p_pix[i] == NULL ) + return -1; /* Set it to all black */ memset( p_context->p_pix[i], ( i == 0 ) ? 0 : 128 , p_context->i_stride[i] * p_context->i_lines[i] );