Originally committed as revision 25668 to svn://svn.ffmpeg.org/ffmpeg/trunktags/n0.8
@@ -37,6 +37,7 @@ | |||||
#include "libavcodec/opt.h" | #include "libavcodec/opt.h" | ||||
#include "libavcodec/audioconvert.h" | #include "libavcodec/audioconvert.h" | ||||
#include "libavcore/parseutils.h" | #include "libavcore/parseutils.h" | ||||
#include "libavcore/samplefmt.h" | |||||
#include "libavutil/colorspace.h" | #include "libavutil/colorspace.h" | ||||
#include "libavutil/fifo.h" | #include "libavutil/fifo.h" | ||||
#include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||
@@ -769,8 +770,8 @@ static void do_audio_out(AVFormatContext *s, | |||||
int size_out, frame_bytes, ret; | int size_out, frame_bytes, ret; | ||||
AVCodecContext *enc= ost->st->codec; | AVCodecContext *enc= ost->st->codec; | ||||
AVCodecContext *dec= ist->st->codec; | AVCodecContext *dec= ist->st->codec; | ||||
int osize= av_get_bits_per_sample_format(enc->sample_fmt)/8; | |||||
int isize= av_get_bits_per_sample_format(dec->sample_fmt)/8; | |||||
int osize= av_get_bits_per_sample_fmt(enc->sample_fmt)/8; | |||||
int isize= av_get_bits_per_sample_fmt(dec->sample_fmt)/8; | |||||
const int coded_bps = av_get_bits_per_sample(enc->codec->id); | const int coded_bps = av_get_bits_per_sample(enc->codec->id); | ||||
need_realloc: | need_realloc: | ||||
@@ -824,8 +825,8 @@ need_realloc: | |||||
dec->sample_fmt, 1, NULL, 0); | dec->sample_fmt, 1, NULL, 0); | ||||
if (!ost->reformat_ctx) { | if (!ost->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", | ||||
avcodec_get_sample_fmt_name(dec->sample_fmt), | |||||
avcodec_get_sample_fmt_name(enc->sample_fmt)); | |||||
av_get_sample_fmt_name(dec->sample_fmt), | |||||
av_get_sample_fmt_name(enc->sample_fmt)); | |||||
ffmpeg_exit(1); | ffmpeg_exit(1); | ||||
} | } | ||||
ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt); | ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt); | ||||
@@ -1443,7 +1444,7 @@ static int output_packet(AVInputStream *ist, int ist_index, | |||||
#endif | #endif | ||||
AVPacket avpkt; | AVPacket avpkt; | ||||
int bps = av_get_bits_per_sample_format(ist->st->codec->sample_fmt)>>3; | |||||
int bps = av_get_bits_per_sample_fmt(ist->st->codec->sample_fmt)>>3; | |||||
if(ist->next_pts == AV_NOPTS_VALUE) | if(ist->next_pts == AV_NOPTS_VALUE) | ||||
ist->next_pts= ist->pts; | ist->next_pts= ist->pts; | ||||
@@ -1760,7 +1761,7 @@ static int output_packet(AVInputStream *ist, int ist_index, | |||||
ret = 0; | ret = 0; | ||||
/* encode any samples remaining in fifo */ | /* encode any samples remaining in fifo */ | ||||
if (fifo_bytes > 0) { | if (fifo_bytes > 0) { | ||||
int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3; | |||||
int osize = av_get_bits_per_sample_fmt(enc->sample_fmt) >> 3; | |||||
int fs_tmp = enc->frame_size; | int fs_tmp = enc->frame_size; | ||||
av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); | av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); | ||||
@@ -2817,9 +2818,9 @@ static int opt_thread_count(const char *opt, const char *arg) | |||||
static void opt_audio_sample_fmt(const char *arg) | static void opt_audio_sample_fmt(const char *arg) | ||||
{ | { | ||||
if (strcmp(arg, "list")) | if (strcmp(arg, "list")) | ||||
audio_sample_fmt = avcodec_get_sample_fmt(arg); | |||||
audio_sample_fmt = av_get_sample_fmt(arg); | |||||
else { | else { | ||||
list_fmts(avcodec_sample_fmt_string, SAMPLE_FMT_NB); | |||||
list_fmts(av_get_sample_fmt_string, SAMPLE_FMT_NB); | |||||
ffmpeg_exit(0); | ffmpeg_exit(0); | ||||
} | } | ||||
} | } | ||||
@@ -30,6 +30,7 @@ | |||||
#include "libavutil/pixdesc.h" | #include "libavutil/pixdesc.h" | ||||
#include "libavcore/imgutils.h" | #include "libavcore/imgutils.h" | ||||
#include "libavcore/parseutils.h" | #include "libavcore/parseutils.h" | ||||
#include "libavcore/samplefmt.h" | |||||
#include "libavformat/avformat.h" | #include "libavformat/avformat.h" | ||||
#include "libavdevice/avdevice.h" | #include "libavdevice/avdevice.h" | ||||
#include "libswscale/swscale.h" | #include "libswscale/swscale.h" | ||||
@@ -2099,8 +2100,8 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr) | |||||
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", | ||||
avcodec_get_sample_fmt_name(dec->sample_fmt), | |||||
avcodec_get_sample_fmt_name(SAMPLE_FMT_S16)); | |||||
av_get_sample_fmt_name(dec->sample_fmt), | |||||
av_get_sample_fmt_name(SAMPLE_FMT_S16)); | |||||
break; | break; | ||||
} | } | ||||
is->audio_src_fmt= dec->sample_fmt; | is->audio_src_fmt= dec->sample_fmt; | ||||
@@ -2109,7 +2110,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr) | |||||
if (is->reformat_ctx) { | if (is->reformat_ctx) { | ||||
const void *ibuf[6]= {is->audio_buf1}; | const void *ibuf[6]= {is->audio_buf1}; | ||||
void *obuf[6]= {is->audio_buf2}; | void *obuf[6]= {is->audio_buf2}; | ||||
int istride[6]= {av_get_bits_per_sample_format(dec->sample_fmt)/8}; | |||||
int istride[6]= {av_get_bits_per_sample_fmt(dec->sample_fmt)/8}; | |||||
int ostride[6]= {2}; | int ostride[6]= {2}; | ||||
int len= data_size/istride[0]; | int len= data_size/istride[0]; | ||||
if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) { | if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) { | ||||
@@ -36,6 +36,7 @@ | |||||
#include "bytestream.h" | #include "bytestream.h" | ||||
#include "bgmc.h" | #include "bgmc.h" | ||||
#include "dsputil.h" | #include "dsputil.h" | ||||
#include "libavcore/samplefmt.h" | |||||
#include "libavutil/crc.h" | #include "libavutil/crc.h" | ||||
#include <stdint.h> | #include <stdint.h> | ||||
@@ -1426,7 +1427,7 @@ static int decode_frame(AVCodecContext *avctx, | |||||
// check for size of decoded data | // check for size of decoded data | ||||
size = ctx->cur_frame_length * avctx->channels * | size = ctx->cur_frame_length * avctx->channels * | ||||
(av_get_bits_per_sample_format(avctx->sample_fmt) >> 3); | |||||
(av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3); | |||||
if (size > *data_size) { | if (size > *data_size) { | ||||
av_log(avctx, AV_LOG_ERROR, "Decoded data exceeds buffer size.\n"); | av_log(avctx, AV_LOG_ERROR, "Decoded data exceeds buffer size.\n"); | ||||
@@ -1679,7 +1680,7 @@ static av_cold int decode_init(AVCodecContext *avctx) | |||||
ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) * | ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) * | ||||
ctx->cur_frame_length * | ctx->cur_frame_length * | ||||
avctx->channels * | avctx->channels * | ||||
(av_get_bits_per_sample_format(avctx->sample_fmt) >> 3)); | |||||
(av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3)); | |||||
if (!ctx->crc_buffer) { | if (!ctx->crc_buffer) { | ||||
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n"); | av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n"); | ||||
decode_end(avctx); | decode_end(avctx); | ||||
@@ -27,6 +27,7 @@ | |||||
#include "avcodec.h" | #include "avcodec.h" | ||||
#include "audioconvert.h" | #include "audioconvert.h" | ||||
#include "libavutil/opt.h" | #include "libavutil/opt.h" | ||||
#include "libavcore/samplefmt.h" | |||||
struct AVResampleContext; | struct AVResampleContext; | ||||
@@ -174,15 +175,15 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, | |||||
s->sample_fmt [0] = sample_fmt_in; | s->sample_fmt [0] = sample_fmt_in; | ||||
s->sample_fmt [1] = sample_fmt_out; | s->sample_fmt [1] = sample_fmt_out; | ||||
s->sample_size[0] = av_get_bits_per_sample_format(s->sample_fmt[0])>>3; | |||||
s->sample_size[1] = av_get_bits_per_sample_format(s->sample_fmt[1])>>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; | |||||
if (s->sample_fmt[0] != SAMPLE_FMT_S16) { | if (s->sample_fmt[0] != 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(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", | ||||
avcodec_get_sample_fmt_name(s->sample_fmt[0])); | |||||
av_get_sample_fmt_name(s->sample_fmt[0])); | |||||
av_free(s); | av_free(s); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
@@ -193,7 +194,7 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, | |||||
SAMPLE_FMT_S16, 1, NULL, 0))) { | 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", | ||||
avcodec_get_sample_fmt_name(s->sample_fmt[1])); | |||||
av_get_sample_fmt_name(s->sample_fmt[1])); | |||||
av_audio_convert_free(s->convert_ctx[0]); | av_audio_convert_free(s->convert_ctx[0]); | ||||
av_free(s); | av_free(s); | ||||
return NULL; | return NULL; | ||||
@@ -30,6 +30,7 @@ | |||||
#include "libavutil/crc.h" | #include "libavutil/crc.h" | ||||
#include "libavutil/pixdesc.h" | #include "libavutil/pixdesc.h" | ||||
#include "libavcore/imgutils.h" | #include "libavcore/imgutils.h" | ||||
#include "libavcore/samplefmt.h" | |||||
#include "avcodec.h" | #include "avcodec.h" | ||||
#include "dsputil.h" | #include "dsputil.h" | ||||
#include "libavutil/opt.h" | #include "libavutil/opt.h" | ||||
@@ -923,7 +924,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) | |||||
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 != SAMPLE_FMT_NONE) { | ||||
snprintf(buf + strlen(buf), buf_size - strlen(buf), | snprintf(buf + strlen(buf), buf_size - strlen(buf), | ||||
", %s", avcodec_get_sample_fmt_name(enc->sample_fmt)); | |||||
", %s", av_get_sample_fmt_name(enc->sample_fmt)); | |||||
} | } | ||||
break; | break; | ||||
case AVMEDIA_TYPE_DATA: | case AVMEDIA_TYPE_DATA: | ||||
@@ -20,6 +20,7 @@ | |||||
*/ | */ | ||||
#include "libavcore/imgutils.h" | #include "libavcore/imgutils.h" | ||||
#include "libavcore/samplefmt.h" | |||||
#include "libavcodec/audioconvert.h" | #include "libavcodec/audioconvert.h" | ||||
#include "avfilter.h" | #include "avfilter.h" | ||||
@@ -109,7 +110,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per | |||||
samples->refcount = 1; | samples->refcount = 1; | ||||
samples->free = avfilter_default_free_buffer; | samples->free = avfilter_default_free_buffer; | ||||
sample_size = av_get_bits_per_sample_format(sample_fmt) >>3; | |||||
sample_size = av_get_bits_per_sample_fmt(sample_fmt) >>3; | |||||
chans_nb = avcodec_channel_layout_num_channels(channel_layout); | chans_nb = avcodec_channel_layout_num_channels(channel_layout); | ||||
per_channel_size = size/chans_nb; | per_channel_size = size/chans_nb; | ||||
@@ -26,6 +26,7 @@ | |||||
#include "avc.h" | #include "avc.h" | ||||
#include "flacenc.h" | #include "flacenc.h" | ||||
#include "avlanguage.h" | #include "avlanguage.h" | ||||
#include "libavcore/samplefmt.h" | |||||
#include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||
#include "libavutil/random_seed.h" | #include "libavutil/random_seed.h" | ||||
#include "libavutil/lfg.h" | #include "libavutil/lfg.h" | ||||
@@ -540,7 +541,7 @@ static int mkv_write_tracks(AVFormatContext *s) | |||||
AVMetadataTag *tag; | AVMetadataTag *tag; | ||||
if (!bit_depth) | if (!bit_depth) | ||||
bit_depth = av_get_bits_per_sample_format(codec->sample_fmt); | |||||
bit_depth = av_get_bits_per_sample_fmt(codec->sample_fmt); | |||||
if (codec->codec_id == CODEC_ID_AAC) | if (codec->codec_id == CODEC_ID_AAC) | ||||
get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate); | get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate); | ||||