]> git.sesse.net Git - vlc/commitdiff
* modules/codec/dmo/dmo.c: small fix to CopyPicture()
authorGildas Bazin <gbazin@videolan.org>
Thu, 1 Jul 2004 16:05:05 +0000 (16:05 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 1 Jul 2004 16:05:05 +0000 (16:05 +0000)
modules/codec/dmo/dmo.c

index 75d410e9a43b8dfc5d2c6e67ed0a2997de21a5fa..6a1dd047273dcffba4cbf0e4b0c6d0f77cfc2478 100644 (file)
@@ -79,6 +79,7 @@ struct decoder_sys_t
     IMediaObject *p_dmo;\r
 \r
     int i_min_output;\r
+    uint8_t *p_buffer;\r
 \r
     audio_date_t end_date;\r
 };\r
@@ -374,6 +375,8 @@ static int DecoderOpen( vlc_object_t *p_this )
             msg_Dbg( p_dec, "GetOutputSizeInfo(): bytes %i, align %i",\r
                      i_size, i_align );\r
             p_sys->i_min_output = i_size;\r
+            p_sys->p_buffer = malloc( i_size );\r
+            if( !p_sys->p_buffer ) goto error;\r
         }\r
     }\r
 \r
@@ -421,6 +424,7 @@ void DecoderClose( vlc_object_t *p_this )
 \r
     FreeLibrary( p_sys->hmsdmo_dll );\r
 \r
+    if( p_sys->p_buffer ) free( p_sys->p_buffer );\r
     free( p_sys );\r
 }\r
 \r
@@ -508,7 +512,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     }\r
 \r
     /* Get output from the DMO */\r
-    block_out.p_buffer = malloc( p_sys->i_min_output );\r
+    block_out.p_buffer = p_sys->p_buffer;;\r
     block_out.i_buffer = 0;\r
 \r
     p_out = CMediaBufferCreate( &block_out, p_sys->i_min_output, VLC_FALSE );\r
@@ -531,7 +535,6 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 #endif\r
 \r
         p_out->vt->Release( (IUnknown *)p_out );\r
-        free( block_out.p_buffer );\r
         return NULL;\r
     }\r
 \r
@@ -545,7 +548,6 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     {\r
         msg_Dbg( p_dec, "GetBufferAndLength(): failed" );\r
         p_out->vt->Release( (IUnknown *)p_out );\r
-        free( block_out.p_buffer );\r
         return NULL;\r
     }\r
 \r
@@ -555,7 +557,6 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         msg_Dbg( p_dec, "ProcessOutput(): no output (i_buffer_out == 0)" );\r
 #endif\r
         p_out->vt->Release( (IUnknown *)p_out );\r
-        free( block_out.p_buffer );\r
         return NULL;\r
     }\r
 \r
@@ -572,7 +573,6 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         aout_DateIncrement( &p_sys->end_date, 1 );\r
 \r
         p_out->vt->Release( (IUnknown *)p_out );\r
-        free( block_out.p_buffer );\r
 \r
         return p_pic;\r
     }\r
@@ -592,7 +592,6 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             aout_DateIncrement( &p_sys->end_date, i_samples );\r
 \r
         p_out->vt->Release( (IUnknown *)p_out );\r
-        free( block_out.p_buffer );\r
 \r
         return p_aout_buffer;\r
     }\r
@@ -615,8 +614,6 @@ static void CopyPicture( decoder_t *p_dec, picture_t *p_pic, uint8_t *p_in )
         i_width = p_pic->p[i_plane].i_visible_pitch;\r
         i_dst_stride  = p_pic->p[i_plane].i_pitch;\r
 \r
-        p_src += i_width;\r
-\r
         for( i_line = 0; i_line < p_pic->p[i_plane].i_lines; i_line++ )\r
         {\r
             p_dec->p_vlc->pf_memcpy( p_dst, p_src, i_width );\r