static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)

{

    AVStream *st;



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

        return 0;

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



    if ((uint64_t)atom.size > (1<<30))

        return AVERROR_INVALIDDATA;



    if (atom.size >= 10) {

        // Broken files created by legacy versions of libavformat will

        // wrap a whole fiel atom inside of a glbl atom.

        unsigned size = avio_rb32(pb);

        unsigned type = avio_rl32(pb);

        avio_seek(pb, -8, SEEK_CUR);

        if (type == MKTAG('f','i','e','l') && size == atom.size)

            return mov_read_default(c, pb, atom);

    }

    av_free(st->codec->extradata);

    st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);

    if (!st->codec->extradata)

        return AVERROR(ENOMEM);

    st->codec->extradata_size = atom.size;

    avio_read(pb, st->codec->extradata, atom.size);

    return 0;

}

static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)

{

    AVStream *st;



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

        return 0;

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



    if ((uint64_t)atom.size > (1<<30))

        return AVERROR_INVALIDDATA;



    if (atom.size >= 10) {

        

        

        unsigned size = avio_rb32(pb);

        unsigned type = avio_rl32(pb);

        avio_seek(pb, -8, SEEK_CUR);

        if (type == MKTAG('f','i','e','l') && size == atom.size)

            return mov_read_default(c, pb, atom);

    }

    av_free(st->codec->extradata);

    st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);

    if (!st->codec->extradata)

        return AVERROR(ENOMEM);

    st->codec->extradata_size = atom.size;

    avio_read(pb, st->codec->extradata, atom.size);

    return 0;

}

    avio_read(pb, st->codec->extradata, atom.size);         return AVERROR_INVALIDDATA;
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)

{

    AVStream *st;



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

        return 0;

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



    if ((uint64_t)VAR_2.VAR_3 > (1<<30))

        return AVERROR_INVALIDDATA;



    if (VAR_2.VAR_3 >= 10) {

        

        

        unsigned VAR_3 = avio_rb32(VAR_1);

        unsigned VAR_4 = avio_rl32(VAR_1);

        avio_seek(VAR_1, -8, SEEK_CUR);

        if (VAR_4 == MKTAG('f','i','e','l') && VAR_3 == VAR_2.VAR_3)

            return mov_read_default(VAR_0, VAR_1, VAR_2);

    }

    av_free(st->codec->extradata);

    st->codec->extradata = av_mallocz(VAR_2.VAR_3 + FF_INPUT_BUFFER_PADDING_SIZE);

    if (!st->codec->extradata)

        return AVERROR(ENOMEM);

    st->codec->extradata_size = VAR_2.VAR_3;

    avio_read(VAR_1, st->codec->extradata, VAR_2.VAR_3);

    return 0;

}

static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)
{ AVStream *st; if (VAR_0->fc->nb_streams < 1)
return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; if ((uint64_t)VAR_2.VAR_3 > (1<<30))
return AVERROR_INVALIDDATA; if (VAR_2.VAR_3 >= 10) { unsigned VAR_3 = avio_rb32(VAR_1); unsigned VAR_4 = avio_rl32(VAR_1); avio_seek(VAR_1, -8, SEEK_CUR); if (VAR_4 == MKTAG('f','i','e','l') && VAR_3 == VAR_2.VAR_3)
return mov_read_default(VAR_0, VAR_1, VAR_2); } av_free(st->codec->extradata); st->codec->extradata = av_mallocz(VAR_2.VAR_3 + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata)
return AVERROR(ENOMEM); st->codec->extradata_size = VAR_2.VAR_3; avio_read(VAR_1, st->codec->extradata, VAR_2.VAR_3); return 0; }