[vlc-commits] picture_chain: add vlc_picture_chain_GetAndClear

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Sep 25 08:45:59 2020 +0200| [5a12c03e8018f6139cb121363bdaa683d3d3748c] | committer: Steve Lhomme

picture_chain: add vlc_picture_chain_GetAndClear

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.

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

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

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index a71edb56a5..cf2b310ef8 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
  */



More information about the vlc-commits mailing list