[vlc-devel] commit: Don't change pf_release() to a dummy function ( Rafaël Carré )

git version control git at videolan.org
Tue May 20 15:16:14 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue May 20 12:40:10 2008 +0200| [cf9c7df72756886b02e6a6a0f657c68194dd4882]

Don't change pf_release() to a dummy function

In the meantime, another module (like the mosaic_bridge hack) could call it.
Instead, increase the reference count to be sure it won't be destroyed.

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

 src/misc/image.c |   22 ++++------------------
 1 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/src/misc/image.c b/src/misc/image.c
index 47c9dbb..7659473 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -247,8 +247,6 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
  *
  */
 
-static void PicRelease( picture_t *p_pic ) { (void)p_pic; }
-
 static block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic,
                             video_format_t *p_fmt_in,
                             video_format_t *p_fmt_out )
@@ -316,11 +314,9 @@ static block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic,
             p_image->p_filter->fmt_out.video = p_image->p_enc->fmt_in.video;
         }
 
-        pf_release = p_pic->pf_release;
-        p_pic->pf_release = PicRelease; /* Small hack */
+        p_pic->i_refcount++; /* pf_video_filter() will call pf_release() */
         p_tmp_pic =
             p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic );
-        p_pic->pf_release = pf_release;
 
         p_block = p_image->p_enc->pf_encode_video( p_image->p_enc, p_tmp_pic );
 
@@ -391,7 +387,6 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
                                 video_format_t *p_fmt_in,
                                 video_format_t *p_fmt_out )
 {
-    void (*pf_release)( picture_t * );
     picture_t *p_pif;
 
     if( !p_fmt_out->i_width && !p_fmt_out->i_height &&
@@ -448,10 +443,8 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
         p_image->p_filter->fmt_out.video = *p_fmt_out;
     }
 
-    pf_release = p_pic->pf_release;
-    p_pic->pf_release = PicRelease; /* Small hack */
+    p_pic->i_refcount++; /* pf_video_filter() will call pf_release() */
     p_pif = p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic );
-    p_pic->pf_release = pf_release;
 
     if( p_fmt_in->i_chroma == p_fmt_out->i_chroma &&
         p_fmt_in->i_width == p_fmt_out->i_width &&
@@ -474,9 +467,6 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
 static picture_t *ImageFilter( image_handler_t *p_image, picture_t *p_pic,
                                video_format_t *p_fmt, const char *psz_module )
 {
-    void (*pf_release)( picture_t * );
-    picture_t *p_pif;
-
     /* Start a filter */
     if( !p_image->p_filter )
     {
@@ -499,12 +489,8 @@ static picture_t *ImageFilter( image_handler_t *p_image, picture_t *p_pic,
         p_image->p_filter->fmt_out.video = *p_fmt;
     }
 
-    pf_release = p_pic->pf_release;
-    p_pic->pf_release = PicRelease; /* Small hack */
-    p_pif = p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic );
-    p_pic->pf_release = pf_release;
-
-    return p_pif;
+    p_pic->i_refcount++; /* pf_video_filter() will call pf_release() */
+    return p_image->p_filter->pf_video_filter( p_image->p_filter, p_pic );
 }
 
 /**




More information about the vlc-devel mailing list