[FFmpeg-devel] [PATCH] ffplay: port avfilter buffersrc fps code from ffmpeg

Michael Niedermayer michaelni at gmx.at
Thu Mar 28 02:52:14 CET 2013


On Thu, Mar 28, 2013 at 02:31:24AM +0100, Marton Balint wrote:
> 
> 
> On Wed, 27 Mar 2013, Michael Niedermayer wrote:
> 
> >Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> >---
> >ffplay.c |   12 ++++++++++++
> >1 file changed, 12 insertions(+)
> >
> >diff --git a/ffplay.c b/ffplay.c
> >index fb09dd6..abf7419 100644
> >--- a/ffplay.c
> >+++ b/ffplay.c
> >@@ -1760,6 +1760,16 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
> >    AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
> >    AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_crop;
> >    AVCodecContext *codec = is->video_st->codec;
> >+    AVRational fr = is->video_st->r_frame_rate;
> >+
> >+    if (is->video_st->codec->ticks_per_frame>1) {
> >+        AVRational codec_fr = av_inv_q(is->video_st->codec->time_base);
> >+        AVRational   avg_fr = is->video_st->avg_frame_rate;
> >+        codec_fr.den *= is->video_st->codec->ticks_per_frame;
> >+        if (   codec_fr.num>0 && codec_fr.den>0 && av_q2d(codec_fr) < av_q2d(fr)*0.7
> >+            && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr)))>0.1)
> >+            fr = codec_fr;
> >+    }
> 
> Shouldn't this code be part of the public API? E.g. AVRational
> av_guess_frame_rate(*AVStream, *AVCodec)?

yes, i sent a patch adding such public API a moment after this one ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130328/69db8c0c/attachment.asc>


More information about the ffmpeg-devel mailing list