From af0d270aac86a0ac1eae8e145c5aaf128edd5e74 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Thu, 11 Apr 2013 14:58:06 +0200 Subject: lavu: add helper functions for integer lists. Add av_int_list_length() to compute a list length. Add av_opt_set_int_list() to set a binary option. Signed-off-by: Nicolas George Signed-off-by: Michael Niedermayer --- libavutil/avutil.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libavutil/avutil.h') diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 78deff1fd8..d71eb1ef4c 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -252,6 +252,27 @@ static inline void *av_x_if_null(const void *p, const void *x) return (void *)(intptr_t)(p ? p : x); } +/** + * Compute the length of an integer list. + * + * @param elsize size in bytes of each list element (only 1, 2, 4 or 8) + * @param term list terminator (usually 0 or -1) + * @param list pointer to the list + * @return length of the list, in elements, not counting the terminator + */ +unsigned av_int_list_length_for_size(unsigned elsize, + const void *list, uint64_t term); + +/** + * Compute the length of an integer list. + * + * @param term list terminator (usually 0 or -1) + * @param list pointer to the list + * @return length of the list, in elements, not counting the terminator + */ +#define av_int_list_length(list, term) \ + av_int_list_length_for_size(sizeof(*list), list, term) + /** * @} * @} -- cgit v1.2.3