changeset 3177:8d1b2cc2a75b libavcodec

(f)printf --> av_log conversion taken from a patch by Steve L'Homme
author diego
date Wed, 08 Mar 2006 11:43:10 +0000
parents babf844e1308
children bd995b8c64fd
files h261.c h263dec.c h264.c huffyuv.c motion_est.c mpeg12.c mpegaudiodec.c msmpeg4.c png.c rv10.c
diffstat 10 files changed, 49 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/h261.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/h261.c	Wed Mar 08 11:43:10 2006 +0000
@@ -921,8 +921,8 @@
     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;
--- a/h263dec.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/h263dec.c	Wed Mar 08 11:43:10 2006 +0000
@@ -694,7 +694,7 @@
         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 @@
     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);
--- a/h264.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/h264.c	Wed Mar 08 11:43:10 2006 +0000
@@ -6977,7 +6977,7 @@
             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;
--- a/huffyuv.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/huffyuv.c	Wed Mar 08 11:43:10 2006 +0000
@@ -343,7 +343,7 @@
 
     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
 }
--- a/motion_est.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/motion_est.c	Wed Mar 08 11:43:10 2006 +0000
@@ -365,7 +365,7 @@
 #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;
--- a/mpeg12.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/mpeg12.c	Wed Mar 08 11:43:10 2006 +0000
@@ -2789,7 +2789,7 @@
         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 @@
         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++) {
--- a/mpegaudiodec.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/mpegaudiodec.c	Wed Mar 08 11:43:10 2006 +0000
@@ -489,10 +489,10 @@
 
 #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 @@
     }
 
 #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 @@
     {
         for(ch=0;ch<s->nb_channels;ch++) {
             for(i=0;i<sblimit;i++)
-                printf(" %d", bit_alloc[ch][i]);
-            printf("\n");
+                dprintf(" %d", bit_alloc[ch][i]);
+            dprintf("\n");
         }
     }
 #endif
@@ -1421,12 +1421,12 @@
         for(i=0;i<sblimit;i++) {
             if (bit_alloc[ch][i]) {
                 sf = scale_factors[ch][i];
-                printf(" %d %d %d", sf[0], sf[1], sf[2]);
+                dprintf(" %d %d %d", sf[0], sf[1], sf[2]);
             } else {
-                printf(" -");
+                dprintf(" -");
             }
         }
-        printf("\n");
+        dprintf("\n");
     }
 #endif
 
@@ -2285,11 +2285,11 @@
                 }
 #if defined(DEBUG)
                 {
-                    printf("scfsi=%x gr=%d ch=%d scale_factors:\n",
+                    dprintf("scfsi=%x gr=%d ch=%d scale_factors:\n",
                            g->scfsi, gr, ch);
                     for(i=0;i<j;i++)
-                        printf(" %d", g->scale_factors[i]);
-                    printf("\n");
+                        dprintf(" %d", g->scale_factors[i]);
+                    dprintf("\n");
                 }
 #endif
             } else {
@@ -2342,11 +2342,11 @@
                     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 @@
     for(i=0;i<nb_frames;i++) {
         for(ch=0;ch<s->nb_channels;ch++) {
             int j;
-            printf("%d-%d:", i, ch);
+            dprintf("%d-%d:", i, ch);
             for(j=0;j<SBLIMIT;j++)
-                printf(" %0.6f", (double)s->sb_samples[ch][i][j] / FRAC_ONE);
-            printf("\n");
+                dprintf(" %0.6f", (double)s->sb_samples[ch][i][j] / FRAC_ONE);
+            dprintf("\n");
         }
     }
 #endif
--- a/msmpeg4.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/msmpeg4.c	Wed Mar 08 11:43:10 2006 +0000
@@ -434,7 +434,7 @@
 
 #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 @@
 #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 i;
 for(i=0; i<s->gb.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 @@
     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 @@
                         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 @@
                     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
--- a/png.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/png.c	Wed Mar 08 11:43:10 2006 +0000
@@ -507,7 +507,7 @@
         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 @@
             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 @@
                     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];
--- a/rv10.c	Wed Mar 08 09:26:57 2006 +0000
+++ b/rv10.c	Wed Mar 08 11:43:10 2006 +0000
@@ -321,7 +321,7 @@
     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 @@
             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 @@
     }
 
 #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 @@
         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 @@
     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 */