]> git.sesse.net Git - vlc/commitdiff
Use picture_New/Delete/Release.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 21 Jul 2008 18:13:25 +0000 (20:13 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 21 Jul 2008 22:25:47 +0000 (00:25 +0200)
src/misc/image.c

index 71c4bfc47f2d710de961c9929fd1b4166d60809b..4e5328473a55c62c77e4c31492b97fcf21ef1f7e 100644 (file)
@@ -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 )