static void estimate_timings_from_bit_rate(AVFormatContext *ic)

{

    int64_t filesize, duration;

    int i;

    AVStream *st;



    /* if bit_rate is already set, we believe it */

    if (ic->bit_rate <= 0) {

        int bit_rate = 0;

        for(i=0;i<ic->nb_streams;i++) {

            st = ic->streams[i];

            if (st->codec->bit_rate > 0) {

                if (INT_MAX - st->codec->bit_rate > bit_rate) {

                    bit_rate = 0;

                    break;

                }

                bit_rate += st->codec->bit_rate;

            }

        }

        ic->bit_rate = bit_rate;

    }



    /* if duration is already set, we believe it */

    if (ic->duration == AV_NOPTS_VALUE &&

        ic->bit_rate != 0) {

        filesize = ic->pb ? avio_size(ic->pb) : 0;

        if (filesize > 0) {

            for(i = 0; i < ic->nb_streams; i++) {

                st = ic->streams[i];

                duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num);

                if (st->duration == AV_NOPTS_VALUE)

                    st->duration = duration;

            }

        }

    }

}

static void estimate_timings_from_bit_rate(AVFormatContext *ic)

{

    int64_t filesize, duration;

    int i;

    AVStream *st;



    

    if (ic->bit_rate <= 0) {

        int bit_rate = 0;

        for(i=0;i<ic->nb_streams;i++) {

            st = ic->streams[i];

            if (st->codec->bit_rate > 0) {

                if (INT_MAX - st->codec->bit_rate > bit_rate) {

                    bit_rate = 0;

                    break;

                }

                bit_rate += st->codec->bit_rate;

            }

        }

        ic->bit_rate = bit_rate;

    }



    

    if (ic->duration == AV_NOPTS_VALUE &&

        ic->bit_rate != 0) {

        filesize = ic->pb ? avio_size(ic->pb) : 0;

        if (filesize > 0) {

            for(i = 0; i < ic->nb_streams; i++) {

                st = ic->streams[i];

                duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num);

                if (st->duration == AV_NOPTS_VALUE)

                    st->duration = duration;

            }

        }

    }

}

                if (INT_MAX - st->codec->bit_rate > bit_rate) {
static void FUNC_0(AVFormatContext *VAR_0)

{

    int64_t filesize, duration;

    int VAR_1;

    AVStream *st;



    

    if (VAR_0->VAR_2 <= 0) {

        int VAR_2 = 0;

        for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) {

            st = VAR_0->streams[VAR_1];

            if (st->codec->VAR_2 > 0) {

                if (INT_MAX - st->codec->VAR_2 > VAR_2) {

                    VAR_2 = 0;

                    break;

                }

                VAR_2 += st->codec->VAR_2;

            }

        }

        VAR_0->VAR_2 = VAR_2;

    }



    

    if (VAR_0->duration == AV_NOPTS_VALUE &&

        VAR_0->VAR_2 != 0) {

        filesize = VAR_0->pb ? avio_size(VAR_0->pb) : 0;

        if (filesize > 0) {

            for(VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {

                st = VAR_0->streams[VAR_1];

                duration= av_rescale(8*filesize, st->time_base.den, VAR_0->VAR_2*(int64_t)st->time_base.num);

                if (st->duration == AV_NOPTS_VALUE)

                    st->duration = duration;

            }

        }

    }

}

static void FUNC_0(AVFormatContext *VAR_0)
{ int64_t filesize, duration; int VAR_1; AVStream *st; if (VAR_0->VAR_2 <= 0) { int VAR_2 = 0; for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) { st = VAR_0->streams[VAR_1]; if (st->codec->VAR_2 > 0) { if (INT_MAX - st->codec->VAR_2 > VAR_2) { VAR_2 = 0; break; } VAR_2 += st->codec->VAR_2; } } VAR_0->VAR_2 = VAR_2; } if (VAR_0->duration == AV_NOPTS_VALUE &&
VAR_0->VAR_2 != 0) { filesize = VAR_0->pb ? avio_size(VAR_0->pb) : 0; if (filesize > 0) { for(VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { st = VAR_0->streams[VAR_1]; duration= av_rescale(8*filesize, st->time_base.den, VAR_0->VAR_2*(int64_t)st->time_base.num); if (st->duration == AV_NOPTS_VALUE)
st->duration = duration; } } } }