static int mov_read_wave(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 (st->codec->codec_id == AV_CODEC_ID_QDM2 || st->codec->codec_id == AV_CODEC_ID_QDMC) {

        // pass all frma atom to codec, needed at least for QDMC and QDM2

        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);

    } else if (atom.size > 8) { /* to read frma, esds atoms */

        int ret;

        if ((ret = mov_read_default(c, pb, atom)) < 0)

            return ret;

    } else

        avio_skip(pb, atom.size);

    return 0;

}

static int mov_read_wave(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 (st->codec->codec_id == AV_CODEC_ID_QDM2 || st->codec->codec_id == AV_CODEC_ID_QDMC) {

        

        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);

    } else if (atom.size > 8) { 

        int ret;

        if ((ret = mov_read_default(c, pb, atom)) < 0)

            return ret;

    } else

        avio_skip(pb, atom.size);

    return 0;

}

        avio_read(pb, st->codec->extradata, atom.size);         int ret;         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.size > (1<<30))

        return AVERROR_INVALIDDATA;



    if (st->codec->codec_id == AV_CODEC_ID_QDM2 || st->codec->codec_id == AV_CODEC_ID_QDMC) {

        

        av_free(st->codec->extradata);

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

        if (!st->codec->extradata)

            return AVERROR(ENOMEM);

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

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

    } else if (VAR_2.size > 8) { 

        int VAR_3;

        if ((VAR_3 = mov_read_default(VAR_0, VAR_1, VAR_2)) < 0)

            return VAR_3;

    } else

        avio_skip(VAR_1, VAR_2.size);

    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.size > (1<<30))
return AVERROR_INVALIDDATA; if (st->codec->codec_id == AV_CODEC_ID_QDM2 || st->codec->codec_id == AV_CODEC_ID_QDMC) { av_free(st->codec->extradata); st->codec->extradata = av_mallocz(VAR_2.size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata)
return AVERROR(ENOMEM); st->codec->extradata_size = VAR_2.size; avio_read(VAR_1, st->codec->extradata, VAR_2.size); } else if (VAR_2.size > 8) { int VAR_3; if ((VAR_3 = mov_read_default(VAR_0, VAR_1, VAR_2)) < 0)
return VAR_3; } else avio_skip(VAR_1, VAR_2.size); return 0; }