static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)

{

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

    MOVStreamContext *sc = st->priv_data;

    unsigned int i, entries;



    get_byte(pb); /* version */

    get_be24(pb); /* flags */



    entries = get_be32(pb);



    if(entries >= UINT_MAX/sizeof(int64_t))

        return -1;



    sc->chunk_offsets = av_malloc(entries * sizeof(int64_t));

    if (!sc->chunk_offsets)

        return AVERROR(ENOMEM);

    sc->chunk_count = entries;



    if      (atom.type == MKTAG('s','t','c','o'))

        for(i=0; i<entries; i++)

            sc->chunk_offsets[i] = get_be32(pb);

    else if (atom.type == MKTAG('c','o','6','4'))

        for(i=0; i<entries; i++)

            sc->chunk_offsets[i] = get_be64(pb);

    else

        return -1;



    return 0;

}

static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)

{

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

    MOVStreamContext *sc = st->priv_data;

    unsigned int i, entries;



    get_byte(pb); 

    get_be24(pb); 



    entries = get_be32(pb);



    if(entries >= UINT_MAX/sizeof(int64_t))

        return -1;



    sc->chunk_offsets = av_malloc(entries * sizeof(int64_t));

    if (!sc->chunk_offsets)

        return AVERROR(ENOMEM);

    sc->chunk_count = entries;



    if      (atom.type == MKTAG('s','t','c','o'))

        for(i=0; i<entries; i++)

            sc->chunk_offsets[i] = get_be32(pb);

    else if (atom.type == MKTAG('c','o','6','4'))

        for(i=0; i<entries; i++)

            sc->chunk_offsets[i] = get_be64(pb);

    else

        return -1;



    return 0;

}

static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)

{

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

    MOVStreamContext *sc = st->priv_data;

    unsigned int VAR_3, VAR_4;



    get_byte(VAR_1); 

    get_be24(VAR_1); 



    VAR_4 = get_be32(VAR_1);



    if(VAR_4 >= UINT_MAX/sizeof(int64_t))

        return -1;



    sc->chunk_offsets = av_malloc(VAR_4 * sizeof(int64_t));

    if (!sc->chunk_offsets)

        return AVERROR(ENOMEM);

    sc->chunk_count = VAR_4;



    if      (VAR_2.type == MKTAG('s','t','VAR_0','o'))

        for(VAR_3=0; VAR_3<VAR_4; VAR_3++)

            sc->chunk_offsets[VAR_3] = get_be32(VAR_1);

    else if (VAR_2.type == MKTAG('VAR_0','o','6','4'))

        for(VAR_3=0; VAR_3<VAR_4; VAR_3++)

            sc->chunk_offsets[VAR_3] = get_be64(VAR_1);

    else

        return -1;



    return 0;

}

static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)
{ AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; unsigned int VAR_3, VAR_4; get_byte(VAR_1); get_be24(VAR_1); VAR_4 = get_be32(VAR_1); if(VAR_4 >= UINT_MAX/sizeof(int64_t))
return -1; sc->chunk_offsets = av_malloc(VAR_4 * sizeof(int64_t)); if (!sc->chunk_offsets)
return AVERROR(ENOMEM); sc->chunk_count = VAR_4; if      (VAR_2.type == MKTAG('s','t','VAR_0','o'))
for(VAR_3=0; VAR_3<VAR_4; VAR_3++) sc->chunk_offsets[VAR_3] = get_be32(VAR_1); else if (VAR_2.type == MKTAG('VAR_0','o','6','4'))
for(VAR_3=0; VAR_3<VAR_4; VAR_3++) sc->chunk_offsets[VAR_3] = get_be64(VAR_1); else
return -1; return 0; }