static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom,

                              enum AVCodecID codec_id)

{

    AVStream *st;

    uint64_t size;

    uint8_t *buf;

    int err;



    if (c->fc->nb_streams < 1) // will happen with jp2 files

        return 0;

    st= c->fc->streams[c->fc->nb_streams-1];



    if (st->codec->codec_id != codec_id)

        return 0; /* unexpected codec_id - don't mess with extradata */



    size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;

    if (size > INT_MAX || (uint64_t)atom.size > INT_MAX)

        return AVERROR_INVALIDDATA;

    if ((err = av_reallocp(&st->codec->extradata, size)) < 0)

        return err;

    buf = st->codec->extradata + st->codec->extradata_size;

    st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;

    AV_WB32(       buf    , atom.size + 8);

    AV_WL32(       buf + 4, atom.type);

    avio_read(pb, buf + 8, atom.size);

    return 0;

}

static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom,

                              enum AVCodecID codec_id)

{

    AVStream *st;

    uint64_t size;

    uint8_t *buf;

    int err;



    if (c->fc->nb_streams < 1) 

        return 0;

    st= c->fc->streams[c->fc->nb_streams-1];



    if (st->codec->codec_id != codec_id)

        return 0; 



    size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;

    if (size > INT_MAX || (uint64_t)atom.size > INT_MAX)

        return AVERROR_INVALIDDATA;

    if ((err = av_reallocp(&st->codec->extradata, size)) < 0)

        return err;

    buf = st->codec->extradata + st->codec->extradata_size;

    st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;

    AV_WB32(       buf    , atom.size + 8);

    AV_WL32(       buf + 4, atom.type);

    avio_read(pb, buf + 8, atom.size);

    return 0;

}

    if ((err = av_reallocp(&st->codec->extradata, size)) < 0)
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2,

                              enum AVCodecID VAR_3)

{

    AVStream *st;

    uint64_t size;

    uint8_t *buf;

    int VAR_4;



    if (VAR_0->fc->nb_streams < 1) 

        return 0;

    st= VAR_0->fc->streams[VAR_0->fc->nb_streams-1];



    if (st->codec->VAR_3 != VAR_3)

        return 0; 



    size= (uint64_t)st->codec->extradata_size + VAR_2.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;

    if (size > INT_MAX || (uint64_t)VAR_2.size > INT_MAX)

        return AVERROR_INVALIDDATA;

    if ((VAR_4 = av_reallocp(&st->codec->extradata, size)) < 0)

        return VAR_4;

    buf = st->codec->extradata + st->codec->extradata_size;

    st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;

    AV_WB32(       buf    , VAR_2.size + 8);

    AV_WL32(       buf + 4, VAR_2.type);

    avio_read(VAR_1, buf + 8, VAR_2.size);

    return 0;

}

static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2,
enum AVCodecID VAR_3)
{ AVStream *st; uint64_t size; uint8_t *buf; int VAR_4; if (VAR_0->fc->nb_streams < 1)
return 0; st= VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; if (st->codec->VAR_3 != VAR_3)
return 0; size= (uint64_t)st->codec->extradata_size + VAR_2.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; if (size > INT_MAX || (uint64_t)VAR_2.size > INT_MAX)
return AVERROR_INVALIDDATA; if ((VAR_4 = av_reallocp(&st->codec->extradata, size)) < 0)
return VAR_4; buf = st->codec->extradata + st->codec->extradata_size; st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; AV_WB32(       buf    , VAR_2.size + 8); AV_WL32(       buf + 4, VAR_2.type); avio_read(VAR_1, buf + 8, VAR_2.size); return 0; }