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>
This commit is contained in:
committed by
Michael Niedermayer
parent
3d7d819aad
commit
af0d270aac
@ -79,3 +79,22 @@ char av_get_picture_type_char(enum AVPictureType pict_type)
|
||||
default: return '?';
|
||||
}
|
||||
}
|
||||
|
||||
unsigned av_int_list_length_for_size(unsigned elsize,
|
||||
const void *list, uint64_t term)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (!list)
|
||||
return 0;
|
||||
#define LIST_LENGTH(type) \
|
||||
{ type t = term, *l = list; for (i = 0; l[i] != t; i++); }
|
||||
switch (elsize) {
|
||||
case 1: LIST_LENGTH(uint8_t); break;
|
||||
case 2: LIST_LENGTH(uint16_t); break;
|
||||
case 4: LIST_LENGTH(uint32_t); break;
|
||||
case 8: LIST_LENGTH(uint64_t); break;
|
||||
default: av_assert0(!"valid element size");
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
Reference in New Issue
Block a user