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

{

    AVStream *st;

    MOVStreamContext *sc;

    unsigned int i, entries;

    int64_t duration=0;

    int64_t total_sample_count=0;



    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, "track[%i].stts.entries = %i\n",

            c->fc->nb_streams-1, entries);



    if (entries >= UINT_MAX / sizeof(*sc->stts_data))

        return -1;



    sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));

    if (!sc->stts_data)

        return AVERROR(ENOMEM);



    sc->stts_count = entries;



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

        int sample_duration;

        int sample_count;



        sample_count=avio_rb32(pb);

        sample_duration = avio_rb32(pb);

        sc->stts_data[i].count= sample_count;

        sc->stts_data[i].duration= sample_duration;



        av_dlog(c->fc, "sample_count=%d, sample_duration=%d\n",

                sample_count, sample_duration);



        duration+=(int64_t)sample_duration*sample_count;

        total_sample_count+=sample_count;

    }



    st->nb_frames= total_sample_count;

    if (duration)

        st->duration= duration;

    return 0;

}

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

{

    AVStream *st;

    MOVStreamContext *sc;

    unsigned int i, entries;

    int64_t duration=0;

    int64_t total_sample_count=0;



    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, "track[%i].stts.entries = %i\n",

            c->fc->nb_streams-1, entries);



    if (entries >= UINT_MAX / sizeof(*sc->stts_data))

        return -1;



    sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));

    if (!sc->stts_data)

        return AVERROR(ENOMEM);



    sc->stts_count = entries;



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

        int sample_duration;

        int sample_count;



        sample_count=avio_rb32(pb);

        sample_duration = avio_rb32(pb);

        sc->stts_data[i].count= sample_count;

        sc->stts_data[i].duration= sample_duration;



        av_dlog(c->fc, "sample_count=%d, sample_duration=%d\n",

                sample_count, sample_duration);



        duration+=(int64_t)sample_duration*sample_count;

        total_sample_count+=sample_count;

    }



    st->nb_frames= total_sample_count;

    if (duration)

        st->duration= duration;

    return 0;

}

    if (entries >= UINT_MAX / sizeof(*sc->stts_data))         return -1;
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)

{

    AVStream *st;

    MOVStreamContext *sc;

    unsigned int VAR_3, VAR_4;

    int64_t duration=0;

    int64_t total_sample_count=0;



    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, "track[%VAR_3].stts.VAR_4 = %VAR_3\n",

            VAR_0->fc->nb_streams-1, VAR_4);



    if (VAR_4 >= UINT_MAX / sizeof(*sc->stts_data))

        return -1;



    sc->stts_data = av_malloc(VAR_4 * sizeof(*sc->stts_data));

    if (!sc->stts_data)

        return AVERROR(ENOMEM);



    sc->stts_count = VAR_4;



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

        int VAR_5;

        int VAR_6;



        VAR_6=avio_rb32(VAR_1);

        VAR_5 = avio_rb32(VAR_1);

        sc->stts_data[VAR_3].count= VAR_6;

        sc->stts_data[VAR_3].duration= VAR_5;



        av_dlog(VAR_0->fc, "VAR_6=%d, VAR_5=%d\n",

                VAR_6, VAR_5);



        duration+=(int64_t)VAR_5*VAR_6;

        total_sample_count+=VAR_6;

    }



    st->nb_frames= total_sample_count;

    if (duration)

        st->duration= duration;

    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; int64_t duration=0; int64_t total_sample_count=0; 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, "track[%VAR_3].stts.VAR_4 = %VAR_3\n",
VAR_0->fc->nb_streams-1, VAR_4); if (VAR_4 >= UINT_MAX / sizeof(*sc->stts_data))
return -1; sc->stts_data = av_malloc(VAR_4 * sizeof(*sc->stts_data)); if (!sc->stts_data)
return AVERROR(ENOMEM); sc->stts_count = VAR_4; for (VAR_3=0; VAR_3<VAR_4; VAR_3++) { int VAR_5; int VAR_6; VAR_6=avio_rb32(VAR_1); VAR_5 = avio_rb32(VAR_1); sc->stts_data[VAR_3].count= VAR_6; sc->stts_data[VAR_3].duration= VAR_5; av_dlog(VAR_0->fc, "VAR_6=%d, VAR_5=%d\n",
VAR_6, VAR_5); duration+=(int64_t)VAR_5*VAR_6; total_sample_count+=VAR_6; } st->nb_frames= total_sample_count; if (duration)
st->duration= duration; return 0; }