[vlc-commits] picture: add pf_destroy to picture_resource_t

Rémi Denis-Courmont git at videolan.org
Sun Jul 14 21:44:16 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 14 22:03:08 2013 +0300| [cbaaea93fb58cc7476067d3bd1dacb51d5600f57] | committer: Rémi Denis-Courmont

picture: add pf_destroy to picture_resource_t

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

 include/vlc_picture.h |    1 +
 src/misc/picture.c    |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 30a8b03..39d50c2 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -133,6 +133,7 @@ VLC_API picture_t * picture_NewFromFormat( const video_format_t *p_fmt ) VLC_USE
 typedef struct
 {
     picture_sys_t *p_sys;
+    void (*pf_destroy)(picture_t *);
 
     /* Plane resources
      * XXX all fields MUST be set to the right value.
diff --git a/src/misc/picture.c b/src/misc/picture.c
index 45fbe51..628bf7b 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -226,6 +226,7 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
     if( p_resource )
     {
         p_picture->p_sys = p_resource->p_sys;
+        p_picture->gc.pf_destroy = p_resource->pf_destroy;
         assert( p_picture->gc.p_sys == NULL );
 
         for( int i = 0; i < p_picture->i_planes; i++ )
@@ -243,18 +244,22 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
             return NULL;
         }
     }
+
     /* */
     p_picture->format = fmt;
 
     vlc_atomic_set( &p_picture->gc.refcount, 1 );
-    p_picture->gc.pf_destroy = PictureDestroy;
+    if( p_picture->gc.pf_destroy == NULL )
+        p_picture->gc.pf_destroy = PictureDestroy;
 
     return p_picture;
 }
+
 picture_t *picture_NewFromFormat( const video_format_t *p_fmt )
 {
     return picture_NewFromResource( p_fmt, NULL );
 }
+
 picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den )
 {
     video_format_t fmt;



More information about the vlc-commits mailing list