1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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
This commit is contained in:
Peter Ross 2008-07-31 10:47:31 +00:00
parent c8fd5da42f
commit fd76c37fd9
46 changed files with 94 additions and 26 deletions

View File

@ -86,6 +86,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
default:
return -1;
}
avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
}

View File

@ -221,6 +221,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
return AVERROR_NOMEM;
}
avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
}

View File

@ -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"),
};

View File

@ -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

View File

@ -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,

View File

@ -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"),
};

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1058,6 +1058,7 @@ static int atrac3_decode_init(AVCodecContext *avctx)
return AVERROR(ENOMEM);
}
avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
}

View File

@ -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

View File

@ -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;
}

View File

@ -154,6 +154,7 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
break;
}
avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
}

View File

@ -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;
}

View File

@ -113,6 +113,7 @@ static av_cold int flac_decode_init(AVCodecContext * avctx)
}
}
avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
}

View File

@ -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)"),
};

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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"),
};

View File

@ -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)"),
};

View File

@ -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;
}

View File

@ -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"),
};

View File

@ -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)"),
};

View File

@ -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"),
} ;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -108,6 +108,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
}
}
vlc_initialized = 1;
avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
}

View File

@ -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;
}

View File

@ -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)"),
};

View File

@ -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;
}

View File

@ -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");

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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,

View File

@ -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"),
};

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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 ;
}

View File

@ -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"),
};

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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"),
};

View File

@ -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;
}