mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Replace deprecated symbols SAMPLE_FMT_* with AV_SAMPLE_FMT_*, and enum
SampleFormat with AVSampleFormat. Originally committed as revision 25730 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
09f47fa44e
commit
5d6e4c160a
12
ffmpeg.c
12
ffmpeg.c
@ -148,7 +148,7 @@ static int frame_width = 0;
|
|||||||
static int frame_height = 0;
|
static int frame_height = 0;
|
||||||
static float frame_aspect_ratio = 0;
|
static float frame_aspect_ratio = 0;
|
||||||
static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
|
static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
|
||||||
static enum SampleFormat audio_sample_fmt = SAMPLE_FMT_NONE;
|
static enum AVSampleFormat audio_sample_fmt = AV_SAMPLE_FMT_NONE;
|
||||||
static int max_frames[4] = {INT_MAX, INT_MAX, INT_MAX, INT_MAX};
|
static int max_frames[4] = {INT_MAX, INT_MAX, INT_MAX, INT_MAX};
|
||||||
static AVRational frame_rate;
|
static AVRational frame_rate;
|
||||||
static float video_qscale = 0;
|
static float video_qscale = 0;
|
||||||
@ -597,7 +597,7 @@ static void *grow_array(void *array, int elem_size, int *size, int new_size)
|
|||||||
static void choose_sample_fmt(AVStream *st, AVCodec *codec)
|
static void choose_sample_fmt(AVStream *st, AVCodec *codec)
|
||||||
{
|
{
|
||||||
if(codec && codec->sample_fmts){
|
if(codec && codec->sample_fmts){
|
||||||
const enum SampleFormat *p= codec->sample_fmts;
|
const enum AVSampleFormat *p= codec->sample_fmts;
|
||||||
for(; *p!=-1; p++){
|
for(; *p!=-1; p++){
|
||||||
if(*p == st->codec->sample_fmt)
|
if(*p == st->codec->sample_fmt)
|
||||||
break;
|
break;
|
||||||
@ -809,7 +809,7 @@ need_realloc:
|
|||||||
ost->audio_resample = 1;
|
ost->audio_resample = 1;
|
||||||
|
|
||||||
if (ost->audio_resample && !ost->resample) {
|
if (ost->audio_resample && !ost->resample) {
|
||||||
if (dec->sample_fmt != SAMPLE_FMT_S16)
|
if (dec->sample_fmt != AV_SAMPLE_FMT_S16)
|
||||||
fprintf(stderr, "Warning, using s16 intermediate sample format for resampling\n");
|
fprintf(stderr, "Warning, using s16 intermediate sample format for resampling\n");
|
||||||
ost->resample = av_audio_resample_init(enc->channels, dec->channels,
|
ost->resample = av_audio_resample_init(enc->channels, dec->channels,
|
||||||
enc->sample_rate, dec->sample_rate,
|
enc->sample_rate, dec->sample_rate,
|
||||||
@ -823,7 +823,7 @@ need_realloc:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_SFMT_PAIR(a,b) ((a)+SAMPLE_FMT_NB*(b))
|
#define MAKE_SFMT_PAIR(a,b) ((a)+AV_SAMPLE_FMT_NB*(b))
|
||||||
if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt &&
|
if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt &&
|
||||||
MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt)!=ost->reformat_pair) {
|
MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt)!=ost->reformat_pair) {
|
||||||
if (ost->reformat_ctx)
|
if (ost->reformat_ctx)
|
||||||
@ -2175,7 +2175,7 @@ static int transcode(AVFormatContext **output_files,
|
|||||||
ost->fifo= av_fifo_alloc(1024);
|
ost->fifo= av_fifo_alloc(1024);
|
||||||
if(!ost->fifo)
|
if(!ost->fifo)
|
||||||
goto fail;
|
goto fail;
|
||||||
ost->reformat_pair = MAKE_SFMT_PAIR(SAMPLE_FMT_NONE,SAMPLE_FMT_NONE);
|
ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE);
|
||||||
ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
|
ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
|
||||||
icodec->request_channels = codec->channels;
|
icodec->request_channels = codec->channels;
|
||||||
ist->decoding_needed = 1;
|
ist->decoding_needed = 1;
|
||||||
@ -2851,7 +2851,7 @@ static void opt_audio_sample_fmt(const char *arg)
|
|||||||
if (strcmp(arg, "list"))
|
if (strcmp(arg, "list"))
|
||||||
audio_sample_fmt = av_get_sample_fmt(arg);
|
audio_sample_fmt = av_get_sample_fmt(arg);
|
||||||
else {
|
else {
|
||||||
list_fmts(av_get_sample_fmt_string, SAMPLE_FMT_NB);
|
list_fmts(av_get_sample_fmt_string, AV_SAMPLE_FMT_NB);
|
||||||
ffmpeg_exit(0);
|
ffmpeg_exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
ffplay.c
8
ffplay.c
@ -163,7 +163,7 @@ typedef struct VideoState {
|
|||||||
int audio_buf_index; /* in bytes */
|
int audio_buf_index; /* in bytes */
|
||||||
AVPacket audio_pkt_temp;
|
AVPacket audio_pkt_temp;
|
||||||
AVPacket audio_pkt;
|
AVPacket audio_pkt;
|
||||||
enum SampleFormat audio_src_fmt;
|
enum AVSampleFormat audio_src_fmt;
|
||||||
AVAudioConvert *reformat_ctx;
|
AVAudioConvert *reformat_ctx;
|
||||||
|
|
||||||
int show_audio; /* if true, display audio samples */
|
int show_audio; /* if true, display audio samples */
|
||||||
@ -2095,12 +2095,12 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
|
|||||||
if (dec->sample_fmt != is->audio_src_fmt) {
|
if (dec->sample_fmt != is->audio_src_fmt) {
|
||||||
if (is->reformat_ctx)
|
if (is->reformat_ctx)
|
||||||
av_audio_convert_free(is->reformat_ctx);
|
av_audio_convert_free(is->reformat_ctx);
|
||||||
is->reformat_ctx= av_audio_convert_alloc(SAMPLE_FMT_S16, 1,
|
is->reformat_ctx= av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1,
|
||||||
dec->sample_fmt, 1, NULL, 0);
|
dec->sample_fmt, 1, NULL, 0);
|
||||||
if (!is->reformat_ctx) {
|
if (!is->reformat_ctx) {
|
||||||
fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
|
fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
|
||||||
av_get_sample_fmt_name(dec->sample_fmt),
|
av_get_sample_fmt_name(dec->sample_fmt),
|
||||||
av_get_sample_fmt_name(SAMPLE_FMT_S16));
|
av_get_sample_fmt_name(AV_SAMPLE_FMT_S16));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
is->audio_src_fmt= dec->sample_fmt;
|
is->audio_src_fmt= dec->sample_fmt;
|
||||||
@ -2268,7 +2268,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
is->audio_hw_buf_size = spec.size;
|
is->audio_hw_buf_size = spec.size;
|
||||||
is->audio_src_fmt= SAMPLE_FMT_S16;
|
is->audio_src_fmt= AV_SAMPLE_FMT_S16;
|
||||||
}
|
}
|
||||||
|
|
||||||
ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;
|
ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;
|
||||||
|
@ -88,7 +88,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
|
|||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +545,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
AAC_INIT_VLC_STATIC( 0, 304);
|
AAC_INIT_VLC_STATIC( 0, 304);
|
||||||
AAC_INIT_VLC_STATIC( 1, 270);
|
AAC_INIT_VLC_STATIC( 1, 270);
|
||||||
@ -2369,8 +2369,8 @@ AVCodec aac_decoder = {
|
|||||||
aac_decode_close,
|
aac_decode_close,
|
||||||
aac_decode_frame,
|
aac_decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
||||||
.sample_fmts = (const enum SampleFormat[]) {
|
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||||
SAMPLE_FMT_S16,SAMPLE_FMT_NONE
|
AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE
|
||||||
},
|
},
|
||||||
.channel_layouts = aac_channel_layout,
|
.channel_layouts = aac_channel_layout,
|
||||||
};
|
};
|
||||||
@ -2389,8 +2389,8 @@ AVCodec aac_latm_decoder = {
|
|||||||
.close = aac_decode_close,
|
.close = aac_decode_close,
|
||||||
.decode = latm_decode_frame,
|
.decode = latm_decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
|
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
|
||||||
.sample_fmts = (const enum SampleFormat[]) {
|
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||||
SAMPLE_FMT_S16,SAMPLE_FMT_NONE
|
AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE
|
||||||
},
|
},
|
||||||
.channel_layouts = aac_channel_layout,
|
.channel_layouts = aac_channel_layout,
|
||||||
};
|
};
|
||||||
|
@ -645,6 +645,6 @@ AVCodec aac_encoder = {
|
|||||||
aac_encode_frame,
|
aac_encode_frame,
|
||||||
aac_encode_end,
|
aac_encode_end,
|
||||||
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
|
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
||||||
};
|
};
|
||||||
|
@ -219,7 +219,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1400,7 +1400,7 @@ AVCodec ac3_encoder = {
|
|||||||
AC3_encode_frame,
|
AC3_encode_frame,
|
||||||
AC3_encode_close,
|
AC3_encode_close,
|
||||||
NULL,
|
NULL,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
||||||
.channel_layouts = (const int64_t[]){
|
.channel_layouts = (const int64_t[]){
|
||||||
CH_LAYOUT_MONO,
|
CH_LAYOUT_MONO,
|
||||||
|
@ -737,7 +737,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1678,7 +1678,7 @@ AVCodec name ## _encoder = { \
|
|||||||
adpcm_encode_frame, \
|
adpcm_encode_frame, \
|
||||||
adpcm_encode_close, \
|
adpcm_encode_close, \
|
||||||
NULL, \
|
NULL, \
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, \
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
|
||||||
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
static av_cold int adx_decode_init(AVCodecContext *avctx)
|
static av_cold int adx_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +192,6 @@ AVCodec adpcm_adx_encoder = {
|
|||||||
adx_encode_frame,
|
adx_encode_frame,
|
||||||
adx_encode_close,
|
adx_encode_close,
|
||||||
NULL,
|
NULL,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
|
.long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
|
||||||
};
|
};
|
||||||
|
@ -505,10 +505,10 @@ static int alac_decode_frame(AVCodecContext *avctx,
|
|||||||
outputsamples = alac->setinfo_max_samples_per_frame;
|
outputsamples = alac->setinfo_max_samples_per_frame;
|
||||||
|
|
||||||
switch (alac->setinfo_sample_size) {
|
switch (alac->setinfo_sample_size) {
|
||||||
case 16: avctx->sample_fmt = SAMPLE_FMT_S16;
|
case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
alac->bytespersample = channels << 1;
|
alac->bytespersample = channels << 1;
|
||||||
break;
|
break;
|
||||||
case 24: avctx->sample_fmt = SAMPLE_FMT_S32;
|
case 24: avctx->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||||
alac->bytespersample = channels << 2;
|
alac->bytespersample = channels << 2;
|
||||||
break;
|
break;
|
||||||
default: av_log(avctx, AV_LOG_ERROR, "Sample depth %d is not supported.\n",
|
default: av_log(avctx, AV_LOG_ERROR, "Sample depth %d is not supported.\n",
|
||||||
|
@ -383,7 +383,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
|
|||||||
avctx->frame_size = DEFAULT_FRAME_SIZE;
|
avctx->frame_size = DEFAULT_FRAME_SIZE;
|
||||||
avctx->bits_per_coded_sample = DEFAULT_SAMPLE_SIZE;
|
avctx->bits_per_coded_sample = DEFAULT_SAMPLE_SIZE;
|
||||||
|
|
||||||
if(avctx->sample_fmt != SAMPLE_FMT_S16) {
|
if(avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n");
|
av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -528,6 +528,6 @@ AVCodec alac_encoder = {
|
|||||||
alac_encode_frame,
|
alac_encode_frame,
|
||||||
alac_encode_close,
|
alac_encode_close,
|
||||||
.capabilities = CODEC_CAP_SMALL_LAST_FRAME,
|
.capabilities = CODEC_CAP_SMALL_LAST_FRAME,
|
||||||
.sample_fmts = (const enum SampleFormat[]){ SAMPLE_FMT_S16, SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
|
.long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
|
||||||
};
|
};
|
||||||
|
@ -1573,11 +1573,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
ff_bgmc_init(avctx, &ctx->bgmc_lut, &ctx->bgmc_lut_status);
|
ff_bgmc_init(avctx, &ctx->bgmc_lut, &ctx->bgmc_lut_status);
|
||||||
|
|
||||||
if (sconf->floating) {
|
if (sconf->floating) {
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
avctx->bits_per_raw_sample = 32;
|
avctx->bits_per_raw_sample = 32;
|
||||||
} else {
|
} else {
|
||||||
avctx->sample_fmt = sconf->resolution > 1
|
avctx->sample_fmt = sconf->resolution > 1
|
||||||
? SAMPLE_FMT_S32 : SAMPLE_FMT_S16;
|
? AV_SAMPLE_FMT_S32 : AV_SAMPLE_FMT_S16;
|
||||||
avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
|
avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx)
|
|||||||
AMRContext *p = avctx->priv_data;
|
AMRContext *p = avctx->priv_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
|
|
||||||
// p->excitation always points to the same position in p->excitation_buf
|
// p->excitation always points to the same position in p->excitation_buf
|
||||||
p->excitation = &p->excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1];
|
p->excitation = &p->excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1];
|
||||||
@ -1044,5 +1044,5 @@ AVCodec amrnb_decoder = {
|
|||||||
.init = amrnb_decode_init,
|
.init = amrnb_decode_init,
|
||||||
.decode = amrnb_decode_frame,
|
.decode = amrnb_decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate NarrowBand"),
|
.long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate NarrowBand"),
|
||||||
.sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_FLT,SAMPLE_FMT_NONE},
|
.sample_fmts = (enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
|
||||||
};
|
};
|
||||||
|
@ -198,7 +198,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dsputil_init(&s->dsp, avctx);
|
dsputil_init(&s->dsp, avctx);
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
|
|||||||
{
|
{
|
||||||
AT1Ctx *q = avctx->priv_data;
|
AT1Ctx *q = avctx->priv_data;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
|
|
||||||
q->channels = avctx->channels;
|
q->channels = avctx->channels;
|
||||||
|
|
||||||
|
@ -1014,7 +1014,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ const char *avcodec_get_sample_fmt_name(int sample_fmt)
|
|||||||
return av_get_sample_fmt_name(sample_fmt);
|
return av_get_sample_fmt_name(sample_fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SampleFormat avcodec_get_sample_fmt(const char* name)
|
enum AVSampleFormat avcodec_get_sample_fmt(const char* name)
|
||||||
{
|
{
|
||||||
return av_get_sample_fmt(name);
|
return av_get_sample_fmt(name);
|
||||||
}
|
}
|
||||||
@ -152,8 +152,8 @@ struct AVAudioConvert {
|
|||||||
int fmt_pair;
|
int fmt_pair;
|
||||||
};
|
};
|
||||||
|
|
||||||
AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels,
|
AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels,
|
||||||
enum SampleFormat in_fmt, int in_channels,
|
enum AVSampleFormat in_fmt, int in_channels,
|
||||||
const float *matrix, int flags)
|
const float *matrix, int flags)
|
||||||
{
|
{
|
||||||
AVAudioConvert *ctx;
|
AVAudioConvert *ctx;
|
||||||
@ -164,7 +164,7 @@ AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channe
|
|||||||
return NULL;
|
return NULL;
|
||||||
ctx->in_channels = in_channels;
|
ctx->in_channels = in_channels;
|
||||||
ctx->out_channels = out_channels;
|
ctx->out_channels = out_channels;
|
||||||
ctx->fmt_pair = out_fmt + SAMPLE_FMT_NB*in_fmt;
|
ctx->fmt_pair = out_fmt + AV_SAMPLE_FMT_NB*in_fmt;
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ int av_audio_convert(AVAudioConvert *ctx,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
#define CONV(ofmt, otype, ifmt, expr)\
|
#define CONV(ofmt, otype, ifmt, expr)\
|
||||||
if(ctx->fmt_pair == ofmt + SAMPLE_FMT_NB*ifmt){\
|
if(ctx->fmt_pair == ofmt + AV_SAMPLE_FMT_NB*ifmt){\
|
||||||
do{\
|
do{\
|
||||||
*(otype*)po = expr; pi += is; po += os;\
|
*(otype*)po = expr; pi += is; po += os;\
|
||||||
}while(po < end);\
|
}while(po < end);\
|
||||||
@ -200,31 +200,31 @@ if(ctx->fmt_pair == ofmt + SAMPLE_FMT_NB*ifmt){\
|
|||||||
//FIXME put things below under ifdefs so we do not waste space for cases no codec will need
|
//FIXME put things below under ifdefs so we do not waste space for cases no codec will need
|
||||||
//FIXME rounding ?
|
//FIXME rounding ?
|
||||||
|
|
||||||
CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_U8 , *(const uint8_t*)pi)
|
CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_U8 , *(const uint8_t*)pi)
|
||||||
else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<8)
|
else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<8)
|
||||||
else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<24)
|
else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<24)
|
||||||
else CONV(SAMPLE_FMT_FLT, float , SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
|
else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
|
||||||
else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
|
else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
|
||||||
else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_S16, (*(const int16_t*)pi>>8) + 0x80)
|
else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S16, (*(const int16_t*)pi>>8) + 0x80)
|
||||||
else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_S16, *(const int16_t*)pi)
|
else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi)
|
||||||
else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_S16, *(const int16_t*)pi<<16)
|
else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi<<16)
|
||||||
else CONV(SAMPLE_FMT_FLT, float , SAMPLE_FMT_S16, *(const int16_t*)pi*(1.0 / (1<<15)))
|
else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_S16, *(const int16_t*)pi*(1.0 / (1<<15)))
|
||||||
else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_S16, *(const int16_t*)pi*(1.0 / (1<<15)))
|
else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_S16, *(const int16_t*)pi*(1.0 / (1<<15)))
|
||||||
else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_S32, (*(const int32_t*)pi>>24) + 0x80)
|
else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S32, (*(const int32_t*)pi>>24) + 0x80)
|
||||||
else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_S32, *(const int32_t*)pi>>16)
|
else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S32, *(const int32_t*)pi>>16)
|
||||||
else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_S32, *(const int32_t*)pi)
|
else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S32, *(const int32_t*)pi)
|
||||||
else CONV(SAMPLE_FMT_FLT, float , SAMPLE_FMT_S32, *(const int32_t*)pi*(1.0 / (1<<31)))
|
else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_S32, *(const int32_t*)pi*(1.0 / (1<<31)))
|
||||||
else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_S32, *(const int32_t*)pi*(1.0 / (1<<31)))
|
else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_S32, *(const int32_t*)pi*(1.0 / (1<<31)))
|
||||||
else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_FLT, av_clip_uint8( lrintf(*(const float*)pi * (1<<7)) + 0x80))
|
else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8( lrintf(*(const float*)pi * (1<<7)) + 0x80))
|
||||||
else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_FLT, av_clip_int16( lrintf(*(const float*)pi * (1<<15))))
|
else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16( lrintf(*(const float*)pi * (1<<15))))
|
||||||
else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float*)pi * (1U<<31))))
|
else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float*)pi * (1U<<31))))
|
||||||
else CONV(SAMPLE_FMT_FLT, float , SAMPLE_FMT_FLT, *(const float*)pi)
|
else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_FLT, *(const float*)pi)
|
||||||
else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_FLT, *(const float*)pi)
|
else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_FLT, *(const float*)pi)
|
||||||
else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_DBL, av_clip_uint8( lrint(*(const double*)pi * (1<<7)) + 0x80))
|
else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8( lrint(*(const double*)pi * (1<<7)) + 0x80))
|
||||||
else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_DBL, av_clip_int16( lrint(*(const double*)pi * (1<<15))))
|
else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16( lrint(*(const double*)pi * (1<<15))))
|
||||||
else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double*)pi * (1U<<31))))
|
else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double*)pi * (1U<<31))))
|
||||||
else CONV(SAMPLE_FMT_FLT, float , SAMPLE_FMT_DBL, *(const double*)pi)
|
else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_DBL, *(const double*)pi)
|
||||||
else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_DBL, *(const double*)pi)
|
else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_DBL, *(const double*)pi)
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -49,7 +49,7 @@ const char *avcodec_get_sample_fmt_name(int sample_fmt);
|
|||||||
* @deprecated Use av_get_sample_fmt() instead.
|
* @deprecated Use av_get_sample_fmt() instead.
|
||||||
*/
|
*/
|
||||||
attribute_deprecated
|
attribute_deprecated
|
||||||
enum SampleFormat avcodec_get_sample_fmt(const char* name);
|
enum AVSampleFormat avcodec_get_sample_fmt(const char* name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,8 +94,8 @@ typedef struct AVAudioConvert AVAudioConvert;
|
|||||||
* @param flags See AV_CPU_FLAG_xx
|
* @param flags See AV_CPU_FLAG_xx
|
||||||
* @return NULL on error
|
* @return NULL on error
|
||||||
*/
|
*/
|
||||||
AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels,
|
AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels,
|
||||||
enum SampleFormat in_fmt, int in_channels,
|
enum AVSampleFormat in_fmt, int in_channels,
|
||||||
const float *matrix, int flags);
|
const float *matrix, int flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1231,7 +1231,7 @@ typedef struct AVCodecContext {
|
|||||||
* - encoding: Set by user.
|
* - encoding: Set by user.
|
||||||
* - decoding: Set by libavcodec.
|
* - decoding: Set by libavcodec.
|
||||||
*/
|
*/
|
||||||
enum SampleFormat sample_fmt; ///< sample format
|
enum AVSampleFormat sample_fmt; ///< sample format
|
||||||
|
|
||||||
/* The following data should not be initialized. */
|
/* The following data should not be initialized. */
|
||||||
/**
|
/**
|
||||||
@ -2555,7 +2555,7 @@ typedef struct AVCodecContext {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bits per sample/pixel of internal libavcodec pixel/sample format.
|
* Bits per sample/pixel of internal libavcodec pixel/sample format.
|
||||||
* This field is applicable only when sample_fmt is SAMPLE_FMT_S32.
|
* This field is applicable only when sample_fmt is AV_SAMPLE_FMT_S32.
|
||||||
* - encoding: set by user.
|
* - encoding: set by user.
|
||||||
* - decoding: set by libavcodec.
|
* - decoding: set by libavcodec.
|
||||||
*/
|
*/
|
||||||
@ -2796,7 +2796,7 @@ typedef struct AVCodec {
|
|||||||
*/
|
*/
|
||||||
const char *long_name;
|
const char *long_name;
|
||||||
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
|
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
|
||||||
const enum SampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
|
const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
|
||||||
const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
|
const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
|
||||||
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
|
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
|
||||||
AVClass *priv_class; ///< AVClass for the private context
|
AVClass *priv_class; ///< AVClass for the private context
|
||||||
@ -3060,8 +3060,8 @@ attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, i
|
|||||||
*/
|
*/
|
||||||
ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
||||||
int output_rate, int input_rate,
|
int output_rate, int input_rate,
|
||||||
enum SampleFormat sample_fmt_out,
|
enum AVSampleFormat sample_fmt_out,
|
||||||
enum SampleFormat sample_fmt_in,
|
enum AVSampleFormat sample_fmt_in,
|
||||||
int filter_length, int log2_phase_count,
|
int filter_length, int log2_phase_count,
|
||||||
int linear, double cutoff);
|
int linear, double cutoff);
|
||||||
|
|
||||||
@ -3744,7 +3744,7 @@ int av_get_bits_per_sample(enum CodecID codec_id);
|
|||||||
* @deprecated Use av_get_bits_per_sample_fmt() instead.
|
* @deprecated Use av_get_bits_per_sample_fmt() instead.
|
||||||
*/
|
*/
|
||||||
attribute_deprecated
|
attribute_deprecated
|
||||||
int av_get_bits_per_sample_format(enum SampleFormat sample_fmt);
|
int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* frame parsing */
|
/* frame parsing */
|
||||||
|
@ -119,7 +119,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
s->bands[s->num_bands] = s->frame_len / 2;
|
s->bands[s->num_bands] = s->frame_len / 2;
|
||||||
|
|
||||||
s->first = 1;
|
s->first = 1;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
for (i = 0; i < s->channels; i++)
|
for (i = 0; i < s->channels; i++)
|
||||||
s->coeffs_ptr[i] = s->coeffs + i * s->frame_len;
|
s->coeffs_ptr[i] = s->coeffs + i * s->frame_len;
|
||||||
|
@ -1270,7 +1270,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
if (channel_mask)
|
if (channel_mask)
|
||||||
avctx->channel_layout = channel_mask;
|
avctx->channel_layout = channel_mask;
|
||||||
else
|
else
|
||||||
|
@ -1464,7 +1464,7 @@ static av_cold int dca_decode_init(AVCodecContext * avctx)
|
|||||||
|
|
||||||
for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++)
|
for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++)
|
||||||
s->samples_chanptr[i] = s->samples + i * 256;
|
s->samples_chanptr[i] = s->samples + i * 256;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
|
if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
|
||||||
s->add_bias = 385.0f;
|
s->add_bias = 385.0f;
|
||||||
|
@ -155,7 +155,7 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ static av_cold int cinaudio_decode_init(AVCodecContext *avctx)
|
|||||||
cin->avctx = avctx;
|
cin->avctx = avctx;
|
||||||
cin->initial_decode_frame = 1;
|
cin->initial_decode_frame = 1;
|
||||||
cin->delta = 0;
|
cin->delta = 0;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
|
|||||||
FLACContext *s = avctx->priv_data;
|
FLACContext *s = avctx->priv_data;
|
||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
/* for now, the raw FLAC header is allowed to be passed to the decoder as
|
/* for now, the raw FLAC header is allowed to be passed to the decoder as
|
||||||
frame data instead of extradata. */
|
frame data instead of extradata. */
|
||||||
@ -126,9 +126,9 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
|
|||||||
/* initialize based on the demuxer-supplied streamdata header */
|
/* initialize based on the demuxer-supplied streamdata header */
|
||||||
ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo);
|
ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo);
|
||||||
if (s->bps > 16)
|
if (s->bps > 16)
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S32;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||||
else
|
else
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
allocate_buffers(s);
|
allocate_buffers(s);
|
||||||
s->got_streaminfo = 1;
|
s->got_streaminfo = 1;
|
||||||
|
|
||||||
@ -603,11 +603,11 @@ static int decode_frame(FLACContext *s)
|
|||||||
s->bps = s->avctx->bits_per_raw_sample = fi.bps;
|
s->bps = s->avctx->bits_per_raw_sample = fi.bps;
|
||||||
|
|
||||||
if (s->bps > 16) {
|
if (s->bps > 16) {
|
||||||
s->avctx->sample_fmt = SAMPLE_FMT_S32;
|
s->avctx->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||||
s->sample_shift = 32 - s->bps;
|
s->sample_shift = 32 - s->bps;
|
||||||
s->is32 = 1;
|
s->is32 = 1;
|
||||||
} else {
|
} else {
|
||||||
s->avctx->sample_fmt = SAMPLE_FMT_S16;
|
s->avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
s->sample_shift = 16 - s->bps;
|
s->sample_shift = 16 - s->bps;
|
||||||
s->is32 = 0;
|
s->is32 = 0;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
dsputil_init(&s->dsp, avctx);
|
dsputil_init(&s->dsp, avctx);
|
||||||
|
|
||||||
if (avctx->sample_fmt != SAMPLE_FMT_S16)
|
if (avctx->sample_fmt != AV_SAMPLE_FMT_S16)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (channels < 1 || channels > FLAC_MAX_CHANNELS)
|
if (channels < 1 || channels > FLAC_MAX_CHANNELS)
|
||||||
@ -1335,6 +1335,6 @@ AVCodec flac_encoder = {
|
|||||||
flac_encode_close,
|
flac_encode_close,
|
||||||
NULL,
|
NULL,
|
||||||
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
|
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
|
.long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
|
||||||
};
|
};
|
||||||
|
@ -193,7 +193,7 @@ static av_cold int g722_init(AVCodecContext * avctx)
|
|||||||
av_log(avctx, AV_LOG_ERROR, "Only mono tracks are allowed.\n");
|
av_log(avctx, AV_LOG_ERROR, "Only mono tracks are allowed.\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
switch (avctx->bits_per_coded_sample) {
|
switch (avctx->bits_per_coded_sample) {
|
||||||
case 8:
|
case 8:
|
||||||
@ -379,7 +379,7 @@ AVCodec adpcm_g722_encoder = {
|
|||||||
.init = g722_init,
|
.init = g722_init,
|
||||||
.encode = g722_encode_frame,
|
.encode = g722_encode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"),
|
.long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"),
|
||||||
.sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ static av_cold int g726_init(AVCodecContext * avctx)
|
|||||||
avctx->coded_frame->key_frame = 1;
|
avctx->coded_frame->key_frame = 1;
|
||||||
|
|
||||||
if (avctx->codec->decode)
|
if (avctx->codec->decode)
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
/* select a frame size that will end on a byte boundary and have a size of
|
/* select a frame size that will end on a byte boundary and have a size of
|
||||||
approximately 1024 bytes */
|
approximately 1024 bytes */
|
||||||
@ -401,7 +401,7 @@ AVCodec adpcm_g726_encoder = {
|
|||||||
g726_close,
|
g726_close,
|
||||||
NULL,
|
NULL,
|
||||||
.capabilities = CODEC_CAP_SMALL_LAST_FRAME,
|
.capabilities = CODEC_CAP_SMALL_LAST_FRAME,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
|
.long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,7 +35,7 @@ static av_cold int gsm_init(AVCodecContext *avctx)
|
|||||||
avctx->channels = 1;
|
avctx->channels = 1;
|
||||||
if (!avctx->sample_rate)
|
if (!avctx->sample_rate)
|
||||||
avctx->sample_rate = 8000;
|
avctx->sample_rate = 8000;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
switch (avctx->codec_id) {
|
switch (avctx->codec_id) {
|
||||||
case CODEC_ID_GSM:
|
case CODEC_ID_GSM:
|
||||||
|
@ -156,7 +156,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx)
|
|||||||
|
|
||||||
ff_fft_init(&q->fft, 7, 1);
|
ff_fft_init(&q->fft, 7, 1);
|
||||||
dsputil_init(&q->dsp, avctx);
|
dsputil_init(&q->dsp, avctx);
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,6 @@ AVCodec libfaac_encoder = {
|
|||||||
Faac_encode_init,
|
Faac_encode_init,
|
||||||
Faac_encode_frame,
|
Faac_encode_frame,
|
||||||
Faac_encode_close,
|
Faac_encode_close,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
|
.long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,7 @@ static av_cold int libgsm_init(AVCodecContext *avctx) {
|
|||||||
if(!avctx->sample_rate)
|
if(!avctx->sample_rate)
|
||||||
avctx->sample_rate= 8000;
|
avctx->sample_rate= 8000;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
}else{
|
}else{
|
||||||
if (avctx->sample_rate != 8000) {
|
if (avctx->sample_rate != 8000) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n",
|
av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n",
|
||||||
@ -120,7 +120,7 @@ AVCodec libgsm_encoder = {
|
|||||||
libgsm_init,
|
libgsm_init,
|
||||||
libgsm_encode_frame,
|
libgsm_encode_frame,
|
||||||
libgsm_close,
|
libgsm_close,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
|
.long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ AVCodec libgsm_ms_encoder = {
|
|||||||
libgsm_init,
|
libgsm_init,
|
||||||
libgsm_encode_frame,
|
libgsm_encode_frame,
|
||||||
libgsm_close,
|
libgsm_close,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
|
.long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ AVCodec libmp3lame_encoder = {
|
|||||||
MP3lame_encode_frame,
|
MP3lame_encode_frame,
|
||||||
MP3lame_encode_close,
|
MP3lame_encode_close,
|
||||||
.capabilities= CODEC_CAP_DELAY,
|
.capabilities= CODEC_CAP_DELAY,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.supported_samplerates= sSampleRates,
|
.supported_samplerates= sSampleRates,
|
||||||
.long_name= NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
|
.long_name= NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx)
|
|||||||
avctx->channels = 1;
|
avctx->channels = 1;
|
||||||
|
|
||||||
avctx->frame_size = 160 * is_amr_wb;
|
avctx->frame_size = 160 * is_amr_wb;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_LIBOPENCORE_AMRNB
|
#if CONFIG_LIBOPENCORE_AMRNB
|
||||||
@ -222,7 +222,7 @@ AVCodec libopencore_amrnb_encoder = {
|
|||||||
amr_nb_encode_frame,
|
amr_nb_encode_frame,
|
||||||
amr_nb_encode_close,
|
amr_nb_encode_close,
|
||||||
NULL,
|
NULL,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"),
|
.long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
|
|||||||
if (avctx->extradata_size >= 80)
|
if (avctx->extradata_size >= 80)
|
||||||
s->header = speex_packet_to_header(avctx->extradata, avctx->extradata_size);
|
s->header = speex_packet_to_header(avctx->extradata, avctx->extradata_size);
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
if (s->header) {
|
if (s->header) {
|
||||||
avctx->sample_rate = s->header->rate;
|
avctx->sample_rate = s->header->rate;
|
||||||
avctx->channels = s->header->nb_channels;
|
avctx->channels = s->header->nb_channels;
|
||||||
|
@ -252,7 +252,7 @@ AVCodec libvorbis_encoder = {
|
|||||||
oggvorbis_encode_frame,
|
oggvorbis_encode_frame,
|
||||||
oggvorbis_encode_close,
|
oggvorbis_encode_close,
|
||||||
.capabilities= CODEC_CAP_DELAY,
|
.capabilities= CODEC_CAP_DELAY,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
|
.long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
|
||||||
.priv_class= &class,
|
.priv_class= &class,
|
||||||
} ;
|
} ;
|
||||||
|
@ -230,7 +230,7 @@ static av_cold int mace_decode_init(AVCodecContext * avctx)
|
|||||||
{
|
{
|
||||||
if (avctx->channels > 2)
|
if (avctx->channels > 2)
|
||||||
return -1;
|
return -1;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,9 +255,9 @@ static int mlp_parse(AVCodecParserContext *s,
|
|||||||
|
|
||||||
avctx->bits_per_raw_sample = mh.group1_bits;
|
avctx->bits_per_raw_sample = mh.group1_bits;
|
||||||
if (avctx->bits_per_raw_sample > 16)
|
if (avctx->bits_per_raw_sample > 16)
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S32;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||||
else
|
else
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
avctx->sample_rate = mh.group1_samplerate;
|
avctx->sample_rate = mh.group1_samplerate;
|
||||||
avctx->frame_size = mh.access_unit_size;
|
avctx->frame_size = mh.access_unit_size;
|
||||||
|
|
||||||
|
@ -318,9 +318,9 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
|
|||||||
|
|
||||||
m->avctx->bits_per_raw_sample = mh.group1_bits;
|
m->avctx->bits_per_raw_sample = mh.group1_bits;
|
||||||
if (mh.group1_bits > 16)
|
if (mh.group1_bits > 16)
|
||||||
m->avctx->sample_fmt = SAMPLE_FMT_S32;
|
m->avctx->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||||
else
|
else
|
||||||
m->avctx->sample_fmt = SAMPLE_FMT_S16;
|
m->avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
m->params_valid = 1;
|
m->params_valid = 1;
|
||||||
for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
|
for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
|
||||||
@ -931,7 +931,7 @@ static int output_data_internal(MLPDecodeContext *m, unsigned int substr,
|
|||||||
static int output_data(MLPDecodeContext *m, unsigned int substr,
|
static int output_data(MLPDecodeContext *m, unsigned int substr,
|
||||||
uint8_t *data, unsigned int *data_size)
|
uint8_t *data, unsigned int *data_size)
|
||||||
{
|
{
|
||||||
if (m->avctx->sample_fmt == SAMPLE_FMT_S32)
|
if (m->avctx->sample_fmt == AV_SAMPLE_FMT_S32)
|
||||||
return output_data_internal(m, substr, data, data_size, 1);
|
return output_data_internal(m, substr, data, data_size, 1);
|
||||||
else
|
else
|
||||||
return output_data_internal(m, substr, data, data_size, 0);
|
return output_data_internal(m, substr, data, data_size, 0);
|
||||||
|
@ -85,7 +85,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
|
|||||||
c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);
|
c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);
|
||||||
c->frames_to_skip = 0;
|
c->frames_to_skip = 0;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
||||||
|
|
||||||
if(vlc_initialized) return 0;
|
if(vlc_initialized) return 0;
|
||||||
|
@ -129,7 +129,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
|
|||||||
c->MSS = get_bits1(&gb);
|
c->MSS = get_bits1(&gb);
|
||||||
c->frames = 1 << (get_bits(&gb, 3) * 2);
|
c->frames = 1 << (get_bits(&gb, 3) * 2);
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
||||||
|
|
||||||
if(vlc_initialized) return 0;
|
if(vlc_initialized) return 0;
|
||||||
|
@ -72,19 +72,19 @@
|
|||||||
|
|
||||||
#if CONFIG_FLOAT
|
#if CONFIG_FLOAT
|
||||||
typedef float OUT_INT;
|
typedef float OUT_INT;
|
||||||
#define OUT_FMT SAMPLE_FMT_FLT
|
#define OUT_FMT AV_SAMPLE_FMT_FLT
|
||||||
#elif CONFIG_MPEGAUDIO_HP && CONFIG_AUDIO_NONSHORT
|
#elif CONFIG_MPEGAUDIO_HP && CONFIG_AUDIO_NONSHORT
|
||||||
typedef int32_t OUT_INT;
|
typedef int32_t OUT_INT;
|
||||||
#define OUT_MAX INT32_MAX
|
#define OUT_MAX INT32_MAX
|
||||||
#define OUT_MIN INT32_MIN
|
#define OUT_MIN INT32_MIN
|
||||||
#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31)
|
#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31)
|
||||||
#define OUT_FMT SAMPLE_FMT_S32
|
#define OUT_FMT AV_SAMPLE_FMT_S32
|
||||||
#else
|
#else
|
||||||
typedef int16_t OUT_INT;
|
typedef int16_t OUT_INT;
|
||||||
#define OUT_MAX INT16_MAX
|
#define OUT_MAX INT16_MAX
|
||||||
#define OUT_MIN INT16_MIN
|
#define OUT_MIN INT16_MIN
|
||||||
#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
|
#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
|
||||||
#define OUT_FMT SAMPLE_FMT_S16
|
#define OUT_FMT AV_SAMPLE_FMT_S16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_FLOAT
|
#if CONFIG_FLOAT
|
||||||
|
@ -792,7 +792,7 @@ AVCodec mp2_encoder = {
|
|||||||
MPA_encode_frame,
|
MPA_encode_frame,
|
||||||
MPA_encode_close,
|
MPA_encode_close,
|
||||||
NULL,
|
NULL,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.supported_samplerates= (const int[]){44100, 48000, 32000, 22050, 24000, 16000, 0},
|
.supported_samplerates= (const int[]){44100, 48000, 32000, 22050, 24000, 16000, 0},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
|
.long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
|
||||||
};
|
};
|
||||||
|
@ -147,7 +147,7 @@ static av_cold int decode_init(AVCodecContext * avctx) {
|
|||||||
if (!ff_sine_128[127])
|
if (!ff_sine_128[127])
|
||||||
ff_init_ff_sine_windows(7);
|
ff_init_ff_sine_windows(7);
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
avctx->channel_layout = CH_LAYOUT_MONO;
|
avctx->channel_layout = CH_LAYOUT_MONO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -392,5 +392,5 @@ AVCodec nellymoser_encoder = {
|
|||||||
.close = encode_end,
|
.close = encode_end,
|
||||||
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
|
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
|
.long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
};
|
};
|
||||||
|
@ -461,7 +461,7 @@ void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_typ
|
|||||||
s->execute2= avcodec_default_execute2;
|
s->execute2= avcodec_default_execute2;
|
||||||
s->sample_aspect_ratio= (AVRational){0,1};
|
s->sample_aspect_ratio= (AVRational){0,1};
|
||||||
s->pix_fmt= PIX_FMT_NONE;
|
s->pix_fmt= PIX_FMT_NONE;
|
||||||
s->sample_fmt= SAMPLE_FMT_NONE;
|
s->sample_fmt= AV_SAMPLE_FMT_NONE;
|
||||||
|
|
||||||
s->palctrl = NULL;
|
s->palctrl = NULL;
|
||||||
s->reget_buffer= avcodec_default_reget_buffer;
|
s->reget_buffer= avcodec_default_reget_buffer;
|
||||||
|
@ -72,8 +72,8 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
|
|||||||
av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (0)\n");
|
av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (0)\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? SAMPLE_FMT_S16 :
|
avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 :
|
||||||
SAMPLE_FMT_S32;
|
AV_SAMPLE_FMT_S32;
|
||||||
|
|
||||||
/* get the sample rate. Not all values are known or exist. */
|
/* get the sample rate. Not all values are known or exist. */
|
||||||
switch (header[2] & 0x0f) {
|
switch (header[2] & 0x0f) {
|
||||||
@ -146,7 +146,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
|
|||||||
samples = buf_size / sample_size;
|
samples = buf_size / sample_size;
|
||||||
|
|
||||||
output_size = samples * avctx->channels *
|
output_size = samples * avctx->channels *
|
||||||
(avctx->sample_fmt == SAMPLE_FMT_S32 ? 4 : 2);
|
(avctx->sample_fmt == AV_SAMPLE_FMT_S32 ? 4 : 2);
|
||||||
if (output_size > *data_size) {
|
if (output_size > *data_size) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Insufficient output buffer space (%d bytes, needed %d bytes)\n",
|
"Insufficient output buffer space (%d bytes, needed %d bytes)\n",
|
||||||
@ -162,7 +162,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
|
|||||||
case CH_LAYOUT_4POINT0:
|
case CH_LAYOUT_4POINT0:
|
||||||
case CH_LAYOUT_2_2:
|
case CH_LAYOUT_2_2:
|
||||||
samples *= num_source_channels;
|
samples *= num_source_channels;
|
||||||
if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
||||||
#if HAVE_BIGENDIAN
|
#if HAVE_BIGENDIAN
|
||||||
memcpy(dst16, src, output_size);
|
memcpy(dst16, src, output_size);
|
||||||
#else
|
#else
|
||||||
@ -181,7 +181,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
|
|||||||
case CH_LAYOUT_SURROUND:
|
case CH_LAYOUT_SURROUND:
|
||||||
case CH_LAYOUT_2_1:
|
case CH_LAYOUT_2_1:
|
||||||
case CH_LAYOUT_5POINT0:
|
case CH_LAYOUT_5POINT0:
|
||||||
if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
||||||
do {
|
do {
|
||||||
#if HAVE_BIGENDIAN
|
#if HAVE_BIGENDIAN
|
||||||
memcpy(dst16, src, avctx->channels * 2);
|
memcpy(dst16, src, avctx->channels * 2);
|
||||||
@ -207,7 +207,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
/* remapping: L, R, C, LBack, RBack, LF */
|
/* remapping: L, R, C, LBack, RBack, LF */
|
||||||
case CH_LAYOUT_5POINT1:
|
case CH_LAYOUT_5POINT1:
|
||||||
if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
||||||
do {
|
do {
|
||||||
dst16[0] = bytestream_get_be16(&src);
|
dst16[0] = bytestream_get_be16(&src);
|
||||||
dst16[1] = bytestream_get_be16(&src);
|
dst16[1] = bytestream_get_be16(&src);
|
||||||
@ -231,7 +231,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
/* remapping: L, R, C, LSide, LBack, RBack, RSide, <unused> */
|
/* remapping: L, R, C, LSide, LBack, RBack, RSide, <unused> */
|
||||||
case CH_LAYOUT_7POINT0:
|
case CH_LAYOUT_7POINT0:
|
||||||
if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
||||||
do {
|
do {
|
||||||
dst16[0] = bytestream_get_be16(&src);
|
dst16[0] = bytestream_get_be16(&src);
|
||||||
dst16[1] = bytestream_get_be16(&src);
|
dst16[1] = bytestream_get_be16(&src);
|
||||||
@ -259,7 +259,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
/* remapping: L, R, C, LSide, LBack, RBack, RSide, LF */
|
/* remapping: L, R, C, LSide, LBack, RBack, RSide, LF */
|
||||||
case CH_LAYOUT_7POINT1:
|
case CH_LAYOUT_7POINT1:
|
||||||
if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
|
||||||
do {
|
do {
|
||||||
dst16[0] = bytestream_get_be16(&src);
|
dst16[0] = bytestream_get_be16(&src);
|
||||||
dst16[1] = bytestream_get_be16(&src);
|
dst16[1] = bytestream_get_be16(&src);
|
||||||
@ -304,7 +304,7 @@ AVCodec pcm_bluray_decoder = {
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
pcm_bluray_decode_frame,
|
pcm_bluray_decode_frame,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16, SAMPLE_FMT_S32,
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32,
|
||||||
SAMPLE_FMT_NONE},
|
AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"),
|
.long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"),
|
||||||
};
|
};
|
||||||
|
@ -228,7 +228,7 @@ static av_cold int pcm_decode_init(AVCodecContext * avctx)
|
|||||||
|
|
||||||
avctx->sample_fmt = avctx->codec->sample_fmts[0];
|
avctx->sample_fmt = avctx->codec->sample_fmts[0];
|
||||||
|
|
||||||
if (avctx->sample_fmt == SAMPLE_FMT_S32)
|
if (avctx->sample_fmt == AV_SAMPLE_FMT_S32)
|
||||||
avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec->id);
|
avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec->id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -475,7 +475,7 @@ AVCodec name_ ## _encoder = { \
|
|||||||
.init = pcm_encode_init, \
|
.init = pcm_encode_init, \
|
||||||
.encode = pcm_encode_frame, \
|
.encode = pcm_encode_frame, \
|
||||||
.close = pcm_encode_close, \
|
.close = pcm_encode_close, \
|
||||||
.sample_fmts = (const enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
|
.sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
|
||||||
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
@ -491,7 +491,7 @@ AVCodec name_ ## _decoder = { \
|
|||||||
.priv_data_size = sizeof(PCMDecode), \
|
.priv_data_size = sizeof(PCMDecode), \
|
||||||
.init = pcm_decode_init, \
|
.init = pcm_decode_init, \
|
||||||
.decode = pcm_decode_frame, \
|
.decode = pcm_decode_frame, \
|
||||||
.sample_fmts = (const enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
|
.sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
|
||||||
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
@ -502,28 +502,28 @@ AVCodec name_ ## _decoder = { \
|
|||||||
PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(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. */
|
/* Note: Do not forget to add new entries to the Makefile as well. */
|
||||||
PCM_CODEC (CODEC_ID_PCM_ALAW, SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
|
PCM_CODEC (CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
|
||||||
PCM_CODEC (CODEC_ID_PCM_DVD, SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
|
PCM_CODEC (CODEC_ID_PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_F32BE, SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
|
PCM_CODEC (CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_F32LE, SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
|
PCM_CODEC (CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_F64BE, SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
|
PCM_CODEC (CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_F64LE, SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
|
PCM_CODEC (CODEC_ID_PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
|
||||||
PCM_DECODER(CODEC_ID_PCM_LXF, SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar");
|
PCM_DECODER(CODEC_ID_PCM_LXF, AV_SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar");
|
||||||
PCM_CODEC (CODEC_ID_PCM_MULAW, SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law");
|
PCM_CODEC (CODEC_ID_PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law");
|
||||||
PCM_CODEC (CODEC_ID_PCM_S8, SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit");
|
PCM_CODEC (CODEC_ID_PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit");
|
||||||
PCM_CODEC (CODEC_ID_PCM_S16BE, SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
|
PCM_CODEC (CODEC_ID_PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_S16LE, SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
|
PCM_CODEC (CODEC_ID_PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
|
||||||
PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, SAMPLE_FMT_S16, pcm_s16le_planar, "PCM 16-bit little-endian planar");
|
PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16, pcm_s16le_planar, "PCM 16-bit little-endian planar");
|
||||||
PCM_CODEC (CODEC_ID_PCM_S24BE, SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
|
PCM_CODEC (CODEC_ID_PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_S24DAUD, SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
|
PCM_CODEC (CODEC_ID_PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
|
||||||
PCM_CODEC (CODEC_ID_PCM_S24LE, SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
|
PCM_CODEC (CODEC_ID_PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_S32BE, SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
|
PCM_CODEC (CODEC_ID_PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_S32LE, SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
|
PCM_CODEC (CODEC_ID_PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_U8, SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit");
|
PCM_CODEC (CODEC_ID_PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit");
|
||||||
PCM_CODEC (CODEC_ID_PCM_U16BE, SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
|
PCM_CODEC (CODEC_ID_PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_U16LE, SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
|
PCM_CODEC (CODEC_ID_PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_U24BE, SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
|
PCM_CODEC (CODEC_ID_PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_U24LE, SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
|
PCM_CODEC (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_U32BE, SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
|
PCM_CODEC (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_U32LE, SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
|
PCM_CODEC (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
|
||||||
PCM_CODEC (CODEC_ID_PCM_ZORK, SAMPLE_FMT_S16, pcm_zork, "PCM Zork");
|
PCM_CODEC (CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_S16, pcm_zork, "PCM Zork");
|
||||||
|
@ -92,7 +92,7 @@ static av_cold int qcelp_decode_init(AVCodecContext *avctx)
|
|||||||
QCELPContext *q = avctx->priv_data;
|
QCELPContext *q = avctx->priv_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
|
|
||||||
for(i=0; i<10; i++)
|
for(i=0; i<10; i++)
|
||||||
q->prev_lspf[i] = (i+1)/11.;
|
q->prev_lspf[i] = (i+1)/11.;
|
||||||
|
@ -1866,7 +1866,7 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
qdm2_init(s);
|
qdm2_init(s);
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
// dump_context(s);
|
// dump_context(s);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -37,7 +37,7 @@ static av_cold int ra144_decode_init(AVCodecContext * avctx)
|
|||||||
ractx->lpc_coef[0] = ractx->lpc_tables[0];
|
ractx->lpc_coef[0] = ractx->lpc_tables[0];
|
||||||
ractx->lpc_coef[1] = ractx->lpc_tables[1];
|
ractx->lpc_coef[1] = ractx->lpc_tables[1];
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
|
|||||||
{
|
{
|
||||||
RA144Context *ractx;
|
RA144Context *ractx;
|
||||||
|
|
||||||
if (avctx->sample_fmt != SAMPLE_FMT_S16) {
|
if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "invalid sample format\n");
|
av_log(avctx, AV_LOG_ERROR, "invalid sample format\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ typedef struct {
|
|||||||
|
|
||||||
static av_cold int ra288_decode_init(AVCodecContext *avctx)
|
static av_cold int ra288_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ struct ReSampleContext {
|
|||||||
/* channel convert */
|
/* channel convert */
|
||||||
int input_channels, output_channels, filter_channels;
|
int input_channels, output_channels, filter_channels;
|
||||||
AVAudioConvert *convert_ctx[2];
|
AVAudioConvert *convert_ctx[2];
|
||||||
enum SampleFormat sample_fmt[2]; ///< input and output sample format
|
enum AVSampleFormat sample_fmt[2]; ///< input and output sample format
|
||||||
unsigned sample_size[2]; ///< size of one sample in sample_fmt
|
unsigned sample_size[2]; ///< size of one sample in sample_fmt
|
||||||
short *buffer[2]; ///< buffers used for conversion to S16
|
short *buffer[2]; ///< buffers used for conversion to S16
|
||||||
unsigned buffer_size[2]; ///< sizes of allocated buffers
|
unsigned buffer_size[2]; ///< sizes of allocated buffers
|
||||||
@ -144,8 +144,8 @@ static void ac3_5p1_mux(short *output, short *input1, short *input2, int n)
|
|||||||
|
|
||||||
ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
||||||
int output_rate, int input_rate,
|
int output_rate, int input_rate,
|
||||||
enum SampleFormat sample_fmt_out,
|
enum AVSampleFormat sample_fmt_out,
|
||||||
enum SampleFormat sample_fmt_in,
|
enum AVSampleFormat sample_fmt_in,
|
||||||
int filter_length, int log2_phase_count,
|
int filter_length, int log2_phase_count,
|
||||||
int linear, double cutoff)
|
int linear, double cutoff)
|
||||||
{
|
{
|
||||||
@ -178,8 +178,8 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
|||||||
s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0])>>3;
|
s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0])>>3;
|
||||||
s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1])>>3;
|
s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1])>>3;
|
||||||
|
|
||||||
if (s->sample_fmt[0] != SAMPLE_FMT_S16) {
|
if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) {
|
||||||
if (!(s->convert_ctx[0] = av_audio_convert_alloc(SAMPLE_FMT_S16, 1,
|
if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1,
|
||||||
s->sample_fmt[0], 1, NULL, 0))) {
|
s->sample_fmt[0], 1, NULL, 0))) {
|
||||||
av_log(s, AV_LOG_ERROR,
|
av_log(s, AV_LOG_ERROR,
|
||||||
"Cannot convert %s sample format to s16 sample format\n",
|
"Cannot convert %s sample format to s16 sample format\n",
|
||||||
@ -189,9 +189,9 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->sample_fmt[1] != SAMPLE_FMT_S16) {
|
if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) {
|
||||||
if (!(s->convert_ctx[1] = av_audio_convert_alloc(s->sample_fmt[1], 1,
|
if (!(s->convert_ctx[1] = av_audio_convert_alloc(s->sample_fmt[1], 1,
|
||||||
SAMPLE_FMT_S16, 1, NULL, 0))) {
|
AV_SAMPLE_FMT_S16, 1, NULL, 0))) {
|
||||||
av_log(s, AV_LOG_ERROR,
|
av_log(s, AV_LOG_ERROR,
|
||||||
"Cannot convert s16 sample format to %s sample format\n",
|
"Cannot convert s16 sample format to %s sample format\n",
|
||||||
av_get_sample_fmt_name(s->sample_fmt[1]));
|
av_get_sample_fmt_name(s->sample_fmt[1]));
|
||||||
@ -224,7 +224,7 @@ ReSampleContext *audio_resample_init(int output_channels, int input_channels,
|
|||||||
{
|
{
|
||||||
return av_audio_resample_init(output_channels, input_channels,
|
return av_audio_resample_init(output_channels, input_channels,
|
||||||
output_rate, input_rate,
|
output_rate, input_rate,
|
||||||
SAMPLE_FMT_S16, SAMPLE_FMT_S16,
|
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16,
|
||||||
TAPS, 10, 0, 0.8);
|
TAPS, 10, 0, 0.8);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -246,7 +246,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
|
|||||||
return nb_samples;
|
return nb_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->sample_fmt[0] != SAMPLE_FMT_S16) {
|
if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) {
|
||||||
int istride[1] = { s->sample_size[0] };
|
int istride[1] = { s->sample_size[0] };
|
||||||
int ostride[1] = { 2 };
|
int ostride[1] = { 2 };
|
||||||
const void *ibuf[1] = { input };
|
const void *ibuf[1] = { input };
|
||||||
@ -276,7 +276,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
|
|||||||
|
|
||||||
lenout= 4*nb_samples * s->ratio + 16;
|
lenout= 4*nb_samples * s->ratio + 16;
|
||||||
|
|
||||||
if (s->sample_fmt[1] != SAMPLE_FMT_S16) {
|
if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) {
|
||||||
output_bak = output;
|
output_bak = output;
|
||||||
|
|
||||||
if (!s->buffer_size[1] || s->buffer_size[1] < lenout) {
|
if (!s->buffer_size[1] || s->buffer_size[1] < lenout) {
|
||||||
@ -341,7 +341,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
|
|||||||
ac3_5p1_mux(output, buftmp3[0], buftmp3[1], nb_samples1);
|
ac3_5p1_mux(output, buftmp3[0], buftmp3[1], nb_samples1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->sample_fmt[1] != SAMPLE_FMT_S16) {
|
if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) {
|
||||||
int istride[1] = { 2 };
|
int istride[1] = { 2 };
|
||||||
int ostride[1] = { s->sample_size[1] };
|
int ostride[1] = { s->sample_size[1] };
|
||||||
const void *ibuf[1] = { output };
|
const void *ibuf[1] = { output };
|
||||||
|
@ -49,7 +49,7 @@ static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
|
|||||||
av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n");
|
av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (avctx->sample_fmt != SAMPLE_FMT_S16) {
|
if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n");
|
av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -162,6 +162,6 @@ AVCodec roq_dpcm_encoder = {
|
|||||||
roq_dpcm_encode_frame,
|
roq_dpcm_encode_frame,
|
||||||
roq_dpcm_encode_close,
|
roq_dpcm_encode_close,
|
||||||
NULL,
|
NULL,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
|
.long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
|
||||||
};
|
};
|
||||||
|
@ -105,7 +105,7 @@ static av_cold int shorten_decode_init(AVCodecContext * avctx)
|
|||||||
{
|
{
|
||||||
ShortenContext *s = avctx->priv_data;
|
ShortenContext *s = avctx->priv_data;
|
||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
|
|||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
ctx->energy_history[i] = -14;
|
ctx->energy_history[i] = -14;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
|
|
||||||
dsputil_init(&ctx->dsp, avctx);
|
dsputil_init(&ctx->dsp, avctx);
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
|||||||
static av_cold int smka_decode_init(AVCodecContext *avctx)
|
static av_cold int smka_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
||||||
avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? SAMPLE_FMT_U8 : SAMPLE_FMT_S16;
|
avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? AV_SAMPLE_FMT_U8 : AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
s->int_samples = av_mallocz(4* s->frame_size);
|
s->int_samples = av_mallocz(4* s->frame_size);
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx)
|
|||||||
{
|
{
|
||||||
// TSContext *c = avctx->priv_data;
|
// TSContext *c = avctx->priv_data;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,15 +246,15 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
|
|||||||
|
|
||||||
if (s->is_float)
|
if (s->is_float)
|
||||||
{
|
{
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else switch(s->bps) {
|
else switch(s->bps) {
|
||||||
// case 1: avctx->sample_fmt = SAMPLE_FMT_U8; break;
|
// case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break;
|
||||||
case 2: avctx->sample_fmt = SAMPLE_FMT_S16; break;
|
case 2: avctx->sample_fmt = AV_SAMPLE_FMT_S16; break;
|
||||||
// case 3: avctx->sample_fmt = SAMPLE_FMT_S24; break;
|
// case 3: avctx->sample_fmt = AV_SAMPLE_FMT_S24; break;
|
||||||
case 4: avctx->sample_fmt = SAMPLE_FMT_S32; break;
|
case 4: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break;
|
||||||
default:
|
default:
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1068,7 +1068,7 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
|
|||||||
int ibps = avctx->bit_rate/(1000 * avctx->channels);
|
int ibps = avctx->bit_rate/(1000 * avctx->channels);
|
||||||
|
|
||||||
tctx->avctx = avctx;
|
tctx->avctx = avctx;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
|
|
||||||
if (avctx->channels > CHANNELS_MAX) {
|
if (avctx->channels > CHANNELS_MAX) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n",
|
av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n",
|
||||||
|
@ -923,7 +923,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
|
|||||||
}
|
}
|
||||||
av_strlcat(buf, ", ", buf_size);
|
av_strlcat(buf, ", ", buf_size);
|
||||||
avcodec_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
|
avcodec_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
|
||||||
if (enc->sample_fmt != SAMPLE_FMT_NONE) {
|
if (enc->sample_fmt != AV_SAMPLE_FMT_NONE) {
|
||||||
snprintf(buf + strlen(buf), buf_size - strlen(buf),
|
snprintf(buf + strlen(buf), buf_size - strlen(buf),
|
||||||
", %s", av_get_sample_fmt_name(enc->sample_fmt));
|
", %s", av_get_sample_fmt_name(enc->sample_fmt));
|
||||||
}
|
}
|
||||||
@ -1067,7 +1067,7 @@ int av_get_bits_per_sample(enum CodecID codec_id){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if FF_API_OLD_SAMPLE_FMT
|
#if FF_API_OLD_SAMPLE_FMT
|
||||||
int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {
|
int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) {
|
||||||
return av_get_bits_per_sample_fmt(sample_fmt);
|
return av_get_bits_per_sample_fmt(sample_fmt);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -446,7 +446,7 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
|
|||||||
s->channels = avctx->channels;
|
s->channels = avctx->channels;
|
||||||
s->bits = avctx->bits_per_coded_sample;
|
s->bits = avctx->bits_per_coded_sample;
|
||||||
s->block_align = avctx->block_align;
|
s->block_align = avctx->block_align;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n",
|
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);
|
s->channels, s->bits, s->block_align, avctx->sample_rate);
|
||||||
|
@ -1006,7 +1006,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
|
|||||||
avccontext->channels = vc->audio_channels;
|
avccontext->channels = vc->audio_channels;
|
||||||
avccontext->sample_rate = vc->audio_samplerate;
|
avccontext->sample_rate = vc->audio_samplerate;
|
||||||
avccontext->frame_size = FFMIN(vc->blocksize[0], vc->blocksize[1]) >> 2;
|
avccontext->frame_size = FFMIN(vc->blocksize[0], vc->blocksize[1]) >> 2;
|
||||||
avccontext->sample_fmt = SAMPLE_FMT_S16;
|
avccontext->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
@ -1111,6 +1111,6 @@ AVCodec vorbis_encoder = {
|
|||||||
vorbis_encode_frame,
|
vorbis_encode_frame,
|
||||||
vorbis_encode_close,
|
vorbis_encode_close,
|
||||||
.capabilities= CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
|
.capabilities= CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
|
.long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
|
||||||
};
|
};
|
||||||
|
@ -494,7 +494,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
|
|||||||
B = s->decorr[i].samplesB[pos];
|
B = s->decorr[i].samplesB[pos];
|
||||||
j = (pos + t) & 7;
|
j = (pos + t) & 7;
|
||||||
}
|
}
|
||||||
if(type != SAMPLE_FMT_S16){
|
if(type != AV_SAMPLE_FMT_S16){
|
||||||
L2 = L + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
|
L2 = L + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
|
||||||
R2 = R + ((s->decorr[i].weightB * (int64_t)B + 512) >> 10);
|
R2 = R + ((s->decorr[i].weightB * (int64_t)B + 512) >> 10);
|
||||||
}else{
|
}else{
|
||||||
@ -506,13 +506,13 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
|
|||||||
s->decorr[i].samplesA[j] = L = L2;
|
s->decorr[i].samplesA[j] = L = L2;
|
||||||
s->decorr[i].samplesB[j] = R = R2;
|
s->decorr[i].samplesB[j] = R = R2;
|
||||||
}else if(t == -1){
|
}else if(t == -1){
|
||||||
if(type != SAMPLE_FMT_S16)
|
if(type != AV_SAMPLE_FMT_S16)
|
||||||
L2 = L + ((s->decorr[i].weightA * (int64_t)s->decorr[i].samplesA[0] + 512) >> 10);
|
L2 = L + ((s->decorr[i].weightA * (int64_t)s->decorr[i].samplesA[0] + 512) >> 10);
|
||||||
else
|
else
|
||||||
L2 = L + ((s->decorr[i].weightA * s->decorr[i].samplesA[0] + 512) >> 10);
|
L2 = L + ((s->decorr[i].weightA * s->decorr[i].samplesA[0] + 512) >> 10);
|
||||||
UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, s->decorr[i].samplesA[0], L);
|
UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, s->decorr[i].samplesA[0], L);
|
||||||
L = L2;
|
L = L2;
|
||||||
if(type != SAMPLE_FMT_S16)
|
if(type != AV_SAMPLE_FMT_S16)
|
||||||
R2 = R + ((s->decorr[i].weightB * (int64_t)L2 + 512) >> 10);
|
R2 = R + ((s->decorr[i].weightB * (int64_t)L2 + 512) >> 10);
|
||||||
else
|
else
|
||||||
R2 = R + ((s->decorr[i].weightB * L2 + 512) >> 10);
|
R2 = R + ((s->decorr[i].weightB * L2 + 512) >> 10);
|
||||||
@ -520,7 +520,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
|
|||||||
R = R2;
|
R = R2;
|
||||||
s->decorr[i].samplesA[0] = R;
|
s->decorr[i].samplesA[0] = R;
|
||||||
}else{
|
}else{
|
||||||
if(type != SAMPLE_FMT_S16)
|
if(type != AV_SAMPLE_FMT_S16)
|
||||||
R2 = R + ((s->decorr[i].weightB * (int64_t)s->decorr[i].samplesB[0] + 512) >> 10);
|
R2 = R + ((s->decorr[i].weightB * (int64_t)s->decorr[i].samplesB[0] + 512) >> 10);
|
||||||
else
|
else
|
||||||
R2 = R + ((s->decorr[i].weightB * s->decorr[i].samplesB[0] + 512) >> 10);
|
R2 = R + ((s->decorr[i].weightB * s->decorr[i].samplesB[0] + 512) >> 10);
|
||||||
@ -532,7 +532,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
|
|||||||
s->decorr[i].samplesA[0] = R;
|
s->decorr[i].samplesA[0] = R;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type != SAMPLE_FMT_S16)
|
if(type != AV_SAMPLE_FMT_S16)
|
||||||
L2 = L + ((s->decorr[i].weightA * (int64_t)R2 + 512) >> 10);
|
L2 = L + ((s->decorr[i].weightA * (int64_t)R2 + 512) >> 10);
|
||||||
else
|
else
|
||||||
L2 = L + ((s->decorr[i].weightA * R2 + 512) >> 10);
|
L2 = L + ((s->decorr[i].weightA * R2 + 512) >> 10);
|
||||||
@ -546,10 +546,10 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
|
|||||||
L += (R -= (L >> 1));
|
L += (R -= (L >> 1));
|
||||||
crc = (crc * 3 + L) * 3 + R;
|
crc = (crc * 3 + L) * 3 + R;
|
||||||
|
|
||||||
if(type == SAMPLE_FMT_FLT){
|
if(type == AV_SAMPLE_FMT_FLT){
|
||||||
*dstfl++ = wv_get_value_float(s, &crc_extra_bits, L);
|
*dstfl++ = wv_get_value_float(s, &crc_extra_bits, L);
|
||||||
*dstfl++ = wv_get_value_float(s, &crc_extra_bits, R);
|
*dstfl++ = wv_get_value_float(s, &crc_extra_bits, R);
|
||||||
} else if(type == SAMPLE_FMT_S32){
|
} else if(type == AV_SAMPLE_FMT_S32){
|
||||||
*dst32++ = wv_get_value_integer(s, &crc_extra_bits, L);
|
*dst32++ = wv_get_value_integer(s, &crc_extra_bits, L);
|
||||||
*dst32++ = wv_get_value_integer(s, &crc_extra_bits, R);
|
*dst32++ = wv_get_value_integer(s, &crc_extra_bits, R);
|
||||||
} else {
|
} else {
|
||||||
@ -613,7 +613,7 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst
|
|||||||
A = s->decorr[i].samplesA[pos];
|
A = s->decorr[i].samplesA[pos];
|
||||||
j = (pos + t) & 7;
|
j = (pos + t) & 7;
|
||||||
}
|
}
|
||||||
if(type != SAMPLE_FMT_S16)
|
if(type != AV_SAMPLE_FMT_S16)
|
||||||
S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
|
S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
|
||||||
else
|
else
|
||||||
S = T + ((s->decorr[i].weightA * A + 512) >> 10);
|
S = T + ((s->decorr[i].weightA * A + 512) >> 10);
|
||||||
@ -623,9 +623,9 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst
|
|||||||
pos = (pos + 1) & 7;
|
pos = (pos + 1) & 7;
|
||||||
crc = crc * 3 + S;
|
crc = crc * 3 + S;
|
||||||
|
|
||||||
if(type == SAMPLE_FMT_FLT)
|
if(type == AV_SAMPLE_FMT_FLT)
|
||||||
*dstfl++ = wv_get_value_float(s, &crc_extra_bits, S);
|
*dstfl++ = wv_get_value_float(s, &crc_extra_bits, S);
|
||||||
else if(type == SAMPLE_FMT_S32)
|
else if(type == AV_SAMPLE_FMT_S32)
|
||||||
*dst32++ = wv_get_value_integer(s, &crc_extra_bits, S);
|
*dst32++ = wv_get_value_integer(s, &crc_extra_bits, S);
|
||||||
else
|
else
|
||||||
*dst16++ = wv_get_value_integer(s, &crc_extra_bits, S);
|
*dst16++ = wv_get_value_integer(s, &crc_extra_bits, S);
|
||||||
@ -662,9 +662,9 @@ static av_cold int wavpack_decode_init(AVCodecContext *avctx)
|
|||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
s->stereo = (avctx->channels == 2);
|
s->stereo = (avctx->channels == 2);
|
||||||
if(avctx->bits_per_coded_sample <= 16)
|
if(avctx->bits_per_coded_sample <= 16)
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
else
|
else
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S32;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||||
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
|
||||||
|
|
||||||
wv_reset_saved_context(s);
|
wv_reset_saved_context(s);
|
||||||
@ -708,13 +708,13 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
|
|||||||
s->frame_flags = AV_RL32(buf); buf += 4;
|
s->frame_flags = AV_RL32(buf); buf += 4;
|
||||||
if(s->frame_flags&0x80){
|
if(s->frame_flags&0x80){
|
||||||
bpp = sizeof(float);
|
bpp = sizeof(float);
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
} else if((s->frame_flags&0x03) <= 1){
|
} else if((s->frame_flags&0x03) <= 1){
|
||||||
bpp = 2;
|
bpp = 2;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
} else {
|
} else {
|
||||||
bpp = 4;
|
bpp = 4;
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S32;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S32;
|
||||||
}
|
}
|
||||||
s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo;
|
s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo;
|
||||||
s->joint = s->frame_flags & WV_JOINT_STEREO;
|
s->joint = s->frame_flags & WV_JOINT_STEREO;
|
||||||
@ -945,11 +945,11 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
|
|||||||
av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
|
av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!got_float && avctx->sample_fmt == SAMPLE_FMT_FLT){
|
if(!got_float && avctx->sample_fmt == AV_SAMPLE_FMT_FLT){
|
||||||
av_log(avctx, AV_LOG_ERROR, "Float information not found\n");
|
av_log(avctx, AV_LOG_ERROR, "Float information not found\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(s->got_extra_bits && avctx->sample_fmt != SAMPLE_FMT_FLT){
|
if(s->got_extra_bits && avctx->sample_fmt != AV_SAMPLE_FMT_FLT){
|
||||||
const int size = get_bits_left(&s->gb_extra_bits);
|
const int size = get_bits_left(&s->gb_extra_bits);
|
||||||
const int wanted = s->samples * s->extra_bits << s->stereo_in;
|
const int wanted = s->samples * s->extra_bits << s->stereo_in;
|
||||||
if(size < wanted){
|
if(size < wanted){
|
||||||
@ -969,22 +969,22 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(s->stereo_in){
|
if(s->stereo_in){
|
||||||
if(avctx->sample_fmt == SAMPLE_FMT_S16)
|
if(avctx->sample_fmt == AV_SAMPLE_FMT_S16)
|
||||||
samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_S16);
|
samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S16);
|
||||||
else if(avctx->sample_fmt == SAMPLE_FMT_S32)
|
else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32)
|
||||||
samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_S32);
|
samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32);
|
||||||
else
|
else
|
||||||
samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_FLT);
|
samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
if(avctx->sample_fmt == SAMPLE_FMT_S16)
|
if(avctx->sample_fmt == AV_SAMPLE_FMT_S16)
|
||||||
samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_S16);
|
samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16);
|
||||||
else if(avctx->sample_fmt == SAMPLE_FMT_S32)
|
else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32)
|
||||||
samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_S32);
|
samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S32);
|
||||||
else
|
else
|
||||||
samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_FLT);
|
samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT);
|
||||||
|
|
||||||
if(s->stereo && avctx->sample_fmt == SAMPLE_FMT_S16){
|
if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16){
|
||||||
int16_t *dst = (int16_t*)samples + samplecount * 2;
|
int16_t *dst = (int16_t*)samples + samplecount * 2;
|
||||||
int16_t *src = (int16_t*)samples + samplecount;
|
int16_t *src = (int16_t*)samples + samplecount;
|
||||||
int cnt = samplecount;
|
int cnt = samplecount;
|
||||||
@ -993,7 +993,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
|
|||||||
*--dst = *src;
|
*--dst = *src;
|
||||||
}
|
}
|
||||||
samplecount *= 2;
|
samplecount *= 2;
|
||||||
}else if(s->stereo && avctx->sample_fmt == SAMPLE_FMT_S32){
|
}else if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S32){
|
||||||
int32_t *dst = (int32_t*)samples + samplecount * 2;
|
int32_t *dst = (int32_t*)samples + samplecount * 2;
|
||||||
int32_t *src = (int32_t*)samples + samplecount;
|
int32_t *src = (int32_t*)samples + samplecount;
|
||||||
int cnt = samplecount;
|
int cnt = samplecount;
|
||||||
|
@ -123,7 +123,7 @@ static int wma_decode_init(AVCodecContext * avctx)
|
|||||||
wma_lsp_to_curve_init(s, s->frame_len);
|
wma_lsp_to_curve_init(s, s->frame_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ AVCodec wmav1_encoder =
|
|||||||
encode_init,
|
encode_init,
|
||||||
encode_superframe,
|
encode_superframe,
|
||||||
ff_wma_end,
|
ff_wma_end,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
|
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -405,6 +405,6 @@ AVCodec wmav2_encoder =
|
|||||||
encode_init,
|
encode_init,
|
||||||
encode_superframe,
|
encode_superframe,
|
||||||
ff_wma_end,
|
ff_wma_end,
|
||||||
.sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
|
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
|
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
|
||||||
};
|
};
|
||||||
|
@ -276,7 +276,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
dsputil_init(&s->dsp, avctx);
|
dsputil_init(&s->dsp, avctx);
|
||||||
init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
|
init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_FLT;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
|
|
||||||
if (avctx->extradata_size >= 18) {
|
if (avctx->extradata_size >= 18) {
|
||||||
s->decode_flags = AV_RL16(edata_ptr+14);
|
s->decode_flags = AV_RL16(edata_ptr+14);
|
||||||
|
@ -425,7 +425,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
|
|||||||
2 * (s->block_conv_table[1] - 2 * s->min_pitch_val);
|
2 * (s->block_conv_table[1] - 2 * s->min_pitch_val);
|
||||||
s->block_pitch_nbits = av_ceil_log2(s->block_pitch_range);
|
s->block_pitch_nbits = av_ceil_log2(s->block_pitch_range);
|
||||||
|
|
||||||
ctx->sample_fmt = SAMPLE_FMT_FLT;
|
ctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ static av_cold int ws_snd_decode_init(AVCodecContext * avctx)
|
|||||||
{
|
{
|
||||||
// WSSNDContext *c = avctx->priv_data;
|
// WSSNDContext *c = avctx->priv_data;
|
||||||
|
|
||||||
avctx->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
|
|||||||
link->srcpad = &src->output_pads[srcpad];
|
link->srcpad = &src->output_pads[srcpad];
|
||||||
link->dstpad = &dst->input_pads[dstpad];
|
link->dstpad = &dst->input_pads[dstpad];
|
||||||
link->type = src->output_pads[srcpad].type;
|
link->type = src->output_pads[srcpad].type;
|
||||||
assert(PIX_FMT_NONE == -1 && SAMPLE_FMT_NONE == -1);
|
assert(PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1);
|
||||||
link->format = -1;
|
link->format = -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -268,7 +268,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
|
AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
|
||||||
enum SampleFormat sample_fmt, int size,
|
enum AVSampleFormat sample_fmt, int size,
|
||||||
int64_t channel_layout, int planar)
|
int64_t channel_layout, int planar)
|
||||||
{
|
{
|
||||||
AVFilterBufferRef *ret = NULL;
|
AVFilterBufferRef *ret = NULL;
|
||||||
|
@ -366,7 +366,7 @@ struct AVFilterPad {
|
|||||||
* Input audio pads only.
|
* Input audio pads only.
|
||||||
*/
|
*/
|
||||||
AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
|
AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
|
||||||
enum SampleFormat sample_fmt, int size,
|
enum AVSampleFormat sample_fmt, int size,
|
||||||
int64_t channel_layout, int planar);
|
int64_t channel_layout, int planar);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -455,7 +455,7 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link,
|
|||||||
|
|
||||||
/** default handler for get_audio_buffer() for audio inputs */
|
/** default handler for get_audio_buffer() for audio inputs */
|
||||||
AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
|
AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
|
||||||
enum SampleFormat sample_fmt, int size,
|
enum AVSampleFormat sample_fmt, int size,
|
||||||
int64_t channel_layout, int planar);
|
int64_t channel_layout, int planar);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -486,7 +486,7 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link,
|
|||||||
|
|
||||||
/** get_audio_buffer() handler for filters which simply pass audio along */
|
/** get_audio_buffer() handler for filters which simply pass audio along */
|
||||||
AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
|
AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
|
||||||
enum SampleFormat sample_fmt, int size,
|
enum AVSampleFormat sample_fmt, int size,
|
||||||
int64_t channel_layout, int planar);
|
int64_t channel_layout, int planar);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -662,7 +662,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms,
|
|||||||
* avfilter_unref_buffer when you are finished with it.
|
* avfilter_unref_buffer when you are finished with it.
|
||||||
*/
|
*/
|
||||||
AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
|
AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
|
||||||
enum SampleFormat sample_fmt, int size,
|
enum AVSampleFormat sample_fmt, int size,
|
||||||
int64_t channel_layout, int planar);
|
int64_t channel_layout, int planar);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
|
AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
|
||||||
enum SampleFormat sample_fmt, int size,
|
enum AVSampleFormat sample_fmt, int size,
|
||||||
int64_t channel_layout, int planar)
|
int64_t channel_layout, int planar)
|
||||||
{
|
{
|
||||||
AVFilterBuffer *samples = av_mallocz(sizeof(AVFilterBuffer));
|
AVFilterBuffer *samples = av_mallocz(sizeof(AVFilterBuffer));
|
||||||
@ -318,7 +318,7 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
|
AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
|
||||||
enum SampleFormat sample_fmt, int size,
|
enum AVSampleFormat sample_fmt, int size,
|
||||||
int64_t channel_layout, int packed)
|
int64_t channel_layout, int packed)
|
||||||
{
|
{
|
||||||
return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt,
|
return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt,
|
||||||
|
@ -108,7 +108,7 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
|
|||||||
AVFilterFormats *ret = NULL;
|
AVFilterFormats *ret = NULL;
|
||||||
int fmt;
|
int fmt;
|
||||||
int num_formats = type == AVMEDIA_TYPE_VIDEO ? PIX_FMT_NB :
|
int num_formats = type == AVMEDIA_TYPE_VIDEO ? PIX_FMT_NB :
|
||||||
type == AVMEDIA_TYPE_AUDIO ? SAMPLE_FMT_NB : 0;
|
type == AVMEDIA_TYPE_AUDIO ? AV_SAMPLE_FMT_NB : 0;
|
||||||
|
|
||||||
for (fmt = 0; fmt < num_formats; fmt++)
|
for (fmt = 0; fmt < num_formats; fmt++)
|
||||||
if ((type != AVMEDIA_TYPE_VIDEO) ||
|
if ((type != AVMEDIA_TYPE_VIDEO) ||
|
||||||
|
@ -157,7 +157,7 @@ static int flic_read_header(AVFormatContext *s,
|
|||||||
ast->codec->codec_tag = 0;
|
ast->codec->codec_tag = 0;
|
||||||
ast->codec->sample_rate = FLIC_TFTD_SAMPLE_RATE;
|
ast->codec->sample_rate = FLIC_TFTD_SAMPLE_RATE;
|
||||||
ast->codec->channels = 1;
|
ast->codec->channels = 1;
|
||||||
ast->codec->sample_fmt = SAMPLE_FMT_U8;
|
ast->codec->sample_fmt = AV_SAMPLE_FMT_U8;
|
||||||
ast->codec->bit_rate = st->codec->sample_rate * 8;
|
ast->codec->bit_rate = st->codec->sample_rate * 8;
|
||||||
ast->codec->bits_per_coded_sample = 8;
|
ast->codec->bits_per_coded_sample = 8;
|
||||||
ast->codec->channel_layout = CH_LAYOUT_MONO;
|
ast->codec->channel_layout = CH_LAYOUT_MONO;
|
||||||
|
@ -68,7 +68,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
|
|||||||
c->codec_type = AVMEDIA_TYPE_AUDIO;
|
c->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||||
|
|
||||||
/* put sample parameters */
|
/* put sample parameters */
|
||||||
c->sample_fmt = SAMPLE_FMT_S16;
|
c->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
c->bit_rate = 64000;
|
c->bit_rate = 64000;
|
||||||
c->sample_rate = 44100;
|
c->sample_rate = 44100;
|
||||||
c->channels = 2;
|
c->channels = 2;
|
||||||
|
@ -2015,7 +2015,7 @@ static int has_codec_parameters(AVCodecContext *enc)
|
|||||||
int val;
|
int val;
|
||||||
switch(enc->codec_type) {
|
switch(enc->codec_type) {
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
val = enc->sample_rate && enc->channels && enc->sample_fmt != SAMPLE_FMT_NONE;
|
val = enc->sample_rate && enc->channels && enc->sample_fmt != AV_SAMPLE_FMT_NONE;
|
||||||
if(!enc->frame_size &&
|
if(!enc->frame_size &&
|
||||||
(enc->codec_id == CODEC_ID_VORBIS ||
|
(enc->codec_id == CODEC_ID_VORBIS ||
|
||||||
enc->codec_id == CODEC_ID_AAC ||
|
enc->codec_id == CODEC_ID_AAC ||
|
||||||
|
Loading…
Reference in New Issue
Block a user