aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/wavdec.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2013-01-06 18:48:51 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-01-06 18:48:51 +0100
commit1ae9d2820e1181a1109c230d4f1e717443dcce2d (patch)
treef84cc0408b71350c81dbb784eb8c94cab1756006 /libavformat/wavdec.c
parent9ff92cf1953d90e0e4f87f76f3f2f6439205a139 (diff)
downloadffmpeg-1ae9d2820e1181a1109c230d4f1e717443dcce2d.tar.gz
Support decoding AC-3 in wav.
All known samples are actually ac3-in-spdif-in-wav, so use the spdif demuxer to get the ac3 frames.
Diffstat (limited to 'libavformat/wavdec.c')
-rw-r--r--libavformat/wavdec.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index f8a36e9d6c..451187739f 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -36,6 +36,7 @@
#include "w64.h"
#include "avio.h"
#include "metadata.h"
+#include "spdif.h"
typedef struct WAVDemuxContext {
const AVClass *class;
@@ -49,6 +50,7 @@ typedef struct WAVDemuxContext {
int smv_eof;
int audio_eof;
int ignore_length;
+ int spdif;
} WAVDemuxContext;
@@ -407,6 +409,21 @@ static int wav_read_packet(AVFormatContext *s,
AVStream *st;
WAVDemuxContext *wav = s->priv_data;
+ if (CONFIG_SPDIF_DEMUXER && wav->spdif == 0 &&
+ s->streams[0]->codec->codec_tag == 1) {
+ enum AVCodecID codec;
+ ret = ff_spdif_probe(s->pb->buffer, s->pb->buf_end - s->pb->buffer,
+ &codec);
+ if (ret > AVPROBE_SCORE_MAX / 2) {
+ s->streams[0]->codec->codec_id = codec;
+ wav->spdif = 1;
+ } else {
+ wav->spdif = -1;
+ }
+ }
+ if (CONFIG_SPDIF_DEMUXER && wav->spdif == 1)
+ return ff_spdif_read_packet(s, pkt);
+
if (wav->smv_data_ofs > 0) {
int64_t audio_dts, video_dts;
smv_retry: