Commit 9b879566 authored by Michel Bardiaux's avatar Michel Bardiaux Committed by Michael Niedermayer

av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)

Originally committed as revision 2469 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8bae9ddc
......@@ -333,7 +333,7 @@ static int decode_p_frame(FourXContext *f, uint8_t *buf, int length){
const int wordstream_size= get32(buf+12);
if(bitstream_size+ bytestream_size+ wordstream_size + 20 != length)
printf("lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
bitstream_size+ bytestream_size+ wordstream_size - length);
f->bitstream_buffer= av_fast_realloc(f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
......@@ -354,7 +354,7 @@ static int decode_p_frame(FourXContext *f, uint8_t *buf, int length){
}
if(bitstream_size != (get_bits_count(&f->gb)+31)/32*4)
printf(" %d %d %d bytes left\n",
av_log(f->avctx, AV_LOG_ERROR, " %d %d %d bytes left\n",
bitstream_size - (get_bits_count(&f->gb)+31)/32*4,
bytestream_size - (f->bytestream - (buf + 20 + bitstream_size + wordstream_size)),
wordstream_size - (((uint8_t*)f->wordstream) - (buf + 20 + bitstream_size))
......@@ -373,7 +373,7 @@ static int decode_i_block(FourXContext *f, DCTELEM *block){
/* DC coef */
val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
if (val>>4){
printf("error dc run != 0\n");
av_log(f->avctx, AV_LOG_ERROR, "error dc run != 0\n");
}
if(val)
......@@ -396,7 +396,7 @@ static int decode_i_block(FourXContext *f, DCTELEM *block){
level = get_xbits(&f->gb, code & 0xf);
i += code >> 4;
if (i >= 64) {
printf("run %d oveflow\n", i);
av_log(f->avctx, AV_LOG_ERROR, "run %d oveflow\n", i);
return 0;
}
......@@ -535,7 +535,7 @@ static uint8_t *read_huffman_tables(FourXContext *f, uint8_t * const buf){
for(node= j; up[node] != -1; node= up[node]){
bits += flag[node]<<len;
len++;
if(len > 31) printf("vlc length overflow\n"); //can this happen at all ?
if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n"); //can this happen at all ?
}
bits_tab[j]= bits;
......@@ -561,7 +561,7 @@ static int decode_i_frame(FourXContext *f, uint8_t *buf, int length){
uint8_t *prestream= buf + bitstream_size + 12;
if(prestream_size + bitstream_size + 12 != length)
fprintf(stderr, "size missmatch %d %d %d\n", prestream_size, bitstream_size, length);
av_log(f->avctx, AV_LOG_ERROR, "size missmatch %d %d %d\n", prestream_size, bitstream_size, length);
prestream= read_huffman_tables(f, prestream);
......@@ -586,7 +586,7 @@ static int decode_i_frame(FourXContext *f, uint8_t *buf, int length){
}
if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
printf("end missmatch\n");
av_log(f->avctx, AV_LOG_ERROR, "end missmatch\n");
return 0;
}
......@@ -609,7 +609,7 @@ static int decode_frame(AVCodecContext *avctx,
frame_4cc= get32(buf);
if(buf_size != get32(buf+4)+8){
fprintf(stderr, "size missmatch %d %d\n", buf_size, get32(buf+4));
av_log(f->avctx, AV_LOG_ERROR, "size missmatch %d %d\n", buf_size, get32(buf+4));
}
if(frame_4cc == ff_get_fourcc("cfrm")){
......@@ -621,7 +621,7 @@ static int decode_frame(AVCodecContext *avctx,
for(i=0; i<CFRAME_BUFFER_COUNT; i++){
if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
printf("lost c frame %d\n", f->cfrm[i].id);
av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id);
}
for(i=0; i<CFRAME_BUFFER_COUNT; i++){
......@@ -645,7 +645,7 @@ static int decode_frame(AVCodecContext *avctx,
frame_size= cfrm->size;
if(id != avctx->frame_number){
printf("cframe id missmatch %d %d\n", id, avctx->frame_number);
av_log(f->avctx, AV_LOG_ERROR, "cframe id missmatch %d %d\n", id, avctx->frame_number);
}
cfrm->size= cfrm->id= 0;
......@@ -671,7 +671,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 1;
if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
......@@ -684,9 +684,9 @@ static int decode_frame(AVCodecContext *avctx,
if(decode_p_frame(f, buf, frame_size) < 0)
return -1;
}else if(frame_4cc == ff_get_fourcc("snd_")){
printf("ignoring snd_ chunk length:%d\n", buf_size);
av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n", buf_size);
}else{
printf("ignoring unknown chunk length:%d\n", buf_size);
av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", buf_size);
}
#if 0
......
......@@ -464,7 +464,7 @@ static void compute_exp_strategy(uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNEL
for(i=1;i<NB_BLOCKS;i++) {
exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], N/2);
#ifdef DEBUG
printf("exp_diff=%d\n", exp_diff);
av_log(AV_LOG_DEBUG, "exp_diff=%d\n", exp_diff);
#endif
if (exp_diff > EXP_DIFF_THRESHOLD)
exp_strategy[i][ch] = EXP_NEW;
......@@ -580,11 +580,11 @@ static int encode_exp(uint8_t encoded_exp[N/2],
}
#if defined(DEBUG)
printf("exponents: strategy=%d\n", exp_strategy);
av_log(AV_LOG_DEBUG, "exponents: strategy=%d\n", exp_strategy);
for(i=0;i<=nb_groups * group_size;i++) {
printf("%d ", encoded_exp[i]);
av_log(AV_LOG_DEBUG, "%d ", encoded_exp[i]);
}
printf("\n");
av_log(AV_LOG_DEBUG, "\n");
#endif
return 4 + (nb_groups / 3) * 7;
......@@ -746,7 +746,7 @@ static int compute_bit_allocation(AC3EncodeContext *s,
bit_alloc(s, bap, encoded_exp, exp_strategy, frame_bits, csnroffst, 0) < 0)
csnroffst -= SNR_INC1;
if (csnroffst < 0) {
fprintf(stderr, "Yack, Error !!!\n");
av_log(NULL, AV_LOG_ERROR, "Yack, Error !!!\n");
return -1;
}
while ((csnroffst + SNR_INC1) <= 63 &&
......@@ -1021,7 +1021,7 @@ static void output_audio_block(AC3EncodeContext *s,
#if defined(DEBUG)
{
static int count = 0;
printf("Block #%d (%d)\n", block_num, count++);
av_log(AV_LOG_DEBUG, "Block #%d (%d)\n", block_num, count++);
}
#endif
/* exponent strategy */
......
......@@ -129,7 +129,7 @@ static int adpcm_encode_init(AVCodecContext *avctx)
return -1; /* only stereo or mono =) */
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_QT:
fprintf(stderr, "ADPCM: codec admcp_ima_qt unsupported for encoding !\n");
av_log(avctx, AV_LOG_ERROR, "ADPCM: codec admcp_ima_qt unsupported for encoding !\n");
avctx->frame_size = 64; /* XXX: can multiple of avctx->channels * 64 (left and right blocks are interleaved) */
return -1;
break;
......@@ -140,7 +140,7 @@ static int adpcm_encode_init(AVCodecContext *avctx)
/* seems frame_size isn't taken into account... have to buffer the samples :-( */
break;
case CODEC_ID_ADPCM_MS:
fprintf(stderr, "ADPCM: codec admcp_ms unsupported for encoding !\n");
av_log(avctx, AV_LOG_ERROR, "ADPCM: codec admcp_ms unsupported for encoding !\n");
return -1;
break;
default:
......@@ -496,7 +496,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
cs->step_index = (*src++) & 0x7F;
if (cs->step_index > 88) fprintf(stderr, "ERROR: step_index = %i\n", cs->step_index);
if (cs->step_index > 88) av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
if (cs->step_index > 88) cs->step_index = 88;
cs->step = step_table[cs->step_index];
......@@ -540,7 +540,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
cs->step_index = *src++;
if (cs->step_index < 0) cs->step_index = 0;
if (cs->step_index > 88) cs->step_index = 88;
if (*src++) fprintf(stderr, "unused byte should be null !!\n"); /* unused */
if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null !!\n"); /* unused */
if (st) {
cs = &(c->status[1]);
......
......@@ -199,7 +199,7 @@ static int adx_encode_init(AVCodecContext *avctx)
// avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32;
printf("adx encode init\n"); fflush(stdout);
av_log(avctx, AV_LOG_DEBUG, "adx encode init\n");
adx_decode_init(avctx);
return 0;
......@@ -318,11 +318,11 @@ static void dump(unsigned char *buf,size_t len)
{
int i;
for(i=0;i<len;i++) {
if ((i&15)==0) printf("%04x ",i);
printf("%02x ",buf[i]);
if ((i&15)==15) printf("\n");
if ((i&15)==0) av_log(NULL, AV_LOG_DEBUG, "%04x ",i);
av_log(NULL, AV_LOG_DEBUG, "%02x ",buf[i]);
if ((i&15)==15) av_log(NULL, AV_LOG_DEBUG, "\n");
}
printf("\n");
av_log(NULL, AV_LOG_ERROR, "\n");
}
static int adx_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
......
......@@ -207,7 +207,7 @@ static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]){
if(ccp){
if(ccp == 16) break;
if(ccp < 0 || i>=10){
printf("coded coeff pattern damaged\n");
av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n");
return -1;
}
......@@ -415,7 +415,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
p->pict_type= I_TYPE;
......@@ -561,7 +561,7 @@ static int decode_init(AVCodecContext *avctx){
a->inv_qscale= ((uint8_t*)avctx->extradata)[0];
if(a->inv_qscale == 0){
printf("illegal qscale 0\n");
av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
if(avctx->codec_id == CODEC_ID_ASV1)
a->inv_qscale= 6;
else
......
......@@ -1830,6 +1830,28 @@ void *__av_mallocz_static(void** location, unsigned int size);
/* add by bero : in adx.c */
int is_adx(const unsigned char *buf,size_t bufsize);
/* av_log API */
#include <stdarg.h>
#define AV_LOG_ERROR 0
#define AV_LOG_INFO 1
#define AV_LOG_DEBUG 2
extern void av_log(AVCodecContext*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
extern void av_vlog(AVCodecContext*, int level, const char *fmt, va_list);
extern int av_log_get_level(void);
extern void av_log_set_level(int);
extern void av_log_set_callback(void (*)(AVCodecContext*, int, const char*, va_list));
#undef AV_LOG_TRAP_PRINTF
#ifdef AV_LOG_TRAP_PRINTF
#define printf DO NOT USE
#define fprintf DO NOT USE
#undef stderr
#define stderr DO NOT USE
#endif
#ifdef __cplusplus
}
#endif
......
......@@ -418,7 +418,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
s->size = buf_size;
if (avctx->get_buffer(avctx, &s->frame)) {
printf (" Cinepak: get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, " Cinepak: get_buffer() failed\n");
return -1;
}
......
......@@ -55,7 +55,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
p->pict_type= I_TYPE;
......
......@@ -196,7 +196,8 @@ void align_get_bits(GetBitContext *s)
int check_marker(GetBitContext *s, const char *msg)
{
int bit= get_bits1(s);
if(!bit) printf("Marker bit missing %s\n", msg);
if(!bit)
av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
return bit;
}
......@@ -281,11 +282,11 @@ static int build_table(VLC *vlc, int table_nb_bits,
nb = 1 << (table_nb_bits - n);
for(k=0;k<nb;k++) {
#ifdef DEBUG_VLC
printf("%4x: code=%d n=%d\n",
av_log(AV_LOG_DEBUG, "%4x: code=%d n=%d\n",
j, i, n);
#endif
if (table[j][1] /*bits*/ != 0) {
fprintf(stderr, "incorrect codes\n");
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
av_abort();
}
table[j][1] = n; //bits
......
......@@ -192,7 +192,7 @@ inline void dprintf(const char* fmt,...) {}
# endif /* !CONFIG_WIN32 */
# define av_abort() do { fprintf(stderr, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
# define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
//rounded divison & shift
#define RSHIFT(a,b) ((a) > 0 ? ((a) + (1<<((b)-1)))>>(b) : ((a) + (1<<((b)-1))-1)>>(b))
......
......@@ -88,7 +88,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
* of 4 pixels. Thus, the total size of the buffer ought to be:
* (3 * 16) + height * (width * 3 / 4) */
if (buf_size != 48 + s->height * (s->width * 3 / 4)) {
printf ("ffmpeg: cyuv: got a buffer with %d bytes when %d were expected\n",
av_log(avctx, AV_LOG_ERROR, "ffmpeg: cyuv: got a buffer with %d bytes when %d were expected\n",
buf_size,
48 + s->height * (s->width * 3 / 4));
return -1;
......@@ -102,7 +102,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
s->frame.reference = 0;
if(avctx->get_buffer(avctx, &s->frame) < 0) {
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
......
......@@ -3089,7 +3089,7 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
break;
default:
fprintf(stderr, "Internal error, IDCT permutation not set\n");
av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
}
}
......@@ -297,7 +297,7 @@ static void dv_decode_ac(DVVideoDecodeContext *s,
if (pos >= 64) {
read_error:
#if defined(VLC_DEBUG) || 1
fprintf(stderr, "error pos=%d\n", pos);
av_log(NULL, AV_LOG_ERROR, "error pos=%d\n", pos);
#endif
/* for errors, we consider the eob is reached */
mb->eob_reached = 1;
......@@ -868,7 +868,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
avctx->width = s->sys->width;
avctx->height = s->sys->height;
if(avctx->get_buffer(avctx, &s->picture) < 0) {
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
s->picture.interlaced_frame = 1;
......
......@@ -669,12 +669,12 @@ void ff_er_frame_end(MpegEncContext *s){
if(!s->error_resilience || s->error_count==0) return;
fprintf(stderr, "concealing errors\n");
av_log(s->avctx, AV_LOG_INFO, "concealing errors\n");
if(s->motion_val == NULL){
int size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2);
fprintf(stderr, "Warning MVs not available\n");
av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");
s->motion_val= av_mallocz(size * 2 * sizeof(int16_t));
}
......@@ -684,9 +684,9 @@ void ff_er_frame_end(MpegEncContext *s){
for(mb_x=0; mb_x<s->mb_width; mb_x++){
int status= s->error_status_table[mb_x + mb_y*s->mb_stride];
printf("%2X ", status);
av_log(s->avctx, AV_LOG_DEBUG, "%2X ", status);
}
printf("\n");
av_log(s->avctx, AV_LOG_DEBUG, "\n");
}
}
......
......@@ -61,7 +61,7 @@ static void evalExpression(Parser *p);
static void push(Parser *p, double d){
if(p->stack_index+1>= STACK_SIZE){
fprintf(stderr, "stack overflow in the parser\n");
av_log(NULL, AV_LOG_ERROR, "stack overflow in the parser\n");
return;
}
p->stack[ p->stack_index++ ]= d;
......@@ -70,7 +70,7 @@ static void push(Parser *p, double d){
static double pop(Parser *p){
if(p->stack_index<=0){
fprintf(stderr, "stack underflow in the parser\n");
av_log(NULL, AV_LOG_ERROR, "stack underflow in the parser\n");
return NAN;
}
//printf("pop\n"); fflush(stdout);
......@@ -109,7 +109,7 @@ static void evalPrimary(Parser *p){
p->s= strchr(p->s, '(');
if(p->s==NULL){
fprintf(stderr, "Parser: missing ( in \"%s\"\n", next);
av_log(NULL, AV_LOG_ERROR, "Parser: missing ( in \"%s\"\n", next);
return;
}
p->s++; // "("
......@@ -159,13 +159,13 @@ static void evalPrimary(Parser *p){
}
if(error){
fprintf(stderr, "Parser: unknown function in \"%s\"\n", next);
av_log(NULL, AV_LOG_ERROR, "Parser: unknown function in \"%s\"\n", next);
return;
}
}
if(p->s[-1]!= ')'){
fprintf(stderr, "Parser: missing ) in \"%s\"\n", next);
av_log(NULL, AV_LOG_ERROR, "Parser: missing ) in \"%s\"\n", next);
return;
}
push(p, d);
......@@ -185,7 +185,7 @@ static void evalPow(Parser *p){
evalExpression(p);
if(p->s[0]!=')')
fprintf(stderr, "Parser: missing )\n");
av_log(NULL, AV_LOG_ERROR, "Parser: missing )\n");
p->s++;
}else{
evalPrimary(p);
......
......@@ -598,7 +598,7 @@ static int encode_init(AVCodecContext *avctx)
s->colorspace= 1;
break;
default:
fprintf(stderr, "format not supported\n");
av_log(avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
......@@ -642,7 +642,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
int used_count= 0;
if(avctx->strict_std_compliance >= 0){
printf("this codec is under development, files encoded with it wont be decodeable with future versions!!!\n"
av_log(avctx, AV_LOG_ERROR, "this codec is under development, files encoded with it wont be decodeable with future versions!!!\n"
"use vstrict=-1 to use it anyway\n");
return -1;
}
......@@ -885,17 +885,17 @@ static int read_header(FFV1Context *f){
case 0x20: f->avctx->pix_fmt= PIX_FMT_YUV411P; break;
case 0x33: f->avctx->pix_fmt= PIX_FMT_YUV410P; break;
default:
fprintf(stderr, "format not supported\n");
av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
}else if(f->colorspace==1){
if(f->chroma_h_shift || f->chroma_v_shift){
fprintf(stderr, "chroma subsampling not supported in this colorspace\n");
av_log(f->avctx, AV_LOG_ERROR, "chroma subsampling not supported in this colorspace\n");
return -1;
}
f->avctx->pix_fmt= PIX_FMT_RGBA32;
}else{
fprintf(stderr, "colorspace not supported\n");
av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
return -1;
}
......@@ -905,7 +905,7 @@ static int read_header(FFV1Context *f){
for(i=0; i<5; i++){
context_count*= read_quant_table(c, f->quant_table[i], context_count);
if(context_count < 0){
printf("read_quant_table error\n");
av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
return -1;
}
}
......@@ -965,16 +965,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
if(avctx->debug&FF_DEBUG_PICT_INFO)
printf("keyframe:%d coder:%d\n", p->key_frame, f->ac);
av_log(avctx, AV_LOG_ERROR, "keyframe:%d coder:%d\n", p->key_frame, f->ac);
if(!f->ac){
bytes_read = get_cabac_terminate(c);
if(bytes_read ==0) printf("error at end of AC stream\n");
if(bytes_read ==0) av_log(avctx, AV_LOG_ERROR, "error at end of AC stream\n");
//printf("pos=%d\n", bytes_read);
init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read);
} else {
......@@ -1004,7 +1004,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
if(f->ac){
bytes_read= get_cabac_terminate(c);
if(bytes_read ==0) printf("error at end of frame\n");
if(bytes_read ==0) av_log(f->avctx, AV_LOG_ERROR, "error at end of frame\n");
}else{
bytes_read+= (get_bits_count(&f->gb)+7)/8;
}
......
This diff is collapsed.
......@@ -219,11 +219,11 @@ static int decode_slice(MpegEncContext *s){
}
return 0;
}else if(ret==SLICE_NOEND){
fprintf(stderr,"Slice mismatch at MB: %d\n", xy);
av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x+1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return -1;
}
fprintf(stderr,"Error at MB: %d\n", xy);
av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
......@@ -281,17 +281,17 @@ static int decode_slice(MpegEncContext *s){
max_extra+= 256*256*256*64;
if(left>max_extra){
fprintf(stderr, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24));
av_log(s->avctx, AV_LOG_ERROR, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24));
}
else if(left<0){
fprintf(stderr, "overreading %d bits\n", -left);
av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
}else
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
return 0;
}
fprintf(stderr, "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
av_log(s->avctx, AV_LOG_ERROR, "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
s->gb.size_in_bits - get_bits_count(&s->gb),
show_bits(&s->gb, 24), s->padding_bug_score);
......@@ -415,7 +415,7 @@ uint64_t time= rdtsc();
}else if(s->codec_id==CODEC_ID_H263){
next= h263_find_frame_end(s, buf, buf_size);
}else{
fprintf(stderr, "this codec doesnt support truncated bitstreams\n");
av_log(s->avctx, AV_LOG_ERROR, "this codec doesnt support truncated bitstreams\n");
return -1;
}
......@@ -470,7 +470,7 @@ retry:
/* skip if the header was thrashed */
if (ret < 0){
fprintf(stderr, "header damaged\n");
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return -1;
}
......@@ -580,7 +580,7 @@ retry:
}
if(avctx->debug & FF_DEBUG_BUGS)
printf("bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
av_log(s->avctx, AV_LOG_DEBUG, "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
s->workaround_bugs, s->lavc_build, s->xvid_build, s->divx_version, s->divx_build,
s->divx_packed ? "p" : "");
......
This diff is collapsed.
......@@ -219,7 +219,7 @@ static int generate_bits_table(uint32_t *dst, uint8_t *len_table){
dst[index]= bits++;
}
if(bits & 1){
fprintf(stderr, "Error generating huffman table\n");
av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
return -1;
}
bits >>= 1;
......@@ -480,7 +480,7 @@ static int encode_init(AVCodecContext *avctx)
switch(avctx->pix_fmt){
case PIX_FMT_YUV420P:
if(avctx->strict_std_compliance>=0){
fprintf(stderr, "YV12-huffyuv is experimental, there WILL be no compatbility! (use (v)strict=-1)\n");
av_log(avctx, AV_LOG_ERROR, "YV12-huffyuv is experimental, there WILL be no compatbility! (use (v)strict=-1)\n");
return -1;
}
s->bitstream_bpp= 12;
......@@ -489,7 +489,7 @@ static int encode_init(AVCodecContext *avctx)
s->bitstream_bpp= 16;
break;
default:
fprintf(stderr, "format not supported\n");
av_log(avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
avctx->bits_per_sample= s->bitstream_bpp;
......@@ -703,7 +703,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
......@@ -724,7 +724,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
p->data[0][1]= get_bits(&s->gb, 8);
p->data[0][0]= get_bits(&s->gb, 8);
fprintf(stderr, "YUY2 output isnt implemenetd yet\n");
av_log(avctx, AV_LOG_ERROR, "YUY2 output isnt implemenetd yet\n");
return -1;
}else{
......@@ -896,11 +896,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
draw_slice(s, height); // just 1 large slice as this isnt possible in reverse order
break;
default:
fprintf(stderr, "prediction type not supported!\n");
av_log(avctx, AV_LOG_ERROR, "prediction type not supported!\n");
}
}else{
fprintf(stderr, "BGR24 output isnt implemenetd yet\n");
av_log(avctx, AV_LOG_ERROR, "BGR24 output isnt implemenetd yet\n");
return -1;
}
}
......@@ -1049,7 +1049,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
}
}
}else{
fprintf(stderr, "Format not supported!\n");
av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");
}
emms_c();
......
......@@ -158,7 +158,7 @@ static int idcin_decode_init(AVCodecContext *avctx)
/* make sure the Huffman tables make it */
if (s->avctx->extradata_size != HUFFMAN_TABLE_SIZE) {
printf(" Id CIN video: expected extradata size of %d\n", HUFFMAN_TABLE_SIZE);
av_log(s->avctx, AV_LOG_ERROR, " Id CIN video: expected extradata size of %d\n", HUFFMAN_TABLE_SIZE);
return -1;
}
......@@ -193,7 +193,7 @@ static void idcin_decode_vlcs(IdcinContext *s)
while(node_num >= HUF_TOKENS) {
if(!bit_pos) {
if(dat_pos > s->size) {
printf("Huffman decode error.\n");
av_log(s->avctx, AV_LOG_ERROR, "Huffman decode error.\n");
return;
}
bit_pos = 8;
......@@ -225,7 +225,7 @@ static int idcin_decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->frame);
if (avctx->get_buffer(avctx, &s->frame)) {
printf (" Id CIN Video: get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, " Id CIN Video: get_buffer() failed\n");
return -1;
}
......
......@@ -622,7 +622,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
break;
case 9:
fprintf(stderr, "UNTESTED.\n");
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
......@@ -791,7 +791,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
break;
case 9:
fprintf(stderr, "UNTESTED.\n");
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
......@@ -887,7 +887,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
break;
case 9:
fprintf(stderr, "UNTESTED.\n");
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
......@@ -980,7 +980,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
break;
case 9:
fprintf(stderr, "UNTESTED.\n");
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
......@@ -1063,7 +1063,7 @@ static int indeo3_decode_frame(AVCodecContext *avctx,
s->frame.reference = 0;
if(avctx->get_buffer(avctx, &s->frame) < 0) {
fprintf(stderr, "get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
......
......@@ -76,7 +76,7 @@ typedef struct IpvideoContext {
#define CHECK_STREAM_PTR(n) \
if ((s->stream_ptr + n) > s->stream_end) { \
printf ("Interplay video warning: stream_ptr out of bounds (%p >= %p)\n", \
av_log(s->avctx, AV_LOG_ERROR, "Interplay video warning: stream_ptr out of bounds (%p >= %p)\n", \
s->stream_ptr + n, s->stream_end); \
return -1; \
}
......@@ -86,10 +86,10 @@ typedef struct IpvideoContext {
motion_offset += y * s->stride; \
motion_offset += x; \
if (motion_offset < 0) { \
printf (" Interplay video: motion offset < 0 (%d)\n", motion_offset); \
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset < 0 (%d)\n", motion_offset); \
return -1; \
} else if (motion_offset > s->upper_motion_limit_offset) { \
printf (" Interplay video: motion offset above limit (%d >= %d)\n", \
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset above limit (%d >= %d)\n", \
motion_offset, s->upper_motion_limit_offset); \
return -1; \
} \
......@@ -101,10 +101,10 @@ typedef struct IpvideoContext {
motion_offset += y * s->stride; \
motion_offset += x; \
if (motion_offset < 0) { \
printf (" Interplay video: motion offset < 0 (%d)\n", motion_offset); \
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset < 0 (%d)\n", motion_offset); \
return -1; \
} else if (motion_offset > s->upper_motion_limit_offset) { \
printf (" Interplay video: motion offset above limit (%d >= %d)\n", \
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset above limit (%d >= %d)\n", \
motion_offset, s->upper_motion_limit_offset); \
return -1; \
} \
......@@ -116,10 +116,10 @@ typedef struct IpvideoContext {
motion_offset += y * s->stride; \
motion_offset += x; \
if (motion_offset < 0) { \
printf (" Interplay video: motion offset < 0 (%d)\n", motion_offset); \
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset < 0 (%d)\n", motion_offset); \
return -1; \
} else if (motion_offset > s->upper_motion_limit_offset) { \
printf (" Interplay video: motion offset above limit (%d >= %d)\n", \
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset above limit (%d >= %d)\n", \
motion_offset, s->upper_motion_limit_offset); \
return -1; \
} \
......@@ -254,7 +254,7 @@ static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x6(IpvideoContext *s)
{
/* mystery opcode? skip multiple blocks? */
printf (" Interplay video: Help! Mystery opcode 0x6 seen\n");
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: Help! Mystery opcode 0x6 seen\n");
/* report success */
return 0;
......@@ -838,7 +838,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
s->pixel_ptr = s->current_frame.data[0] + x;
ret = ipvideo_decode_block[opcode](s);
if (ret != 0) {
printf(" Interplay video: decode problem on frame %d, @ block (%d, %d)\n",
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode problem on frame %d, @ block (%d, %d)\n",
frame, x - y, y / s->stride);
return;
}
......@@ -846,7 +846,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
}
if ((s->stream_ptr != s->stream_end) &&
(s->stream_ptr + 1 != s->stream_end)) {
printf (" Interplay video: decode finished with %d bytes left over\n",
av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode finished with %d bytes left over\n",
s->stream_end - s->stream_ptr);
}
}
......@@ -858,7 +858,7 @@ static int ipvideo_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
if (s->avctx->palctrl == NULL) {
printf (" Interplay video: palette expected.\n");
av_log(avctx, AV_LOG_ERROR, " Interplay video: palette expected.\n");
return -1;
}
......@@ -906,7 +906,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
s->current_frame.reference = 3;
if (avctx->get_buffer(avctx, &s->current_frame)) {
printf (" Interplay Video: get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, " Interplay Video: get_buffer() failed\n");
return -1;
}
......
......@@ -110,7 +110,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n)
}
}
if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", a->mb_x, a->mb_y);
av_log(a->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", a->mb_x, a->mb_y);
return -1;
}
......@@ -175,7 +175,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
p->pict_type= I_TYPE;
......
......@@ -884,7 +884,7 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
if (avctx->flags & CODEC_FLAG_EXTERN_HUFF)
{
printf("mjpeg: using external huffman table\n");
av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n");
init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8);
mjpeg_decode_dht(s);
/* should check for error - but dunno */
......@@ -987,7 +987,7 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
if(s->bits==9 && !s->pegasus_rct) s->rct=1; //FIXME ugly
if (s->bits != 8 && !s->lossless){
printf("only 8 bits/component accepted\n");
av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n");
return -1;
}
height = get_bits(&s->gb, 16);
......@@ -1066,7 +1066,7 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
s->picture.reference= 0;
if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
fprintf(stderr, "get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
s->picture.pict_type= I_TYPE;
......@@ -1444,7 +1444,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s)
}
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
printf("%s %s p:%d >>:%d\n", s->lossless ? "lossless" : "sequencial DCT", s->rgb ? "RGB" : "", predictor, point_transform);
av_log(s->avctx, AV_LOG_DEBUG, "%s %s p:%d >>:%d\n", s->lossless ? "lossless" : "sequencial DCT", s->rgb ? "RGB" : "", predictor, point_transform);
if(s->lossless){
if(s->rgb){
......@@ -1489,7 +1489,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
len -= 6;
if(s->avctx->debug & FF_DEBUG_STARTCODE){
printf("APPx %8X\n", id);
av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id);
}
/* buggy AVID, it puts EOI only at every 10th frame */
......@@ -1525,7 +1525,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
{
int t_w, t_h;
skip_bits(&s->gb, 8); /* the trailing zero-byte */
printf("mjpeg: JFIF header found (version: %x.%x)\n",
av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x)\n",
get_bits(&s->gb, 8), get_bits(&s->gb, 8));
skip_bits(&s->gb, 8);
......@@ -1546,7 +1546,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
if (id == ff_get_fourcc("Adob") && (get_bits(&s->gb, 8) == 'e'))
{
printf("mjpeg: Adobe header found\n");
av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
skip_bits(&s->gb, 16); /* version */
skip_bits(&s->gb, 16); /* flags0 */
skip_bits(&s->gb, 16); /* flags1 */
......@@ -1556,7 +1556,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
}
if (id == ff_get_fourcc("LJIF")){
printf("Pegasus lossless jpeg header found\n");
av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n");
skip_bits(&s->gb, 16); /* version ? */
skip_bits(&s->gb, 16); /* unknwon always 0? */
skip_bits(&s->gb, 16); /* unknwon always 0? */
......@@ -1571,7 +1571,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
s->pegasus_rct=1;
break;
default:
printf("unknown colorspace\n");
av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace\n");
}
len -= 9;
goto out;
......@@ -1596,14 +1596,14 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
skip_bits(&s->gb, 32); /* data off */
#endif
if (s->first_picture)
printf("mjpeg: Apple MJPEG-A header found\n");
av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n");
}
}
out:
/* slow but needed for extreme adobe jpegs */
if (len < 0)
printf("mjpeg: error, decode_app parser read over the end\n");
av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n");
while(--len > 0)
skip_bits(&s->gb, 8);
......@@ -1626,7 +1626,7 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
else
cbuf[i] = 0;
printf("mjpeg comment: '%s'\n", cbuf);
av_log(s->avctx, AV_LOG_INFO, "mjpeg comment: '%s'\n", cbuf);
/* buggy avid, it puts EOI only at every 10th frame */
if (!strcmp(cbuf, "AVID"))
......@@ -1766,7 +1766,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
s->start_code = start_code;
if(s->avctx->debug & FF_DEBUG_STARTCODE){
printf("startcode: %X\n", start_code);
av_log(s->avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
}
/* process markers */
......@@ -1791,7 +1791,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
break;
case DHT:
if(mjpeg_decode_dht(s) < 0){
fprintf(stderr, "huffman table decode error\n");
av_log(s->avctx, AV_LOG_ERROR, "huffman table decode error\n");
return -1;
}
break;
......@@ -1829,7 +1829,7 @@ eoi_parser:
picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16);
if(avctx->debug & FF_DEBUG_QP)
printf("QP: %d\n", picture->quality);
av_log(s->avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
picture->quality*= FF_QP2LAMBDA;
}
......@@ -1858,7 +1858,7 @@ eoi_parser:
case SOF14:
case SOF15:
case JPG:
printf("mjpeg: unsupported coding type (%x)\n", start_code);
av_log(s->avctx, AV_LOG_ERROR, "mjpeg: unsupported coding type (%x)\n", start_code);
break;
// default:
// printf("mjpeg: unsupported marker (%x)\n", start_code);
......@@ -1987,7 +1987,7 @@ read_header:
picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16);
if(avctx->debug & FF_DEBUG_QP)
printf("QP: %d\n", picture->quality);
av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
picture->quality*= FF_QP2LAMBDA;
}
......
......@@ -322,7 +322,7 @@ static void set_cmp(MpegEncContext *s, me_cmp_func *cmp, int type){
}
break;
default:
fprintf(stderr,"internal error in cmp function selection\n");
av_log(s->avctx, AV_LOG_ERROR,"internal error in cmp function selection\n");
}
}
......
......@@ -994,7 +994,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
if (s->mb_skip_run-- != 0) {
if(s->pict_type == I_TYPE){
fprintf(stderr, "skiped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "skiped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
......@@ -1034,7 +1034,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
case I_TYPE:
if (get_bits1(&s->gb) == 0) {
if (get_bits1(&s->gb) == 0){
fprintf(stderr, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA;
......@@ -1045,7 +1045,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
case P_TYPE:
mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1);
if (mb_type < 0){
fprintf(stderr, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_type = ptype2mb_type[ mb_type ];
......@@ -1053,7 +1053,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
case B_TYPE:
mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1);
if (mb_type < 0){
fprintf(stderr, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_type = btype2mb_type[ mb_type ];
......@@ -1268,7 +1268,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
if (IS_PAT(mb_type)) {
cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
if (cbp < 0){
fprintf(stderr, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
cbp++;
......@@ -1356,7 +1356,7 @@ static inline int decode_dc(GetBitContext *gb, int component)
code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2);
}
if (code < 0){
fprintf(stderr, "invalid dc code at\n");
av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n");
return 0xffff;
}
if (code == 0) {
......@@ -1428,7 +1428,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s,
}
}
if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
......@@ -1504,7 +1504,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s,
}
}
if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
......@@ -1582,7 +1582,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
}
}
if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
......@@ -1662,7 +1662,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
}
}
if (i > 63){
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
......@@ -1810,7 +1810,7 @@ static void mpeg_decode_sequence_extension(MpegEncContext *s)
}
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
printf("profile: %d, level: %d \n", profile, level);
av_log(s->avctx, AV_LOG_DEBUG, "profile: %d, level: %d \n", profile, level);
}
static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
......@@ -1841,7 +1841,7 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
);
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
printf("sde w:%d, h:%d\n", w, h);
av_log(s->avctx, AV_LOG_DEBUG, "sde w:%d, h:%d\n", w, h);
}
static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
......@@ -1857,7 +1857,7 @@ static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
}
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
printf("pde (%d,%d) (%d,%d) (%d,%d)\n",
av_log(s->avctx, AV_LOG_DEBUG, "pde (%d,%d) (%d,%d) (%d,%d)\n",
s1->pan_scan.position[0][0], s1->pan_scan.position[0][1],
s1->pan_scan.position[1][0], s1->pan_scan.position[1][1],
s1->pan_scan.position[2][0], s1->pan_scan.position[2][1]
......@@ -2014,7 +2014,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
start_code = (start_code - 1) & 0xff;
if (start_code >= s->mb_height){
fprintf(stderr, "slice below image (%d >= %d)\n", start_code, s->mb_height);
av_log(s->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", start_code, s->mb_height);
return -1;
}
......@@ -2047,7 +2047,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
//printf("%d\n", s->current_picture_ptr->repeat_pict);
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qp:%d fc:%2d%2d%2d%2d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%2d%2d%2d%2d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1],
s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")),
s->progressive_sequence ? "pro" :"", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"",
......@@ -2058,7 +2058,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
int i;
if(!s->current_picture_ptr){
fprintf(stderr, "first field missing\n");
av_log(s->avctx, AV_LOG_ERROR, "first field missing\n");
return -1;
}
......@@ -2082,7 +2082,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
s->qscale = get_qscale(s);
if(s->qscale == 0){
fprintf(stderr, "qscale == 0\n");
av_log(s->avctx, AV_LOG_ERROR, "qscale == 0\n");
return -1;
}
......@@ -2096,7 +2096,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
for(;;) {
int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
if (code < 0){
fprintf(stderr, "first mb_incr damaged\n");
av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n");
return -1;
}
if (code >= 33) {
......@@ -2173,7 +2173,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
if(left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23)))
|| (avctx->error_resilience >= FF_ER_AGGRESSIVE && left>8)){
fprintf(stderr, "end missmatch left=%d\n", left);
av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d\n", left);
return -1;
}else
goto eos;
......@@ -2189,7 +2189,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
for(;;) {
int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
if (code < 0){
fprintf(stderr, "mb incr damaged\n");
av_log(s->avctx, AV_LOG_ERROR, "mb incr damaged\n");
return -1;
}
if (code >= 33) {
......@@ -2197,7 +2197,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
s->mb_skip_run += 33;
}else if(code == 35){
if(s->mb_skip_run != 0 || show_bits(&s->gb, 15) != 0){
fprintf(stderr, "slice missmatch\n");
av_log(s->avctx, AV_LOG_ERROR, "slice mismatch\n");
return -1;
}
goto eos; /* end of slice */
......@@ -2564,7 +2564,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
input_size = buf_end - buf_ptr;
if(avctx->debug & FF_DEBUG_STARTCODE){
printf("%3X at %d left %d\n", start_code, buf_ptr-buf, input_size);
av_log(avctx, AV_LOG_DEBUG, "%3X at %d left %d\n", start_code, buf_ptr-buf, input_size);
}
/* prepare data for next start code */
......
......@@ -117,7 +117,7 @@ static int MPA_encode_init(AVCodecContext *avctx)
s->alloc_table = alloc_tables[table];
#ifdef DEBUG
printf("%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
av_log(AV_LOG_DEBUG, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
bitrate, freq, s->frame_size, table, s->frame_frac_incr);
#endif
......
This diff is collapsed.
......@@ -1238,7 +1238,7 @@ return -1;
int start_code, num;
start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16);
if(start_code!=0x00000100){
fprintf(stderr, "invalid startcode\n");
av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n");
return -1;
}
......@@ -1248,7 +1248,7 @@ return -1;
s->pict_type = get_bits(&s->gb, 2) + 1;
if (s->pict_type != I_TYPE &&
s->pict_type != P_TYPE){
fprintf(stderr, "invalid picture type\n");
av_log(s->avctx, AV_LOG_ERROR, "invalid picture type\n");
return -1;
}
#if 0
......@@ -1260,7 +1260,7 @@ return -1;
#endif
s->qscale = get_bits(&s->gb, 5);
if(s->qscale==0){
fprintf(stderr, "invalid qscale\n");
av_log(s->avctx, AV_LOG_ERROR, "invalid qscale\n");
return -1;
}
......@@ -1268,7 +1268,7 @@ return -1;
code = get_bits(&s->gb, 5);
if(s->msmpeg4_version==1){
if(code==0 || code>s->mb_height){
fprintf(stderr, "invalid slice height %d\n", code);
av_log(s->avctx, AV_LOG_ERROR, "invalid slice height %d\n", code);
return -1;
}
......@@ -1276,7 +1276,7 @@ return -1;
}else{
/* 0x17: one slice, 0x18: two slices, ... */
if (code < 0x17){
fprintf(stderr, "error, slice code was %X\n", code);
av_log(s->avctx, AV_LOG_ERROR, "error, slice code was %X\n", code);
return -1;
}
......@@ -1314,7 +1314,7 @@ return -1;
}
s->no_rounding = 1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO)
printf("qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d \n",
av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d \n",
s->qscale,
s->rl_chroma_table_index,
s->rl_table_index,
......@@ -1362,7 +1362,7 @@ return -1;
}
if(s->avctx->debug&FF_DEBUG_PICT_INFO)
printf("skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d \n",
av_log(s->avctx, AV_LOG_DEBUG, "skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d \n",
s->use_skip_mb_code,
s->rl_table_index,
s->rl_chroma_table_index,
......@@ -1410,11 +1410,11 @@ int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
{
s->flipflop_rounding= 0;
if(s->msmpeg4_version != 2)
printf("ext header missing, %d left\n", left);
av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left);
}
else
{
fprintf(stderr, "I frame too long, ignoring ext header\n");
av_log(s->avctx, AV_LOG_ERROR, "I frame too long, ignoring ext header\n");
}
return 0;
......@@ -1517,7 +1517,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
else
code = get_vlc2(&s->gb, v1_inter_cbpc_vlc.table, V1_INTER_CBPC_VLC_BITS, 3);
if(code<0 || code>7){
fprintf(stderr, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y);
return -1;
}
......@@ -1531,7 +1531,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
else
cbp= get_vlc2(&s->gb, v1_intra_cbpc_vlc.table, V1_INTRA_CBPC_VLC_BITS, 1);
if(cbp<0 || cbp>3){
fprintf(stderr, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1;
}
}
......@@ -1541,7 +1541,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
cbpy= get_vlc2(&s->gb, cbpy_vlc.table, CBPY_VLC_BITS, 1);
if(cbpy<0){
fprintf(stderr, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1;
}
......@@ -1570,7 +1570,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{
fprintf(stderr,"\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1;
}
}
......@@ -1662,7 +1662,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{
fprintf(stderr,"\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1;
}
}
......@@ -1688,20 +1688,20 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
if (level < 0){
fprintf(stderr, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
if(s->inter_intra_pred) level=0;
else return -1;
}
if (n < 4) {
rl = &rl_table[s->rl_table_index];
if(level > 256*s->y_dc_scale){
fprintf(stderr, "dc overflow+ L qscale: %d//\n", s->qscale);
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1;
}
} else {
rl = &rl_table[3 + s->rl_chroma_table_index];
if(level > 256*s->c_dc_scale){
fprintf(stderr, "dc overflow+ C qscale: %d//\n", s->qscale);
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1;
}
}
......@@ -1770,7 +1770,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
if(s->qscale<8){
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
if(ll==0){
if(SHOW_UBITS(re, &s->gb, 1)) printf("cool a new vlc code ,contact the ffmpeg developers and upload the file\n");
if(SHOW_UBITS(re, &s->gb, 1)) av_log(s->avctx, AV_LOG_ERROR, "cool a new vlc code ,contact the ffmpeg developers and upload the file\n");
SKIP_BITS(re, &s->gb, 1);
ll=8;
}
......@@ -1891,10 +1891,10 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
if(i&(~63)){
const int left= s->gb.size_in_bits - get_bits_count(&s->gb);
if(((i+192 == 64 && level/qmul==-1) || s->error_resilience<=1) && left>=0){
fprintf(stderr, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
break;
}else{
fprintf(stderr, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
}
......@@ -1940,7 +1940,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
level = get_vlc2(&s->gb, dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
if (level < 0){
fprintf(stderr, "illegal dc vlc\n");
av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
return -1;
}
......@@ -1987,7 +1987,7 @@ static int msmpeg4_decode_motion(MpegEncContext * s,
code = get_vlc2(&s->gb, mv->vlc.table, MV_VLC_BITS, 2);
if (code < 0){
fprintf(stderr, "illegal MV code at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "illegal MV code at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if (code == mv->n) {
......
......@@ -51,7 +51,7 @@ typedef struct MsrleContext {
#define FETCH_NEXT_STREAM_BYTE() \
if (stream_ptr >= s->size) \
{ \
printf(" MS RLE: stream ptr just went out of bounds (1)\n"); \
av_log(s->avctx, AV_LOG_ERROR, " MS RLE: stream ptr just went out of bounds (1)\n"); \
return; \
} \
stream_byte = s->buf[stream_ptr++];
......@@ -90,14 +90,14 @@ static void msrle_decode_pal8(MsrleContext *s)
/* copy pixels from encoded stream */
if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
(row_ptr < 0)) {
printf(" MS RLE: frame ptr just went out of bounds (1)\n");
av_log(s->avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
return;
}
rle_code = stream_byte;
extra_byte = stream_byte & 0x01;
if (stream_ptr + rle_code + extra_byte > s->size) {
printf(" MS RLE: stream ptr just went out of bounds (2)\n");
av_log(s->avctx, AV_LOG_ERROR, " MS RLE: stream ptr just went out of bounds (2)\n");
return;
}
......@@ -115,7 +115,7 @@ static void msrle_decode_pal8(MsrleContext *s)
/* decode a run of data */
if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
(row_ptr < 0)) {
printf(" MS RLE: frame ptr just went out of bounds (2)\n");
av_log(s->avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (2)\n");
return;
}
......@@ -137,7 +137,7 @@ static void msrle_decode_pal8(MsrleContext *s)
/* one last sanity check on the way out */
if (stream_ptr < s->size)
printf(" MS RLE: ended frame decode with bytes left over (%d < %d)\n",
av_log(s->avctx, AV_LOG_ERROR, " MS RLE: ended frame decode with bytes left over (%d < %d)\n",
stream_ptr, s->size);
}
......@@ -165,12 +165,12 @@ static int msrle_decode_frame(AVCodecContext *avctx,
s->frame.reference = 1;
if (avctx->get_buffer(avctx, &s->frame)) {
printf (" MS RLE: get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, " MS RLE: get_buffer() failed\n");
return -1;
}
if (s->prev_frame.data[0] && (s->frame.linesize[0] != s->prev_frame.linesize[0]))
printf (" MS RLE: Buffer linesize changed: current %u, previous %u.\n"
av_log(avctx, AV_LOG_ERROR, " MS RLE: Buffer linesize changed: current %u, previous %u.\n"
" Expect wrong image and/or crash!\n",
s->frame.linesize[0], s->prev_frame.linesize[0]);
......
......@@ -42,7 +42,7 @@
#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
#define CHECK_STREAM_PTR(n) \
if ((stream_ptr + n) > s->size ) { \
printf (" MS Video-1 warning: stream_ptr out of bounds (%d >= %d)\n", \
av_log(s->avctx, AV_LOG_ERROR, " MS Video-1 warning: stream_ptr out of bounds (%d >= %d)\n", \
stream_ptr + n, s->size); \
return; \
}
......@@ -322,12 +322,12 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
s->size = buf_size;
if (avctx->get_buffer(avctx, &s->frame)) {
printf (" MS Video-1 Video: get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, " MS Video-1 Video: get_buffer() failed\n");
return -1;
}
if (s->prev_frame.data[0] &&(s->frame.linesize[0] != s->prev_frame.linesize[0]))
printf (" MS Video-1: Buffer linesize changed: current %u, previous %u.\n"
av_log(avctx, AV_LOG_ERROR, " MS Video-1: Buffer linesize changed: current %u, previous %u.\n"
" Expect wrong image and/or crash!\n",
s->frame.linesize[0], s->prev_frame.linesize[0]);
......
......@@ -47,7 +47,7 @@ static int oggvorbis_encode_init(AVCodecContext *avccontext) {
vorbis_info_init(&context->vi) ;
if(oggvorbis_init_encoder(&context->vi, avccontext) < 0) {
fprintf(stderr, "oggvorbis_encode_init: init_encoder failed") ;
av_log(avccontext, AV_LOG_ERROR, "oggvorbis_encode_init: init_encoder failed") ;
return -1 ;
}
vorbis_analysis_init(&context->vd, &context->vi) ;
......@@ -112,7 +112,7 @@ static int oggvorbis_encode_close(AVCodecContext *avccontext) {
/* We need to write all the remaining packets into the stream
* on closing */
fprintf(stderr, "fixme: not all packets written on oggvorbis_encode_close()\n") ;
av_log(avccontext, AV_LOG_ERROR, "fixme: not all packets written on oggvorbis_encode_close()\n") ;
/*
while(vorbis_bitrate_flushpacket(&context->vd, &op)) {
......@@ -195,7 +195,7 @@ static int oggvorbis_decode_frame(AVCodecContext *avccontext,
}
if(op->packetno == 3) {
fprintf(stderr, "vorbis_decode: %d channel, %ldHz, encoder `%s'\n",
av_log(avccontext, AV_LOG_ERROR, "vorbis_decode: %d channel, %ldHz, encoder `%s'\n",
context->vi.channels, context->vi.rate, context->vc.vendor);
avccontext->channels = context->vi.channels ;
......
......@@ -89,7 +89,7 @@ static int parse_double(const AVOption *c, char *s, double *var)
d = atof(s);
if (c->min != c->max) {
if (d < c->min || d > c->max) {
fprintf(stderr, "Option: %s double value: %f out of range <%f, %f>\n",
av_log(NULL, AV_LOG_ERROR, "Option: %s double value: %f out of range <%f, %f>\n",
c->name, d, c->min, c->max);
return -1;
}
......@@ -106,7 +106,7 @@ static int parse_int(const AVOption* c, char* s, int* var)
i = atoi(s);
if (c->min != c->max) {
if (i < (int)c->min || i > (int)c->max) {
fprintf(stderr, "Option: %s integer value: %d out of range <%d, %d>\n",
av_log(NULL, AV_LOG_ERROR, "Option: %s integer value: %d out of range <%d, %d>\n",
c->name, i, (int)c->min, (int)c->max);
return -1;
}
......@@ -136,7 +136,7 @@ static int parse_string(const AVOption *c, char *s, void* strct, char **var)
//printf("parsed Rc: %d,%d,%d,%f (%d)\n", sf,ef,qs,qf, avctx->rc_override_count);
} else {
printf("incorrect/unparsable Rc: \"%s\"\n", s);
av_log(NULL, AV_LOG_ERROR, "incorrect/unparsable Rc: \"%s\"\n", s);
}
} else
*var = av_strdup(s);
......
......@@ -244,7 +244,7 @@ static int ra288_decode_frame(AVCodecContext * avctx,
int i,j;
if(buf_size<w*h)
{
fprintf(stderr,"ffra288: Error! Input buffer is too small [%d<%d]\n",buf_size,w*h);
av_log(avctx, AV_LOG_ERROR, "ffra288: Error! Input buffer is too small [%d<%d]\n",buf_size,w*h);
return 0;
}
datao = data;
......@@ -260,7 +260,7 @@ static int ra288_decode_frame(AVCodecContext * avctx,
}
else
{
fprintf(stderr,"ffra288: Error: need extra data!!!\n");
av_log(avctx, AV_LOG_ERROR, "ffra288: Error: need extra data!!!\n");
return 0;
}
}
......
......@@ -109,7 +109,7 @@ int ff_rate_control_init(MpegEncContext *s)
&rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits,
&rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, &rce->i_count);
if(e!=12){
fprintf(stderr, "statistics are damaged at line %d, parser out=%d\n", i, e);
av_log(s->avctx, AV_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e);
return -1;
}
p= next;
......@@ -183,14 +183,14 @@ void ff_rate_control_uninit(MpegEncContext *s)
static inline double qp2bits(RateControlEntry *rce, double qp){
if(qp<=0.0){
fprintf(stderr, "qp<=0.0\n");
av_log(NULL, AV_LOG_ERROR, "qp<=0.0\n");
}
return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ qp;
}
static inline double bits2qp(RateControlEntry *rce, double bits){
if(bits<0.9){
fprintf(stderr, "bits<0.9\n");
av_log(NULL, AV_LOG_ERROR, "bits<0.9\n");
}
return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ bits;
}
......@@ -213,9 +213,9 @@ static void update_rc_buffer(MpegEncContext *s, int frame_size){
}
if(rcc->buffer_index < 0)
fprintf(stderr, "rc buffer underflow\n");
av_log(s->avctx, AV_LOG_ERROR, "rc buffer underflow\n");
if(rcc->buffer_index >= s->avctx->rc_buffer_size)
fprintf(stderr, "rc buffer overflow\n");
av_log(s->avctx, AV_LOG_ERROR, "rc buffer overflow\n");
}
}
......@@ -667,7 +667,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s)
}
if(s->avctx->debug&FF_DEBUG_RC){
printf("%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f size:%d var:%d/%d br:%d fps:%d\n",
av_log(s->avctx, AV_LOG_DEBUG, "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f size:%d var:%d/%d br:%d fps:%d\n",
av_get_pict_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits/1000, (int)s->total_bits/1000,
br_compensation, short_term_q, s->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, s->bit_rate/1000, (int)fps
);
......@@ -732,7 +732,7 @@ static int init_pass2(MpegEncContext *s)
all_const_bits= const_bits[I_TYPE] + const_bits[P_TYPE] + const_bits[B_TYPE];
if(all_available_bits < all_const_bits){
fprintf(stderr, "requested bitrate is to low\n");
av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is to low\n");
return -1;
}
......@@ -823,7 +823,7 @@ static int init_pass2(MpegEncContext *s)
av_free(blured_qscale);
if(abs(expected_bits/all_available_bits - 1.0) > 0.01 ){
fprintf(stderr, "Error: 2pass curve failed to converge\n");
av_log(s->avctx, AV_LOG_ERROR, "Error: 2pass curve failed to converge\n");
return -1;
}
......
......@@ -243,14 +243,14 @@ ReSampleContext *audio_resample_init(int output_channels, int input_channels,
if ( input_channels > 2)
{
printf("Resampling with input channels greater than 2 unsupported.");
av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.");
return NULL;
}
s = av_mallocz(sizeof(ReSampleContext));
if (!s)
{
printf("Can't allocate memory for resample context.");
av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.");
return NULL;
}
......
......@@ -411,7 +411,7 @@ static void roqvideo_decode_frame(RoqContext *ri)
}
break;
default:
printf("Unknown vq code: %d\n", vqid);
av_log(ri->avctx, AV_LOG_ERROR, "Unknown vq code: %d\n", vqid);
}
}
......@@ -453,7 +453,7 @@ static int roq_decode_frame(AVCodecContext *avctx,
*data_size = 0;
if (avctx->get_buffer(avctx, &s->current_frame)) {
printf (" RoQ: get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, " RoQ: get_buffer() failed\n");
return -1;
}
s->y_stride = s->current_frame.linesize[0];
......
......@@ -71,7 +71,7 @@ typedef struct RpzaContext {
total_blocks--; \
if (total_blocks < 0) \
{ \
printf("warning: block counter just went negative (this should not happen)\n"); \
av_log(s->avctx, AV_LOG_ERROR, "warning: block counter just went negative (this should not happen)\n"); \
return; \
} \
}
......@@ -100,7 +100,7 @@ static void rpza_decode_stream(RpzaContext *s)
/* First byte is always 0xe1. Warn if it's different */
if (s->buf[stream_ptr] != 0xe1)
printf("First chunk byte is 0x%02x instead of 0x1e\n",
av_log(s->avctx, AV_LOG_ERROR, "First chunk byte is 0x%02x instead of 0x1e\n",
s->buf[stream_ptr]);
/* Get chunk size, ingnoring first byte */
......@@ -109,7 +109,7 @@ static void rpza_decode_stream(RpzaContext *s)
/* If length mismatch use size from MOV file and try to decode anyway */
if (chunk_size != s->size)
printf("MOV chunk size != encoded chunk size; using MOV chunk size\n");
av_log(s->avctx, AV_LOG_ERROR, "MOV chunk size != encoded chunk size; using MOV chunk size\n");
chunk_size = s->size;
......@@ -236,7 +236,7 @@ static void rpza_decode_stream(RpzaContext *s)
/* Unknown opcode */
default:
printf("Unknown opcode %d in rpza chunk."
av_log(s->avctx, AV_LOG_ERROR, "Unknown opcode %d in rpza chunk."
" Skip remaining %d bytes of chunk data.\n", opcode,
chunk_size - stream_ptr);
return;
......@@ -269,7 +269,7 @@ static int rpza_decode_frame(AVCodecContext *avctx,
s->frame.reference = 1;
if (avctx->get_buffer(avctx, &s->frame)) {
printf (" RPZA Video: get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, " RPZA Video: get_buffer() failed\n");
return -1;
}
......
......@@ -216,7 +216,7 @@ int rv_decode_dc(MpegEncContext *s, int n)
get_bits(&s->gb, 9);
code = 1;
} else {
fprintf(stderr, "chroma dc error\n");
av_log(s->avctx, AV_LOG_ERROR, "chroma dc error\n");
return 0xffff;
}
} else {
......@@ -286,7 +286,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
else
s->pict_type = I_TYPE;
//printf("h:%X ver:%d\n",h,s->rv10_version);
if(!marker) printf("marker missing\n");
if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
pb_frame = get_bits(&s->gb, 1);
#ifdef DEBUG
......@@ -294,13 +294,13 @@ static int rv10_decode_picture_header(MpegEncContext *s)
#endif
if (pb_frame){
fprintf(stderr, "pb frame not supported\n");
av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n");
return -1;
}
s->qscale = get_bits(&s->gb, 5);
if(s->qscale==0){
fprintf(stderr, "error, qscale:0\n");
av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n");
return -1;
}
......@@ -363,7 +363,7 @@ static int rv10_decode_init(AVCodecContext *avctx)
s->h263_long_vectors=0;
break;
default:
fprintf(stderr, "unknown header %X\n", avctx->sub_id);
av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
}
//printf("ver:%X\n", avctx->sub_id);
s->flags= avctx->flags;
......@@ -411,19 +411,19 @@ static int rv10_decode_packet(AVCodecContext *avctx,
mb_count = rv10_decode_picture_header(s);
if (mb_count < 0) {
fprintf(stderr, "HEADER ERROR\n");
av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n");
return -1;
}
if (s->mb_x >= s->mb_width ||
s->mb_y >= s->mb_height) {
fprintf(stderr, "POS ERROR %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "POS ERROR %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_pos = s->mb_y * s->mb_width + s->mb_x;
left = s->mb_width * s->mb_height - mb_pos;
if (mb_count > left) {
fprintf(stderr, "COUNT ERROR\n");
av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n");
return -1;
}
......@@ -463,7 +463,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
if (ff_h263_decode_mb(s, s->block) == SLICE_ERROR) {
fprintf(stderr, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
ff_h263_update_motion_val(s);
......
......@@ -613,7 +613,7 @@ static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
svq1_parse_string (bitbuf, (char *) msg);
printf ("embedded message: \"%s\"\n", (char *) msg);
av_log(s->avctx, AV_LOG_INFO, "embedded message: \"%s\"\n", (char *) msg);
}
skip_bits (bitbuf, 2);
......
......@@ -690,7 +690,7 @@ static int svq3_decode_slice_header (H264Context *h) {
if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
/* TODO: what? */
fprintf (stderr, "unsupported slice header (%02X)\n", header);
av_log(h->s.avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header);
return -1;
} else {
int length = (header >> 5) & 3;
......@@ -841,7 +841,7 @@ static int svq3_decode_frame (AVCodecContext *avctx,
s->picture_number = h->slice_num;
if(avctx->debug&FF_DEBUG_PICT_INFO){
printf("%c hpel:%d, tpel:%d aqp:%d qp:%d\n",
av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d\n",
av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
s->adaptive_quant, s->qscale
);
......@@ -874,7 +874,7 @@ static int svq3_decode_frame (AVCodecContext *avctx,
h->frame_num_offset += 256;
}
if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
printf ("error in B-frame picture id\n");
av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
return -1;
}
} else {
......@@ -920,7 +920,7 @@ static int svq3_decode_frame (AVCodecContext *avctx,
mb_type += 4;
}
if (mb_type > 33 || svq3_decode_mb (h, mb_type)) {
fprintf (stderr, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
......
/*
* utils for libavcodec
* Copyright (c) 2001 Fabrice Bellard.
* Copyright (c) 2003 Michel Bardiaux for the av_log API
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -25,6 +26,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
#include <stdarg.h>
void *av_mallocz(unsigned int size)
{
......@@ -766,3 +768,52 @@ int64_t av_rescale(int64_t a, int b, int c){
return ((h/c)<<32) + l/c;
}
/* av_log API */
#ifdef AV_LOG_TRAP_PRINTF
#undef stderr
#undef fprintf
#endif
static int av_log_level = AV_LOG_DEBUG;
static void av_log_default_callback(AVCodecContext* avctx, int level, const char* fmt, va_list vl)
{
if(level>av_log_level)
return;
if(avctx)
fprintf(stderr, "[%s @ %p]", avctx->codec->name, avctx);
vfprintf(stderr, fmt, vl);
}
static void (*av_log_callback)(AVCodecContext*, int, const char*, va_list) = av_log_default_callback;
void av_log(AVCodecContext* avctx, int level, const char *fmt, ...)
{
va_list vl;
va_start(vl, fmt);
av_vlog(avctx, level, fmt, vl);
va_end(vl);
}
void av_vlog(AVCodecContext* avctx, int level, const char *fmt, va_list vl)
{
av_log_callback(avctx, level, fmt, vl);
}
int av_log_get_level(void)
{
return av_log_level;
}
void av_log_set_level(int level)
{
av_log_level = level;
}
void av_log_set_callback(void (*callback)(AVCodecContext*, int, const char*, va_list))
{
av_log_callback = callback;
}
......@@ -57,7 +57,7 @@ static int decode_frame(AVCodecContext *avctx,
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n");
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
p->pict_type= I_TYPE;
......
......@@ -1109,7 +1109,7 @@ static void unpack_token(GetBitContext *gb, int token, int *zero_run,
break;
default:
printf (" vp3: help! Got a bad token: %d > 31\n", token);
av_log(NULL, AV_LOG_ERROR, " vp3: help! Got a bad token: %d > 31\n", token);
break;
}
......@@ -1549,7 +1549,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
/* if the fragment is in bounds, check its coding status */
current_fragment = s->superblock_fragments[i * 16 + j];
if (current_fragment >= s->fragment_count) {
printf (" vp3:unpack_superblocks(): bad fragment number (%d >= %d)\n",
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_superblocks(): bad fragment number (%d >= %d)\n",
current_fragment, s->fragment_count);
return 1;
}
......@@ -1685,7 +1685,7 @@ static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
(s->macroblock_coding[current_macroblock] == MODE_COPY))
continue;
if (current_macroblock >= s->macroblock_count) {
printf (" vp3:unpack_modes(): bad macroblock number (%d >= %d)\n",
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_modes(): bad macroblock number (%d >= %d)\n",
current_macroblock, s->macroblock_count);
return 1;
}
......@@ -1703,7 +1703,7 @@ static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
if (current_fragment == -1)
continue;
if (current_fragment >= s->fragment_count) {
printf (" vp3:unpack_modes(): bad fragment number (%d >= %d)\n",
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_modes(): bad fragment number (%d >= %d)\n",
current_fragment, s->fragment_count);
return 1;
}
......@@ -1764,14 +1764,14 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
(s->macroblock_coding[current_macroblock] == MODE_COPY))
continue;
if (current_macroblock >= s->macroblock_count) {
printf (" vp3:unpack_vectors(): bad macroblock number (%d >= %d)\n",
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad macroblock number (%d >= %d)\n",
current_macroblock, s->macroblock_count);
return 1;
}
current_fragment = s->macroblock_fragments[current_macroblock * 6];
if (current_fragment >= s->fragment_count) {
printf (" vp3:unpack_vectors(): bad fragment number (%d >= %d\n",
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad fragment number (%d >= %d\n",
current_fragment, s->fragment_count);
return 1;
}
......@@ -1887,7 +1887,7 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
if (current_fragment == -1)
continue;
if (current_fragment >= s->fragment_count) {
printf (" vp3:unpack_vectors(): bad fragment number (%d >= %d)\n",
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad fragment number (%d >= %d)\n",
current_fragment, s->fragment_count);
return 1;
}
......@@ -1929,7 +1929,7 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
if ((first_fragment >= s->fragment_count) ||
(last_fragment >= s->fragment_count)) {
printf (" vp3:unpack_vlcs(): bad fragment number (%d -> %d ?)\n",
av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vlcs(): bad fragment number (%d -> %d ?)\n",
first_fragment, last_fragment);
return 0;
}
......@@ -2393,7 +2393,7 @@ static void render_fragments(Vp3DecodeContext *s,
for (x = 0; x < width; x += 8, i++) {
if ((i < 0) || (i >= s->fragment_count)) {
printf (" vp3:render_fragments(): bad fragment number (%d)\n", i);
av_log(s->avctx, AV_LOG_ERROR, " vp3:render_fragments(): bad fragment number (%d)\n", i);
return;
}
......@@ -2424,7 +2424,7 @@ static void render_fragments(Vp3DecodeContext *s,
src_x= (motion_x>>1) + x;
src_y= (motion_y>>1) + y;
if ((motion_x == 0xbeef) || (motion_y == 0xbeef))
printf (" help! got beefy vector! (%X, %X)\n", motion_x, motion_y);
av_log(s->avctx, AV_LOG_ERROR, " help! got beefy vector! (%X, %X)\n", motion_x, motion_y);
motion_halfpel_index = motion_x & 0x01;
motion_source += (motion_x >> 1);
......@@ -2704,7 +2704,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
if (s->theora && get_bits1(&gb))
{
printf("Theora: bad frame indicator\n");
av_log(s->avctx, AV_LOG_ERROR, "Theora: bad frame indicator\n");
return -1;
}
......@@ -2712,7 +2712,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
if (s->theora && s->keyframe)
{
if (get_bits1(&gb))
printf("Theora: warning, unsupported keyframe coding type?!\n");
av_log(s->avctx, AV_LOG_ERROR, "Theora: warning, unsupported keyframe coding type?!\n");
skip_bits(&gb, 2); /* reserved? */
}
else
......@@ -2743,7 +2743,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
s->golden_frame.reference = 3;
if(avctx->get_buffer(avctx, &s->golden_frame) < 0) {
printf("vp3: get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
return -1;
}
......@@ -2758,7 +2758,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
/* allocate a new current frame */
s->current_frame.reference = 3;
if(avctx->get_buffer(avctx, &s->current_frame) < 0) {
printf("vp3: get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
return -1;
}
}
......@@ -2786,7 +2786,7 @@ if (!s->keyframe) {
unpack_vectors(s, &gb) ||
unpack_dct_coeffs(s, &gb)) {
printf(" vp3: could not decode frame\n");
av_log(s->avctx, AV_LOG_ERROR, " vp3: could not decode frame\n");
return -1;
}
......
......@@ -155,7 +155,7 @@ static int vqa_decode_init(AVCodecContext *avctx)
/* make sure the extradata made it */
if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
printf(" VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
av_log(s->avctx, AV_LOG_ERROR, " VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
return -1;
}
......@@ -206,8 +206,8 @@ static int vqa_decode_init(AVCodecContext *avctx)
#define CHECK_COUNT() \
if (dest_index + count > dest_size) { \
printf (" VQA video: decode_format80 problem: next op would overflow dest_index\n"); \
printf (" VQA video: current dest_index = %d, count = %d, dest_size = %d\n", \
av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: next op would overflow dest_index\n"); \
av_log(NULL, AV_LOG_ERROR, " VQA video: current dest_index = %d, count = %d, dest_size = %d\n", \
dest_index, count, dest_size); \
return; \
}
......@@ -231,7 +231,7 @@ static void decode_format80(unsigned char *src, int src_size,
return;
if (dest_index >= dest_size) {
printf (" VQA video: decode_format80 problem: dest_index (%d) exceeded dest_size (%d)\n",
av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: dest_index (%d) exceeded dest_size (%d)\n",
dest_index, dest_size);
return;
}
......@@ -299,7 +299,7 @@ static void decode_format80(unsigned char *src, int src_size,
* not every entry needs to be filled */
if (check_size)
if (dest_index < dest_size)
printf (" VQA video: decode_format80 problem: decode finished with dest_index (%d) < dest_size (%d)\n",
av_log(NULL, AV_LOG_ERROR, " VQA video: decode_format80 problem: decode finished with dest_index (%d) < dest_size (%d)\n",
dest_index, dest_size);
}
......@@ -367,7 +367,7 @@ static void vqa_decode_chunk(VqaContext *s)
break;
default:
printf (" VQA video: Found unknown chunk type: %c%c%c%c (%08X)\n",
av_log(s->avctx, AV_LOG_ERROR, " VQA video: Found unknown chunk type: %c%c%c%c (%08X)\n",
(chunk_type >> 24) & 0xFF,
(chunk_type >> 16) & 0xFF,
(chunk_type >> 8) & 0xFF,
......@@ -384,7 +384,7 @@ static void vqa_decode_chunk(VqaContext *s)
if ((cpl0_chunk != -1) && (cplz_chunk != -1)) {
/* a chunk should not have both chunk types */
printf (" VQA video: problem: found both CPL0 and CPLZ chunks\n");
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CPL0 and CPLZ chunks\n");
return;
}
......@@ -401,7 +401,7 @@ static void vqa_decode_chunk(VqaContext *s)
chunk_size = BE_32(&s->buf[cpl0_chunk + 4]);
/* sanity check the palette size */
if (chunk_size / 3 > 256) {
printf (" VQA video: problem: found a palette chunk with %d colors\n",
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found a palette chunk with %d colors\n",
chunk_size / 3);
return;
}
......@@ -419,7 +419,7 @@ static void vqa_decode_chunk(VqaContext *s)
if ((cbf0_chunk != -1) && (cbfz_chunk != -1)) {
/* a chunk should not have both chunk types */
printf (" VQA video: problem: found both CBF0 and CBFZ chunks\n");
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CBF0 and CBFZ chunks\n");
return;
}
......@@ -438,7 +438,7 @@ static void vqa_decode_chunk(VqaContext *s)
chunk_size = BE_32(&s->buf[cbf0_chunk + 4]);
/* sanity check the full codebook size */
if (chunk_size > MAX_CODEBOOK_SIZE) {
printf (" VQA video: problem: CBF0 chunk too large (0x%X bytes)\n",
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: CBF0 chunk too large (0x%X bytes)\n",
chunk_size);
return;
}
......@@ -451,7 +451,7 @@ static void vqa_decode_chunk(VqaContext *s)
if (vptz_chunk == -1) {
/* something is wrong if there is no VPTZ chunk */
printf (" VQA video: problem: no VPTZ chunk found\n");
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: no VPTZ chunk found\n");
return;
}
......@@ -508,7 +508,7 @@ static void vqa_decode_chunk(VqaContext *s)
/* handle partial codebook */
if ((cbp0_chunk != -1) && (cbpz_chunk != -1)) {
/* a chunk should not have both chunk types */
printf (" VQA video: problem: found both CBP0 and CBPZ chunks\n");
av_log(s->avctx, AV_LOG_ERROR, " VQA video: problem: found both CBP0 and CBPZ chunks\n");
return;
}
......@@ -573,7 +573,7 @@ static int vqa_decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->frame);
if (avctx->get_buffer(avctx, &s->frame)) {
printf (" VQA Video: get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, " VQA Video: get_buffer() failed\n");
return -1;
}
......
......@@ -338,7 +338,7 @@ static int decode_ext_header(Wmv2Context *w){
s->slice_height = s->mb_height / code;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n",
av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n",
fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, w->flag3,
code);
}
......@@ -366,7 +366,7 @@ return -1;
s->pict_type = get_bits(&s->gb, 1) + 1;
if(s->pict_type == I_TYPE){
code = get_bits(&s->gb, 7);
printf("I7:%X/\n", code);
av_log(s->avctx, AV_LOG_ERROR, "I7:%X/\n", code);
}
s->qscale = get_bits(&s->gb, 5);
if(s->qscale < 0)
......@@ -397,7 +397,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)
s->inter_intra_pred= 0;
s->no_rounding = 1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
s->qscale,
s->rl_chroma_table_index,
s->rl_table_index,
......@@ -447,7 +447,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)
s->no_rounding ^= 1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
av_log(s->avctx, AV_LOG_DEBUG, "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
s->rl_table_index,
s->rl_chroma_table_index,
s->dc_table_index,
......@@ -471,7 +471,7 @@ s->picture_number++; //FIXME ?
// return wmv2_decode_j_picture(w); //FIXME
if(w->j_type){
printf("J-type picture isnt supported\n");
av_log(s->avctx, AV_LOG_ERROR, "J-type picture isnt supported\n");
return -1;
}
......@@ -604,7 +604,7 @@ static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int st
memset(w->abt_block2[n], 0, 64*sizeof(DCTELEM));
break;
default:
fprintf(stderr, "internal error in WMV2 abt\n");
av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n");
}
}
......@@ -738,7 +738,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
s->mb_intra = 1;
code = get_vlc2(&s->gb, mb_intra_vlc.table, MB_INTRA_VLC_BITS, 2);
if (code < 0){
fprintf(stderr, "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
av_log(s->avctx, AV_LOG_ERROR, "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
/* predict coded block pattern */
......@@ -784,7 +784,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
for (i = 0; i < 6; i++) {
if (wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1) < 0)
{
fprintf(stderr,"\nerror while decoding inter block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding inter block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1;
}
}
......@@ -805,7 +805,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
for (i = 0; i < 6; i++) {
if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
{
fprintf(stderr,"\nerror while decoding intra block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding intra block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
return -1;
}
}
......
......@@ -116,7 +116,7 @@ static int xan_decode_init(AVCodecContext *avctx)
if ((avctx->codec->id == CODEC_ID_XAN_WC3) &&
(s->avctx->palctrl == NULL)) {
printf (" WC3 Xan video: palette expected.\n");
av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n");
return -1;
}
......@@ -336,7 +336,7 @@ static void inline xan_wc3_build_palette(XanContext *s,
break;
default:
printf (" Xan WC3: Unhandled colorspace\n");
av_log(s->avctx, AV_LOG_ERROR, " Xan WC3: Unhandled colorspace\n");
break;
}
}
......@@ -457,7 +457,7 @@ static void inline xan_wc3_output_pixel_run(XanContext *s,
break;
default:
printf (" Xan WC3: Unhandled colorspace\n");
av_log(s->avctx, AV_LOG_ERROR, " Xan WC3: Unhandled colorspace\n");
break;
}
}
......@@ -600,7 +600,7 @@ static void inline xan_wc3_copy_pixel_run(XanContext *s,
break;
default:
printf (" Xan WC3: Unhandled colorspace\n");
av_log(s->avctx, AV_LOG_ERROR, " Xan WC3: Unhandled colorspace\n");
break;
}
}
......@@ -761,7 +761,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
}
if (avctx->get_buffer(avctx, &s->current_frame)) {
printf (" Xan Video: get_buffer() failed\n");
av_log(s->avctx, AV_LOG_ERROR, " Xan Video: get_buffer() failed\n");
return -1;
}
s->current_frame.reference = 3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment