/* Read the next element as binary data. 0 is success, < 0 is failure.  */
static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
/* Read the next element as binary data. 0 is success, < 0 is failure.  */
static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
{
    av_free(bin->data);
    if (!(bin->data = av_malloc(length)))
        return AVERROR(ENOMEM);
    bin->size = length;
    bin->pos  = url_ftell(pb);
    if (get_buffer(pb, bin->data, length) != length)
        return AVERROR(EIO);
    return 0;
}