void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStream *st,

                               AVCodecParserContext *pc, AVPacket *pkt)

{

    AVRational codec_framerate = s->iformat ? st->codec->framerate :

                                              av_inv_q(st->codec->time_base);

    int frame_size;



    *pnum = 0;

    *pden = 0;

    switch (st->codec->codec_type) {

    case AVMEDIA_TYPE_VIDEO:

        if (st->r_frame_rate.num && !pc) {

            *pnum = st->r_frame_rate.den;

            *pden = st->r_frame_rate.num;

        } else if (st->time_base.num * 1000LL > st->time_base.den) {

            *pnum = st->time_base.num;

            *pden = st->time_base.den;

        } else if (codec_framerate.den * 1000LL > codec_framerate.num) {

            *pnum = codec_framerate.den;

            *pden = codec_framerate.num;



            *pden *= st->codec->ticks_per_frame;

            av_assert0(st->codec->ticks_per_frame);

            if (pc && pc->repeat_pict) {

                av_assert0(s->iformat); // this may be wrong for interlaced encoding but its not used for that case

                if (*pnum > INT_MAX / (1 + pc->repeat_pict))

                    *pden /= 1 + pc->repeat_pict;

                else

                    *pnum *= 1 + pc->repeat_pict;

            }

            /* If this codec can be interlaced or progressive then we need

             * a parser to compute duration of a packet. Thus if we have

             * no parser in such case leave duration undefined. */

            if (st->codec->ticks_per_frame > 1 && !pc)

                *pnum = *pden = 0;

        }

        break;

    case AVMEDIA_TYPE_AUDIO:

        frame_size = av_get_audio_frame_duration(st->codec, pkt->size);

        if (frame_size <= 0 || st->codec->sample_rate <= 0)

            break;

        *pnum = frame_size;

        *pden = st->codec->sample_rate;

        break;

    default:

        break;

    }

}

void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStream *st,

                               AVCodecParserContext *pc, AVPacket *pkt)

{

    AVRational codec_framerate = s->iformat ? st->codec->framerate :

                                              av_inv_q(st->codec->time_base);

    int frame_size;



    *pnum = 0;

    *pden = 0;

    switch (st->codec->codec_type) {

    case AVMEDIA_TYPE_VIDEO:

        if (st->r_frame_rate.num && !pc) {

            *pnum = st->r_frame_rate.den;

            *pden = st->r_frame_rate.num;

        } else if (st->time_base.num * 1000LL > st->time_base.den) {

            *pnum = st->time_base.num;

            *pden = st->time_base.den;

        } else if (codec_framerate.den * 1000LL > codec_framerate.num) {

            *pnum = codec_framerate.den;

            *pden = codec_framerate.num;



            *pden *= st->codec->ticks_per_frame;

            av_assert0(st->codec->ticks_per_frame);

            if (pc && pc->repeat_pict) {

                av_assert0(s->iformat); 

                if (*pnum > INT_MAX / (1 + pc->repeat_pict))

                    *pden /= 1 + pc->repeat_pict;

                else

                    *pnum *= 1 + pc->repeat_pict;

            }

            





            if (st->codec->ticks_per_frame > 1 && !pc)

                *pnum = *pden = 0;

        }

        break;

    case AVMEDIA_TYPE_AUDIO:

        frame_size = av_get_audio_frame_duration(st->codec, pkt->size);

        if (frame_size <= 0 || st->codec->sample_rate <= 0)

            break;

        *pnum = frame_size;

        *pden = st->codec->sample_rate;

        break;

    default:

        break;

    }

}

            *pnum = codec_framerate.den;             *pden = codec_framerate.num;             *pden *= st->codec->ticks_per_frame;                 if (*pnum > INT_MAX / (1 + pc->repeat_pict))                     *pden /= 1 + pc->repeat_pict;                     *pnum *= 1 + pc->repeat_pict;
void FUNC_0(AVFormatContext *VAR_0, int *VAR_1, int *VAR_2, AVStream *VAR_3,

                               AVCodecParserContext *VAR_4, AVPacket *VAR_5)

