[vlc-devel] commit: Improved a bit picture API. (Laurent Aimar )

git version control git at videolan.org
Mon May 18 22:41:16 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon May 18 22:33:47 2009 +0200| [caa4d653ca0db09f951b366d9b580417b66dbb90] | committer: Laurent Aimar 

Improved a bit picture API.

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

 include/vlc_picture.h            |   19 ++++++++++++++++++-
 src/video_output/vout_pictures.c |    4 +++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 26f6154..a1f4b9f 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -52,6 +52,11 @@ typedef struct plane_t
 } plane_t;
 
 /**
+ * A private definition to help overloading picture release
+ */
+typedef struct picture_release_sys_t picture_release_sys_t;
+
+/**
  * Video picture
  *
  * Any picture destined to be displayed by a video output thread should be
@@ -113,6 +118,7 @@ struct picture_t
 
     /** This way the picture_Release can be overloaded */
     void (*pf_release)( picture_t * );
+    picture_release_sys_t *p_release_sys;
 
     /** Next picture in a FIFO a pictures */
     struct picture_t *p_next;
@@ -122,7 +128,7 @@ struct picture_t
  * This function will create a new picture.
  * The picture created will implement a default release management compatible
  * with picture_Hold and picture_Release. This default management will release
- * picture_sys_t *p_sys field if non NULL.
+ * p_sys, p_q, p_data_orig fields if non NULL.
  */
 VLC_EXPORT( picture_t *, picture_New, ( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) );
 
@@ -156,6 +162,17 @@ static inline void picture_Release( picture_t *p_picture )
 }
 
 /**
+ * This function will return true if you are not the only owner of the
+ * picture.
+ *
+ * It is only valid if it is created using picture_New.
+ */
+static inline bool picture_IsReferenced( picture_t *p_picture )
+{
+    return p_picture->i_refcount > 1;
+}
+
+/**
  * Cleanup quantization matrix data and set to 0
  */
 static inline void picture_CleanupQuant( picture_t *p_pic )
diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
index bc9a8fb..1d8b79e 100644
--- a/src/video_output/vout_pictures.c
+++ b/src/video_output/vout_pictures.c
@@ -38,6 +38,7 @@
 #include <vlc_filter.h>
 #include <vlc_image.h>
 #include <vlc_block.h>
+#include <vlc_picture_pool.h>
 
 #include "vout_pictures.h"
 #include "vout_internal.h"
@@ -664,6 +665,7 @@ int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma, int i_width, int
     }
 
     p_picture->pf_release = NULL;
+    p_picture->p_release_sys = NULL;
     p_picture->pf_lock = NULL;
     p_picture->pf_unlock = NULL;
     p_picture->i_refcount = 0;
@@ -925,6 +927,7 @@ picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_
 void picture_Delete( picture_t *p_picture )
 {
     assert( p_picture && p_picture->i_refcount == 0 );
+    assert( p_picture->p_release_sys == NULL );
 
     free( p_picture->p_q );
     free( p_picture->p_data_orig );
@@ -1047,4 +1050,3 @@ int picture_Export( vlc_object_t *p_obj,
 /*****************************************************************************
  *
  *****************************************************************************/
-




More information about the vlc-devel mailing list