Browse code

ffplay: use av_guess_frame_rate()

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/03/30 02:34:19
Showing 1 changed files
... ...
@@ -1760,6 +1760,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
1760 1760
     AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
1761 1761
     AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_crop;
1762 1762
     AVCodecContext *codec = is->video_st->codec;
1763
+    AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
1763 1764
 
1764 1765
     if (!buffersink_params)
1765 1766
         return AVERROR(ENOMEM);
... ...
@@ -1773,6 +1774,8 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
1773 1773
              frame->width, frame->height, frame->format,
1774 1774
              is->video_st->time_base.num, is->video_st->time_base.den,
1775 1775
              codec->sample_aspect_ratio.num, FFMAX(codec->sample_aspect_ratio.den, 1));
1776
+    if (fr.num && fr.den)
1777
+        av_strlcatf(buffersrc_args, sizeof(buffersrc_args), ":frame_rate=%d/%d", fr.num, fr.den);
1776 1778
 
1777 1779
     if ((ret = avfilter_graph_create_filter(&filt_src,
1778 1780
                                             avfilter_get_by_name("buffer"),