summaryrefslogtreecommitdiff
path: root/libavutil/avutil.h
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2013-04-11 14:58:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-12 12:09:51 +0200
commitaf0d270aac86a0ac1eae8e145c5aaf128edd5e74 (patch)
tree042a8a893baf9c27131bd0112c82664a23dfdf75 /libavutil/avutil.h
parent3d7d819aad52581c39aa3978bf9ae6d3c189e5a9 (diff)
downloadffmpeg-af0d270aac86a0ac1eae8e145c5aaf128edd5e74.tar.gz
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 <nicolas.george@normalesup.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/avutil.h')
-rw-r--r--libavutil/avutil.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 78deff1fd8..d71eb1ef4c 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -253,6 +253,27 @@ static inline void *av_x_if_null(const void *p, const void *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)
+
+/**
* @}
* @}
*/