summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-18 04:06:53 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-23 11:30:57 +0100
commit926c1bf85c76444af578aeb68f2aab3267e03edf (patch)
treeced4773d68b296af46a784ede30ea23518195275
parent1df1083b6c8cb2dcfa7bfd183b032ce4cabd69e6 (diff)
avformat/wavdec: Share wav and w64 options
The options of the w64 demuxer are a proper subset of the options for the wav demuxer, making it possible to reuse a part of the options for the wav demuxer for the w64 demuxer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavformat/wavdec.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index e99de8f6d3..8214ab8498 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -27,6 +27,7 @@
#include <stdint.h>
+#include "config.h"
#include "libavutil/avassert.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
@@ -63,6 +64,17 @@ typedef struct WAVDemuxContext {
int rifx; // RIFX: integer byte order for parameters is big endian
} WAVDemuxContext;
+#define OFFSET(x) offsetof(WAVDemuxContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+static const AVOption demux_options[] = {
+#define W64_DEMUXER_OPTIONS_OFFSET (1 * CONFIG_WAV_DEMUXER)
+#if CONFIG_WAV_DEMUXER
+ { "ignore_length", "Ignore length", OFFSET(ignore_length), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
+#endif
+ { "max_size", "max size of single packet", OFFSET(max_size), AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
+ { NULL },
+};
+
static void set_spdif(AVFormatContext *s, WAVDemuxContext *wav)
{
if (CONFIG_SPDIF_DEMUXER && s->streams[0]->codecpar->codec_tag == 1) {
@@ -798,14 +810,6 @@ static int wav_read_seek(AVFormatContext *s,
return ff_pcm_read_seek(s, stream_index, timestamp, flags);
}
-#define OFFSET(x) offsetof(WAVDemuxContext, x)
-#define DEC AV_OPT_FLAG_DECODING_PARAM
-static const AVOption demux_options[] = {
- { "ignore_length", "Ignore length", OFFSET(ignore_length), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
- { "max_size", "max size of single packet", OFFSET(max_size), AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
- { NULL },
-};
-
static const AVClass wav_demuxer_class = {
.class_name = "WAV demuxer",
.item_name = av_default_item_name,
@@ -955,17 +959,10 @@ static int w64_read_header(AVFormatContext *s)
return 0;
}
-#define OFFSET(x) offsetof(WAVDemuxContext, x)
-#define DEC AV_OPT_FLAG_DECODING_PARAM
-static const AVOption w64_demux_options[] = {
- { "max_size", "max size of single packet", OFFSET(max_size), AV_OPT_TYPE_INT, { .i64 = 4096 }, 1024, 1 << 22, DEC },
- { NULL }
-};
-
static const AVClass w64_demuxer_class = {
.class_name = "W64 demuxer",
.item_name = av_default_item_name,
- .option = w64_demux_options,
+ .option = &demux_options[W64_DEMUXER_OPTIONS_OFFSET],
.version = LIBAVUTIL_VERSION_INT,
};