[vlc-commits] picture_pool: add picture_pool_Deref()

Rémi Denis-Courmont git at videolan.org
Sun Jun 28 10:57:47 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 27 16:32:30 2015 +0300| [557040b6eec80089a2e936897e35c11a7a006870] | committer: Rémi Denis-Courmont

picture_pool: add picture_pool_Deref()

This returns the original picture from the pool clone.

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

 include/vlc_picture_pool.h |    8 +++++++-
 src/libvlccore.sym         |    1 +
 src/misc/picture_pool.c    |    5 +++++
 src/test/picture_pool.c    |    6 +++++-
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/vlc_picture_pool.h b/include/vlc_picture_pool.h
index 37ef7b3..3b60345 100644
--- a/include/vlc_picture_pool.h
+++ b/include/vlc_picture_pool.h
@@ -168,6 +168,12 @@ VLC_USED;
  */
 VLC_API unsigned picture_pool_GetSize(const picture_pool_t *);
 
+/**
+ * Looks up the underlying pooled picture buffer.
+ * @param picture a picture reference opbtained with picture_pool_Get()
+ * @return the corresponding picture pointer as it was passed to
+ * picture_pool_New() or picture_pool_NewExtended()
+ */
+VLC_API picture_t *picture_pool_Deref(picture_t *);
 
 #endif /* VLC_PICTURE_POOL_H */
-
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index be6e4e3..197bffe 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -313,6 +313,7 @@ picture_pool_New
 picture_pool_NewExtended
 picture_pool_NewFromFormat
 picture_pool_Reserve
+picture_pool_Deref
 picture_Reset
 picture_Setup
 plane_CopyPixels
diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index c544253..db390a2 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -277,6 +277,11 @@ unsigned picture_pool_GetSize(const picture_pool_t *pool)
     return pool->picture_count;
 }
 
+picture_t *picture_pool_Deref(picture_t *picture)
+{
+    return ((picture_priv_t *)picture)->gc.opaque->picture;
+}
+
 void picture_pool_Enum(picture_pool_t *pool, void (*cb)(void *, picture_t *),
                        void *opaque)
 {
diff --git a/src/test/picture_pool.c b/src/test/picture_pool.c
index 93d70c0..3e58445 100644
--- a/src/test/picture_pool.c
+++ b/src/test/picture_pool.c
@@ -60,8 +60,12 @@ static void test(bool zombie)
         picture_Release(pics[i]);
 
     for (unsigned i = 0; i < PICTURES; i++) {
+        picture_t *pic = picture_pool_Deref(pics[i]);
+        assert(pic != NULL);
+        assert(pic != pics[i]);
         picture_Release(pics[i]);
-        assert(picture_pool_Get(pool) == pics[i]);
+        pics[i] = picture_pool_Get(pool);
+        assert(picture_pool_Deref(pics[i]) == pic);
     }
 
     for (unsigned i = 0; i < PICTURES; i++)



More information about the vlc-commits mailing list