[FFmpeg-devel] [PATCH 1/2] lavf: make max_analyze_duration warning an information log.

Clément Bœsch ubitux at gmail.com
Mon Jan 30 23:27:44 CET 2012


On Mon, Jan 30, 2012 at 05:11:26PM +0100, Michael Niedermayer wrote:
> On Sat, Jan 28, 2012 at 11:45:37AM +0100, Clément Bœsch wrote:
> > On Sat, Jan 28, 2012 at 02:10:43AM +0100, Michael Niedermayer wrote:
> > [...]
> > > > > > --- ./tests/ref/seek/mp2_mp2    2011-01-18 21:10:05.123248731 +0100
> > > > > > +++ tests/data/fate/seek-mp2_mp2        2012-01-27 21:25:56.926199589 +0100
> > > > > > @@ -1,6 +1,6 @@
> > > > > > -ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
> > > > > > +ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:      0 size:   417
> > > > > >  ret: 0         st:-1 flags:0  ts:-1.000000
> > > > > > -ret: 0         st: 0 flags:1 dts: 0.026122 pts: 0.026122 pos:    417 size:   418
> > > > > > +ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
> > > > > >  ret: 0         st:-1 flags:1  ts: 1.894167
> > > > > >  ret: 0         st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos:  30093 size:   418
> > > > > >  ret: 0         st: 0 flags:0  ts: 0.788334
> > > > > > 
> > > > > > Note that FATE passes when I do the same with the FLAC.
> > > > > 
> > > > > you could try setting cur_dts = 0 in read_header of mp3
> > > > > 
> > > > 
> > > > This seems not be needed (and doesn't fix anything); in avformat_new_stream():
> > > 
> > > hmm, try:
> > > 
> > > st->first_dts == AV_NOPTS_VALUE && !((ic->iformat->flags & AVFMT_NOTIMESTAMPS) && st->cur_dts))
> > > 
> > 
> > This seems to do the trick, thank you, see attached patch. I guess it
> > applies to a lot of other audio formats, should we add the flag when
> > necessary?
> > 
> 
> > Or can't we just do the exact opposite: assume audio codecs have no
> > timestamps and add have an expection for those who have (if anyone has one
> > in mind...)?
> 
> this might be simpler if it works
> it would need the following checks at least
> nb_streams==1
> AVFMTCTX_NOHEADER not set (otherwise more streams can appear later)
> cur_dts != 0
> type == audio
> 

Thank you, please check if the comment is accurate enough.

-- 
Clément B.
-------------- next part --------------
From ed013b275d08144697857cbd9091aef644c3590d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <ubitux at gmail.com>
Date: Fri, 27 Jan 2012 21:28:47 +0100
Subject: [PATCH] lavf: do not raise max_analyze_duration warning with raw
 audio files.

Solution-by: Michael Niedermayer
---
 libavformat/utils.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 912c2ba..d28d83b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2332,7 +2332,12 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
             if(st->first_dts == AV_NOPTS_VALUE && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
                 break;
         }
-        if (i == ic->nb_streams) {
+        /* check if all streams are handled, or if the media is a single audio
+         * stream with known timestamp or duration */
+        if (i == ic->nb_streams ||
+            (ic->nb_streams == 1 &&
+             ic->streams[0]->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
+             ic->streams[0]->cur_dts)) {
             /* NOTE: if the format has no header, then we need to read
                some packets to get most of the streams, so we cannot
                stop here */
-- 
1.7.9

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120130/3c215a27/attachment.asc>


More information about the ffmpeg-devel mailing list