/* Read the next element as an unsigned int. 0 is success, < 0 is failure.  */
static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
/* Read the next element as an unsigned int. 0 is success, < 0 is failure.  */
static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
{
    int n = 0;
    if (size < 1 || size > 8)
        return AVERROR_INVALIDDATA;
    *num = 0;
    while (n++ < size)
        *num = (*num << 8) | get_byte(pb);
    return 0;
}