[vlc-commits] picture: pointer for decoder-specified hardware context

Rémi Denis-Courmont git at videolan.org
Sun Jul 7 20:13:37 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jun 21 23:12:30 2013 +0300| [ddcac44467641259d5697afe3253e46eabf82668] | committer: Rémi Denis-Courmont

picture: pointer for decoder-specified hardware context

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

 include/vlc_picture.h |    2 ++
 src/misc/picture.c    |   14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index c99f54d..0b3f948 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -91,6 +91,8 @@ struct picture_t
     bool            b_progressive;          /**< is it a progressive frame ? */
     bool            b_top_field_first;             /**< which field is first */
     unsigned int    i_nb_fields;                  /**< # of displayed fields */
+    void          * context;          /**< video format-specific data pointer,
+             * must point to a (void (*)(void*)) pointer to free the context */
     /**@}*/
 
     /** Private data - the video output plugin might want to put stuff here to
diff --git a/src/misc/picture.c b/src/misc/picture.c
index ee30af0..ac4caba 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -85,6 +85,18 @@ static int AllocatePicture( picture_t *p_pic )
 /*****************************************************************************
  *
  *****************************************************************************/
+
+static void PictureDestroyContext( picture_t *p_picture )
+{
+    void (**context)( void * ) = p_picture->context;
+    if( context != NULL )
+    {
+        void (*context_destroy)( void * ) = *context;
+        context_destroy( context );
+        p_picture->context = NULL;
+    }
+}
+
 static void PictureDestroy( picture_t *p_picture )
 {
     assert( p_picture &&
@@ -106,6 +118,7 @@ void picture_Reset( picture_t *p_picture )
     p_picture->b_progressive = false;
     p_picture->i_nb_fields = 2;
     p_picture->b_top_field_first = false;
+    PictureDestroyContext( p_picture );
 }
 
 /*****************************************************************************
@@ -271,6 +284,7 @@ void picture_Release( picture_t *p_picture )
     if( refs > 0 )
         return;
 
+    PictureDestroyContext( p_picture );
     if( p_picture->gc.pf_destroy != NULL )
         p_picture->gc.pf_destroy( p_picture );
 }



More information about the vlc-commits mailing list