[vlc-devel] commit: Use picture_New/Delete/Release. (Laurent Aimar )

git version control git at videolan.org
Tue Jul 22 00:27:45 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Jul 21 20:13:25 2008 +0200| [8ffbd86ab31339eea0c36d295eb2398835d2738f]

Use picture_New/Delete/Release.

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

 src/misc/image.c |   40 ++++++++++------------------------------
 1 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/src/misc/image.c b/src/misc/image.c
index 71c4bfc..4e53284 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -568,44 +568,24 @@ static const char *Fourcc2Ext( vlc_fourcc_t i_codec )
 
 static void video_release_buffer( picture_t *p_pic )
 {
-    if( --p_pic->i_refcount > 0 ) return;
-
-    free( p_pic->p_data_orig );
-    free( p_pic->p_sys );
-    free( p_pic );
+    picture_Release( p_pic );
 }
 
 static picture_t *video_new_buffer( decoder_t *p_dec )
 {
-    picture_t *p_pic = malloc( sizeof(picture_t) );
-
-    p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
-    vout_AllocatePicture( VLC_OBJECT(p_dec), p_pic,
-                          p_dec->fmt_out.video.i_chroma,
-                          p_dec->fmt_out.video.i_width,
-                          p_dec->fmt_out.video.i_height,
-                          p_dec->fmt_out.video.i_aspect );
-
-    if( !p_pic->i_planes )
-    {
-        free( p_pic );
-        return 0;
-    }
-
-    p_pic->i_refcount = 1;
-    p_pic->pf_release = video_release_buffer;
-    p_pic->i_status = RESERVED_PICTURE;
-    p_pic->p_sys = NULL;
-
-    return p_pic;
+    return picture_New( p_dec->fmt_out.video.i_chroma,
+                        p_dec->fmt_out.video.i_width,
+                        p_dec->fmt_out.video.i_height,
+                        p_dec->fmt_out.video.i_aspect );
 }
 
 static void video_del_buffer( decoder_t *p_dec, picture_t *p_pic )
 {
-    (void)p_dec;
-    free( p_pic->p_data_orig );
-    free( p_pic->p_sys );
-    free( p_pic );
+    if( p_pic->i_refcount != 1 )
+        msg_Err( p_dec, "invalid picture reference count" );
+
+    p_pic->i_refcount = 0;
+    picture_Delete( p_pic );
 }
 
 static void video_link_picture( decoder_t *p_dec, picture_t *p_pic )




More information about the vlc-devel mailing list