summaryrefslogtreecommitdiff
path: root/libavformat/pcmdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-24 01:02:30 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-28 17:14:21 +0100
commit301ae25e999d9771a4ece0e3d6f0983797dcc65a (patch)
tree9e8b41580c3dc49cc4a0d0ebdb997ecdbf65a27f /libavformat/pcmdec.c
parent90723d172125184fb33d894041858f5bbf3cc781 (diff)
avformat/pcm(dec|enc): Don't include disabled (de)muxers
Also make the macro used for the demuxers spec-compliant. The earlier macro was not, because the ... argument of a variadic macro must not be left out. GCC and Clang warn about this when using -pedantic. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/pcmdec.c')
-rw-r--r--libavformat/pcmdec.c102
1 files changed, 37 insertions, 65 deletions
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 9895af03a4..e65b535665 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -104,7 +104,8 @@ static const AVOption pcm_options[] = {
{ NULL },
};
-#define PCMDEF(name_, long_name_, ext, codec, ...) \
+#define PCMDEF_0(name_, long_name_, ext, codec, ...)
+#define PCMDEF_1(name_, long_name_, ext, codec, ...) \
static const AVClass name_ ## _demuxer_class = { \
.class_name = #name_ " demuxer", \
.item_name = av_default_item_name, \
@@ -124,70 +125,40 @@ AVInputFormat ff_pcm_ ## name_ ## _demuxer = { \
.priv_class = &name_ ## _demuxer_class, \
__VA_ARGS__ \
};
-
-PCMDEF(f64be, "PCM 64-bit floating-point big-endian",
- NULL, AV_CODEC_ID_PCM_F64BE)
-
-PCMDEF(f64le, "PCM 64-bit floating-point little-endian",
- NULL, AV_CODEC_ID_PCM_F64LE)
-
-PCMDEF(f32be, "PCM 32-bit floating-point big-endian",
- NULL, AV_CODEC_ID_PCM_F32BE)
-
-PCMDEF(f32le, "PCM 32-bit floating-point little-endian",
- NULL, AV_CODEC_ID_PCM_F32LE)
-
-PCMDEF(s32be, "PCM signed 32-bit big-endian",
- NULL, AV_CODEC_ID_PCM_S32BE)
-
-PCMDEF(s32le, "PCM signed 32-bit little-endian",
- NULL, AV_CODEC_ID_PCM_S32LE)
-
-PCMDEF(s24be, "PCM signed 24-bit big-endian",
- NULL, AV_CODEC_ID_PCM_S24BE)
-
-PCMDEF(s24le, "PCM signed 24-bit little-endian",
- NULL, AV_CODEC_ID_PCM_S24LE)
-
-PCMDEF(s16be, "PCM signed 16-bit big-endian",
- AV_NE("sw", NULL), AV_CODEC_ID_PCM_S16BE, .mime_type = "audio/L16")
-
-PCMDEF(s16le, "PCM signed 16-bit little-endian",
- AV_NE(NULL, "sw"), AV_CODEC_ID_PCM_S16LE)
-
-PCMDEF(s8, "PCM signed 8-bit",
- "sb", AV_CODEC_ID_PCM_S8)
-
-PCMDEF(u32be, "PCM unsigned 32-bit big-endian",
- NULL, AV_CODEC_ID_PCM_U32BE)
-
-PCMDEF(u32le, "PCM unsigned 32-bit little-endian",
- NULL, AV_CODEC_ID_PCM_U32LE)
-
-PCMDEF(u24be, "PCM unsigned 24-bit big-endian",
- NULL, AV_CODEC_ID_PCM_U24BE)
-
-PCMDEF(u24le, "PCM unsigned 24-bit little-endian",
- NULL, AV_CODEC_ID_PCM_U24LE)
-
-PCMDEF(u16be, "PCM unsigned 16-bit big-endian",
- AV_NE("uw", NULL), AV_CODEC_ID_PCM_U16BE)
-
-PCMDEF(u16le, "PCM unsigned 16-bit little-endian",
- AV_NE(NULL, "uw"), AV_CODEC_ID_PCM_U16LE)
-
-PCMDEF(u8, "PCM unsigned 8-bit",
- "ub", AV_CODEC_ID_PCM_U8)
-
-PCMDEF(alaw, "PCM A-law",
- "al", AV_CODEC_ID_PCM_ALAW)
-
-PCMDEF(mulaw, "PCM mu-law",
- "ul", AV_CODEC_ID_PCM_MULAW)
-
-PCMDEF(vidc, "PCM Archimedes VIDC",
- NULL, AV_CODEC_ID_PCM_VIDC)
-
+#define PCMDEF_2(name, long_name, ext, codec, enabled, ...) \
+ PCMDEF_ ## enabled(name, long_name, ext, codec, __VA_ARGS__)
+#define PCMDEF_3(name, long_name, ext, codec, config, ...) \
+ PCMDEF_2(name, long_name, ext, codec, config, __VA_ARGS__)
+#define PCMDEF_EXT(name, long_name, ext, uppercase, ...) \
+ PCMDEF_3(name, long_name, ext, AV_CODEC_ID_PCM_ ## uppercase, \
+ CONFIG_PCM_ ## uppercase ## _DEMUXER, __VA_ARGS__)
+#define PCMDEF(name, long_name, ext, uppercase) \
+ PCMDEF_EXT(name, long_name, ext, uppercase, )
+
+PCMDEF(f64be, "PCM 64-bit floating-point big-endian", NULL, F64BE)
+PCMDEF(f64le, "PCM 64-bit floating-point little-endian", NULL, F64LE)
+PCMDEF(f32be, "PCM 32-bit floating-point big-endian", NULL, F32BE)
+PCMDEF(f32le, "PCM 32-bit floating-point little-endian", NULL, F32LE)
+PCMDEF(s32be, "PCM signed 32-bit big-endian", NULL, S32BE)
+PCMDEF(s32le, "PCM signed 32-bit little-endian", NULL, S32LE)
+PCMDEF(s24be, "PCM signed 24-bit big-endian", NULL, S24BE)
+PCMDEF(s24le, "PCM signed 24-bit little-endian", NULL, S24LE)
+PCMDEF_EXT(s16be, "PCM signed 16-bit big-endian",
+ AV_NE("sw", NULL), S16BE, .mime_type = "audio/L16")
+PCMDEF(s16le, "PCM signed 16-bit little-endian", AV_NE(NULL, "sw"), S16LE)
+PCMDEF(s8, "PCM signed 8-bit", "sb", S8)
+PCMDEF(u32be, "PCM unsigned 32-bit big-endian", NULL, U32BE)
+PCMDEF(u32le, "PCM unsigned 32-bit little-endian", NULL, U32LE)
+PCMDEF(u24be, "PCM unsigned 24-bit big-endian", NULL, U24BE)
+PCMDEF(u24le, "PCM unsigned 24-bit little-endian", NULL, U24LE)
+PCMDEF(u16be, "PCM unsigned 16-bit big-endian", AV_NE("uw", NULL), U16BE)
+PCMDEF(u16le, "PCM unsigned 16-bit little-endian", AV_NE(NULL, "uw"), U16LE)
+PCMDEF(u8, "PCM unsigned 8-bit", "ub", U8)
+PCMDEF(alaw, "PCM A-law", "al", ALAW)
+PCMDEF(mulaw, "PCM mu-law", "ul", MULAW)
+PCMDEF(vidc, "PCM Archimedes VIDC", NULL, VIDC)
+
+#if CONFIG_SLN_DEMUXER
static const AVOption sln_options[] = {
{ "sample_rate", "", offsetof(PCMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 8000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ "channels", "", offsetof(PCMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
@@ -213,3 +184,4 @@ AVInputFormat ff_sln_demuxer = {
.raw_codec_id = AV_CODEC_ID_PCM_S16LE,
.priv_class = &sln_demuxer_class,
};
+#endif