]> git.sesse.net Git - vlc/commitdiff
picture: add pf_destroy to picture_resource_t
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 14 Jul 2013 19:03:08 +0000 (22:03 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 14 Jul 2013 19:19:52 +0000 (22:19 +0300)
include/vlc_picture.h
src/misc/picture.c

index 30a8b03552812bc5c794ddc3768915b14c16a288..39d50c2f578989d6ca487482c9522ce3f4e2c462 100644 (file)
@@ -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.
index 45fbe51949f3e6b9ad96ac622dcf190d5b92c48c..628bf7b7e6abaadad1c8e7c8d9e16f5a4037d66f 100644 (file)
@@ -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;