[vlc-devel] commit: Do not use pf_make_region as it leads to a horrible hack. ( Laurent Aimar )

git version control git at videolan.org
Wed Sep 17 19:11:28 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Sep 16 23:12:27 2008 +0200| [1de839cc561121a64c6fd56572ac0de8bcf7a5df] | committer: Laurent Aimar 

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.

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

 modules/video_filter/mosaic.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/modules/video_filter/mosaic.c b/modules/video_filter/mosaic.c
index b581dbd..661eb77 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;




More information about the vlc-devel mailing list