]> git.sesse.net Git - vlc/blobdiff - modules/codec/dirac.c
Fix memleak in lua module.
[vlc] / modules / codec / dirac.c
index 19168ccfc432460616f1792c3feba5f4e776cde1..f621090ec24dd365a62dd516f412f8c584550880 100644 (file)
@@ -29,7 +29,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_codec.h>
 #include <vlc_sout.h>
 #include <vlc_vout.h>
@@ -61,7 +62,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict );
 
 #define ENC_CFG_PREFIX "sout-dirac-"
 
-static const char *ppsz_enc_options[] = {
+static const char *const ppsz_enc_options[] = {
     "quality", NULL
 };
 
@@ -75,13 +76,13 @@ static const char *ppsz_enc_options[] = {
 vlc_module_begin();
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_VCODEC );
-    set_description( _("Dirac video decoder") );
+    set_description( N_("Dirac video decoder") );
     set_capability( "decoder", 100 );
     set_callbacks( OpenDecoder, CloseDecoder );
     add_shortcut( "dirac" );
 
     add_submodule();
-    set_description( _("Dirac video encoder") );
+    set_description( N_("Dirac video encoder") );
     set_capability( "encoder", 100 );
     set_callbacks( OpenEncoder, CloseEncoder );
     add_float( ENC_CFG_PREFIX "quality", 7.0, NULL, ENC_QUALITY_TEXT,
@@ -109,10 +110,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 =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     p_sys->p_dirac = p_dirac;
 
@@ -190,7 +188,7 @@ static picture_t *GetNewPicture( decoder_t *p_dec )
 
         for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines; i_line++ )
         {
-            p_dec->p_libvlc->pf_memcpy( p_dst, p_src, i_width );
+            vlc_memcpy( p_dst, p_src, i_width );
             p_src += i_width;
             p_dst += i_dst_stride;
         }
@@ -277,16 +275,9 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             FreeFrameBuffer( p_sys->p_dirac );
             break;
 
-        case STATE_PICTURE_START:
-            msg_Dbg( p_dec, "PICTURE_START: frame_type=%i frame_num=%d",
-                     p_sys->p_dirac->frame_params.ftype,
-                     p_sys->p_dirac->frame_params.fnum );
-            break;
-
         case STATE_PICTURE_AVAIL:
-            msg_Dbg( p_dec, "PICTURE_AVAI : frame_type=%i frame_num=%d",
-                     p_sys->p_dirac->frame_params.ftype,
-                     p_sys->p_dirac->frame_params.fnum );
+            msg_Dbg( p_dec, "PICTURE_AVAIL : frame_num=%d",
+                     p_sys->p_dirac->frame_num );
 
             /* Picture available for display */
             p_pic = GetNewPicture( p_dec );
@@ -344,10 +335,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_EGENERIC;
-    }
+        return VLC_ENOMEM;
     memset( p_sys, 0, sizeof(encoder_sys_t) );
     p_enc->p_sys = p_sys;
 
@@ -410,7 +398,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
 
         for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines; i_line++ )
         {
-            p_enc->p_libvlc->pf_memcpy( p_dst, p_src, i_width );
+            vlc_memcpy( p_dst, p_src, i_width );
             p_dst += i_width;
             p_src += i_src_stride;
         }
@@ -481,7 +469,7 @@ static void CloseEncoder( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t *)p_this;
     encoder_sys_t *p_sys = p_enc->p_sys;
 
-    msg_Dbg( p_enc, "resulting bit-rate: %i bits/sec",
+    msg_Dbg( p_enc, "resulting bit-rate: %lld bits/sec",
              p_sys->p_dirac->enc_seqstats.bit_rate );
 
     /* Free the encoder resources */