[FFmpeg-devel] [PATCH]Only print the "Estimating duration from bitrate" warning if a duration was estimated

Michael Niedermayer michaelni at gmx.at
Fri Mar 29 22:37:24 CET 2013


On Fri, Mar 29, 2013 at 10:35:21PM +0100, Carl Eugen Hoyos wrote:
> On Friday 29 March 2013 01:49:45 pm Michael Niedermayer wrote:
> > On Fri, Mar 29, 2013 at 07:26:10AM +0100, Carl Eugen Hoyos wrote:
> > > Hi!
> > >
> > > Attached patch silences a warning when it makes no sense to print it.
> > >
> > > Please comment, Carl Eugen
> > >
> > >  utils.c |    8 +++++++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > > ba89179ddaa756f8f0ecaf9e4b2bd324f8128a01  patchestimating.diff
> > > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > > index df688f1..6fd942a 100644
> > > --- a/libavformat/utils.c
> > > +++ b/libavformat/utils.c
> > > @@ -2440,10 +2440,16 @@ static void estimate_timings(AVFormatContext *ic,
> > > int64_t old_offset) fill_all_stream_timings(ic);
> > >          ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM;
> > >      } else {
> > > -        av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate,
> > > this may be inaccurate\n"); +        int i;
> > >          /* less precise: use bitrate info */
> > >          estimate_timings_from_bit_rate(ic);
> > >          ic->duration_estimation_method = AVFMT_DURATION_FROM_BITRATE;
> > > +        for (i = 0; i < ic->nb_streams; i++) {
> > > +            if (ic->streams[i]->duration != AV_NOPTS_VALUE) {
> > > +                av_log(ic, AV_LOG_WARNING, "Estimating duration from
> > > bitrate, this may be inaccurate\n"); +                break;
> > > +            }
> > > +        }
> >
> > may be easier/cleaner to do this inside estimate_timings_from_bit_rate()
> 
> New patch attached.
> 
> Thank you, Carl Eugen

>  utils.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 76236ead236a5d1033c7f9ac8ecd8e8e271a0440  patchestimating2.diff
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index d0393f9..0a12d8a 100644

LGTM

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.
-------------- 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/0c381555/attachment.asc>


More information about the ffmpeg-devel mailing list