]> git.sesse.net Git - vlc/blobdiff - modules/codec/cinepak.c
Use picture helpers.
[vlc] / modules / codec / cinepak.c
index 75d103a6d7bd23e683e159e831fcd6aced01afb8..b7642ec24911bb3240bfc7db3d6aa194f99b9c93 100644 (file)
@@ -28,7 +28,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_vout.h>
 #include <vlc_codec.h>
 
@@ -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] );