static int mov_read_smi(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;



    // currently SVQ3 decoder expect full STSD header - so let's fake it

    // this should be fixed and just SMI header should be passed

    av_free(st->codec->extradata);

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

    if (!st->codec->extradata)

        return AVERROR(ENOMEM);

    st->codec->extradata_size = 0x5a + atom.size;

    memcpy(st->codec->extradata, "SVQ3", 4); // fake

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

    av_log(c->fc, AV_LOG_TRACE, "Reading SMI %"PRId64"  %s\n", atom.size, st->codec->extradata + 0x5a);

    return 0;

}

static int mov_read_smi(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;



    

    

    av_free(st->codec->extradata);

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

    if (!st->codec->extradata)

        return AVERROR(ENOMEM);

    st->codec->extradata_size = 0x5a + atom.size;

    memcpy(st->codec->extradata, "SVQ3", 4); 

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

    av_log(c->fc, AV_LOG_TRACE, "Reading SMI %"PRId64"  %s\n", atom.size, st->codec->extradata + 0x5a);

    return 0;

}

    avio_read(pb, st->codec->extradata + 0x5a, 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.size > (1<<30))

        return AVERROR_INVALIDDATA;



    

    

    av_free(st->codec->extradata);

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

    if (!st->codec->extradata)

        return AVERROR(ENOMEM);

    st->codec->extradata_size = 0x5a + VAR_2.size;

    memcpy(st->codec->extradata, "SVQ3", 4); 

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

    av_log(VAR_0->fc, AV_LOG_TRACE, "Reading SMI %"PRId64"  %s\n", VAR_2.size, st->codec->extradata + 0x5a);

    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; av_free(st->codec->extradata); st->codec->extradata = av_mallocz(VAR_2.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata)
return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + VAR_2.size; memcpy(st->codec->extradata, "SVQ3", 4); avio_read(VAR_1, st->codec->extradata + 0x5a, VAR_2.size); av_log(VAR_0->fc, AV_LOG_TRACE, "Reading SMI %"PRId64"  %s\n", VAR_2.size, st->codec->extradata + 0x5a); return 0; }