[vlc-devel] commit: Don't store the picture_t inside of the decoder_sys_t ( Hugo Beauzee-Luyssen )

git version control git at videolan.org
Fri Sep 25 20:24:32 CEST 2009


vlc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Thu Sep 17 10:56:30 2009 +0200| [0a090e3392306042adfbbe63a6cbab2f578d8224] | committer: Rémi Denis-Courmont 

Don't store the picture_t inside of the decoder_sys_t

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0a090e3392306042adfbbe63a6cbab2f578d8224
---

 modules/codec/invmem.c |   24 ++++++++----------------
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/modules/codec/invmem.c b/modules/codec/invmem.c
index d18513c..ca2fbd4 100644
--- a/modules/codec/invmem.c
+++ b/modules/codec/invmem.c
@@ -108,8 +108,6 @@ struct decoder_sys_t
     int i_pitch;
 
     vlc_fourcc_t i_chroma;
-
-    picture_t *p_pic;
 };
 
 
@@ -219,8 +217,6 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     p_sys->i_pitch = pitch;
 
-    p_sys->p_pic = NULL;
-
     /* Set callbacks */
     p_dec->pf_decode_video = DecodeBlock;
 
@@ -240,28 +236,27 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t *p_block;
+    picture_t*  p_pic;
 
     if( !pp_block || !*pp_block ) return NULL;
 
     p_block = *pp_block;
 
     // create new picture
-    if( p_sys->p_pic != NULL )
-        picture_Release( p_sys->p_pic );
-    p_sys->p_pic = decoder_NewPicture( p_dec );
-    if ( !p_sys->p_pic ) return NULL;
-    p_sys->p_pic->b_force = true;
-    p_sys->p_pic->p->i_pitch = p_dec->p_sys->i_pitch;
-    p_sys->p_pic->date = p_block->i_pts > 0 ? p_block->i_pts : p_block->i_dts;
+    p_pic = decoder_NewPicture( p_dec );
+    if ( !p_pic ) return NULL;
+    p_pic->b_force = true;
+    p_pic->p->i_pitch = p_dec->p_sys->i_pitch;
+    p_pic->date = p_block->i_pts > 0 ? p_block->i_pts : p_block->i_dts;
 
     // lock input and copy to picture
-    p_sys->p_pic->p->p_pixels = p_sys->pf_lock( p_dec->p_sys->p_data );
+    p_pic->p->p_pixels = p_sys->pf_lock( p_dec->p_sys->p_data );
 
     // unlock input
     p_sys->pf_unlock( p_dec->p_sys->p_data );
 
     block_Release( *pp_block ); *pp_block = NULL;
-    return p_sys->p_pic;
+    return p_pic;
 }
 
 /*****************************************************************************
@@ -272,8 +267,5 @@ static void CloseDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if( p_sys->p_pic != NULL )
-        picture_Release( p_sys->p_pic );
-
     free( p_sys );
 }




More information about the vlc-devel mailing list