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
This commit is contained in:
parent
71375e0500
commit
dd1c8f3e6e
@ -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->samplerate;
|
||||
st->codec->bits_per_sample = ape->bps;
|
||||
st->codec->bits_per_coded_sample = ape->bps;
|
||||
st->codec->frame_size = MAC_SUBFRAME_SIZE;
|
||||
|
||||
st->nb_frames = ape->totalframes;
|
||||
|
@ -315,7 +315,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->height = get_le32(pb);
|
||||
/* not available for asf */
|
||||
get_le16(pb); /* panes */
|
||||
st->codec->bits_per_sample = get_le16(pb); /* depth */
|
||||
st->codec->bits_per_coded_sample = get_le16(pb); /* depth */
|
||||
tag1 = get_le32(pb);
|
||||
url_fskip(pb, 20);
|
||||
// av_log(NULL, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
|
||||
@ -329,7 +329,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
/* Extract palette from extradata if bpp <= 8 */
|
||||
/* This code assumes that extradata contains only palette */
|
||||
/* This is true for all paletted codecs implemented in ffmpeg */
|
||||
if (st->codec->extradata_size && (st->codec->bits_per_sample <= 8)) {
|
||||
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
|
||||
st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
|
||||
|
@ -445,7 +445,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->width = get_le32(pb);
|
||||
st->codec->height = get_le32(pb);
|
||||
get_le16(pb); /* panes */
|
||||
st->codec->bits_per_sample= get_le16(pb); /* depth */
|
||||
st->codec->bits_per_coded_sample= get_le16(pb); /* depth */
|
||||
tag1 = get_le32(pb);
|
||||
get_le32(pb); /* ImageSize */
|
||||
get_le32(pb); /* XPelsPerMeter */
|
||||
@ -472,7 +472,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
/* Extract palette from extradata if bpp <= 8. */
|
||||
/* This code assumes that extradata contains only palette. */
|
||||
/* This is true for all paletted codecs implemented in FFmpeg. */
|
||||
if (st->codec->extradata_size && (st->codec->bits_per_sample <= 8)) {
|
||||
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
|
||||
st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
|
||||
|
@ -182,7 +182,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
|
||||
avs->st_video->codec->codec_id = CODEC_ID_AVS;
|
||||
avs->st_video->codec->width = avs->width;
|
||||
avs->st_video->codec->height = avs->height;
|
||||
avs->st_video->codec->bits_per_sample=avs->bits_per_sample;
|
||||
avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample;
|
||||
avs->st_video->nb_frames = avs->nb_frames;
|
||||
avs->st_video->codec->time_base = (AVRational) {
|
||||
1, avs->fps};
|
||||
|
@ -89,8 +89,8 @@ static int vid_read_header(AVFormatContext *s,
|
||||
stream->codec->codec_id = CODEC_ID_PCM_U8;
|
||||
stream->codec->channels = 1;
|
||||
stream->codec->sample_rate = 11025;
|
||||
stream->codec->bits_per_sample = 8;
|
||||
stream->codec->bit_rate = stream->codec->channels * stream->codec->sample_rate * stream->codec->bits_per_sample;
|
||||
stream->codec->bits_per_coded_sample = 8;
|
||||
stream->codec->bit_rate = stream->codec->channels * stream->codec->sample_rate * stream->codec->bits_per_coded_sample;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -197,7 +197,7 @@ static int vid_read_packet(AVFormatContext *s,
|
||||
get_le16(pb);
|
||||
// soundblaster DAC used for sample rate, as on specification page (link above)
|
||||
s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb));
|
||||
s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_sample;
|
||||
s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
|
||||
case AUDIO_BLOCK:
|
||||
audio_length = get_le16(pb);
|
||||
ret_value = av_get_packet(pb, pkt, audio_length);
|
||||
|
@ -94,9 +94,9 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
|
||||
astream->codec->codec_type = CODEC_TYPE_AUDIO;
|
||||
astream->codec->codec_id = CODEC_ID_PCM_U8;
|
||||
astream->codec->channels = 1;
|
||||
astream->codec->bits_per_sample = 8;
|
||||
astream->codec->bits_per_coded_sample = 8;
|
||||
astream->codec->bit_rate =
|
||||
astream->codec->sample_rate * astream->codec->bits_per_sample;
|
||||
astream->codec->sample_rate * astream->codec->bits_per_coded_sample;
|
||||
url_fseek(pb, chunk_header - 3, SEEK_SET);
|
||||
av_set_pts_info(astream, 64, 1, astream->codec->sample_rate);
|
||||
return 0;
|
||||
|
@ -31,7 +31,7 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
|
||||
st->codec->sample_rate = 96000;
|
||||
st->codec->bit_rate = 3 * 6 * 96000 * 8;
|
||||
st->codec->block_align = 3 * 6;
|
||||
st->codec->bits_per_sample = 24;
|
||||
st->codec->bits_per_coded_sample = 24;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -130,9 +130,9 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->codec_tag = 0; /* no tag */
|
||||
st->codec->channels = 1;
|
||||
st->codec->sample_rate = 22050;
|
||||
st->codec->bits_per_sample = 16;
|
||||
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_sample * st->codec->channels;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample = 16;
|
||||
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -411,10 +411,10 @@ static int ea_read_header(AVFormatContext *s,
|
||||
st->codec->codec_tag = 0; /* no tag */
|
||||
st->codec->channels = ea->num_channels;
|
||||
st->codec->sample_rate = ea->sample_rate;
|
||||
st->codec->bits_per_sample = ea->bytes * 8;
|
||||
st->codec->bits_per_coded_sample = ea->bytes * 8;
|
||||
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
|
||||
st->codec->bits_per_sample / 4;
|
||||
st->codec->block_align = st->codec->channels*st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample / 4;
|
||||
st->codec->block_align = st->codec->channels*st->codec->bits_per_coded_sample;
|
||||
ea->audio_stream_index = st->index;
|
||||
ea->audio_frame_counter = 0;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, int flv_c
|
||||
switch(flv_codecid) {
|
||||
//no distinction between S16 and S8 PCM codec flags
|
||||
case FLV_CODECID_PCM:
|
||||
acodec->codec_id = acodec->bits_per_sample == 8 ? CODEC_ID_PCM_S8 :
|
||||
acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_S8 :
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
CODEC_ID_PCM_S16BE;
|
||||
#else
|
||||
@ -50,7 +50,7 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, int flv_c
|
||||
#endif
|
||||
break;
|
||||
case FLV_CODECID_PCM_LE:
|
||||
acodec->codec_id = acodec->bits_per_sample == 8 ? CODEC_ID_PCM_S8 : CODEC_ID_PCM_S16LE; break;
|
||||
acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_S8 : CODEC_ID_PCM_S16LE; break;
|
||||
case FLV_CODECID_AAC : acodec->codec_id = CODEC_ID_AAC; break;
|
||||
case FLV_CODECID_ADPCM: acodec->codec_id = CODEC_ID_ADPCM_SWF; break;
|
||||
case FLV_CODECID_SPEEX: acodec->codec_id = CODEC_ID_SPEEX; break;
|
||||
@ -185,7 +185,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
|
||||
else if(!strcmp(key, "videocodecid") && vcodec && 0 <= (int)num_val)
|
||||
flv_set_video_codec(s, vstream, (int)num_val);
|
||||
else if(!strcmp(key, "audiosamplesize") && acodec && 0 < (int)num_val) {
|
||||
acodec->bits_per_sample = num_val;
|
||||
acodec->bits_per_coded_sample = num_val;
|
||||
//we may have to rewrite a previously read codecid because FLV only marks PCM endianness.
|
||||
if(num_val == 8 && (acodec->codec_id == CODEC_ID_PCM_S16BE || acodec->codec_id == CODEC_ID_PCM_S16LE))
|
||||
acodec->codec_id = CODEC_ID_PCM_S8;
|
||||
@ -382,13 +382,13 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
|
||||
if(is_audio){
|
||||
if(!st->codec->sample_rate || !st->codec->bits_per_sample || (!st->codec->codec_id && !st->codec->codec_tag)) {
|
||||
if(!st->codec->sample_rate || !st->codec->bits_per_coded_sample || (!st->codec->codec_id && !st->codec->codec_tag)) {
|
||||
st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;
|
||||
if((flags & FLV_AUDIO_CODECID_MASK) == FLV_CODECID_NELLYMOSER_8HZ_MONO)
|
||||
st->codec->sample_rate= 8000;
|
||||
else
|
||||
st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3);
|
||||
st->codec->bits_per_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
|
||||
st->codec->bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
|
||||
flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK);
|
||||
}
|
||||
}else{
|
||||
|
@ -55,7 +55,7 @@ typedef struct FLVContext {
|
||||
} FLVContext;
|
||||
|
||||
static int get_audio_flags(AVCodecContext *enc){
|
||||
int flags = (enc->bits_per_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT;
|
||||
int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT;
|
||||
|
||||
if (enc->codec_id == CODEC_ID_AAC) // specs force these parameters
|
||||
return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO;
|
||||
|
@ -120,7 +120,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
|
||||
st->codec->sample_rate = 48000;
|
||||
st->codec->bit_rate = 3 * 1 * 48000 * 8;
|
||||
st->codec->block_align = 3 * 1;
|
||||
st->codec->bits_per_sample = 24;
|
||||
st->codec->bits_per_coded_sample = 24;
|
||||
break;
|
||||
case 10:
|
||||
st->codec->codec_type = CODEC_TYPE_AUDIO;
|
||||
@ -129,7 +129,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
|
||||
st->codec->sample_rate = 48000;
|
||||
st->codec->bit_rate = 2 * 1 * 48000 * 8;
|
||||
st->codec->block_align = 2 * 1;
|
||||
st->codec->bits_per_sample = 16;
|
||||
st->codec->bits_per_coded_sample = 16;
|
||||
break;
|
||||
case 17:
|
||||
st->codec->codec_type = CODEC_TYPE_AUDIO;
|
||||
|
@ -181,7 +181,7 @@ static int idcin_read_header(AVFormatContext *s,
|
||||
st->codec->codec_tag = 1;
|
||||
st->codec->channels = channels;
|
||||
st->codec->sample_rate = sample_rate;
|
||||
st->codec->bits_per_sample = bytes_per_sample * 8;
|
||||
st->codec->bits_per_coded_sample = bytes_per_sample * 8;
|
||||
st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
|
||||
st->codec->block_align = bytes_per_sample * channels;
|
||||
if (bytes_per_sample == 1)
|
||||
|
@ -161,10 +161,10 @@ static int roq_read_header(AVFormatContext *s,
|
||||
st->codec->codec_tag = 0; /* no tag */
|
||||
st->codec->channels = roq->audio_channels;
|
||||
st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE;
|
||||
st->codec->bits_per_sample = 16;
|
||||
st->codec->bits_per_coded_sample = 16;
|
||||
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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -149,9 +149,9 @@ static int iff_read_header(AVFormatContext *s,
|
||||
return -1;
|
||||
}
|
||||
|
||||
st->codec->bits_per_sample = 8;
|
||||
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 = 8;
|
||||
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_coded_sample;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -574,12 +574,12 @@ static int ipmovie_read_header(AVFormatContext *s,
|
||||
st->codec->codec_tag = 0; /* no tag */
|
||||
st->codec->channels = ipmovie->audio_channels;
|
||||
st->codec->sample_rate = ipmovie->audio_sample_rate;
|
||||
st->codec->bits_per_sample = ipmovie->audio_bits;
|
||||
st->codec->bits_per_coded_sample = ipmovie->audio_bits;
|
||||
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
|
||||
st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample;
|
||||
if (st->codec->codec_id == CODEC_ID_INTERPLAY_DPCM)
|
||||
st->codec->bit_rate /= 2;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -248,8 +248,8 @@ static int mmf_read_header(AVFormatContext *s,
|
||||
st->codec->codec_id = CODEC_ID_ADPCM_YAMAHA;
|
||||
st->codec->sample_rate = rate;
|
||||
st->codec->channels = 1;
|
||||
st->codec->bits_per_sample = 4;
|
||||
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample = 4;
|
||||
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample;
|
||||
|
||||
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
|
||||
|
||||
|
@ -796,13 +796,13 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
|
||||
st->codec->codec_name[codec_name[0]] = 0;
|
||||
}
|
||||
|
||||
st->codec->bits_per_sample = get_be16(pb); /* depth */
|
||||
st->codec->bits_per_coded_sample = get_be16(pb); /* depth */
|
||||
st->codec->color_table_id = get_be16(pb); /* colortable id */
|
||||
dprintf(c->fc, "depth %d, ctab id %d\n",
|
||||
st->codec->bits_per_sample, st->codec->color_table_id);
|
||||
st->codec->bits_per_coded_sample, st->codec->color_table_id);
|
||||
/* figure out the palette situation */
|
||||
color_depth = st->codec->bits_per_sample & 0x1F;
|
||||
color_greyscale = st->codec->bits_per_sample & 0x20;
|
||||
color_depth = st->codec->bits_per_coded_sample & 0x1F;
|
||||
color_greyscale = st->codec->bits_per_coded_sample & 0x20;
|
||||
|
||||
/* if the depth is 2, 4, or 8 bpp, file is palettized */
|
||||
if ((color_depth == 2) || (color_depth == 4) ||
|
||||
@ -814,7 +814,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
|
||||
if (color_greyscale) {
|
||||
int color_index, color_dec;
|
||||
/* compute the greyscale palette */
|
||||
st->codec->bits_per_sample = color_depth;
|
||||
st->codec->bits_per_coded_sample = color_depth;
|
||||
color_count = 1 << color_depth;
|
||||
color_index = 255;
|
||||
color_dec = 256 / (color_count - 1);
|
||||
@ -882,7 +882,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
|
||||
|
||||
st->codec->channels = get_be16(pb); /* channel count */
|
||||
dprintf(c->fc, "audio channels %d\n", st->codec->channels);
|
||||
st->codec->bits_per_sample = get_be16(pb); /* sample size */
|
||||
st->codec->bits_per_coded_sample = get_be16(pb); /* sample size */
|
||||
|
||||
sc->audio_cid = get_be16(pb);
|
||||
get_be16(pb); /* packet size = 0 */
|
||||
@ -902,26 +902,26 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
|
||||
st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */
|
||||
st->codec->channels = get_be32(pb);
|
||||
get_be32(pb); /* always 0x7F000000 */
|
||||
st->codec->bits_per_sample = get_be32(pb); /* bits per channel if sound is uncompressed */
|
||||
st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */
|
||||
flags = get_be32(pb); /* lcpm format specific flag */
|
||||
sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */
|
||||
sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */
|
||||
if (format == MKTAG('l','p','c','m'))
|
||||
st->codec->codec_id = mov_get_lpcm_codec_id(st->codec->bits_per_sample, flags);
|
||||
st->codec->codec_id = mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);
|
||||
}
|
||||
}
|
||||
|
||||
switch (st->codec->codec_id) {
|
||||
case CODEC_ID_PCM_S8:
|
||||
case CODEC_ID_PCM_U8:
|
||||
if (st->codec->bits_per_sample == 16)
|
||||
if (st->codec->bits_per_coded_sample == 16)
|
||||
st->codec->codec_id = CODEC_ID_PCM_S16BE;
|
||||
break;
|
||||
case CODEC_ID_PCM_S16LE:
|
||||
case CODEC_ID_PCM_S16BE:
|
||||
if (st->codec->bits_per_sample == 8)
|
||||
if (st->codec->bits_per_coded_sample == 8)
|
||||
st->codec->codec_id = CODEC_ID_PCM_S8;
|
||||
else if (st->codec->bits_per_sample == 24)
|
||||
else if (st->codec->bits_per_coded_sample == 24)
|
||||
st->codec->codec_id =
|
||||
st->codec->codec_id == CODEC_ID_PCM_S16BE ?
|
||||
CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE;
|
||||
@ -949,7 +949,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
|
||||
|
||||
bits_per_sample = av_get_bits_per_sample(st->codec->codec_id);
|
||||
if (bits_per_sample) {
|
||||
st->codec->bits_per_sample = bits_per_sample;
|
||||
st->codec->bits_per_coded_sample = bits_per_sample;
|
||||
sc->sample_size = (bits_per_sample >> 3) * st->codec->channels;
|
||||
}
|
||||
} else if(st->codec->codec_type==CODEC_TYPE_SUBTITLE){
|
||||
|
@ -684,8 +684,8 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
|
||||
put_byte(pb, strlen(compressor_name));
|
||||
put_buffer(pb, compressor_name, 31);
|
||||
|
||||
if (track->mode == MODE_MOV && track->enc->bits_per_sample)
|
||||
put_be16(pb, track->enc->bits_per_sample);
|
||||
if (track->mode == MODE_MOV && track->enc->bits_per_coded_sample)
|
||||
put_be16(pb, track->enc->bits_per_coded_sample);
|
||||
else
|
||||
put_be16(pb, 0x18); /* Reserved */
|
||||
put_be16(pb, 0xffff); /* Reserved */
|
||||
|
@ -97,7 +97,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->codec_type = CODEC_TYPE_AUDIO;
|
||||
st->codec->codec_id = CODEC_ID_MUSEPACK7;
|
||||
st->codec->channels = 2;
|
||||
st->codec->bits_per_sample = 16;
|
||||
st->codec->bits_per_coded_sample = 16;
|
||||
|
||||
st->codec->extradata_size = 16;
|
||||
st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
@ -182,7 +182,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
return AVERROR(ENOMEM);
|
||||
st->codec->codec_type = CODEC_TYPE_AUDIO;
|
||||
st->codec->codec_id = CODEC_ID_MUSEPACK8;
|
||||
st->codec->bits_per_sample = 16;
|
||||
st->codec->bits_per_coded_sample = 16;
|
||||
|
||||
st->codec->extradata_size = 2;
|
||||
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
@ -520,13 +520,13 @@ static int mpegps_read_packet(AVFormatContext *s,
|
||||
freq = (b1 >> 4) & 3;
|
||||
st->codec->sample_rate = lpcm_freq_tab[freq];
|
||||
st->codec->channels = 1 + (b1 & 7);
|
||||
st->codec->bits_per_sample = 16 + ((b1 >> 6) & 3) * 4;
|
||||
st->codec->bits_per_coded_sample = 16 + ((b1 >> 6) & 3) * 4;
|
||||
st->codec->bit_rate = st->codec->channels *
|
||||
st->codec->sample_rate *
|
||||
st->codec->bits_per_sample;
|
||||
if (st->codec->bits_per_sample == 16)
|
||||
st->codec->bits_per_coded_sample;
|
||||
if (st->codec->bits_per_coded_sample == 16)
|
||||
st->codec->codec_id = CODEC_ID_PCM_S16BE;
|
||||
else if (st->codec->bits_per_sample == 28)
|
||||
else if (st->codec->bits_per_coded_sample == 28)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
av_new_packet(pkt, len);
|
||||
|
@ -102,7 +102,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->codec_tag = MKTAG('R', 'G', 'B', mtv->img_bpp);
|
||||
st->codec->width = mtv->img_width;
|
||||
st->codec->height = mtv->img_height;
|
||||
st->codec->bits_per_sample = mtv->img_bpp;
|
||||
st->codec->bits_per_coded_sample = mtv->img_bpp;
|
||||
st->codec->sample_rate = mtv->video_fps;
|
||||
|
||||
/* audio - mp3 */
|
||||
|
@ -80,7 +80,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
ast->codec->codec_type = CODEC_TYPE_AUDIO;
|
||||
ast->codec->codec_id = CODEC_ID_PCM_U8;
|
||||
ast->codec->channels = 1;
|
||||
ast->codec->bits_per_sample = 8;
|
||||
ast->codec->bits_per_coded_sample = 8;
|
||||
ast->codec->bit_rate = ast->codec->sample_rate * 8;
|
||||
|
||||
av_set_pts_info(vst, 64, msecs_per_frame, 1000000);
|
||||
|
@ -222,7 +222,7 @@ static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pk
|
||||
for (; buf_ptr < end_ptr; ) {
|
||||
for (i = 0; i < st->codec->channels; i++) {
|
||||
uint32_t sample = bytestream_get_le32(&buf_ptr);
|
||||
if (st->codec->bits_per_sample == 24)
|
||||
if (st->codec->bits_per_coded_sample == 24)
|
||||
bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff);
|
||||
else
|
||||
bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff);
|
||||
@ -788,7 +788,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
|
||||
st->codec->codec_id = container_ul->id;
|
||||
st->codec->width = descriptor->width;
|
||||
st->codec->height = descriptor->height;
|
||||
st->codec->bits_per_sample = descriptor->bits_per_sample; /* Uncompressed */
|
||||
st->codec->bits_per_coded_sample = descriptor->bits_per_sample; /* Uncompressed */
|
||||
st->sample_aspect_ratio = descriptor->aspect_ratio;
|
||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||
} else if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
|
||||
@ -796,7 +796,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
|
||||
if (st->codec->codec_id == CODEC_ID_NONE)
|
||||
st->codec->codec_id = container_ul->id;
|
||||
st->codec->channels = descriptor->channels;
|
||||
st->codec->bits_per_sample = descriptor->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample = descriptor->bits_per_sample;
|
||||
st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;
|
||||
/* TODO: implement CODEC_ID_RAWAUDIO */
|
||||
if (st->codec->codec_id == CODEC_ID_PCM_S16LE) {
|
||||
|
@ -588,7 +588,7 @@ static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st)
|
||||
put_be32(pb, st->codec->channels);
|
||||
|
||||
mxf_write_local_tag(pb, 4, 0x3D01);
|
||||
put_be32(pb, st->codec->bits_per_sample);
|
||||
put_be32(pb, st->codec->bits_per_coded_sample);
|
||||
}
|
||||
|
||||
static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type)
|
||||
|
@ -456,7 +456,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->codec_id = codec_get_id(nsv_codec_video_tags, vtag);
|
||||
st->codec->width = vwidth;
|
||||
st->codec->height = vheight;
|
||||
st->codec->bits_per_sample = 24; /* depth XXX */
|
||||
st->codec->bits_per_coded_sample = 24; /* depth XXX */
|
||||
|
||||
av_set_pts_info(st, 64, framerate.den, framerate.num);
|
||||
st->start_time = 0;
|
||||
|
@ -93,11 +93,11 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst,
|
||||
if (ast) {
|
||||
ast->codec->codec_tag = get_le32(pb);
|
||||
ast->codec->sample_rate = get_le32(pb);
|
||||
ast->codec->bits_per_sample = get_le32(pb);
|
||||
ast->codec->bits_per_coded_sample = get_le32(pb);
|
||||
ast->codec->channels = get_le32(pb);
|
||||
ast->codec->codec_id =
|
||||
wav_codec_get_id(ast->codec->codec_tag,
|
||||
ast->codec->bits_per_sample);
|
||||
ast->codec->bits_per_coded_sample);
|
||||
ast->need_parsing = AVSTREAM_PARSE_FULL;
|
||||
} else
|
||||
url_fskip(pb, 4 * 4);
|
||||
@ -157,7 +157,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
|
||||
vst->codec->codec_id = CODEC_ID_NUV;
|
||||
vst->codec->width = width;
|
||||
vst->codec->height = height;
|
||||
vst->codec->bits_per_sample = 10;
|
||||
vst->codec->bits_per_coded_sample = 10;
|
||||
vst->sample_aspect_ratio = av_d2q(aspect * height / width, 10000);
|
||||
vst->r_frame_rate = av_d2q(fps, 60000);
|
||||
av_set_pts_info(vst, 32, 1, 1000);
|
||||
@ -175,7 +175,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
|
||||
ast->codec->sample_rate = 44100;
|
||||
ast->codec->bit_rate = 2 * 2 * 44100 * 8;
|
||||
ast->codec->block_align = 2 * 2;
|
||||
ast->codec->bits_per_sample = 16;
|
||||
ast->codec->bits_per_coded_sample = 16;
|
||||
av_set_pts_info(ast, 32, 1, 1000);
|
||||
} else
|
||||
ctx->a_id = -1;
|
||||
|
@ -251,8 +251,8 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
|
||||
if (!(bps = av_get_bits_per_sample(enc->codec_id)))
|
||||
bps = 16; // default to 16
|
||||
}
|
||||
if(bps != enc->bits_per_sample && enc->bits_per_sample){
|
||||
av_log(enc, AV_LOG_WARNING, "requested bits_per_sample (%d) and actually stored (%d) differ\n", enc->bits_per_sample, bps);
|
||||
if(bps != enc->bits_per_coded_sample && enc->bits_per_coded_sample){
|
||||
av_log(enc, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) and actually stored (%d) differ\n", enc->bits_per_coded_sample, bps);
|
||||
}
|
||||
|
||||
if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_AC3) {
|
||||
@ -327,7 +327,7 @@ void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *ta
|
||||
put_le32(pb, enc->height);
|
||||
put_le16(pb, 1); /* planes */
|
||||
|
||||
put_le16(pb, enc->bits_per_sample ? enc->bits_per_sample : 24); /* depth */
|
||||
put_le16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */
|
||||
/* compression type */
|
||||
put_le32(pb, enc->codec_tag);
|
||||
put_le32(pb, enc->width * enc->height * 3);
|
||||
@ -363,15 +363,15 @@ void get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size)
|
||||
codec->bit_rate = get_le32(pb) * 8;
|
||||
codec->block_align = get_le16(pb);
|
||||
if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */
|
||||
codec->bits_per_sample = 8;
|
||||
codec->bits_per_coded_sample = 8;
|
||||
}else
|
||||
codec->bits_per_sample = get_le16(pb);
|
||||
codec->bits_per_coded_sample = get_le16(pb);
|
||||
if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */
|
||||
int cbSize = get_le16(pb); /* cbSize */
|
||||
size -= 18;
|
||||
cbSize = FFMIN(size, cbSize);
|
||||
if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */
|
||||
codec->bits_per_sample = get_le16(pb);
|
||||
codec->bits_per_coded_sample = get_le16(pb);
|
||||
get_le32(pb); /* dwChannelMask */
|
||||
id = get_le32(pb); /* 4 first bytes of GUID */
|
||||
url_fskip(pb, 12); /* skip end of GUID */
|
||||
@ -389,7 +389,7 @@ void get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size)
|
||||
if (size > 0)
|
||||
url_fskip(pb, size);
|
||||
}
|
||||
codec->codec_id = wav_codec_get_id(id, codec->bits_per_sample);
|
||||
codec->codec_id = wav_codec_get_id(id, codec->bits_per_coded_sample);
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,12 +148,12 @@ static av_cold int rl2_read_header(AVFormatContext *s,
|
||||
st->codec->codec_id = CODEC_ID_PCM_U8;
|
||||
st->codec->codec_tag = 1;
|
||||
st->codec->channels = channels;
|
||||
st->codec->bits_per_sample = 8;
|
||||
st->codec->bits_per_coded_sample = 8;
|
||||
st->codec->sample_rate = rate;
|
||||
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
|
||||
st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample;
|
||||
st->codec->block_align = st->codec->channels *
|
||||
st->codec->bits_per_sample / 8;
|
||||
st->codec->bits_per_coded_sample / 8;
|
||||
av_set_pts_info(st,32,1,rate);
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
vst->codec->codec_tag = read_line_and_int(pb, &error); // video format
|
||||
vst->codec->width = read_line_and_int(pb, &error); // video width
|
||||
vst->codec->height = read_line_and_int(pb, &error); // video height
|
||||
vst->codec->bits_per_sample = read_line_and_int(pb, &error); // video bits per sample
|
||||
vst->codec->bits_per_coded_sample = read_line_and_int(pb, &error); // video bits per sample
|
||||
error |= read_line(pb, line, sizeof(line)); // video frames per second
|
||||
fps = read_fps(line, &error);
|
||||
av_set_pts_info(vst, 32, fps.den, fps.num);
|
||||
@ -157,7 +157,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
case 124:
|
||||
vst->codec->codec_id = CODEC_ID_ESCAPE124;
|
||||
// The header is wrong here, at least sometimes
|
||||
vst->codec->bits_per_sample = 16;
|
||||
vst->codec->bits_per_coded_sample = 16;
|
||||
break;
|
||||
#if 0
|
||||
case 130:
|
||||
@ -184,20 +184,20 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
ast->codec->codec_tag = audio_format;
|
||||
ast->codec->sample_rate = read_line_and_int(pb, &error); // audio bitrate
|
||||
ast->codec->channels = read_line_and_int(pb, &error); // number of audio channels
|
||||
ast->codec->bits_per_sample = read_line_and_int(pb, &error); // audio bits per sample
|
||||
ast->codec->bits_per_coded_sample = read_line_and_int(pb, &error); // audio bits per sample
|
||||
// At least one sample uses 0 for ADPCM, which is really 4 bits
|
||||
// per sample.
|
||||
if (ast->codec->bits_per_sample == 0)
|
||||
ast->codec->bits_per_sample = 4;
|
||||
if (ast->codec->bits_per_coded_sample == 0)
|
||||
ast->codec->bits_per_coded_sample = 4;
|
||||
|
||||
ast->codec->bit_rate = ast->codec->sample_rate *
|
||||
ast->codec->bits_per_sample *
|
||||
ast->codec->bits_per_coded_sample *
|
||||
ast->codec->channels;
|
||||
|
||||
ast->codec->codec_id = CODEC_ID_NONE;
|
||||
switch (audio_format) {
|
||||
case 1:
|
||||
if (ast->codec->bits_per_sample == 16) {
|
||||
if (ast->codec->bits_per_coded_sample == 16) {
|
||||
// 16-bit audio is always signed
|
||||
ast->codec->codec_id = CODEC_ID_PCM_S16LE;
|
||||
break;
|
||||
@ -206,12 +206,12 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
// samples needed.
|
||||
break;
|
||||
case 101:
|
||||
if (ast->codec->bits_per_sample == 8) {
|
||||
if (ast->codec->bits_per_coded_sample == 8) {
|
||||
// The samples with this kind of audio that I have
|
||||
// are all unsigned.
|
||||
ast->codec->codec_id = CODEC_ID_PCM_U8;
|
||||
break;
|
||||
} else if (ast->codec->bits_per_sample == 4) {
|
||||
} else if (ast->codec->bits_per_coded_sample == 4) {
|
||||
ast->codec->codec_id = CODEC_ID_ADPCM_IMA_EA_SEAD;
|
||||
break;
|
||||
}
|
||||
|
@ -148,12 +148,12 @@ static int film_read_header(AVFormatContext *s,
|
||||
st->codec->codec_id = film->audio_type;
|
||||
st->codec->codec_tag = 1;
|
||||
st->codec->channels = film->audio_channels;
|
||||
st->codec->bits_per_sample = film->audio_bits;
|
||||
st->codec->bits_per_coded_sample = film->audio_bits;
|
||||
st->codec->sample_rate = film->audio_samplerate;
|
||||
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
|
||||
st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample;
|
||||
st->codec->block_align = st->codec->channels *
|
||||
st->codec->bits_per_sample / 8;
|
||||
st->codec->bits_per_coded_sample / 8;
|
||||
}
|
||||
|
||||
/* load the sample table */
|
||||
|
@ -120,13 +120,13 @@ static int vmd_read_header(AVFormatContext *s,
|
||||
st->codec->sample_rate = vmd->sample_rate;
|
||||
st->codec->block_align = AV_RL16(&vmd->vmd_header[806]);
|
||||
if (st->codec->block_align & 0x8000) {
|
||||
st->codec->bits_per_sample = 16;
|
||||
st->codec->bits_per_coded_sample = 16;
|
||||
st->codec->block_align = -(st->codec->block_align - 0x10000);
|
||||
} else {
|
||||
st->codec->bits_per_sample = 8;
|
||||
st->codec->bits_per_coded_sample = 8;
|
||||
}
|
||||
st->codec->bit_rate = st->codec->sample_rate *
|
||||
st->codec->bits_per_sample * st->codec->channels;
|
||||
st->codec->bits_per_coded_sample * st->codec->channels;
|
||||
|
||||
/* calculate pts */
|
||||
num = st->codec->block_align;
|
||||
|
@ -75,7 +75,7 @@ static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
|
||||
ast->codec->codec_type = CODEC_TYPE_AUDIO;
|
||||
ast->codec->codec_id = CODEC_ID_PCM_U8;
|
||||
ast->codec->channels = 1;
|
||||
ast->codec->bits_per_sample = c->bits;
|
||||
ast->codec->bits_per_coded_sample = c->bits;
|
||||
ast->codec->sample_rate = c->rate;
|
||||
ast->codec->frame_size = c->block_align;
|
||||
av_set_pts_info(ast, 16, 1, c->rate);
|
||||
|
@ -179,11 +179,11 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
ast[i]->codec->codec_tag = MKTAG('S', 'M', 'K', 'A');
|
||||
ast[i]->codec->channels = (smk->rates[i] & SMK_AUD_STEREO) ? 2 : 1;
|
||||
ast[i]->codec->sample_rate = smk->rates[i] & 0xFFFFFF;
|
||||
ast[i]->codec->bits_per_sample = (smk->rates[i] & SMK_AUD_16BITS) ? 16 : 8;
|
||||
if(ast[i]->codec->bits_per_sample == 16 && ast[i]->codec->codec_id == CODEC_ID_PCM_U8)
|
||||
ast[i]->codec->bits_per_coded_sample = (smk->rates[i] & SMK_AUD_16BITS) ? 16 : 8;
|
||||
if(ast[i]->codec->bits_per_coded_sample == 16 && ast[i]->codec->codec_id == CODEC_ID_PCM_U8)
|
||||
ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE;
|
||||
av_set_pts_info(ast[i], 64, 1, ast[i]->codec->sample_rate
|
||||
* ast[i]->codec->channels * ast[i]->codec->bits_per_sample / 8);
|
||||
* ast[i]->codec->channels * ast[i]->codec->bits_per_coded_sample / 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,9 +230,9 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->codec_tag = 0; /* no tag */
|
||||
st->codec->channels = 1;
|
||||
st->codec->sample_rate = SEQ_SAMPLE_RATE;
|
||||
st->codec->bits_per_sample = 16;
|
||||
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_sample * st->codec->channels;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample = 16;
|
||||
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
st->codec->codec_id = CODEC_ID_TTA;
|
||||
st->codec->channels = channels;
|
||||
st->codec->sample_rate = samplerate;
|
||||
st->codec->bits_per_sample = bps;
|
||||
st->codec->bits_per_coded_sample = bps;
|
||||
|
||||
st->codec->extradata_size = url_ftell(s->pb);
|
||||
if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
|
||||
|
@ -2166,7 +2166,7 @@ int av_find_stream_info(AVFormatContext *ic)
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
st = ic->streams[i];
|
||||
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
|
||||
if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_sample)
|
||||
if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample)
|
||||
st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
|
||||
|
||||
if(duration_count[i]
|
||||
@ -2198,8 +2198,8 @@ int av_find_stream_info(AVFormatContext *ic)
|
||||
}
|
||||
}
|
||||
}else if(st->codec->codec_type == CODEC_TYPE_AUDIO) {
|
||||
if(!st->codec->bits_per_sample)
|
||||
st->codec->bits_per_sample= av_get_bits_per_sample(st->codec->codec_id);
|
||||
if(!st->codec->bits_per_coded_sample)
|
||||
st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
|
||||
dec->sample_rate = sample_rate;
|
||||
dec->channels = channels;
|
||||
dec->codec_id = codec_get_id(ff_voc_codec_tags, get_byte(pb));
|
||||
dec->bits_per_sample = av_get_bits_per_sample(dec->codec_id);
|
||||
dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id);
|
||||
voc->remaining_size -= 2;
|
||||
max_size -= 2;
|
||||
channels = 1;
|
||||
@ -104,7 +104,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
|
||||
|
||||
case VOC_TYPE_NEW_VOICE_DATA:
|
||||
dec->sample_rate = get_le32(pb);
|
||||
dec->bits_per_sample = get_byte(pb);
|
||||
dec->bits_per_coded_sample = get_byte(pb);
|
||||
dec->channels = get_byte(pb);
|
||||
dec->codec_id = codec_get_id(ff_voc_codec_tags, get_le16(pb));
|
||||
url_fskip(pb, 4);
|
||||
@ -120,7 +120,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
|
||||
}
|
||||
}
|
||||
|
||||
dec->bit_rate = dec->sample_rate * dec->bits_per_sample;
|
||||
dec->bit_rate = dec->sample_rate * dec->bits_per_coded_sample;
|
||||
|
||||
if (max_size <= 0)
|
||||
max_size = 2048;
|
||||
|
@ -55,7 +55,7 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
put_byte(pb, VOC_TYPE_NEW_VOICE_DATA);
|
||||
put_le24(pb, pkt->size + 12);
|
||||
put_le32(pb, enc->sample_rate);
|
||||
put_byte(pb, enc->bits_per_sample);
|
||||
put_byte(pb, enc->bits_per_coded_sample);
|
||||
put_byte(pb, enc->channels);
|
||||
put_le16(pb, enc->codec_tag);
|
||||
put_le32(pb, 0);
|
||||
|
@ -259,10 +259,10 @@ static int wc3_read_header(AVFormatContext *s,
|
||||
st->codec->codec_id = CODEC_ID_PCM_S16LE;
|
||||
st->codec->codec_tag = 1;
|
||||
st->codec->channels = WC3_AUDIO_CHANNELS;
|
||||
st->codec->bits_per_sample = WC3_AUDIO_BITS;
|
||||
st->codec->bits_per_coded_sample = WC3_AUDIO_BITS;
|
||||
st->codec->sample_rate = WC3_SAMPLE_RATE;
|
||||
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
|
||||
st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample;
|
||||
st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
|
||||
|
||||
return 0;
|
||||
|
@ -154,10 +154,10 @@ static int wsaud_read_header(AVFormatContext *s,
|
||||
st->codec->codec_tag = 0; /* no tag */
|
||||
st->codec->channels = wsaud->audio_channels;
|
||||
st->codec->sample_rate = wsaud->audio_samplerate;
|
||||
st->codec->bits_per_sample = wsaud->audio_bits;
|
||||
st->codec->bits_per_coded_sample = wsaud->audio_bits;
|
||||
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
|
||||
st->codec->bits_per_sample / 4;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample / 4;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
|
||||
|
||||
wsaud->audio_stream_index = st->index;
|
||||
wsaud->audio_frame_counter = 0;
|
||||
@ -264,10 +264,10 @@ static int wsvqa_read_header(AVFormatContext *s,
|
||||
st->codec->channels = header[26];
|
||||
if (!st->codec->channels)
|
||||
st->codec->channels = 1;
|
||||
st->codec->bits_per_sample = 16;
|
||||
st->codec->bits_per_coded_sample = 16;
|
||||
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
|
||||
st->codec->bits_per_sample / 4;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
|
||||
st->codec->bits_per_coded_sample / 4;
|
||||
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
|
||||
|
||||
wsvqa->audio_stream_index = st->index;
|
||||
wsvqa->audio_samplerate = st->codec->sample_rate;
|
||||
|
@ -151,7 +151,7 @@ static int wv_read_header(AVFormatContext *s,
|
||||
st->codec->codec_id = CODEC_ID_WAVPACK;
|
||||
st->codec->channels = wc->chan;
|
||||
st->codec->sample_rate = wc->rate;
|
||||
st->codec->bits_per_sample = wc->bpp;
|
||||
st->codec->bits_per_coded_sample = wc->bpp;
|
||||
av_set_pts_info(st, 64, 1, wc->rate);
|
||||
s->start_time = 0;
|
||||
s->duration = (int64_t)wc->samples * AV_TIME_BASE / st->codec->sample_rate;
|
||||
|
@ -72,7 +72,7 @@ static int xa_read_header(AVFormatContext *s,
|
||||
/* Value in file is average byte rate*/
|
||||
st->codec->bit_rate = get_le32(pb) * 8;
|
||||
st->codec->block_align = get_le16(pb);
|
||||
st->codec->bits_per_sample = get_le16(pb);
|
||||
st->codec->bits_per_coded_sample = get_le16(pb);
|
||||
|
||||
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
|
||||
|
||||
|
@ -180,7 +180,7 @@ do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
|
||||
do_video_decoding
|
||||
|
||||
# mpeg2 encoding intra vlc qprd
|
||||
do_video_encoding mpeg2ivlc-qprd.mpg "-vb 500k -bf 2 -flags +trell+qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd" "-vcodec mpeg2video -f mpeg2video"
|
||||
do_video_encoding mpeg2ivlc-qprd.mpg "-vb 500k -bf 2 -trellis 1 -flags +qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd" "-vcodec mpeg2video -f mpeg2video"
|
||||
do_video_decoding
|
||||
|
||||
#mpeg2 4:2:2 encoding
|
||||
@ -262,13 +262,13 @@ do_video_decoding
|
||||
fi
|
||||
|
||||
if [ -n "$do_mpeg4adv" ] ; then
|
||||
do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200" "-an -vcodec mpeg4"
|
||||
do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200" "-an -vcodec mpeg4"
|
||||
do_video_decoding
|
||||
|
||||
do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -flags +mv4+trell+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd" "-an -vcodec mpeg4"
|
||||
do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -trellis 1 -flags +mv4+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd" "-an -vcodec mpeg4"
|
||||
do_video_decoding
|
||||
|
||||
do_video_encoding mpeg4-adap.avi "-b 550k -bf 2 -flags +mv4+trell+mv0 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3" "-an -vcodec mpeg4"
|
||||
do_video_encoding mpeg4-adap.avi "-b 550k -bf 2 -flags +mv4+mv0 -trellis 1 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3" "-an -vcodec mpeg4"
|
||||
do_video_decoding
|
||||
|
||||
do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
|
||||
@ -276,7 +276,7 @@ do_video_decoding
|
||||
fi
|
||||
|
||||
if [ -n "$do_mpeg4thread" ] ; then
|
||||
do_video_encoding mpeg4-thread.avi "-b 500k -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
|
||||
do_video_encoding mpeg4-thread.avi "-b 500k -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
|
||||
do_video_decoding
|
||||
fi
|
||||
|
||||
@ -341,7 +341,7 @@ do_video_decoding
|
||||
fi
|
||||
|
||||
if [ -n "$do_snow" ] ; then
|
||||
do_video_encoding snow.avi "-strict -2" "-an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
|
||||
do_video_encoding snow.avi "-strict -2" "-an -vcodec snow -qscale 2 -flags +qpel -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
|
||||
do_video_decoding "" "-s 352x288"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user