[FFmpeg-devel] [PATCH] ffmpeg/avformat: factor av_guess_frame_rate() out
Michael Niedermayer
michaelni at gmx.at
Fri Mar 29 17:52:55 CET 2013
On Thu, Mar 28, 2013 at 01:02:34AM +0100, Stefano Sabatini wrote:
> On date Wednesday 2013-03-27 22:48:50 +0100, Michael Niedermayer encoded:
> > This will be used in ffplay
> >
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> > ffmpeg_filter.c | 13 +++----------
> > libavformat/avformat.h | 10 ++++++++++
> > libavformat/utils.c | 16 ++++++++++++++++
> > 3 files changed, 29 insertions(+), 10 deletions(-)
>
> missing minor bump and APIchanges entry
fixed
>
> >
> > diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
> > index 654c19d..6824af6 100644
> > --- a/ffmpeg_filter.c
> > +++ b/ffmpeg_filter.c
> > @@ -542,22 +542,15 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
> > InputStream *ist = ifilter->ist;
> > AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) :
> > ist->st->time_base;
> > - AVRational fr = ist->framerate.num ? ist->framerate :
> > - ist->st->r_frame_rate;
> > + AVRational fr = ist->framerate;
> > AVRational sar;
> > AVBPrint args;
> > char name[255];
> > int pad_idx = in->pad_idx;
> > int ret;
> >
> > - if (!ist->framerate.num && ist->st->codec->ticks_per_frame>1) {
> > - AVRational codec_fr = av_inv_q(ist->st->codec->time_base);
> - AVRational avg_fr = ist->st->avg_frame_rate;
> > - codec_fr.den *= ist->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;
> > - }
> > + if (!fr.num)
> > + fr = av_guess_frame_rate(input_files[ist->file_index]->ctx, ist->st, NULL);
> >
> > if (ist->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
> > ret = sub2video_prepare(ist);
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index 549a0fa..9b3aeb0 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -2108,6 +2108,16 @@ const struct AVCodecTag *avformat_get_riff_audio_tags(void);
> > AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame);
> >
>
> > /**
> > + * Guess the frame rate, based on both the container and codec information.
> > + *
> > + * @param format the format context which the stream is part of
> > + * @param stream the stream which the frame is part of
> > + * @param frame the frame for which the frame rate should be determined, may be NULL
> > + * @return the guessed (valid) frame rate, 0/1 if no idea
> > + */
> > +AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *stream, AVFrame *frame);
>
> nit: format_ctx
fixed
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.
-------------- 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/20130329/015bccb2/attachment.asc>
More information about the ffmpeg-devel
mailing list