vlc | branch: master | Steve Lhomme <[email protected]> | Thu Sep 17 08:38:12 2020 +0200| [618db1d773183ddf94c05c6bdef3a1bac6ea5368] | committer: Steve Lhomme
picture: add helpers for picture chaining Picture chains are used either to keep a list of picture (in FIFO order) or to attach a picture to another and return them all at once (filters). > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=618db1d773183ddf94c05c6bdef3a1bac6ea5368 --- include/vlc_picture.h | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/include/vlc_picture.h b/include/vlc_picture.h index 7bb9ee5083..ef86ed41ea 100644 --- a/include/vlc_picture.h +++ b/include/vlc_picture.h @@ -167,6 +167,74 @@ static inline vlc_video_context* picture_GetVideoContext(picture_t *pic) return pic->context ? pic->context->vctx : NULL; } +/** + * picture chaining helpers + */ + +/** + * Pop the front of a picture chain. + * + * The next picture in the chain becomes the front of the picture chain. + * + * \return the front of the picture chain (the picture itself) + */ +static inline picture_t * vlc_picture_chain_PopFront(picture_t **chain) +{ + picture_t *front = *chain; + if (front) + { + *chain = front->p_next; + // unlink the front picture from the rest of the chain + front->p_next = NULL; + } + return front; +} + +/** + * Append a picture to a picture chain. + * + * \param chain the picture chain pointer + * \param pic the picture to append to the chain + * + * \return the new tail of the picture chain + */ +VLC_USED +static inline picture_t * vlc_picture_chain_Append(picture_t *chain, picture_t *pic) +{ + chain->p_next = pic; + pic->p_next = NULL; // we're appending a picture, not a chain + return pic; +} + +/** + * Append a picture chain to a picture chain. + */ +static inline void vlc_picture_chain_AppendChain(picture_t *chain, picture_t *tail) +{ + chain->p_next = tail; +} + +/** + * Check whether a picture has other pictures linked + */ +static inline bool picture_HasChainedPics(const picture_t *pic) +{ + return pic->p_next != NULL; +} + +/** + * Reset a picture chain. + * + * \return the picture chain that was contained in the picture + */ +static inline picture_t * picture_GetAndResetChain(picture_t *pic) +{ + picture_t *chain = pic->p_next; + pic->p_next = NULL; + return chain; +} + + /** * This function will create a new picture. * The picture created will implement a default release management compatible _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
