Commit dd1c8f3e authored by Luca Abeni's avatar Luca Abeni Committed by Michael Niedermayer
Browse files

Bump Major version, this commit is almost just renaming bits_per_sample to

bits_per_coded_sample but that cannot be done seperately.
Patch by Luca Abeni
Also reset the minor version and fix the forgotton change to libfaad.
Note: The API/ABI should not be considered stable yet, there still may
be a change done here or there if some developer has some cleanup ideas and
patches!

Originally committed as revision 15262 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 71375e05
......@@ -160,7 +160,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 1;
}
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 8:
avctx->pix_fmt = PIX_FMT_PAL8;
c->planes = 1;
......@@ -193,7 +193,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
#endif
break;
default:
av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_sample);
av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_coded_sample);
return -1;
}
......
......@@ -597,7 +597,7 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
alac->context_initialized = 0;
alac->numchannels = alac->avctx->channels;
alac->bytespersample = (avctx->bits_per_sample / 8) * alac->numchannels;
alac->bytespersample = (avctx->bits_per_coded_sample / 8) * alac->numchannels;
avctx->sample_fmt = SAMPLE_FMT_S16;
return 0;
......
......@@ -364,7 +364,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
uint8_t *alac_extradata = av_mallocz(ALAC_EXTRADATA_SIZE+1);
avctx->frame_size = DEFAULT_FRAME_SIZE;
avctx->bits_per_sample = DEFAULT_SAMPLE_SIZE;
avctx->bits_per_coded_sample = DEFAULT_SAMPLE_SIZE;
if(avctx->sample_fmt != SAMPLE_FMT_S16) {
av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n");
......@@ -384,17 +384,17 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
s->rc.rice_modifier = 4;
s->max_coded_frame_size = (ALAC_FRAME_HEADER_SIZE + ALAC_FRAME_FOOTER_SIZE +
avctx->frame_size*avctx->channels*avctx->bits_per_sample)>>3;
avctx->frame_size*avctx->channels*avctx->bits_per_coded_sample)>>3;
s->write_sample_size = avctx->bits_per_sample + avctx->channels - 1; // FIXME: consider wasted_bytes
s->write_sample_size = avctx->bits_per_coded_sample + avctx->channels - 1; // FIXME: consider wasted_bytes
AV_WB32(alac_extradata, ALAC_EXTRADATA_SIZE);
AV_WB32(alac_extradata+4, MKBETAG('a','l','a','c'));
AV_WB32(alac_extradata+12, avctx->frame_size);
AV_WB8 (alac_extradata+17, avctx->bits_per_sample);
AV_WB8 (alac_extradata+17, avctx->bits_per_coded_sample);
AV_WB8 (alac_extradata+21, avctx->channels);
AV_WB32(alac_extradata+24, s->max_coded_frame_size);
AV_WB32(alac_extradata+28, avctx->sample_rate*avctx->channels*avctx->bits_per_sample); // average bitrate
AV_WB32(alac_extradata+28, avctx->sample_rate*avctx->channels*avctx->bits_per_coded_sample); // average bitrate
AV_WB32(alac_extradata+32, avctx->sample_rate);
// Set relevant extradata fields
......
......@@ -171,7 +171,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n");
return -1;
}
if (avctx->bits_per_sample != 16) {
if (avctx->bits_per_coded_sample != 16) {
av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n");
return -1;
}
......
......@@ -29,8 +29,8 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 51
#define LIBAVCODEC_VERSION_MINOR 71
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 0
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -395,7 +395,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
s->sega_film_skip_bytes = -1; /* uninitialized state */
// check for paletted data
if ((avctx->palctrl == NULL) || (avctx->bits_per_sample == 40)) {
if ((avctx->palctrl == NULL) || (avctx->bits_per_coded_sample == 40)) {
s->palette_video = 0;
avctx->pix_fmt = PIX_FMT_YUV420P;
} else {
......
......@@ -217,19 +217,19 @@ static av_cold int decode_init(AVCodecContext *avctx) {
if (avcodec_check_dimensions(avctx, avctx->height, avctx->width) < 0) {
return 1;
}
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
case 24: avctx->pix_fmt = PIX_FMT_BGR24; break;
case 32: avctx->pix_fmt = PIX_FMT_RGB32; break;
default:
av_log(avctx, AV_LOG_ERROR,
"CamStudio codec error: invalid depth %i bpp\n",
avctx->bits_per_sample);
avctx->bits_per_coded_sample);
return 1;
}
c->bpp = avctx->bits_per_sample;
c->bpp = avctx->bits_per_coded_sample;
c->pic.data[0] = NULL;
c->linelen = avctx->width * avctx->bits_per_sample / 8;
c->linelen = avctx->width * avctx->bits_per_coded_sample / 8;
c->height = avctx->height;
c->decomp_size = c->height * c->linelen;
c->decomp_buf = av_malloc(c->decomp_size + LZO_OUTPUT_PADDING);
......
......@@ -492,7 +492,7 @@ s->bgr32=1;
//if(avctx->extradata)
// printf("extradata:%X, extradata_size:%d\n", *(uint32_t*)avctx->extradata, avctx->extradata_size);
if(avctx->extradata_size){
if((avctx->bits_per_sample&7) && avctx->bits_per_sample != 12)
if((avctx->bits_per_coded_sample&7) && avctx->bits_per_coded_sample != 12)
s->version=1; // do such files exist at all?
else
s->version=2;
......@@ -507,7 +507,7 @@ s->bgr32=1;
s->predictor= method&63;
s->bitstream_bpp= ((uint8_t*)avctx->extradata)[1];
if(s->bitstream_bpp==0)
s->bitstream_bpp= avctx->bits_per_sample&~7;
s->bitstream_bpp= avctx->bits_per_coded_sample&~7;
interlace= (((uint8_t*)avctx->extradata)[2] & 0x30) >> 4;
s->interlaced= (interlace==1) ? 1 : (interlace==2) ? 0 : s->interlaced;
s->context= ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0;
......@@ -515,7 +515,7 @@ s->bgr32=1;
if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size) < 0)
return -1;
}else{
switch(avctx->bits_per_sample&7){
switch(avctx->bits_per_coded_sample&7){
case 1:
s->predictor= LEFT;
s->decorrelate= 0;
......@@ -526,7 +526,7 @@ s->bgr32=1;
break;
case 3:
s->predictor= PLANE;
s->decorrelate= avctx->bits_per_sample >= 24;
s->decorrelate= avctx->bits_per_coded_sample >= 24;
break;
case 4:
s->predictor= MEDIAN;
......@@ -537,7 +537,7 @@ s->bgr32=1;
s->decorrelate= 0;
break;
}
s->bitstream_bpp= avctx->bits_per_sample & ~7;
s->bitstream_bpp= avctx->bits_per_coded_sample & ~7;
s->context= 0;
if(read_old_huffman_tables(s) < 0)
......@@ -569,7 +569,7 @@ s->bgr32=1;
alloc_temp(s);
// av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_sample, s->interlaced);
// av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);
return 0;
}
......@@ -626,7 +626,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
avctx->bits_per_sample= s->bitstream_bpp;
avctx->bits_per_coded_sample= s->bitstream_bpp;
s->decorrelate= s->bitstream_bpp >= 24;
s->predictor= avctx->prediction_method;
s->interlaced= avctx->flags&CODEC_FLAG_INTERLACED_ME ? 1 : 0;
......@@ -717,7 +717,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->stats[i][j]= 0;
}
// printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_sample, s->interlaced);
// printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);
alloc_temp(s);
......
......@@ -53,7 +53,7 @@ struct SwsContext {
enum PixelFormat src_pix_fmt, dst_pix_fmt;
};
struct ImgReSampleContext {
typedef struct ImgReSampleContext {
int iwidth, iheight, owidth, oheight;
int topBand, bottomBand, leftBand, rightBand;
int padtop, padbottom, padleft, padright;
......@@ -62,7 +62,7 @@ struct ImgReSampleContext {
DECLARE_ALIGNED_8(int16_t, h_filters[NB_PHASES][NB_TAPS]); /* horizontal filters */
DECLARE_ALIGNED_8(int16_t, v_filters[NB_PHASES][NB_TAPS]); /* vertical filters */
uint8_t *line_buf;
};
} ImgReSampleContext;
void av_build_filter(int16_t *filter, double factor, int tap_count, int phase_count, int scale, int type);
......@@ -424,13 +424,6 @@ static void component_resample(ImgReSampleContext *s,
}
}
ImgReSampleContext *img_resample_init(int owidth, int oheight,
int iwidth, int iheight)
{
return img_resample_full_init(owidth, oheight, iwidth, iheight,
0, 0, 0, 0, 0, 0, 0, 0);
}
ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
int iwidth, int iheight,
int topBand, int bottomBand,
......@@ -484,6 +477,13 @@ fail:
return NULL;
}
ImgReSampleContext *img_resample_init(int owidth, int oheight,
int iwidth, int iheight)
{
return img_resample_full_init(owidth, oheight, iwidth, iheight,
0, 0, 0, 0, 0, 0, 0, 0);
}
void img_resample(ImgReSampleContext *s,
AVPicture *output, const AVPicture *input)
{
......
......@@ -164,7 +164,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
case PIX_FMT_BGR24:
c->imgtype = IMGTYPE_RGB24;
c->decomp_size = avctx->width * avctx->height * 3;
avctx->bits_per_sample= 24;
avctx->bits_per_coded_sample= 24;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Input pixel format %s not supported\n", avcodec_get_pix_fmt_name(avctx->pix_fmt));
......
......@@ -279,8 +279,8 @@ static av_cold int faac_decode_init(AVCodecContext *avctx)
faac_cfg = s->faacDecGetCurrentConfiguration(s->faac_handle);
if (faac_cfg) {
switch (avctx->bits_per_sample) {
case 8: av_log(avctx, AV_LOG_ERROR, "FAADlib unsupported bps %d\n", avctx->bits_per_sample); break;
switch (avctx->bits_per_coded_sample) {
case 8: av_log(avctx, AV_LOG_ERROR, "FAADlib unsupported bps %d\n", avctx->bits_per_coded_sample); break;
default:
case 16:
#ifdef FAAD2_VERSION
......
......@@ -264,7 +264,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
return -1;
}
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 8:
msrle_decode_pal8(s);
break;
......@@ -273,7 +273,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
break;
default:
av_log(avctx, AV_LOG_ERROR, "Don't know how to decode depth %u.\n",
avctx->bits_per_sample);
avctx->bits_per_coded_sample);
}
*data_size = sizeof(AVFrame);
......
......@@ -118,8 +118,8 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx)
break;
}
avctx->bits_per_sample = av_get_bits_per_sample(avctx->codec->id);
avctx->block_align = avctx->channels * avctx->bits_per_sample/8;
avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
avctx->coded_frame= avcodec_alloc_frame();
avctx->coded_frame->key_frame= 1;
......@@ -354,7 +354,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
/* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
if (CODEC_ID_PCM_DVD == avctx->codec_id)
/* 2 samples are interleaved per block in PCM_DVD */
sample_size = avctx->bits_per_sample * 2 / 8;
sample_size = avctx->bits_per_coded_sample * 2 / 8;
n = avctx->channels * sample_size;
......@@ -470,7 +470,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
case CODEC_ID_PCM_DVD:
dst_int32_t = data;
n /= avctx->channels;
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 20:
while (n--) {
c = avctx->channels;
......
......@@ -383,7 +383,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
QtrleContext *s = avctx->priv_data;
s->avctx = avctx;
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 1:
case 33:
avctx->pix_fmt = PIX_FMT_MONOWHITE;
......@@ -412,7 +412,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
default:
av_log (avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
avctx->bits_per_sample);
avctx->bits_per_coded_sample);
break;
}
......@@ -466,7 +466,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
}
row_ptr = s->frame.linesize[0] * start_line;
switch (avctx->bits_per_sample) {
switch (avctx->bits_per_coded_sample) {
case 1:
case 33:
qtrle_decode_1bpp(s, stream_ptr, row_ptr, height);
......@@ -504,7 +504,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
default:
av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
avctx->bits_per_sample);
avctx->bits_per_coded_sample);
break;
}
......
......@@ -78,7 +78,7 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Unsupported colorspace.\n");
break;
}
avctx->bits_per_sample = s->pixel_size*8;
avctx->bits_per_coded_sample = s->pixel_size*8;
s->rlecode_table = av_mallocz(s->avctx->width);
s->skip_table = av_mallocz(s->avctx->width);
......
......@@ -69,11 +69,11 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
RawVideoContext *context = avctx->priv_data;
if (avctx->codec_tag == MKTAG('r','a','w',' '))
avctx->pix_fmt = findPixelFormat(pixelFormatBpsMOV, avctx->bits_per_sample);
avctx->pix_fmt = findPixelFormat(pixelFormatBpsMOV, avctx->bits_per_coded_sample);
else if (avctx->codec_tag)
avctx->pix_fmt = findPixelFormat(ff_raw_pixelFormatTags, avctx->codec_tag);
else if (avctx->bits_per_sample)
avctx->pix_fmt = findPixelFormat(pixelFormatBpsAVI, avctx->bits_per_sample);
else if (avctx->bits_per_coded_sample)
avctx->pix_fmt = findPixelFormat(pixelFormatBpsAVI, avctx->bits_per_coded_sample);
context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
context->buffer = av_malloc(context->length);
......@@ -89,7 +89,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
}
static void flip(AVCodecContext *avctx, AVPicture * picture){
if(!avctx->codec_tag && avctx->bits_per_sample && picture->linesize[2]==0){
if(!avctx->codec_tag && avctx->bits_per_coded_sample && picture->linesize[2]==0){
picture->data[0] += picture->linesize[0] * (avctx->height-1);
picture->linesize[0] *= -1;
}
......@@ -108,7 +108,7 @@ static int raw_decode(AVCodecContext *avctx,
frame->top_field_first = avctx->coded_frame->top_field_first;
//4bpp raw in avi and mov (yes this is ugly ...)
if(avctx->bits_per_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 &&
if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 &&
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
int i;
for(i=256*2; i+1 < context->length>>1; i++){
......
......@@ -228,9 +228,9 @@ static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header
avctx->sample_rate = get_le32(&hb);
avctx->bit_rate = get_le32(&hb) * 8;
avctx->block_align = get_le16(&hb);
avctx->bits_per_sample = get_le16(&hb);
avctx->bits_per_coded_sample = get_le16(&hb);
if (avctx->bits_per_sample != 16) {
if (avctx->bits_per_coded_sample != 16) {
av_log(avctx, AV_LOG_ERROR, "unsupported number of bits per sample\n");
return -1;
}
......
......@@ -274,17 +274,17 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled.\n");
return 1;
#endif
switch(avctx->bits_per_sample){
switch(avctx->bits_per_coded_sample){
case 8: avctx->pix_fmt = PIX_FMT_PAL8; break;
case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
case 24:
avctx->pix_fmt = PIX_FMT_BGR24;
break;
case 32: avctx->pix_fmt = PIX_FMT_RGB32; break;
default: av_log(avctx, AV_LOG_ERROR, "Camtasia error: unknown depth %i bpp\n", avctx->bits_per_sample);
default: av_log(avctx, AV_LOG_ERROR, "Camtasia error: unknown depth %i bpp\n", avctx->bits_per_coded_sample);
return -1;
}
c->bpp = avctx->bits_per_sample;
c->bpp = avctx->bits_per_coded_sample;
c->decomp_size = (avctx->width * c->bpp + (avctx->width + 254) / 255 + 2) * avctx->height + 2;//RLE in the 'best' case
/* Allocate decompression buffer */
......
......@@ -226,8 +226,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
}
s->is_float = (s->flags == FORMAT_FLOAT);
avctx->channels = s->channels = get_bits(&s->gb, 16);
avctx->bits_per_sample = get_bits(&s->gb, 16);
s->bps = (avctx->bits_per_sample + 7) / 8;
avctx->bits_per_coded_sample = get_bits(&s->gb, 16);
s->bps = (avctx->bits_per_coded_sample + 7) / 8;
avctx->sample_rate = get_bits_long(&s->gb, 32);
if(avctx->sample_rate > 1000000){ //prevent FRAME_TIME * avctx->sample_rate from overflowing and sanity check
av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
......@@ -261,7 +261,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
(s->last_frame_length ? 1 : 0);
av_log(s->avctx, AV_LOG_DEBUG, "flags: %x chans: %d bps: %d rate: %d block: %d\n",
s->flags, avctx->channels, avctx->bits_per_sample, avctx->sample_rate,
s->flags, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate,
avctx->block_align);
av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
s->data_length, s->frame_length, s->last_frame_length, s->total_frames);
......
......@@ -544,7 +544,6 @@ static const AVOption options[]={
{"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
{"p_mask", "inter masking", OFFSET(p_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
{"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
{"unused", NULL, OFFSET(unused), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
{"idct", "select IDCT implementation", OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E|D, "idct"},
{"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_AUTO, INT_MIN, INT_MAX, V|E|D, "idct"},
{"int", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_INT, INT_MIN, INT_MAX, V|E|D, "idct"},
......
......@@ -444,7 +444,7 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->channels = avctx->channels;
s->bits = avctx->bits_per_sample;
s->bits = avctx->bits_per_coded_sample;
s->block_align = avctx->block_align;
avctx->sample_fmt = SAMPLE_FMT_S16;
......
......@@ -469,7 +469,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
return 1;
}
c->bpp = avctx->bits_per_sample;
c->bpp = avctx->bits_per_coded_sample;
c->bpp2 = c->bpp/8;
switch(c->bpp){
......
......@@ -603,7 +603,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
return 1;
}
c->bpp = avctx->bits_per_sample;
c->bpp = avctx->bits_per_coded_sample;
// Needed if zlib unused or init aborted before inflateInit
memset(&(c->zstream), 0, sizeof(z_stream));
......
......@@ -193,13 +193,13 @@ static int fourxm_read_header(AVFormatContext *s,
st->codec->codec_tag = 0;
st->codec->channels = fourxm->tracks[current_track].channels;
st->codec->sample_rate = fourxm->tracks[current_track].sample_rate;
st->codec->bits_per_sample = fourxm->tracks[current_track].bits;
st->codec->bits_per_coded_sample = fourxm->tracks[current_track].bits;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_sample;
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
st->codec->bits_per_coded_sample;
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
if (fourxm->tracks[current_track].adpcm)
st->codec->codec_id = CODEC_ID_ADPCM_4XM;
else if (st->codec->bits_per_sample == 8)
else if (st->codec->bits_per_coded_sample == 8)
st->codec->codec_id = CODEC_ID_PCM_U8;
else
st->codec->codec_id = CODEC_ID_PCM_S16LE;
......
......@@ -112,7 +112,7 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
codec->codec_type = CODEC_TYPE_AUDIO;
codec->channels = get_be16(pb);
num_frames = get_be32(pb);
codec->bits_per_sample = get_be16(pb);
codec->bits_per_coded_sample = get_be16(pb);
get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */
......@@ -126,8 +126,8 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
switch (codec->codec_id) {
case CODEC_ID_PCM_S16BE:
codec->codec_id = aiff_codec_get_id(codec->bits_per_sample);
codec->bits_per_sample = av_get_bits_per_sample(codec->codec_id);
codec->codec_id = aiff_codec_get_id(codec->bits_per_coded_sample);
codec->bits_per_coded_sample = av_get_bits_per_sample(codec->codec_id);
break;
case CODEC_ID_ADPCM_IMA_QT:
codec->block_align = 34*codec->channels;
......@@ -151,14 +151,14 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
size -= 4;
} else {
/* Need the codec type */
codec->codec_id = aiff_codec_get_id(codec->bits_per_sample);
codec->bits_per_sample = av_get_bits_per_sample(codec->codec_id);
codec->codec_id = aiff_codec_get_id(codec->bits_per_coded_sample);
codec->bits_per_coded_sample = av_get_bits_per_sample(codec->codec_id);
}
/* Block align needs to be computed in all cases, as the definition
* is specific to applications -> here we use the WAVE format definition */
if (!codec->block_align)
codec->block_align = (codec->bits_per_sample * codec->channels) >> 3;
codec->block_align = (codec->bits_per_coded_sample * codec->channels) >> 3;
codec->bit_rate = (codec->frame_size ? codec->sample_rate/codec->frame_size :
codec->sample_rate) * (codec->block_align << 3);
......@@ -198,7 +198,7 @@ static int aiff_write_header(AVFormatContext *s)
put_tag(pb, aifc ? "AIFC" : "AIFF");
if (aifc) { // compressed audio
enc->bits_per_sample = 16;
enc->bits_per_coded_sample = 16;
if (!enc->block_align) {
av_log(s, AV_LOG_ERROR, "block align not set\n");
return -1;
......@@ -217,16 +217,16 @@ static int aiff_write_header(AVFormatContext *s)
aiff->frames = url_ftell(pb);
put_be32(pb, 0); /* Number of frames */
if (!enc->bits_per_sample)
enc->bits_per_sample = av_get_bits_per_sample(enc->codec_id);
if (!enc->bits_per_sample) {
if (!enc->bits_per_coded_sample)
enc->bits_per_coded_sample = av_get_bits_per_sample(enc->codec_id);
if (!enc->bits_per_coded_sample) {
av_log(s, AV_LOG_ERROR, "could not compute bits per sample\n");
return -1;
}
if (!enc->block_align)
enc->block_align = (enc->bits_per_sample * enc->channels) >> 3;
enc->block_align = (enc->bits_per_coded_sample * enc->channels) >> 3;
put_be16(pb, enc->bits_per_sample); /* Sample size */
put_be16(pb, enc->bits_per_coded_sample); /* Sample size */
sample_rate = av_dbl2ext((double)enc->sample_rate);
put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
......
......@@ -62,8 +62,8 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (get_le32(pb))
st->codec->channels = 2;
st->codec->bits_per_sample = 4;
st->codec->bit_rate = st->codec->bits_per_sample * st->codec->channels
st->codec->bits_per_coded_sample = 4;
st->codec->bit_rate = st->codec->bits_per_coded_sample * st->codec->channels
* st->codec->sample_rate;
st->codec->block_align = 1;
......
......@@ -424,7 +424,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
st->codec->codec_tag = MKTAG('A', 'P', 'E', ' ');
st->codec->channels = ape->channels;
st->codec->sample_rate = ape->