-#ifdef CONFIG_ENCODERS
-#define PCM_ENCODER(id,sample_fmt_,name,long_name_) \
-AVCodec name ## _encoder = { \
- #name, \
- CODEC_TYPE_AUDIO, \
- id, \
- 0, \
- pcm_encode_init, \
- pcm_encode_frame, \
- pcm_encode_close, \
- NULL, \
- .sample_fmts = (enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
- .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
-#else
-#define PCM_ENCODER(id,sample_fmt_,name,long_name_)
-#endif
-
-#ifdef CONFIG_DECODERS
-#define PCM_DECODER(id,sample_fmt_,name,long_name_) \
-AVCodec name ## _decoder = { \
- #name, \
- CODEC_TYPE_AUDIO, \
- id, \
- sizeof(PCMDecode), \
- pcm_decode_init, \
- NULL, \
- NULL, \
- pcm_decode_frame, \
- .sample_fmts = (enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
- .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
-#else
-#define PCM_DECODER(id,sample_fmt_,name,long_name_)
-#endif
+#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_, \
+ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+ .type = AVMEDIA_TYPE_AUDIO, \
+ .id = AV_CODEC_ID_ ## id_, \
+ .init = pcm_encode_init, \
+ .encode2 = pcm_encode_frame, \
+ .close = pcm_encode_close, \
+ .capabilities = CODEC_CAP_VARIABLE_FRAME_SIZE, \
+ .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
+ AV_SAMPLE_FMT_NONE }, \
+}
+
+#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_, \
+ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+ .type = AVMEDIA_TYPE_AUDIO, \
+ .id = AV_CODEC_ID_ ## id_, \
+ .priv_data_size = sizeof(PCMDecode), \
+ .init = pcm_decode_init, \
+ .decode = pcm_decode_frame, \
+ .capabilities = CODEC_CAP_DR1, \
+ .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
+ AV_SAMPLE_FMT_NONE }, \
+}
+
+#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)