diff --git a/ffmpeg.c b/ffmpeg.c index 1a5a5b1bc1..dcad55a074 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -148,7 +148,7 @@ static int frame_width = 0; static int frame_height = 0; static float frame_aspect_ratio = 0; 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 AVRational frame_rate; 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) { if(codec && codec->sample_fmts){ - const enum SampleFormat *p= codec->sample_fmts; + const enum AVSampleFormat *p= codec->sample_fmts; for(; *p!=-1; p++){ if(*p == st->codec->sample_fmt) break; @@ -809,7 +809,7 @@ need_realloc: ost->audio_resample = 1; 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"); ost->resample = av_audio_resample_init(enc->channels, dec->channels, 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 && MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt)!=ost->reformat_pair) { if (ost->reformat_ctx) @@ -2175,7 +2175,7 @@ static int transcode(AVFormatContext **output_files, ost->fifo= av_fifo_alloc(1024); if(!ost->fifo) 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; icodec->request_channels = codec->channels; ist->decoding_needed = 1; @@ -2851,7 +2851,7 @@ static void opt_audio_sample_fmt(const char *arg) if (strcmp(arg, "list")) audio_sample_fmt = av_get_sample_fmt(arg); 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); } } diff --git a/ffplay.c b/ffplay.c index c2c41343fc..d478bcb2a4 100644 --- a/ffplay.c +++ b/ffplay.c @@ -163,7 +163,7 @@ typedef struct VideoState { int audio_buf_index; /* in bytes */ AVPacket audio_pkt_temp; AVPacket audio_pkt; - enum SampleFormat audio_src_fmt; + enum AVSampleFormat audio_src_fmt; AVAudioConvert *reformat_ctx; 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 (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); if (!is->reformat_ctx) { 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(SAMPLE_FMT_S16)); + av_get_sample_fmt_name(AV_SAMPLE_FMT_S16)); break; } is->audio_src_fmt= dec->sample_fmt; @@ -2268,7 +2268,7 @@ static int stream_component_open(VideoState *is, int stream_index) return -1; } 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; diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index 6e09b11e03..66820be1ad 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -88,7 +88,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx) default: return -1; } - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index c6e5951c6a..fa527da37c 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -545,7 +545,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) 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( 1, 270); @@ -2369,8 +2369,8 @@ AVCodec aac_decoder = { aac_decode_close, aac_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"), - .sample_fmts = (const enum SampleFormat[]) { - SAMPLE_FMT_S16,SAMPLE_FMT_NONE + .sample_fmts = (const enum AVSampleFormat[]) { + AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE }, .channel_layouts = aac_channel_layout, }; @@ -2389,8 +2389,8 @@ AVCodec aac_latm_decoder = { .close = aac_decode_close, .decode = latm_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"), - .sample_fmts = (const enum SampleFormat[]) { - SAMPLE_FMT_S16,SAMPLE_FMT_NONE + .sample_fmts = (const enum AVSampleFormat[]) { + AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE }, .channel_layouts = aac_channel_layout, }; diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 1646489515..c52ffa0c45 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -645,6 +645,6 @@ AVCodec aac_encoder = { aac_encode_frame, aac_encode_end, .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"), }; diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index f2f6e5ce4d..32172dc906 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -219,7 +219,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index ea8ba8b496..200ba36c6a 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1400,7 +1400,7 @@ AVCodec ac3_encoder = { AC3_encode_frame, AC3_encode_close, 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)"), .channel_layouts = (const int64_t[]){ CH_LAYOUT_MONO, diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 455b477332..4825d41ed8 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -737,7 +737,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) default: break; } - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } @@ -1678,7 +1678,7 @@ AVCodec name ## _encoder = { \ adpcm_encode_frame, \ adpcm_encode_close, \ 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_), \ }; #else diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c index adb22fcfe5..030f2d781a 100644 --- a/libavcodec/adxdec.c +++ b/libavcodec/adxdec.c @@ -34,7 +34,7 @@ static av_cold int adx_decode_init(AVCodecContext *avctx) { - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c index 116b746ed0..2200f5c6c8 100644 --- a/libavcodec/adxenc.c +++ b/libavcodec/adxenc.c @@ -192,6 +192,6 @@ AVCodec adpcm_adx_encoder = { adx_encode_frame, adx_encode_close, 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"), }; diff --git a/libavcodec/alac.c b/libavcodec/alac.c index c5a8b5d8c6..3a255781a2 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -505,10 +505,10 @@ static int alac_decode_frame(AVCodecContext *avctx, outputsamples = alac->setinfo_max_samples_per_frame; 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; break; - case 24: avctx->sample_fmt = SAMPLE_FMT_S32; + case 24: avctx->sample_fmt = AV_SAMPLE_FMT_S32; alac->bytespersample = channels << 2; break; default: av_log(avctx, AV_LOG_ERROR, "Sample depth %d is not supported.\n", diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index 0fad99febd..d1369c4859 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -383,7 +383,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx) avctx->frame_size = DEFAULT_FRAME_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"); return -1; } @@ -528,6 +528,6 @@ AVCodec alac_encoder = { alac_encode_frame, alac_encode_close, .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)"), }; diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index f74a52b15a..9b71b2dbb8 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1573,11 +1573,11 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_bgmc_init(avctx, &ctx->bgmc_lut, &ctx->bgmc_lut_status); if (sconf->floating) { - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; avctx->bits_per_raw_sample = 32; } else { 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; } diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index e878019bd2..a7d9fc52c0 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -154,7 +154,7 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx) AMRContext *p = avctx->priv_data; 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 = &p->excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1]; @@ -1044,5 +1044,5 @@ AVCodec amrnb_decoder = { .init = amrnb_decode_init, .decode = amrnb_decode_frame, .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}, }; diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index dd372e275a..497595463b 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -198,7 +198,7 @@ static av_cold int ape_decode_init(AVCodecContext * 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; return 0; } diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index 5ff8816476..513ecc7d8b 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -326,7 +326,7 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx) { AT1Ctx *q = avctx->priv_data; - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; q->channels = avctx->channels; diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 8ccba0bc70..797e1f1992 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -1014,7 +1014,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/audioconvert.c b/libavcodec/audioconvert.c index 4e4063fab5..3f1c819754 100644 --- a/libavcodec/audioconvert.c +++ b/libavcodec/audioconvert.c @@ -37,7 +37,7 @@ const char *avcodec_get_sample_fmt_name(int 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); } @@ -152,8 +152,8 @@ struct AVAudioConvert { int fmt_pair; }; -AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels, - enum SampleFormat in_fmt, int in_channels, +AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels, + enum AVSampleFormat in_fmt, int in_channels, const float *matrix, int flags) { AVAudioConvert *ctx; @@ -164,7 +164,7 @@ AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channe return NULL; ctx->in_channels = in_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; } @@ -191,7 +191,7 @@ int av_audio_convert(AVAudioConvert *ctx, continue; #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{\ *(otype*)po = expr; pi += is; po += os;\ }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 rounding ? - CONV(SAMPLE_FMT_U8 , uint8_t, 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(SAMPLE_FMT_S32, int32_t, 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(SAMPLE_FMT_DBL, double , 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(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_S16, *(const int16_t*)pi) - else CONV(SAMPLE_FMT_S32, int32_t, 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(SAMPLE_FMT_DBL, double , 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(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_S32, *(const int32_t*)pi>>16) - else CONV(SAMPLE_FMT_S32, int32_t, 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(SAMPLE_FMT_DBL, double , 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(SAMPLE_FMT_S16, int16_t, 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(SAMPLE_FMT_FLT, float , SAMPLE_FMT_FLT, *(const float*)pi) - else CONV(SAMPLE_FMT_DBL, double , 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(SAMPLE_FMT_S16, int16_t, 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(SAMPLE_FMT_FLT, float , SAMPLE_FMT_DBL, *(const double*)pi) - else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_DBL, *(const double*)pi) + CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_U8 , *(const uint8_t*)pi) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<8) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<24) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_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(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S16, (*(const int16_t*)pi>>8) + 0x80) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi<<16) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_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(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S32, (*(const int32_t*)pi>>24) + 0x80) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S32, *(const int32_t*)pi>>16) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S32, *(const int32_t*)pi) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_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(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8( lrintf(*(const float*)pi * (1<<7)) + 0x80)) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16( lrintf(*(const float*)pi * (1<<15)))) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float*)pi * (1U<<31)))) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_FLT, *(const float*)pi) + else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_FLT, *(const float*)pi) + else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8( lrint(*(const double*)pi * (1<<7)) + 0x80)) + else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16( lrint(*(const double*)pi * (1<<15)))) + else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double*)pi * (1U<<31)))) + else CONV(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_DBL, *(const double*)pi) + else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_DBL, *(const double*)pi) else return -1; } return 0; diff --git a/libavcodec/audioconvert.h b/libavcodec/audioconvert.h index e7d262bae5..a1e61c263d 100644 --- a/libavcodec/audioconvert.h +++ b/libavcodec/audioconvert.h @@ -49,7 +49,7 @@ const char *avcodec_get_sample_fmt_name(int sample_fmt); * @deprecated Use av_get_sample_fmt() instead. */ attribute_deprecated -enum SampleFormat avcodec_get_sample_fmt(const char* name); +enum AVSampleFormat avcodec_get_sample_fmt(const char* name); #endif /** @@ -94,8 +94,8 @@ typedef struct AVAudioConvert AVAudioConvert; * @param flags See AV_CPU_FLAG_xx * @return NULL on error */ -AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels, - enum SampleFormat in_fmt, int in_channels, +AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels, + enum AVSampleFormat in_fmt, int in_channels, const float *matrix, int flags); /** diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7f28e9e9ff..b85fd24ddf 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1231,7 +1231,7 @@ typedef struct AVCodecContext { * - encoding: Set by user. * - decoding: Set by libavcodec. */ - enum SampleFormat sample_fmt; ///< sample format + enum AVSampleFormat sample_fmt; ///< sample format /* The following data should not be initialized. */ /** @@ -2555,7 +2555,7 @@ typedef struct AVCodecContext { /** * 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. * - decoding: set by libavcodec. */ @@ -2796,7 +2796,7 @@ typedef struct AVCodec { */ const char *long_name; 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 uint8_t max_lowres; ///< maximum value for lowres supported by the decoder 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, int output_rate, int input_rate, - enum SampleFormat sample_fmt_out, - enum SampleFormat sample_fmt_in, + enum AVSampleFormat sample_fmt_out, + enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, 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. */ 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 /* frame parsing */ diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 295b351898..62ff17035e 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -119,7 +119,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->bands[s->num_bands] = s->frame_len / 2; s->first = 1; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; for (i = 0; i < s->channels; i++) s->coeffs_ptr[i] = s->coeffs + i * s->frame_len; diff --git a/libavcodec/cook.c b/libavcodec/cook.c index b7e2ef1a91..2cbad5fc7a 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1270,7 +1270,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) return -1; } - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; if (channel_mask) avctx->channel_layout = channel_mask; else diff --git a/libavcodec/dca.c b/libavcodec/dca.c index afd55bb075..c47f3b3735 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1464,7 +1464,7 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++) 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) { s->add_bias = 385.0f; diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index 3f3842c8e9..334f25dfdc 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -155,7 +155,7 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx) break; } - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index 895b6237d7..4eddaac5a6 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -307,7 +307,7 @@ static av_cold int cinaudio_decode_init(AVCodecContext *avctx) cin->avctx = avctx; cin->initial_decode_frame = 1; cin->delta = 0; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 2d4dac0616..8488a9d090 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -113,7 +113,7 @@ static av_cold int flac_decode_init(AVCodecContext *avctx) FLACContext *s = avctx->priv_data; 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 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 */ ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo); if (s->bps > 16) - avctx->sample_fmt = SAMPLE_FMT_S32; + avctx->sample_fmt = AV_SAMPLE_FMT_S32; else - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; allocate_buffers(s); s->got_streaminfo = 1; @@ -603,11 +603,11 @@ static int decode_frame(FLACContext *s) s->bps = s->avctx->bits_per_raw_sample = fi.bps; 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->is32 = 1; } else { - s->avctx->sample_fmt = SAMPLE_FMT_S16; + s->avctx->sample_fmt = AV_SAMPLE_FMT_S16; s->sample_shift = 16 - s->bps; s->is32 = 0; } diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 824e639945..272d446b29 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -219,7 +219,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) dsputil_init(&s->dsp, avctx); - if (avctx->sample_fmt != SAMPLE_FMT_S16) + if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) return -1; if (channels < 1 || channels > FLAC_MAX_CHANNELS) @@ -1335,6 +1335,6 @@ AVCodec flac_encoder = { flac_encode_close, NULL, .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)"), }; diff --git a/libavcodec/g722.c b/libavcodec/g722.c index 51a0f39abc..6b094244b6 100644 --- a/libavcodec/g722.c +++ b/libavcodec/g722.c @@ -193,7 +193,7 @@ static av_cold int g722_init(AVCodecContext * avctx) av_log(avctx, AV_LOG_ERROR, "Only mono tracks are allowed.\n"); return AVERROR_INVALIDDATA; } - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; switch (avctx->bits_per_coded_sample) { case 8: @@ -379,7 +379,7 @@ AVCodec adpcm_g722_encoder = { .init = g722_init, .encode = g722_encode_frame, .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 diff --git a/libavcodec/g726.c b/libavcodec/g726.c index 4c63bf3895..52ebda6e49 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -332,7 +332,7 @@ static av_cold int g726_init(AVCodecContext * avctx) avctx->coded_frame->key_frame = 1; 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 approximately 1024 bytes */ @@ -401,7 +401,7 @@ AVCodec adpcm_g726_encoder = { g726_close, NULL, .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"), }; #endif diff --git a/libavcodec/gsmdec.c b/libavcodec/gsmdec.c index 3b85504f37..b316810c4d 100644 --- a/libavcodec/gsmdec.c +++ b/libavcodec/gsmdec.c @@ -35,7 +35,7 @@ static av_cold int gsm_init(AVCodecContext *avctx) avctx->channels = 1; if (!avctx->sample_rate) avctx->sample_rate = 8000; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; switch (avctx->codec_id) { case CODEC_ID_GSM: diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 730d8218da..272e4ee76e 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -156,7 +156,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx) ff_fft_init(&q->fft, 7, 1); dsputil_init(&q->dsp, avctx); - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; return 0; } diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index 82fd05bafd..b220b1714e 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -153,6 +153,6 @@ AVCodec libfaac_encoder = { Faac_encode_init, Faac_encode_frame, 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)"), }; diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index a7bc68ad71..77cc8914cc 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -49,7 +49,7 @@ static av_cold int libgsm_init(AVCodecContext *avctx) { if(!avctx->sample_rate) avctx->sample_rate= 8000; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; }else{ if (avctx->sample_rate != 8000) { 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_encode_frame, 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"), }; @@ -132,7 +132,7 @@ AVCodec libgsm_ms_encoder = { libgsm_init, libgsm_encode_frame, 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"), }; diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 6915258272..35c80547bd 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -222,7 +222,7 @@ AVCodec libmp3lame_encoder = { MP3lame_encode_frame, MP3lame_encode_close, .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, .long_name= NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"), }; diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 266164514f..ab1f89aad7 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -32,7 +32,7 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx) avctx->channels = 1; avctx->frame_size = 160 * is_amr_wb; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; } #if CONFIG_LIBOPENCORE_AMRNB @@ -222,7 +222,7 @@ AVCodec libopencore_amrnb_encoder = { amr_nb_encode_frame, amr_nb_encode_close, 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"), }; diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c index c5cfbd5108..204e52c10e 100644 --- a/libavcodec/libspeexdec.c +++ b/libavcodec/libspeexdec.c @@ -49,7 +49,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx) if (avctx->extradata_size >= 80) 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) { avctx->sample_rate = s->header->rate; avctx->channels = s->header->nb_channels; diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c index b7466cd1b5..7e75d1d7cb 100644 --- a/libavcodec/libvorbis.c +++ b/libavcodec/libvorbis.c @@ -252,7 +252,7 @@ AVCodec libvorbis_encoder = { oggvorbis_encode_frame, oggvorbis_encode_close, .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"), .priv_class= &class, } ; diff --git a/libavcodec/mace.c b/libavcodec/mace.c index 3c71320d54..c4c43f6184 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -230,7 +230,7 @@ static av_cold int mace_decode_init(AVCodecContext * avctx) { if (avctx->channels > 2) return -1; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c index 90bf9391e9..36a296f98e 100644 --- a/libavcodec/mlp_parser.c +++ b/libavcodec/mlp_parser.c @@ -255,9 +255,9 @@ static int mlp_parse(AVCodecParserContext *s, avctx->bits_per_raw_sample = mh.group1_bits; if (avctx->bits_per_raw_sample > 16) - avctx->sample_fmt = SAMPLE_FMT_S32; + avctx->sample_fmt = AV_SAMPLE_FMT_S32; else - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->sample_rate = mh.group1_samplerate; avctx->frame_size = mh.access_unit_size; diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 16397eefd7..2a04be5156 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -318,9 +318,9 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) m->avctx->bits_per_raw_sample = mh.group1_bits; if (mh.group1_bits > 16) - m->avctx->sample_fmt = SAMPLE_FMT_S32; + m->avctx->sample_fmt = AV_SAMPLE_FMT_S32; else - m->avctx->sample_fmt = SAMPLE_FMT_S16; + m->avctx->sample_fmt = AV_SAMPLE_FMT_S16; m->params_valid = 1; 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, 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); else return output_data_internal(m, substr, data, data_size, 0); diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 42de27e7b9..83e1aa4781 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -85,7 +85,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); 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; if(vlc_initialized) return 0; diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 376274608f..1296f255a4 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -129,7 +129,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) c->MSS = get_bits1(&gb); 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; if(vlc_initialized) return 0; diff --git a/libavcodec/mpegaudio.h b/libavcodec/mpegaudio.h index e2ad911b0c..97c7855f06 100644 --- a/libavcodec/mpegaudio.h +++ b/libavcodec/mpegaudio.h @@ -72,19 +72,19 @@ #if CONFIG_FLOAT typedef float OUT_INT; -#define OUT_FMT SAMPLE_FMT_FLT +#define OUT_FMT AV_SAMPLE_FMT_FLT #elif CONFIG_MPEGAUDIO_HP && CONFIG_AUDIO_NONSHORT typedef int32_t OUT_INT; #define OUT_MAX INT32_MAX #define OUT_MIN INT32_MIN #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31) -#define OUT_FMT SAMPLE_FMT_S32 +#define OUT_FMT AV_SAMPLE_FMT_S32 #else typedef int16_t OUT_INT; #define OUT_MAX INT16_MAX #define OUT_MIN INT16_MIN #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15) -#define OUT_FMT SAMPLE_FMT_S16 +#define OUT_FMT AV_SAMPLE_FMT_S16 #endif #if CONFIG_FLOAT diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 5dc4a9b145..736cbe1219 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -792,7 +792,7 @@ AVCodec mp2_encoder = { MPA_encode_frame, MPA_encode_close, 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}, .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), }; diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 8976467f61..612ca9c1fb 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -147,7 +147,7 @@ static av_cold int decode_init(AVCodecContext * avctx) { if (!ff_sine_128[127]) 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; return 0; } diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index a596926f50..b3f6aa31d2 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -392,5 +392,5 @@ AVCodec nellymoser_encoder = { .close = encode_end, .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY, .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}, }; diff --git a/libavcodec/options.c b/libavcodec/options.c index ef7573c794..e31a007891 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -461,7 +461,7 @@ void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_typ s->execute2= avcodec_default_execute2; s->sample_aspect_ratio= (AVRational){0,1}; s->pix_fmt= PIX_FMT_NONE; - s->sample_fmt= SAMPLE_FMT_NONE; + s->sample_fmt= AV_SAMPLE_FMT_NONE; s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c index c2343a69b0..59c4ecfd4a 100644 --- a/libavcodec/pcm-mpeg.c +++ b/libavcodec/pcm-mpeg.c @@ -72,8 +72,8 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (0)\n"); return -1; } - avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? SAMPLE_FMT_S16 : - SAMPLE_FMT_S32; + avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 : + AV_SAMPLE_FMT_S32; /* get the sample rate. Not all values are known or exist. */ switch (header[2] & 0x0f) { @@ -146,7 +146,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, samples = buf_size / sample_size; 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) { av_log(avctx, AV_LOG_ERROR, "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_2_2: samples *= num_source_channels; - if (SAMPLE_FMT_S16 == avctx->sample_fmt) { + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { #if HAVE_BIGENDIAN memcpy(dst16, src, output_size); #else @@ -181,7 +181,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, case CH_LAYOUT_SURROUND: case CH_LAYOUT_2_1: case CH_LAYOUT_5POINT0: - if (SAMPLE_FMT_S16 == avctx->sample_fmt) { + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { do { #if HAVE_BIGENDIAN memcpy(dst16, src, avctx->channels * 2); @@ -207,7 +207,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, break; /* remapping: L, R, C, LBack, RBack, LF */ case CH_LAYOUT_5POINT1: - if (SAMPLE_FMT_S16 == avctx->sample_fmt) { + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { do { dst16[0] = bytestream_get_be16(&src); dst16[1] = bytestream_get_be16(&src); @@ -231,7 +231,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, break; /* remapping: L, R, C, LSide, LBack, RBack, RSide, */ case CH_LAYOUT_7POINT0: - if (SAMPLE_FMT_S16 == avctx->sample_fmt) { + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { do { dst16[0] = bytestream_get_be16(&src); dst16[1] = bytestream_get_be16(&src); @@ -259,7 +259,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, break; /* remapping: L, R, C, LSide, LBack, RBack, RSide, LF */ case CH_LAYOUT_7POINT1: - if (SAMPLE_FMT_S16 == avctx->sample_fmt) { + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { do { dst16[0] = bytestream_get_be16(&src); dst16[1] = bytestream_get_be16(&src); @@ -304,7 +304,7 @@ AVCodec pcm_bluray_decoder = { NULL, NULL, pcm_bluray_decode_frame, - .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16, SAMPLE_FMT_S32, - SAMPLE_FMT_NONE}, + .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, + AV_SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"), }; diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 51dbfd6abd..b6b49dc049 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -228,7 +228,7 @@ static av_cold int pcm_decode_init(AVCodecContext * avctx) 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); return 0; @@ -475,7 +475,7 @@ AVCodec name_ ## _encoder = { \ .init = pcm_encode_init, \ .encode = pcm_encode_frame, \ .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_), \ }; #else @@ -491,7 +491,7 @@ AVCodec name_ ## _decoder = { \ .priv_data_size = sizeof(PCMDecode), \ .init = pcm_decode_init, \ .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_), \ }; #else @@ -502,28 +502,28 @@ AVCodec name_ ## _decoder = { \ PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_) /* Note: Do not forget to add new entries to the Makefile as well. */ -PCM_CODEC (CODEC_ID_PCM_ALAW, 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_F32BE, 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_F64BE, 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_DECODER(CODEC_ID_PCM_LXF, 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_S8, 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_S16LE, 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_CODEC (CODEC_ID_PCM_S24BE, 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_S24LE, 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_S32LE, 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_U16BE, 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_U24BE, 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_U32BE, 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_ZORK, SAMPLE_FMT_S16, pcm_zork, "PCM Zork"); +PCM_CODEC (CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law"); +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, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-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, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-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, AV_SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar"); +PCM_CODEC (CODEC_ID_PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law"); +PCM_CODEC (CODEC_ID_PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit"); +PCM_CODEC (CODEC_ID_PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-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, AV_SAMPLE_FMT_S16, pcm_s16le_planar, "PCM 16-bit little-endian planar"); +PCM_CODEC (CODEC_ID_PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian"); +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, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-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, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian"); +PCM_CODEC (CODEC_ID_PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit"); +PCM_CODEC (CODEC_ID_PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-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, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-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, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-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, AV_SAMPLE_FMT_S16, pcm_zork, "PCM Zork"); diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c index 0441e1fcae..22b90ceb80 100644 --- a/libavcodec/qcelpdec.c +++ b/libavcodec/qcelpdec.c @@ -92,7 +92,7 @@ static av_cold int qcelp_decode_init(AVCodecContext *avctx) QCELPContext *q = avctx->priv_data; int i; - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; for(i=0; i<10; i++) q->prev_lspf[i] = (i+1)/11.; diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 8b28c2d0f0..9dffff0fd2 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1866,7 +1866,7 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx) qdm2_init(s); - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; // dump_context(s); return 0; diff --git a/libavcodec/ra144dec.c b/libavcodec/ra144dec.c index 5b391d4675..2c022b1417 100644 --- a/libavcodec/ra144dec.c +++ b/libavcodec/ra144dec.c @@ -37,7 +37,7 @@ static av_cold int ra144_decode_init(AVCodecContext * avctx) ractx->lpc_coef[0] = ractx->lpc_tables[0]; ractx->lpc_coef[1] = ractx->lpc_tables[1]; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index 195821cddb..9865dc9c04 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -38,7 +38,7 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx) { 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"); return -1; } diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index bfc62e1ffa..03cf18fff0 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -54,7 +54,7 @@ typedef struct { static av_cold int ra288_decode_init(AVCodecContext *avctx) { - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; return 0; } diff --git a/libavcodec/resample.c b/libavcodec/resample.c index 89e2d71e53..272831520d 100644 --- a/libavcodec/resample.c +++ b/libavcodec/resample.c @@ -47,7 +47,7 @@ struct ReSampleContext { /* channel convert */ int input_channels, output_channels, filter_channels; 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 short *buffer[2]; ///< buffers used for conversion to S16 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, int output_rate, int input_rate, - enum SampleFormat sample_fmt_out, - enum SampleFormat sample_fmt_in, + enum AVSampleFormat sample_fmt_out, + enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, 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[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1])>>3; - if (s->sample_fmt[0] != SAMPLE_FMT_S16) { - if (!(s->convert_ctx[0] = av_audio_convert_alloc(SAMPLE_FMT_S16, 1, + if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) { + if (!(s->convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1, s->sample_fmt[0], 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "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, - SAMPLE_FMT_S16, 1, NULL, 0))) { + AV_SAMPLE_FMT_S16, 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert s16 sample format to %s sample format\n", 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, output_rate, input_rate, - SAMPLE_FMT_S16, SAMPLE_FMT_S16, + AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16, TAPS, 10, 0, 0.8); } #endif @@ -246,7 +246,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl 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 ostride[1] = { 2 }; 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; - if (s->sample_fmt[1] != SAMPLE_FMT_S16) { + if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) { output_bak = output; 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); } - if (s->sample_fmt[1] != SAMPLE_FMT_S16) { + if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) { int istride[1] = { 2 }; int ostride[1] = { s->sample_size[1] }; const void *ibuf[1] = { output }; diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c index 050c6571dd..229b546649 100644 --- a/libavcodec/roqaudioenc.c +++ b/libavcodec/roqaudioenc.c @@ -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"); 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"); return -1; } @@ -162,6 +162,6 @@ AVCodec roq_dpcm_encoder = { roq_dpcm_encode_frame, roq_dpcm_encode_close, 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"), }; diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 213e5b39b7..f61c2631e6 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -105,7 +105,7 @@ static av_cold int shorten_decode_init(AVCodecContext * avctx) { ShortenContext *s = avctx->priv_data; s->avctx = avctx; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c index dc84116f93..08224568aa 100644 --- a/libavcodec/sipr.c +++ b/libavcodec/sipr.c @@ -493,7 +493,7 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx) for (i = 0; i < 4; i++) ctx->energy_history[i] = -14; - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; dsputil_init(&ctx->dsp, avctx); diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index ac2f76b775..38ca61c9c7 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -555,7 +555,7 @@ static av_cold int decode_end(AVCodecContext *avctx) static av_cold int smka_decode_init(AVCodecContext *avctx) { 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; } diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index d24931f6fe..aff155d57f 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -825,7 +825,7 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx) } s->int_samples = av_mallocz(4* s->frame_size); - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c index 807329ee11..6bc1e7b1d8 100644 --- a/libavcodec/truespeech.c +++ b/libavcodec/truespeech.c @@ -56,7 +56,7 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx) { // TSContext *c = avctx->priv_data; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 81217f57d2..dad9933b0e 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -246,15 +246,15 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) 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"); return -1; } else switch(s->bps) { -// case 1: avctx->sample_fmt = SAMPLE_FMT_U8; break; - case 2: avctx->sample_fmt = SAMPLE_FMT_S16; break; -// case 3: avctx->sample_fmt = SAMPLE_FMT_S24; break; - case 4: avctx->sample_fmt = SAMPLE_FMT_S32; break; +// case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break; + case 2: avctx->sample_fmt = AV_SAMPLE_FMT_S16; break; +// case 3: avctx->sample_fmt = AV_SAMPLE_FMT_S24; break; + case 4: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break; default: av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n"); return -1; diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index 701e9595cf..3d26c6e3cb 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -1068,7 +1068,7 @@ static av_cold int twin_decode_init(AVCodecContext *avctx) int ibps = avctx->bit_rate/(1000 * avctx->channels); tctx->avctx = avctx; - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; if (avctx->channels > CHANNELS_MAX) { av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n", diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f07e5c90c9..38751400b9 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -923,7 +923,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) } av_strlcat(buf, ", ", buf_size); 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), ", %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 -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); } #endif diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 4914d2a09a..9f44e31ed9 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -446,7 +446,7 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) s->channels = avctx->channels; s->bits = avctx->bits_per_coded_sample; 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", s->channels, s->bits, s->block_align, avctx->sample_rate); diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 56559045ed..749e9a9396 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -1006,7 +1006,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext) avccontext->channels = vc->audio_channels; avccontext->sample_rate = vc->audio_samplerate; avccontext->frame_size = FFMIN(vc->blocksize[0], vc->blocksize[1]) >> 2; - avccontext->sample_fmt = SAMPLE_FMT_S16; + avccontext->sample_fmt = AV_SAMPLE_FMT_S16; return 0 ; } diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index d5b3cf4f41..0a9c80d6d2 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -1111,6 +1111,6 @@ AVCodec vorbis_encoder = { vorbis_encode_frame, vorbis_encode_close, .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"), }; diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 7358d29735..57534c9dfa 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -494,7 +494,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d B = s->decorr[i].samplesB[pos]; 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); R2 = R + ((s->decorr[i].weightB * (int64_t)B + 512) >> 10); }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].samplesB[j] = R = R2; }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); else 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); L = L2; - if(type != SAMPLE_FMT_S16) + if(type != AV_SAMPLE_FMT_S16) R2 = R + ((s->decorr[i].weightB * (int64_t)L2 + 512) >> 10); else 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; s->decorr[i].samplesA[0] = R; }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); else 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; } - if(type != SAMPLE_FMT_S16) + if(type != AV_SAMPLE_FMT_S16) L2 = L + ((s->decorr[i].weightA * (int64_t)R2 + 512) >> 10); else 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)); 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, 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, R); } else { @@ -613,7 +613,7 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst A = s->decorr[i].samplesA[pos]; 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); else 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; 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); - else if(type == SAMPLE_FMT_S32) + else if(type == AV_SAMPLE_FMT_S32) *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S); else *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->stereo = (avctx->channels == 2); if(avctx->bits_per_coded_sample <= 16) - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; 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; wv_reset_saved_context(s); @@ -708,13 +708,13 @@ static int wavpack_decode_frame(AVCodecContext *avctx, s->frame_flags = AV_RL32(buf); buf += 4; if(s->frame_flags&0x80){ bpp = sizeof(float); - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; } else if((s->frame_flags&0x03) <= 1){ bpp = 2; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; } else { 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->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"); 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"); 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 wanted = s->samples * s->extra_bits << s->stereo_in; if(size < wanted){ @@ -969,22 +969,22 @@ static int wavpack_decode_frame(AVCodecContext *avctx, } if(s->stereo_in){ - if(avctx->sample_fmt == SAMPLE_FMT_S16) - samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_S16); - else if(avctx->sample_fmt == SAMPLE_FMT_S32) - samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_S32); + if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) + samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S16); + else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) + samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32); 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{ - if(avctx->sample_fmt == SAMPLE_FMT_S16) - samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_S16); - else if(avctx->sample_fmt == SAMPLE_FMT_S32) - samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_S32); + if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) + samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16); + else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) + samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S32); 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 *src = (int16_t*)samples + samplecount; int cnt = samplecount; @@ -993,7 +993,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, *--dst = *src; } 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 *src = (int32_t*)samples + samplecount; int cnt = samplecount; diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index 5582a7236b..694b15d1fb 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -123,7 +123,7 @@ static int wma_decode_init(AVCodecContext * avctx) wma_lsp_to_curve_init(s, s->frame_len); } - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index 3ba4800aee..f96aa3a107 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -392,7 +392,7 @@ AVCodec wmav1_encoder = encode_init, encode_superframe, 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"), }; @@ -405,6 +405,6 @@ AVCodec wmav2_encoder = encode_init, encode_superframe, 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"), }; diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 742896d42e..38810ee269 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -276,7 +276,7 @@ static av_cold int decode_init(AVCodecContext *avctx) dsputil_init(&s->dsp, avctx); 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) { s->decode_flags = AV_RL16(edata_ptr+14); diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index b500c21e66..76c2ef5aea 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -425,7 +425,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx) 2 * (s->block_conv_table[1] - 2 * s->min_pitch_val); 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; } diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c index 5ddb8cd445..c16c99a62a 100644 --- a/libavcodec/ws-snd1.c +++ b/libavcodec/ws-snd1.c @@ -43,7 +43,7 @@ static av_cold int ws_snd_decode_init(AVCodecContext * avctx) { // WSSNDContext *c = avctx->priv_data; - avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index fa15b35bde..e8f536a102 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -115,7 +115,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, link->srcpad = &src->output_pads[srcpad]; link->dstpad = &dst->input_pads[dstpad]; 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; 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, - enum SampleFormat sample_fmt, int size, + enum AVSampleFormat sample_fmt, int size, int64_t channel_layout, int planar) { AVFilterBufferRef *ret = NULL; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 5ee7887922..5583a141b7 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -366,7 +366,7 @@ struct AVFilterPad { * Input audio pads only. */ 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); /** @@ -455,7 +455,7 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, /** default handler for get_audio_buffer() for audio inputs */ 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); /** @@ -486,7 +486,7 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, /** get_audio_buffer() handler for filters which simply pass audio along */ 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); /** @@ -662,7 +662,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, * avfilter_unref_buffer when you are finished with it. */ 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); /** diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index 5462b1a34a..388d12c15e 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -82,7 +82,7 @@ fail: } 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) { 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, - enum SampleFormat sample_fmt, int size, + enum AVSampleFormat sample_fmt, int size, int64_t channel_layout, int packed) { return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt, diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 5e65c2968d..f53d6baf62 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -108,7 +108,7 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type) AVFilterFormats *ret = NULL; int fmt; 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++) if ((type != AVMEDIA_TYPE_VIDEO) || diff --git a/libavformat/flic.c b/libavformat/flic.c index fbdf931517..51320c9da3 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -157,7 +157,7 @@ static int flic_read_header(AVFormatContext *s, ast->codec->codec_tag = 0; ast->codec->sample_rate = FLIC_TFTD_SAMPLE_RATE; 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->bits_per_coded_sample = 8; ast->codec->channel_layout = CH_LAYOUT_MONO; diff --git a/libavformat/output-example.c b/libavformat/output-example.c index 15e2d9ac98..06207eddfc 100644 --- a/libavformat/output-example.c +++ b/libavformat/output-example.c @@ -68,7 +68,7 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id) c->codec_type = AVMEDIA_TYPE_AUDIO; /* put sample parameters */ - c->sample_fmt = SAMPLE_FMT_S16; + c->sample_fmt = AV_SAMPLE_FMT_S16; c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; diff --git a/libavformat/utils.c b/libavformat/utils.c index 23d0a3b0d5..03dfbb04c3 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2015,7 +2015,7 @@ static int has_codec_parameters(AVCodecContext *enc) int val; switch(enc->codec_type) { 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 && (enc->codec_id == CODEC_ID_VORBIS || enc->codec_id == CODEC_ID_AAC ||