[vlc-commits] filter: add a type to handle picture chains

Steve Lhomme git at videolan.org
Tue Oct 6 13:27:15 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 24 12:34:19 2020 +0200| [edb2985f2e86955c37c77d568c6349d75d35072d] | committer: Steve Lhomme

filter: add a type to handle picture chains

Each implementation uses the same double pointer.

Eventually it may be replaced by a vlc_list but that implies adding an extra
pointer in the picture_t structure.

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

 include/vlc_picture.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index af57f335ed..bdac103d9d 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -171,6 +171,32 @@ static inline vlc_video_context* picture_GetVideoContext(picture_t *pic)
  * picture chaining helpers
  */
 
+typedef struct vlc_pic_chain {
+    picture_t *front;
+    picture_t *tail;
+} vlc_picture_chain_t;
+
+/**
+ * Initializes or reset a picture chain
+ *
+ * \warning do not call this if the chain still holds pictures, it will leak them.
+ */
+static inline void vlc_picture_chain_Init(vlc_picture_chain_t *chain)
+{
+    chain->front = NULL;
+    // chain->tail = NULL not needed
+}
+
+/**
+ * Check whether a picture chain holds pictures or not.
+ *
+ * \return true if it is empty.
+ */
+static inline bool vlc_picture_chain_IsEmpty(const vlc_picture_chain_t *chain)
+{
+    return chain->front == NULL;
+}
+
 /**
  * Pop the front of a picture chain.
  *



More information about the vlc-commits mailing list