Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-10 08:42:18 +0400
committerMichael Niedermayer <michaelni@gmx.at>2011-12-10 08:42:18 +0400
commit02acfb1c01135542540045a8fb5b7dc16377476c (patch)
tree8623d7861ca44d9fef390a8d8ae9c7cdf99f1f4f /libavformat/wav.c
parent85cd1eb12f7c607e8fb2bdd0d098530ebbff86b2 (diff)
wavdec: add ignore length option to ignore incorrect lengthes
like SOX Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/wav.c')
-rw-r--r--libavformat/wav.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 61ea579092..87d97b4c0c 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -52,6 +52,7 @@ typedef struct {
int smv_last_stream;
int smv_eof;
int audio_eof;
+ int ignore_length;
} WAVContext;
#if CONFIG_WAV_MUXER
@@ -618,6 +619,8 @@ smv_out:
st = s->streams[0];
left = wav->data_end - avio_tell(s->pb);
+ if (wav->ignore_length)
+ left= INT_MAX;
if (left <= 0){
if (CONFIG_W64_DEMUXER && wav->w64)
left = find_guid(s->pb, guid_data) - 24;
@@ -677,6 +680,19 @@ static int wav_read_seek(AVFormatContext *s,
return pcm_read_seek(s, stream_index, timestamp, flags);
}
+#define OFFSET(x) offsetof(WAVContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+static const AVOption demux_options[] = {
+ { "ignore_length", "Ignore length", OFFSET(ignore_length), AV_OPT_TYPE_INT, { 0 }, 0, 1, DEC },
+ { NULL },
+};
+
+static const AVClass wav_demuxer_class = {
+ .class_name = "WAV demuxer",
+ .item_name = av_default_item_name,
+ .option = demux_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
AVInputFormat ff_wav_demuxer = {
.name = "wav",
.long_name = NULL_IF_CONFIG_SMALL("WAV format"),
@@ -687,6 +703,7 @@ AVInputFormat ff_wav_demuxer = {
.read_seek = wav_read_seek,
.flags= AVFMT_GENERIC_INDEX,
.codec_tag= (const AVCodecTag* const []){ff_codec_wav_tags, 0},
+ .priv_class = &wav_demuxer_class,
};
#endif /* CONFIG_WAV_DEMUXER */