[FFmpeg-devel] [PATCH 1/2] lavf: make max_analyze_duration warning an information log.
Clément Bœsch
ubitux at gmail.com
Sat Jan 28 11:45:37 CET 2012
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...)?
[...]
--
Clément B.
-------------- next part --------------
From ffdcc9cd4fe29783fc4b28475a703c9fd9435d32 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 MP3,
FLAC and WAV.
MP3, FLAC and WAV don't have timestamps, and thus there is no need to
wait for pts/dts. This should also speed up probing.
---
libavformat/flacdec.c | 2 +-
libavformat/mp3dec.c | 2 +-
libavformat/utils.c | 5 ++++-
libavformat/wav.c | 4 ++--
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 65a75b2..b13e87c 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -155,7 +155,7 @@ AVInputFormat ff_flac_demuxer = {
.read_probe = flac_probe,
.read_header = flac_read_header,
.read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
.extensions = "flac",
.value = CODEC_ID_FLAC,
};
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index f3079e3..b8bbcb9 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -196,6 +196,6 @@ AVInputFormat ff_mp3_demuxer = {
.read_probe = mp3_read_probe,
.read_header = mp3_read_header,
.read_packet = mp3_read_packet,
- .flags= AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
.extensions = "mp2,mp3,m2a", /* XXX: use probe */
};
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 912c2ba..a19b7d2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2329,8 +2329,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
break;
if(st->parser && st->parser->parser->split && !st->codec->extradata)
break;
- if(st->first_dts == AV_NOPTS_VALUE && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
+ if(st->first_dts == AV_NOPTS_VALUE &&
+ !((ic->iformat->flags & AVFMT_NOTIMESTAMPS) && st->cur_dts) &&
+ (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO)) {
break;
+ }
}
if (i == ic->nb_streams) {
/* NOTE: if the format has no header, then we need to read
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 610c792..39e1ea9 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -700,7 +700,7 @@ AVInputFormat ff_wav_demuxer = {
.read_header = wav_read_header,
.read_packet = wav_read_packet,
.read_seek = wav_read_seek,
- .flags= AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
.codec_tag= (const AVCodecTag* const []){ff_codec_wav_tags, 0},
.priv_class = &wav_demuxer_class,
};
@@ -789,7 +789,7 @@ AVInputFormat ff_w64_demuxer = {
.read_header = w64_read_header,
.read_packet = wav_read_packet,
.read_seek = wav_read_seek,
- .flags = AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
.codec_tag = (const AVCodecTag* const []){ff_codec_wav_tags, 0},
};
#endif /* CONFIG_W64_DEMUXER */
--
1.7.8.4
-------------- 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/20120128/7526172e/attachment.asc>
More information about the ffmpeg-devel
mailing list