aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/pcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-23 12:36:16 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-23 12:36:16 +0200
commitdcb0d1193a3de3711bdb410c1fe3f70cc5143603 (patch)
treeda6d7cc880fbcec931838a9adf178d1b9e962212 /libavcodec/pcm.c
parent34ccb94796b7f9cc3ee82f94f3890748a5c51dd5 (diff)
parent5ac673b5531d846b79a3d77e3e932e0cb1234c45 (diff)
downloadffmpeg-dcb0d1193a3de3711bdb410c1fe3f70cc5143603.tar.gz
Merge commit '5ac673b5531d846b79a3d77e3e932e0cb1234c45'
* commit '5ac673b5531d846b79a3d77e3e932e0cb1234c45': atrac3: use AVCodecContext.channels instead of keeping a private copy atrac3: simplify some loop indexing atrac3: cosmetics: pretty-printing and renaming pcm: define AVCodec instances only for enabled codecs libxvid: remove useless doxy comments. lavc: remove stats_out from the options table. Conflicts: libavcodec/atrac3.c libavcodec/pcm.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r--libavcodec/pcm.c82
1 files changed, 45 insertions, 37 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index e2ae9f964c..7f4db373fb 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -477,12 +477,12 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
return buf_size;
}
-#if CONFIG_ENCODERS
-#define PCM_ENCODER(id_, sample_fmt_, name_, long_name_) \
+#define PCM_ENCODER_0(id_, sample_fmt_, name_, long_name_)
+#define PCM_ENCODER_1(id_, sample_fmt_, name_, long_name_) \
AVCodec ff_ ## name_ ## _encoder = { \
.name = #name_, \
.type = AVMEDIA_TYPE_AUDIO, \
- .id = id_, \
+ .id = AV_CODEC_ID_ ## id_, \
.init = pcm_encode_init, \
.encode2 = pcm_encode_frame, \
.close = pcm_encode_close, \
@@ -491,16 +491,20 @@ AVCodec ff_ ## name_ ## _encoder = { \
AV_SAMPLE_FMT_NONE }, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
}
-#else
-#define PCM_ENCODER(id, sample_fmt_, name, long_name_)
-#endif
-#if CONFIG_DECODERS
-#define PCM_DECODER(id_, sample_fmt_, name_, long_name_) \
+#define PCM_ENCODER_2(cf, id, sample_fmt, name, long_name) \
+ PCM_ENCODER_ ## cf(id, sample_fmt, name, long_name)
+#define PCM_ENCODER_3(cf, id, sample_fmt, name, long_name) \
+ PCM_ENCODER_2(cf, id, sample_fmt, name, long_name)
+#define PCM_ENCODER(id, sample_fmt, name, long_name) \
+ PCM_ENCODER_3(CONFIG_ ## id ## _ENCODER, id, sample_fmt, name, long_name)
+
+#define PCM_DECODER_0(id, sample_fmt, name, long_name)
+#define PCM_DECODER_1(id_, sample_fmt_, name_, long_name_) \
AVCodec ff_ ## name_ ## _decoder = { \
.name = #name_, \
.type = AVMEDIA_TYPE_AUDIO, \
- .id = id_, \
+ .id = AV_CODEC_ID_ ## id_, \
.priv_data_size = sizeof(PCMDecode), \
.init = pcm_decode_init, \
.decode = pcm_decode_frame, \
@@ -509,38 +513,42 @@ AVCodec ff_ ## name_ ## _decoder = { \
AV_SAMPLE_FMT_NONE }, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
}
-#else
-#define PCM_DECODER(id, sample_fmt_, name, long_name_)
-#endif
+
+#define PCM_DECODER_2(cf, id, sample_fmt, name, long_name) \
+ PCM_DECODER_ ## cf(id, sample_fmt, name, long_name)
+#define PCM_DECODER_3(cf, id, sample_fmt, name, long_name) \
+ PCM_DECODER_2(cf, id, sample_fmt, name, long_name)
+#define PCM_DECODER(id, sample_fmt, name, long_name) \
+ PCM_DECODER_3(CONFIG_ ## id ## _DECODER, id, sample_fmt, name, long_name)
#define PCM_CODEC(id, sample_fmt_, name, long_name_) \
PCM_ENCODER(id, sample_fmt_, name, long_name_); \
PCM_DECODER(id, sample_fmt_, name, long_name_)
/* Note: Do not forget to add new entries to the Makefile as well. */
-PCM_CODEC (AV_CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law / G.711 A-law");
-PCM_DECODER(AV_CODEC_ID_PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
-PCM_DECODER(AV_CODEC_ID_PCM_LXF, AV_SAMPLE_FMT_S32P,pcm_lxf, "PCM signed 20-bit little-endian planar");
-PCM_CODEC (AV_CODEC_ID_PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law / G.711 mu-law");
-PCM_CODEC (AV_CODEC_ID_PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit");
-PCM_CODEC (AV_CODEC_ID_PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
-PCM_DECODER(AV_CODEC_ID_PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16le_planar, "PCM 16-bit little-endian planar");
-PCM_CODEC (AV_CODEC_ID_PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
-PCM_CODEC (AV_CODEC_ID_PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit");
-PCM_CODEC (AV_CODEC_ID_PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
-PCM_CODEC (AV_CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
-PCM_DECODER(AV_CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork");
+PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law / G.711 A-law");
+PCM_DECODER(PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
+PCM_CODEC (PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
+PCM_CODEC (PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
+PCM_CODEC (PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
+PCM_CODEC (PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
+PCM_DECODER(PCM_LXF, AV_SAMPLE_FMT_S32P,pcm_lxf, "PCM signed 20-bit little-endian planar");
+PCM_CODEC (PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law / G.711 mu-law");
+PCM_CODEC (PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit");
+PCM_CODEC (PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
+PCM_CODEC (PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
+PCM_DECODER(PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16le_planar, "PCM 16-bit little-endian planar");
+PCM_CODEC (PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
+PCM_CODEC (PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
+PCM_CODEC (PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
+PCM_CODEC (PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
+PCM_CODEC (PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
+PCM_CODEC (PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit");
+PCM_CODEC (PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
+PCM_CODEC (PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
+PCM_CODEC (PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
+PCM_CODEC (PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
+PCM_CODEC (PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
+PCM_CODEC (PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
+PCM_DECODER(PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork");