Commit 8ffbd86a authored by Laurent Aimar's avatar Laurent Aimar

Use picture_New/Delete/Release.

parent a0057ba2
...@@ -568,44 +568,24 @@ static const char *Fourcc2Ext( vlc_fourcc_t i_codec ) ...@@ -568,44 +568,24 @@ static const char *Fourcc2Ext( vlc_fourcc_t i_codec )
static void video_release_buffer( picture_t *p_pic ) static void video_release_buffer( picture_t *p_pic )
{ {
if( --p_pic->i_refcount > 0 ) return; picture_Release( p_pic );
free( p_pic->p_data_orig );
free( p_pic->p_sys );
free( p_pic );
} }
static picture_t *video_new_buffer( decoder_t *p_dec ) static picture_t *video_new_buffer( decoder_t *p_dec )
{ {
picture_t *p_pic = malloc( sizeof(picture_t) ); return picture_New( p_dec->fmt_out.video.i_chroma,
p_dec->fmt_out.video.i_width,
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec; p_dec->fmt_out.video.i_height,
vout_AllocatePicture( VLC_OBJECT(p_dec), p_pic, p_dec->fmt_out.video.i_aspect );
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;
} }
static void video_del_buffer( decoder_t *p_dec, picture_t *p_pic ) static void video_del_buffer( decoder_t *p_dec, picture_t *p_pic )
{ {
(void)p_dec; if( p_pic->i_refcount != 1 )
free( p_pic->p_data_orig ); msg_Err( p_dec, "invalid picture reference count" );
free( p_pic->p_sys );
free( p_pic ); p_pic->i_refcount = 0;
picture_Delete( p_pic );
} }
static void video_link_picture( decoder_t *p_dec, picture_t *p_pic ) static void video_link_picture( decoder_t *p_dec, picture_t *p_pic )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment