From fd76c37fd9f564b4e979fbe20ecfcfad13f8b4f4 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Thu, 31 Jul 2008 10:47:31 +0000 Subject: [PATCH] Modify all codecs to report their supported input and output sample format(s). Originally committed as revision 14482 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/8svx.c | 1 + libavcodec/ac3dec.c | 1 + libavcodec/ac3enc.c | 1 + libavcodec/adpcm.c | 2 ++ libavcodec/adxdec.c | 8 ++++++- libavcodec/adxenc.c | 1 + libavcodec/alac.c | 1 + libavcodec/apedec.c | 1 + libavcodec/atrac3.c | 1 + libavcodec/cook.c | 2 ++ libavcodec/dca.c | 1 + libavcodec/dpcm.c | 1 + libavcodec/dsicinav.c | 1 + libavcodec/flac.c | 1 + libavcodec/flacenc.c | 1 + libavcodec/g726.c | 4 ++++ libavcodec/imc.c | 1 + libavcodec/liba52.c | 1 + libavcodec/libamr.c | 3 +++ libavcodec/libfaac.c | 1 + libavcodec/libfaad.c | 1 + libavcodec/libgsm.c | 4 ++++ libavcodec/libmp3lame.c | 1 + libavcodec/libvorbis.c | 1 + libavcodec/mace.c | 1 + libavcodec/mlpdec.c | 1 + libavcodec/mpc7.c | 1 + libavcodec/mpc8.c | 1 + libavcodec/mpegaudioenc.c | 1 + libavcodec/nellymoserdec.c | 1 + libavcodec/pcm.c | 49 +++++++++++++++++++------------------- libavcodec/qdm2.c | 2 ++ libavcodec/ra144.c | 1 + libavcodec/ra288.c | 8 ++++++- libavcodec/roqaudioenc.c | 1 + libavcodec/shorten.c | 1 + libavcodec/smacker.c | 1 + libavcodec/sonic.c | 1 + libavcodec/truespeech.c | 1 + libavcodec/vmdav.c | 1 + libavcodec/vorbis_dec.c | 1 + libavcodec/vorbis_enc.c | 1 + libavcodec/wavpack.c | 1 + libavcodec/wmadec.c | 1 + libavcodec/wmaenc.c | 2 ++ libavcodec/ws-snd1.c | 1 + 46 files changed, 94 insertions(+), 26 deletions(-) diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index 660f00ccf8..4a7f5d9fed 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -86,6 +86,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx) default: return -1; } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index d76597afc1..51cda0bcbf 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -221,6 +221,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) return AVERROR_NOMEM; } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 86ccb49822..b373b261eb 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1364,5 +1364,6 @@ AVCodec ac3_encoder = { AC3_encode_frame, AC3_encode_close, NULL, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 / AC-3"), }; diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 9cd03fe787..c4fb3eeb6d 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -698,6 +698,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) default: break; } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } @@ -1599,6 +1600,7 @@ AVCodec name ## _encoder = { \ adpcm_encode_frame, \ adpcm_encode_close, \ NULL, \ + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ }; #else diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c index 91331c04b1..8765a456dd 100644 --- a/libavcodec/adxdec.c +++ b/libavcodec/adxdec.c @@ -30,6 +30,12 @@ * adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/ */ +static av_cold void adx_decode_init(AVCodecContext *avctx) +{ + avctx->sample_fmt = SAMPLE_FMT_S16; + return 0; +} + /* 18 bytes <-> 32 samples */ static void adx_decode(short *out,const unsigned char *in,PREV *prev) @@ -161,7 +167,7 @@ AVCodec adpcm_adx_decoder = { CODEC_TYPE_AUDIO, CODEC_ID_ADPCM_ADX, sizeof(ADXContext), - NULL, + adx_decode_init, NULL, NULL, adx_decode_frame, diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c index 927ecd7b1a..6bce31a186 100644 --- a/libavcodec/adxenc.c +++ b/libavcodec/adxenc.c @@ -190,5 +190,6 @@ AVCodec adpcm_adx_encoder = { adx_encode_frame, adx_encode_close, NULL, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX"), }; diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 6815fa1aea..cb710a6346 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -594,6 +594,7 @@ static av_cold int alac_decode_init(AVCodecContext * avctx) alac->numchannels = alac->avctx->channels; alac->bytespersample = (avctx->bits_per_sample / 8) * alac->numchannels; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index c4aa38f8fd..40fb1f365d 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -198,6 +198,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx) } dsputil_init(&s->dsp, avctx); + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 7bf3ec27f4..9a03bbe207 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -1058,6 +1058,7 @@ static int atrac3_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/cook.c b/libavcodec/cook.c index cbf1c9c621..3a16c77797 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1178,6 +1178,8 @@ static int cook_decode_init(AVCodecContext *avctx) return -1; } + avctx->sample_fmt = SAMPLE_FMT_S16; + #ifdef COOKDEBUG dump_cook_context(q); #endif diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 8770def744..8cca01a020 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1253,6 +1253,7 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) avctx->channels = avctx->request_channels; } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index e31f180b54..ff684aeb43 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -154,6 +154,7 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx) break; } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index 2cd5db8525..039b0adc0d 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -305,6 +305,7 @@ static av_cold int cinaudio_decode_init(AVCodecContext *avctx) cin->avctx = avctx; cin->initial_decode_frame = 1; cin->delta = 0; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/flac.c b/libavcodec/flac.c index fc1e0ec0e4..60b35a3933 100644 --- a/libavcodec/flac.c +++ b/libavcodec/flac.c @@ -113,6 +113,7 @@ static av_cold int flac_decode_init(AVCodecContext * avctx) } } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 622db4b524..c6751aad8e 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1485,5 +1485,6 @@ AVCodec flac_encoder = { flac_encode_close, NULL, .capabilities = CODEC_CAP_SMALL_LAST_FRAME, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"), }; diff --git a/libavcodec/g726.c b/libavcodec/g726.c index bace3d045b..463d993137 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -323,6 +323,9 @@ static av_cold int g726_init(AVCodecContext * avctx) return AVERROR(ENOMEM); avctx->coded_frame->key_frame = 1; + if (avctx->codec->decode) + avctx->sample_fmt = SAMPLE_FMT_S16; + return 0; } @@ -381,6 +384,7 @@ AVCodec adpcm_g726_encoder = { g726_encode_frame, g726_close, NULL, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"), }; #endif //CONFIG_ENCODERS diff --git a/libavcodec/imc.c b/libavcodec/imc.c index d316ba4cbb..436a5c9552 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -154,6 +154,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx) ff_fft_init(&q->fft, 7, 1); dsputil_init(&q->dsp, avctx); + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/liba52.c b/libavcodec/liba52.c index becae1d73f..ec0a252b5f 100644 --- a/libavcodec/liba52.c +++ b/libavcodec/liba52.c @@ -119,6 +119,7 @@ static av_cold int a52_decode_init(AVCodecContext *avctx) avctx->channels = avctx->request_channels; } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/libamr.c b/libavcodec/libamr.c index 0e23de14b1..4f56e4d729 100644 --- a/libavcodec/libamr.c +++ b/libavcodec/libamr.c @@ -134,6 +134,7 @@ static void amr_decode_fix_avctx(AVCodecContext * avctx) } avctx->frame_size = 160 * is_amr_wb; + avctx->sample_fmt = SAMPLE_FMT_S16; } #ifdef CONFIG_LIBAMR_NB_FIXED @@ -516,6 +517,7 @@ AVCodec libamr_nb_encoder = amr_nb_encode_frame, amr_nb_encode_close, NULL, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"), }; @@ -710,6 +712,7 @@ AVCodec libamr_wb_encoder = amr_wb_encode_frame, amr_wb_encode_close, NULL, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"), }; diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index a66ac2e854..2ed4f765f9 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -151,5 +151,6 @@ AVCodec libfaac_encoder = { Faac_encode_init, Faac_encode_frame, Faac_encode_close, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"), }; diff --git a/libavcodec/libfaad.c b/libavcodec/libfaad.c index bb901f9675..3e7339d6f4 100644 --- a/libavcodec/libfaad.c +++ b/libavcodec/libfaad.c @@ -313,6 +313,7 @@ static av_cold int faac_decode_init(AVCodecContext *avctx) if(!s->init && avctx->channels > 0) channel_setup(avctx); + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index ef2f5e759a..09578b403d 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -48,6 +48,8 @@ static av_cold int libgsm_init(AVCodecContext *avctx) { if(!avctx->sample_rate) avctx->sample_rate= 8000; + + avctx->sample_fmt = SAMPLE_FMT_S16; }else{ if (avctx->sample_rate != 8000) { av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n", @@ -117,6 +119,7 @@ AVCodec libgsm_encoder = { libgsm_init, libgsm_encode_frame, libgsm_close, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"), }; @@ -128,6 +131,7 @@ AVCodec libgsm_ms_encoder = { libgsm_init, libgsm_encode_frame, libgsm_close, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"), }; diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 13a658a1f1..ab22038276 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -218,5 +218,6 @@ AVCodec libmp3lame_encoder = { MP3lame_encode_frame, MP3lame_encode_close, .capabilities= CODEC_CAP_DELAY, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"), }; diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c index f1eb5a1f3c..ce796a05f7 100644 --- a/libavcodec/libvorbis.c +++ b/libavcodec/libvorbis.c @@ -217,5 +217,6 @@ AVCodec libvorbis_encoder = { oggvorbis_encode_frame, oggvorbis_encode_close, .capabilities= CODEC_CAP_DELAY, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"), } ; diff --git a/libavcodec/mace.c b/libavcodec/mace.c index 2e15e91ed3..c789984618 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -396,6 +396,7 @@ static av_cold int mace_decode_init(AVCodecContext * avctx) { if (avctx->channels > 2) return -1; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index f4d7313c4c..03dbec056d 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -336,6 +336,7 @@ static av_cold int mlp_decode_init(AVCodecContext *avctx) m->avctx = avctx; for (substr = 0; substr < MAX_SUBSTREAMS; substr++) m->substream[substr].lossless_check_data = 0xffffffff; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index a975db3c36..565b8589ec 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -108,6 +108,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) } } vlc_initialized = 1; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 55fe94214b..0d4f128912 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -177,6 +177,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) &mpc8_q8_codes[i], 1, 1, INIT_VLC_USE_STATIC); } vlc_initialized = 1; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 07b5509401..c061d7f5cf 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -796,6 +796,7 @@ AVCodec mp2_encoder = { MPA_encode_frame, MPA_encode_close, NULL, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), }; diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 8045e4b8d0..a4c74ea676 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -149,6 +149,7 @@ static av_cold int decode_init(AVCodecContext * avctx) { if (!sine_window[0]) ff_sine_window_init(sine_window, 128); + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 8f02fda7e3..2935d01a7e 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -553,7 +553,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, } #ifdef CONFIG_ENCODERS -#define PCM_ENCODER(id,name,long_name_) \ +#define PCM_ENCODER(id,sample_fmt_,name,long_name_) \ AVCodec name ## _encoder = { \ #name, \ CODEC_TYPE_AUDIO, \ @@ -563,10 +563,11 @@ AVCodec name ## _encoder = { \ 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,name,long_name_) +#define PCM_ENCODER(id,sample_fmt_,name,long_name_) #endif #ifdef CONFIG_DECODERS @@ -586,28 +587,28 @@ AVCodec name ## _decoder = { \ #define PCM_DECODER(id,name,long_name_) #endif -#define PCM_CODEC(id, name, long_name_) \ - PCM_ENCODER(id,name,long_name_) PCM_DECODER(id,name,long_name_) +#define PCM_CODEC(id, sample_fmt_, name, long_name_) \ + PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,name,long_name_) /* Note: Do not forget to add new entries to the Makefile as well. */ -PCM_CODEC (CODEC_ID_PCM_ALAW, pcm_alaw, "A-law PCM"); -PCM_CODEC (CODEC_ID_PCM_DVD, pcm_dvd, "signed 16|20|24-bit big-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_F32BE, pcm_f32be, "32-bit floating point big-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_MULAW, pcm_mulaw, "mu-law PCM"); -PCM_CODEC (CODEC_ID_PCM_S8, pcm_s8, "signed 8-bit PCM"); -PCM_CODEC (CODEC_ID_PCM_S16BE, pcm_s16be, "signed 16-bit big-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_S16LE, pcm_s16le, "signed 16-bit little-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_ALAW, SAMPLE_FMT_S16, pcm_alaw, "A-law PCM"); +PCM_CODEC (CODEC_ID_PCM_DVD, SAMPLE_FMT_S16, pcm_dvd, "signed 16|20|24-bit big-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_F32BE, SAMPLE_FMT_FLT, pcm_f32be, "32-bit floating point big-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_MULAW, SAMPLE_FMT_S16, pcm_mulaw, "mu-law PCM"); +PCM_CODEC (CODEC_ID_PCM_S8, SAMPLE_FMT_S16, pcm_s8, "signed 8-bit PCM"); +PCM_CODEC (CODEC_ID_PCM_S16BE, SAMPLE_FMT_S16, pcm_s16be, "signed 16-bit big-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_S16LE, SAMPLE_FMT_S16, pcm_s16le, "signed 16-bit little-endian PCM"); PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, pcm_s16le_planar, "16-bit little-endian planar PCM"); -PCM_CODEC (CODEC_ID_PCM_S24BE, pcm_s24be, "signed 24-bit big-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_S24DAUD, pcm_s24daud, "D-Cinema audio signed 24-bit PCM"); -PCM_CODEC (CODEC_ID_PCM_S24LE, pcm_s24le, "signed 24-bit little-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_S32BE, pcm_s32be, "signed 32-bit big-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_S32LE, pcm_s32le, "signed 32-bit little-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_U8, pcm_u8, "unsigned 8-bit PCM"); -PCM_CODEC (CODEC_ID_PCM_U16BE, pcm_u16be, "unsigned 16-bit big-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_U16LE, pcm_u16le, "unsigned 16-bit little-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_U24BE, pcm_u24be, "unsigned 24-bit big-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_U24LE, pcm_u24le, "unsigned 24-bit little-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_U32BE, pcm_u32be, "unsigned 32-bit big-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_U32LE, pcm_u32le, "unsigned 32-bit little-endian PCM"); -PCM_CODEC (CODEC_ID_PCM_ZORK, pcm_zork, "Zork PCM"); +PCM_CODEC (CODEC_ID_PCM_S24BE, SAMPLE_FMT_S16, pcm_s24be, "signed 24-bit big-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_S24DAUD, SAMPLE_FMT_S16, pcm_s24daud, "D-Cinema audio signed 24-bit PCM"); +PCM_CODEC (CODEC_ID_PCM_S24LE, SAMPLE_FMT_S16, pcm_s24le, "signed 24-bit little-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_S32BE, SAMPLE_FMT_S16, pcm_s32be, "signed 32-bit big-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_S32LE, SAMPLE_FMT_S16, pcm_s32le, "signed 32-bit little-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_U8, SAMPLE_FMT_S16, pcm_u8, "unsigned 8-bit PCM"); +PCM_CODEC (CODEC_ID_PCM_U16BE, SAMPLE_FMT_S16, pcm_u16be, "unsigned 16-bit big-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_U16LE, SAMPLE_FMT_S16, pcm_u16le, "unsigned 16-bit little-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_U24BE, SAMPLE_FMT_S16, pcm_u24be, "unsigned 24-bit big-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_U24LE, SAMPLE_FMT_S16, pcm_u24le, "unsigned 24-bit little-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_U32BE, SAMPLE_FMT_S16, pcm_u32be, "unsigned 32-bit big-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_U32LE, SAMPLE_FMT_S16, pcm_u32le, "unsigned 32-bit little-endian PCM"); +PCM_CODEC (CODEC_ID_PCM_ZORK, SAMPLE_FMT_S16, pcm_zork, "Zork PCM"); diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 203312144a..e1b67d0c19 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1931,6 +1931,8 @@ static int qdm2_decode_init(AVCodecContext *avctx) qdm2_init(s); + avctx->sample_fmt = SAMPLE_FMT_S16; + // dump_context(s); return 0; } diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c index 3b243b4596..fc99655e80 100644 --- a/libavcodec/ra144.c +++ b/libavcodec/ra144.c @@ -58,6 +58,7 @@ static int ra144_decode_init(AVCodecContext * avctx) ractx->lpc_coef[0] = ractx->lpc_tables[0]; ractx->lpc_coef[1] = ractx->lpc_tables[1]; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index 6930cf5368..f3e8af4fd2 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -42,6 +42,12 @@ typedef struct { float gain_block[10]; ///< Gain data of four blocks (spec: GSTATE) } RA288Context; +static av_cold int ra288_decode_init(AVCodecContext *avctx) +{ + avctx->sample_fmt = SAMPLE_FMT_S16; + return 0; +} + static inline float scalar_product_float(const float * v1, const float * v2, int size) { @@ -258,7 +264,7 @@ AVCodec ra_288_decoder = CODEC_TYPE_AUDIO, CODEC_ID_RA_288, sizeof(RA288Context), - NULL, + ra288_decode_init, NULL, NULL, ra288_decode_frame, diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c index 6c40e906e4..df014a449f 100644 --- a/libavcodec/roqaudioenc.c +++ b/libavcodec/roqaudioenc.c @@ -174,5 +174,6 @@ AVCodec roq_dpcm_encoder = { roq_dpcm_encode_frame, roq_dpcm_encode_close, NULL, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"), }; diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 7516c65f3e..7f8ef819c0 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -104,6 +104,7 @@ static av_cold int shorten_decode_init(AVCodecContext * avctx) { ShortenContext *s = avctx->priv_data; s->avctx = avctx; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 5e3b6df8cf..1690518b6b 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -558,6 +558,7 @@ static av_cold int decode_end(AVCodecContext *avctx) static av_cold int smka_decode_init(AVCodecContext *avctx) { + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index 9d594efd7f..60d36a5891 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -828,6 +828,7 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx) } s->int_samples = av_mallocz(4* s->frame_size); + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c index 8311835d6a..3df71cb7f2 100644 --- a/libavcodec/truespeech.c +++ b/libavcodec/truespeech.c @@ -54,6 +54,7 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx) { // TSContext *c = avctx->priv_data; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index e3a8144b01..b6e10d7faa 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -446,6 +446,7 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) s->channels = avctx->channels; s->bits = avctx->bits_per_sample; s->block_align = avctx->block_align; + avctx->sample_fmt = SAMPLE_FMT_S16; av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n", s->channels, s->bits, s->block_align, avctx->sample_rate); diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 4e74b14d55..46ec7b690f 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -971,6 +971,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext) { avccontext->channels = vc->audio_channels; avccontext->sample_rate = vc->audio_samplerate; avccontext->frame_size = FFMIN(vc->blocksize[0], vc->blocksize[1])>>2; + avccontext->sample_fmt = SAMPLE_FMT_S16; return 0 ; } diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index 0a997a6b46..5add7a91b5 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -1084,5 +1084,6 @@ AVCodec vorbis_encoder = { vorbis_encode_frame, vorbis_encode_close, .capabilities= CODEC_CAP_DELAY, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Vorbis"), }; diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 660c78abf4..e8703b38dc 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -360,6 +360,7 @@ static av_cold int wavpack_decode_init(AVCodecContext *avctx) s->avctx = avctx; s->stereo = (avctx->channels == 2); + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index 4d892ceac6..fa987512e4 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -126,6 +126,7 @@ static int wma_decode_init(AVCodecContext * avctx) wma_lsp_to_curve_init(s, s->frame_len); } + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index 0fa17e2864..b2ea90e638 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -387,6 +387,7 @@ AVCodec wmav1_encoder = encode_init, encode_superframe, ff_wma_end, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), }; @@ -399,5 +400,6 @@ AVCodec wmav2_encoder = encode_init, encode_superframe, ff_wma_end, + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), }; diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c index 18911c79fe..24753b0c9c 100644 --- a/libavcodec/ws-snd1.c +++ b/libavcodec/ws-snd1.c @@ -40,6 +40,7 @@ static av_cold int ws_snd_decode_init(AVCodecContext * avctx) { // WSSNDContext *c = avctx->priv_data; + avctx->sample_fmt = SAMPLE_FMT_S16; return 0; }