{

    AVRational codec_framerate = VAR_0->iformat ? VAR_3->codec->framerate :

                                              av_inv_q(VAR_3->codec->time_base);

    int VAR_6;



    *VAR_1 = 0;

    *VAR_2 = 0;

    switch (VAR_3->codec->codec_type) {

    case AVMEDIA_TYPE_VIDEO:

        if (VAR_3->r_frame_rate.num && !VAR_4) {

            *VAR_1 = VAR_3->r_frame_rate.den;

            *VAR_2 = VAR_3->r_frame_rate.num;

        } else if (VAR_3->time_base.num * 1000LL > VAR_3->time_base.den) {

            *VAR_1 = VAR_3->time_base.num;

            *VAR_2 = VAR_3->time_base.den;

        } else if (codec_framerate.den * 1000LL > codec_framerate.num) {

            *VAR_1 = codec_framerate.den;

            *VAR_2 = codec_framerate.num;



            *VAR_2 *= VAR_3->codec->ticks_per_frame;

            av_assert0(VAR_3->codec->ticks_per_frame);

            if (VAR_4 && VAR_4->repeat_pict) {

                av_assert0(VAR_0->iformat); 

                if (*VAR_1 > INT_MAX / (1 + VAR_4->repeat_pict))

                    *VAR_2 /= 1 + VAR_4->repeat_pict;

                else

                    *VAR_1 *= 1 + VAR_4->repeat_pict;

            }

            





            if (VAR_3->codec->ticks_per_frame > 1 && !VAR_4)

                *VAR_1 = *VAR_2 = 0;

        }

        break;

    case AVMEDIA_TYPE_AUDIO:

        VAR_6 = av_get_audio_frame_duration(VAR_3->codec, VAR_5->size);

        if (VAR_6 <= 0 || VAR_3->codec->sample_rate <= 0)

            break;

        *VAR_1 = VAR_6;

        *VAR_2 = VAR_3->codec->sample_rate;

        break;

    default:

        break;

    }

}

void FUNC_0(AVFormatContext *VAR_0, int *VAR_1, int *VAR_2, AVStream *VAR_3,
AVCodecParserContext *VAR_4, AVPacket *VAR_5)
{ AVRational codec_framerate = VAR_0->iformat ? VAR_3->codec->framerate :
av_inv_q(VAR_3->codec->time_base); int VAR_6; *VAR_1 = 0; *VAR_2 = 0; switch (VAR_3->codec->codec_type) { case AVMEDIA_TYPE_VIDEO:
if (VAR_3->r_frame_rate.num && !VAR_4) { *VAR_1 = VAR_3->r_frame_rate.den; *VAR_2 = VAR_3->r_frame_rate.num; } else if (VAR_3->time_base.num * 1000LL > VAR_3->time_base.den) { *VAR_1 = VAR_3->time_base.num; *VAR_2 = VAR_3->time_base.den; } else if (codec_framerate.den * 1000LL > codec_framerate.num) { *VAR_1 = codec_framerate.den; *VAR_2 = codec_framerate.num; *VAR_2 *= VAR_3->codec->ticks_per_frame; av_assert0(VAR_3->codec->ticks_per_frame); if (VAR_4 && VAR_4->repeat_pict) { av_assert0(VAR_0->iformat); if (*VAR_1 > INT_MAX / (1 + VAR_4->repeat_pict))
*VAR_2 /= 1 + VAR_4->repeat_pict; else
*VAR_1 *= 1 + VAR_4->repeat_pict; } if (VAR_3->codec->ticks_per_frame > 1 && !VAR_4)
*VAR_1 = *VAR_2 = 0; } break; case AVMEDIA_TYPE_AUDIO:
VAR_6 = av_get_audio_frame_duration(VAR_3->codec, VAR_5->size); if (VAR_6 <= 0 || VAR_3->codec->sample_rate <= 0)
break; *VAR_1 = VAR_6; *VAR_2 = VAR_3->codec->sample_rate; break; default:
break; } }