From: Laurent Aimar Date: Tue, 16 Sep 2008 21:12:27 +0000 (+0200) Subject: Do not use pf_make_region as it leads to a horrible hack. X-Git-Tag: 1.0.0-pre1~3198 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1de839cc561121a64c6fd56572ac0de8bcf7a5df;p=vlc Do not use pf_make_region as it leads to a horrible hack. Yes this creates a 'useless' picture copy per region, but it is currently needed. --- diff --git a/modules/video_filter/mosaic.c b/modules/video_filter/mosaic.c index b581dbd53e..661eb77e26 100644 --- a/modules/video_filter/mosaic.c +++ b/modules/video_filter/mosaic.c @@ -634,7 +634,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) else { p_converted = p_es->p_picture; - picture_Yield( p_converted ); fmt_in.i_width = fmt_out.i_width = p_converted->format.i_width; fmt_in.i_height = fmt_out.i_height = p_converted->format.i_height; fmt_in.i_chroma = fmt_out.i_chroma = p_converted->format.i_chroma; @@ -642,8 +641,13 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) fmt_out.i_visible_height = fmt_out.i_height; } - p_region = p_spu->pf_make_region( VLC_OBJECT(p_filter), &fmt_out, - p_converted ); + p_region = p_spu->pf_create_region( VLC_OBJECT(p_filter), &fmt_out ); + /* XXX That's a pity to do a copy, but it is needed for now */ + if( p_region ) + picture_Copy( &p_region->picture, p_converted ); + if( !p_sys->b_keep ) + picture_Release( p_converted ); + if( !p_region ) { msg_Err( p_filter, "cannot allocate SPU region" ); @@ -653,20 +657,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) return p_spu; } - /* HACK ALERT: let's fix the pointers to avoid picture duplication. - * This is necessary because p_region->picture is not a pointer - * as it ought to be. */ - if( !p_sys->b_keep ) - { - free( p_converted ); - } - else - { - /* Keep a pointer to the original picture (and its refcount...). */ - p_region->picture.p_sys = (picture_sys_t *)p_converted; - p_region->picture.pf_release = MosaicReleasePicture; - } - if( p_es->i_x >= 0 && p_es->i_y >= 0 ) { p_region->i_x = p_es->i_x;