[PATCH 2/2] wav: probe for non-pcm audio in case of pcm_s16le (issue70)

Anssi Hannula anssi.hannula
Tue Jul 20 19:45:49 CEST 2010


---
 libavformat/wav.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/libavformat/wav.c b/libavformat/wav.c
index da08558..b6fb5b3 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -220,6 +220,14 @@ static int wav_read_header(AVFormatContext *s,
     ff_get_wav_header(pb, st->codec, size);
     st->need_parsing = AVSTREAM_PARSE_FULL;
 
+    if (st->codec->codec_id == CODEC_ID_PCM_S16LE) {
+        /* 4 dca frames (max size 16384) as is the minimum for detection,
+         * plus an extra one */
+        st->probe_fallback_bytes = 5 * 16384;
+        st->probe_fallback_codec_id = st->codec->codec_id;
+        st->codec->codec_id = CODEC_ID_PROBE;
+    }
+
     av_set_pts_info(st, 64, 1, st->codec->sample_rate);
 
     size = find_tag(pb, MKTAG('d', 'a', 't', 'a'));
-- 
1.7.1


--Boundary-00=_Gf7RM1vgvqoGuiw--



More information about the ffmpeg-devel mailing list