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

{

    AVStream *st;

    MOVStreamContext *sc;

    unsigned int i, entries;



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

        return 0;

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

    sc = st->priv_data;



    avio_r8(pb); /* version */

    avio_rb24(pb); /* flags */



    entries = avio_rb32(pb);



    av_dlog(c->fc, "keyframe_count = %d\n", entries);



    if (!entries)

    {

        sc->keyframe_absent = 1;

        if (!st->need_parsing)

            st->need_parsing = AVSTREAM_PARSE_HEADERS;

        return 0;

    }

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

        return AVERROR_INVALIDDATA;

    sc->keyframes = av_malloc(entries * sizeof(int));

    if (!sc->keyframes)

        return AVERROR(ENOMEM);



    for (i = 0; i < entries && !pb->eof_reached; i++) {

        sc->keyframes[i] = avio_rb32(pb);

        //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);

    }



    sc->keyframe_count = i;



    if (pb->eof_reached)

        return AVERROR_EOF;



    return 0;

}

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

{

    AVStream *st;

    MOVStreamContext *sc;

    unsigned int i, entries;



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

        return 0;

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

    sc = st->priv_data;



    avio_r8(pb); 

    avio_rb24(pb); 



    entries = avio_rb32(pb);



    av_dlog(c->fc, "keyframe_count = %d\n", entries);



    if (!entries)

    {

        sc->keyframe_absent = 1;

        if (!st->need_parsing)

            st->need_parsing = AVSTREAM_PARSE_HEADERS;

        return 0;

    }

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

        return AVERROR_INVALIDDATA;

    sc->keyframes = av_malloc(entries * sizeof(int));

    if (!sc->keyframes)

        return AVERROR(ENOMEM);



    for (i = 0; i < entries && !pb->eof_reached; i++) {

        sc->keyframes[i] = avio_rb32(pb);

        

    }



    sc->keyframe_count = i;



    if (pb->eof_reached)

        return AVERROR_EOF;



    return 0;

}

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

{

    AVStream *st;

    MOVStreamContext *sc;

    unsigned int VAR_3, VAR_4;



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

        return 0;

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

    sc = st->priv_data;



    avio_r8(VAR_1); 

    avio_rb24(VAR_1); 



    VAR_4 = avio_rb32(VAR_1);



    av_dlog(VAR_0->fc, "keyframe_count = %d\n", VAR_4);



    if (!VAR_4)

    {

        sc->keyframe_absent = 1;

        if (!st->need_parsing)

            st->need_parsing = AVSTREAM_PARSE_HEADERS;

        return 0;

    }

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

        return AVERROR_INVALIDDATA;

    sc->keyframes = av_malloc(VAR_4 * sizeof(int));

    if (!sc->keyframes)

        return AVERROR(ENOMEM);



    for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) {

        sc->keyframes[VAR_3] = avio_rb32(VAR_1);

        

    }



    sc->keyframe_count = VAR_3;



    if (VAR_1->eof_reached)

        return AVERROR_EOF;



    return 0;

}

static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)
{ AVStream *st; MOVStreamContext *sc; unsigned int VAR_3, VAR_4; if (VAR_0->fc->nb_streams < 1)
return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; avio_r8(VAR_1); avio_rb24(VAR_1); VAR_4 = avio_rb32(VAR_1); av_dlog(VAR_0->fc, "keyframe_count = %d\n", VAR_4); if (!VAR_4)
{ sc->keyframe_absent = 1; if (!st->need_parsing)
st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } if (VAR_4 >= UINT_MAX / sizeof(int))
return AVERROR_INVALIDDATA; sc->keyframes = av_malloc(VAR_4 * sizeof(int)); if (!sc->keyframes)
return AVERROR(ENOMEM); for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) { sc->keyframes[VAR_3] = avio_rb32(VAR_1); } sc->keyframe_count = VAR_3; if (VAR_1->eof_reached)
return AVERROR_EOF; return 0; }