[vlc-devel] [PATCH 1/4] picture_chain: add vlc_picture_chain_GetAndClear

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 25 16:41:58 CEST 2020


In some rare case it's necessary to get a picture chain under lock and clear
it right after, without holding the lock while each item is being processed.
---
 include/vlc_picture.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index a71edb56a58..cf2b310ef8f 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -256,6 +256,20 @@ static inline void vlc_picture_chain_AppendChain(picture_t *chain, picture_t *ta
     chain->p_next = tail;
 }
 
+/**
+ * Copy the picture chain in another picture chain and clear the original
+ * picture chain.
+ *
+ * \param in picture chain to copy and clear
+ * \param out picture chain to copy into
+ */
+static inline void vlc_picture_chain_GetAndClear(vlc_picture_chain_t *in,
+                                                 vlc_picture_chain_t *out)
+{
+    *out = *in;
+    vlc_picture_chain_Init(in);
+}
+
 /**
  * Check whether a picture has other pictures linked
  */
-- 
2.26.2



More information about the vlc-devel mailing list