From 267f7edcd1f1f31595610b4de29a8c4d3e7929c5 Mon Sep 17 00:00:00 2001 From: Steve L'Homme Date: Wed, 8 Mar 2006 11:43:10 +0000 Subject: (f)printf --> av_log conversion taken from a patch by Steve L'Homme Originally committed as revision 5127 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/h261.c | 4 ++-- libavcodec/h263dec.c | 4 ++-- libavcodec/h264.c | 2 +- libavcodec/huffyuv.c | 2 +- libavcodec/motion_est.c | 2 +- libavcodec/mpeg12.c | 4 ++-- libavcodec/mpegaudiodec.c | 46 +++++++++++++++++++++++----------------------- libavcodec/msmpeg4.c | 18 +++++++++--------- libavcodec/png.c | 6 +++--- libavcodec/rv10.c | 10 +++++----- libavformat/dv1394.c | 4 ++-- 11 files changed, 51 insertions(+), 51 deletions(-) diff --git a/libavcodec/h261.c b/libavcodec/h261.c index c6218c8b9d..96b5af1f64 100644 --- a/libavcodec/h261.c +++ b/libavcodec/h261.c @@ -921,8 +921,8 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict = data; #ifdef DEBUG - printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); - printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); + av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size); + av_log(avctx, AV_LOG_DEBUG, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); #endif s->flags= avctx->flags; s->flags2= avctx->flags2; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index ac22bca8ef..91caa48e55 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -694,7 +694,7 @@ retry: return -1; #ifdef DEBUG - printf("qscale=%d\n", s->qscale); + av_log(avctx, AV_LOG_DEBUG, "qscale=%d\n", s->qscale); #endif ff_er_frame_start(s); @@ -783,7 +783,7 @@ assert(s->current_picture.pict_type == s->pict_type); if(s->last_picture_ptr || s->low_delay) *data_size = sizeof(AVFrame); #ifdef PRINT_FRAME_TIME -printf("%Ld\n", rdtsc()-time); +av_log(avctx, AV_LOG_DEBUG, "%Ld\n", rdtsc()-time); #endif return get_consumed_bytes(s, buf_size); diff --git a/libavcodec/h264.c b/libavcodec/h264.c index b9f000f217..678a0d0694 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -6977,7 +6977,7 @@ static int decode_slice(H264Context *h){ hl_decode_mb(h); if(ret<0){ - fprintf(stderr, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); + av_log(s->avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); 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; diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index dc9e123ff4..dd5e8bee68 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -343,7 +343,7 @@ static int read_old_huffman_tables(HYuvContext *s){ return 0; #else - fprintf(stderr, "v1 huffyuv is not supported \n"); + av_log(s->avctx, AV_LOG_DEBUG, "v1 huffyuv is not supported \n"); return -1; #endif } diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 526773b897..0967b7bb84 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -365,7 +365,7 @@ static int full_motion_search(MpegEncContext * s, #if 0 if (*mx_ptr < -(2 * range) || *mx_ptr >= (2 * range) || *my_ptr < -(2 * range) || *my_ptr >= (2 * range)) { - fprintf(stderr, "error %d %d\n", *mx_ptr, *my_ptr); + av_log(NULL, AV_LOG_ERROR, "error %d %d\n", *mx_ptr, *my_ptr); } #endif return dmin; diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index de92fbbd6e..148523f06d 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2789,7 +2789,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, dprintf("intra matrix present\n"); for(i=0;i<64;i++) dprintf(" %d", s->intra_matrix[s->dsp.idct_permutation[i]]); - printf("\n"); + dprintf("\n"); #endif } else { for(i=0;i<64;i++) { @@ -2814,7 +2814,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, dprintf("non intra matrix present\n"); for(i=0;i<64;i++) dprintf(" %d", s->inter_matrix[s->dsp.idct_permutation[i]]); - printf("\n"); + dprintf("\n"); #endif } else { for(i=0;i<64;i++) { diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index ff1f1113e7..89b703dc56 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -489,10 +489,10 @@ static int decode_init(AVCodecContext * avctx) #if defined(DEBUG) for(j=0;j<8;j++) { - printf("win%d=\n", j); + av_log(avctx, AV_LOG_DEBUG, "win%d=\n", j); for(i=0;i<36;i++) - printf("%f, ", (double)mdct_win[j][i] / FRAC_ONE); - printf("\n"); + av_log(avctx, AV_LOG_DEBUG, "%f, ", (double)mdct_win[j][i] / FRAC_ONE); + av_log(avctx, AV_LOG_DEBUG, "\n"); } #endif init = 1; @@ -1179,20 +1179,20 @@ static int decode_header(MPADecodeContext *s, uint32_t header) } #if defined(DEBUG) - printf("layer%d, %d Hz, %d kbits/s, ", + dprintf("layer%d, %d Hz, %d kbits/s, ", s->layer, s->sample_rate, s->bit_rate); if (s->nb_channels == 2) { if (s->layer == 3) { if (s->mode_ext & MODE_EXT_MS_STEREO) - printf("ms-"); + dprintf("ms-"); if (s->mode_ext & MODE_EXT_I_STEREO) - printf("i-"); + dprintf("i-"); } - printf("stereo"); + dprintf("stereo"); } else { - printf("mono"); + dprintf("mono"); } - printf("\n"); + dprintf("\n"); #endif return 0; } @@ -1370,8 +1370,8 @@ static int mp_decode_layer2(MPADecodeContext *s) { for(ch=0;chnb_channels;ch++) { for(i=0;iscfsi, gr, ch); for(i=0;iscale_factors[i]); - printf("\n"); + dprintf(" %d", g->scale_factors[i]); + dprintf("\n"); } #endif } else { @@ -2342,11 +2342,11 @@ static int mp_decode_layer3(MPADecodeContext *s) g->scale_factors[j] = 0; #if defined(DEBUG) { - printf("gr=%d ch=%d scale_factors:\n", + dprintf("gr=%d ch=%d scale_factors:\n", gr, ch); for(i=0;i<40;i++) - printf(" %d", g->scale_factors[i]); - printf("\n"); + dprintf(" %d", g->scale_factors[i]); + dprintf("\n"); } #endif } @@ -2428,10 +2428,10 @@ static int mp_decode_frame(MPADecodeContext *s, for(i=0;inb_channels;ch++) { int j; - printf("%d-%d:", i, ch); + dprintf("%d-%d:", i, ch); for(j=0;jsb_samples[ch][i][j] / FRAC_ONE); - printf("\n"); + dprintf(" %0.6f", (double)s->sb_samples[ch][i][j] / FRAC_ONE); + dprintf("\n"); } } #endif diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 5bb7158e6f..1e351f7b75 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -434,7 +434,7 @@ void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number) #ifdef DEBUG intra_count = 0; - printf("*****frame %d:\n", frame_count++); + av_log(s->avctx, AV_LOG_DEBUG, "*****frame %d:\n", frame_count++); #endif } @@ -504,7 +504,7 @@ static void msmpeg4_encode_motion(MpegEncContext * s, #if 0 if ((unsigned)mx >= 64 || (unsigned)my >= 64) - fprintf(stderr, "error mx=%d my=%d\n", mx, my); + av_log(s->avctx, AV_LOG_ERROR, "error mx=%d my=%d\n", mx, my); #endif mv = &mv_tables[s->mv_table_index]; @@ -1214,9 +1214,9 @@ int msmpeg4_decode_picture_header(MpegEncContext * s) { int i; for(i=0; igb.size_in_bits; i++) - printf("%d", get_bits1(&s->gb)); + av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); // get_bits1(&s->gb); -printf("END\n"); +av_log(s->avctx, AV_LOG_DEBUG, "END\n"); return -1; } #endif @@ -1370,7 +1370,7 @@ return -1; s->esc3_run_length= 0; #ifdef DEBUG - printf("*****frame %d:\n", frame_count++); + av_log(s->avctx, AV_LOG_DEBUG, "*****frame %d:\n", frame_count++); #endif return 0; } @@ -1794,15 +1794,15 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, const int run1= run - rl->max_run[last][abs_level] - run_diff; if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ if(abs_level <= rl->max_level[last][run]){ - fprintf(stderr, "illegal 3. esc, vlc encoding possible\n"); + av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n"); return DECODING_AC_LOST; } if(abs_level <= rl->max_level[last][run]*2){ - fprintf(stderr, "illegal 3. esc, esc 1 encoding possible\n"); + av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n"); return DECODING_AC_LOST; } if(run1>=0 && abs_level <= rl->max_level[last][run1]){ - fprintf(stderr, "illegal 3. esc, esc 2 encoding possible\n"); + av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n"); return DECODING_AC_LOST; } } @@ -1813,7 +1813,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, else level= level * qmul - qadd; #if 0 // waste of time too :( if(level>2048 || level<-2048){ - fprintf(stderr, "|level| overflow in 3. esc\n"); + av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n"); return DECODING_AC_LOST; } #endif diff --git a/libavcodec/png.c b/libavcodec/png.c index 0491f5931c..c96638c2d8 100644 --- a/libavcodec/png.c +++ b/libavcodec/png.c @@ -507,7 +507,7 @@ static int decode_frame(AVCodecContext *avctx, tag32 = get32(&s->bytestream); tag = bswap_32(tag32); #ifdef DEBUG - printf("png: tag=%c%c%c%c length=%u\n", + av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n", (tag & 0xff), ((tag >> 8) & 0xff), ((tag >> 16) & 0xff), @@ -531,7 +531,7 @@ static int decode_frame(AVCodecContext *avctx, crc = get32(&s->bytestream); s->state |= PNG_IHDR; #ifdef DEBUG - printf("width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n", + av_log(avctx, AV_LOG_DEBUG, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n", s->width, s->height, s->bit_depth, s->color_type, s->compression_type, s->filter_type, s->interlace_type); #endif @@ -589,7 +589,7 @@ static int decode_frame(AVCodecContext *avctx, s->crow_size = s->pass_row_size + 1; } #ifdef DEBUG - printf("row_size=%d crow_size =%d\n", + av_log(avctx, AV_LOG_DEBUG, "row_size=%d crow_size =%d\n", s->row_size, s->crow_size); #endif s->image_buf = p->data[0]; diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 5dd942dc55..0b90cc2c18 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -321,7 +321,7 @@ static int rv10_decode_picture_header(MpegEncContext *s) pb_frame = get_bits(&s->gb, 1); #ifdef DEBUG - printf("pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); + av_log(s->avctx, AV_LOG_DEBUG, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); #endif if (pb_frame){ @@ -342,7 +342,7 @@ static int rv10_decode_picture_header(MpegEncContext *s) s->last_dc[1] = get_bits(&s->gb, 8); s->last_dc[2] = get_bits(&s->gb, 8); #ifdef DEBUG - printf("DC:%d %d %d\n", + av_log(s->avctx, AV_LOG_DEBUG, "DC:%d %d %d\n", s->last_dc[0], s->last_dc[1], s->last_dc[2]); @@ -631,7 +631,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, } #ifdef DEBUG - printf("qscale=%d\n", s->qscale); + av_log(avctx, AV_LOG_DEBUG, "qscale=%d\n", s->qscale); #endif /* default quantization values */ @@ -672,7 +672,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, int ret; ff_update_block_index(s); #ifdef DEBUG - printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); + av_log(avctx, AV_LOG_DEBUG, "**mb x=%d y=%d\n", s->mb_x, s->mb_y); #endif s->mv_dir = MV_DIR_FORWARD; @@ -713,7 +713,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict = data; #ifdef DEBUG - printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); + av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size); #endif /* no supplementary picture */ diff --git a/libavformat/dv1394.c b/libavformat/dv1394.c index 2d2a1f7809..96bbae145a 100644 --- a/libavformat/dv1394.c +++ b/libavformat/dv1394.c @@ -173,7 +173,7 @@ restart_poll: return AVERROR_IO; } #ifdef DV1394_DEBUG - fprintf(stderr, "DV1394: status\n" + av_log(context, AV_LOG_ERROR, "DV1394: status\n" "\tactive_frame\t%d\n" "\tfirst_clear_frame\t%d\n" "\tn_clear_frames\t%d\n" @@ -196,7 +196,7 @@ restart_poll: } #ifdef DV1394_DEBUG - fprintf(stderr, "index %d, avail %d, done %d\n", dv->index, dv->avail, + av_log(context, AV_LOG_ERROR, "index %d, avail %d, done %d\n", dv->index, dv->avail, dv->done); #endif -- cgit v1.2.3