changeset 9999:c78fd9154378 libavcodec

Change av_log() calls surrounded by '#ifdef DEBUG' into dprintf macros.
author diego
date Thu, 30 Jul 2009 21:00:08 +0000
parents 6b229807a182
children 334d727f7f7a
files ac3enc.c dvbsub_parser.c dvbsubdec.c dvdsubdec.c h261dec.c h263.c mjpegdec.c mpegaudioenc.c pngdec.c
diffstat 9 files changed, 42 insertions(+), 97 deletions(-) [+]
line wrap: on
line diff
--- a/ac3enc.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/ac3enc.c	Thu Jul 30 21:00:08 2009 +0000
@@ -250,9 +250,7 @@
     exp_strategy[0][ch] = EXP_NEW;
     for(i=1;i<NB_BLOCKS;i++) {
         exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], N/2);
-#ifdef DEBUG
-        av_log(NULL, AV_LOG_DEBUG, "exp_diff=%d\n", exp_diff);
-#endif
+        dprintf(NULL, "exp_diff=%d\n", exp_diff);
         if (exp_diff > EXP_DIFF_THRESHOLD)
             exp_strategy[i][ch] = EXP_NEW;
         else
--- a/dvbsub_parser.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/dvbsub_parser.c	Thu Jul 30 21:00:08 2009 +0000
@@ -55,10 +55,8 @@
     uint8_t *p, *p_end;
     int len, buf_pos = 0;
 
-#ifdef DEBUG
-    av_log(avctx, AV_LOG_INFO, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n",
+    dprintf(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n",
             s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]);
-#endif
 
 #ifdef DEBUG_PACKET_CONTENTS
     int i;
@@ -84,19 +82,15 @@
     {
         if (pc->packet_index != pc->packet_start)
         {
-#ifdef DEBUG
-            av_log(avctx, AV_LOG_INFO, "Discarding %d bytes\n",
-                pc->packet_index - pc->packet_start);
-#endif
+            dprintf(avctx, "Discarding %d bytes\n",
+                    pc->packet_index - pc->packet_start);
         }
 
         pc->packet_start = 0;
         pc->packet_index = 0;
 
         if (buf_size < 2 || buf[0] != 0x20 || buf[1] != 0x00) {
-#ifdef DEBUG
-            av_log(avctx, AV_LOG_INFO, "Bad packet header\n");
-#endif
+            dprintf(avctx, "Bad packet header\n");
             return -1;
         }
 
@@ -153,9 +147,7 @@
         } else if (*p == 0xff) {
             if (p + 1 < p_end)
             {
-#ifdef DEBUG
-                av_log(avctx, AV_LOG_INFO, "Junk at end of packet\n");
-#endif
+                dprintf(avctx, "Junk at end of packet\n");
             }
             pc->packet_index = p - pc->packet_buf;
             pc->in_packet = 0;
--- a/dvbsubdec.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/dvbsubdec.c	Thu Jul 30 21:00:08 2009 +0000
@@ -731,10 +731,8 @@
                          0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
     uint8_t *map_table;
 
-#ifdef DEBUG
-    av_log(avctx, AV_LOG_INFO, "DVB pixel block size %d, %s field:\n", buf_size,
-                top_bottom ? "bottom" : "top");
-#endif
+    dprintf(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
+            top_bottom ? "bottom" : "top");
 
 #ifdef DEBUG_PACKET_CONTENTS
     for (i = 0; i < buf_size; i++) {
@@ -968,9 +966,7 @@
         YUV_TO_RGB1_CCIR(cb, cr);
         YUV_TO_RGB2_CCIR(r, g, b, y);
 
-#ifdef DEBUG
-        av_log(avctx, AV_LOG_INFO, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha);
-#endif
+        dprintf(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha);
 
         if (depth & 0x80)
             clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha);
@@ -1046,15 +1042,11 @@
             region->bgcolor = (((*buf++) >> 2) & 3);
     }
 
-#ifdef DEBUG
-    av_log(avctx, AV_LOG_INFO, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
-#endif
+    dprintf(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
 
     if (fill) {
         memset(region->pbuf, region->bgcolor, region->buf_size);
-#ifdef DEBUG
-        av_log(avctx, AV_LOG_INFO, "Fill region (%d)\n", region->bgcolor);
-#endif
+        dprintf(avctx, "Fill region (%d)\n", region->bgcolor);
     }
 
     delete_region_display_list(ctx, region);
@@ -1115,9 +1107,7 @@
     ctx->time_out = *buf++;
     page_state = ((*buf++) >> 2) & 3;
 
-#ifdef DEBUG
-    av_log(avctx, AV_LOG_INFO, "Page time out %ds, state %d\n", ctx->time_out, page_state);
-#endif
+    dprintf(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state);
 
     if (page_state == 2) {
         delete_state(ctx);
@@ -1155,9 +1145,7 @@
         ctx->display_list = display;
         ctx->display_list_size++;
 
-#ifdef DEBUG
-        av_log(avctx, AV_LOG_INFO, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos);
-#endif
+        dprintf(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos);
     }
 
     while (tmp_display_list) {
@@ -1405,10 +1393,8 @@
                 *data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub);
                 break;
             default:
-#ifdef DEBUG
-                av_log(avctx, AV_LOG_INFO, "Subtitling segment type 0x%x, page id %d, length %d\n",
+                dprintf(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
                         segment_type, page_id, segment_length);
-#endif
                 break;
             }
         }
@@ -1417,9 +1403,7 @@
     }
 
     if (p != p_end) {
-#ifdef DEBUG
-        av_log(avctx, AV_LOG_INFO, "Junk at end of packet\n");
-#endif
+        dprintf(avctx, "Junk at end of packet\n");
         return -1;
     }
 
--- a/dvdsubdec.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/dvdsubdec.c	Thu Jul 30 21:00:08 2009 +0000
@@ -194,19 +194,15 @@
     while ((cmd_pos + 2 + offset_size) < buf_size) {
         date = AV_RB16(buf + cmd_pos);
         next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2);
-#ifdef DEBUG
-        av_log(NULL, AV_LOG_INFO, "cmd_pos=0x%04x next=0x%04x date=%d\n",
-               cmd_pos, next_cmd_pos, date);
-#endif
+        dprintf(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n",
+                cmd_pos, next_cmd_pos, date);
         pos = cmd_pos + 2 + offset_size;
         offset1 = -1;
         offset2 = -1;
         x1 = y1 = x2 = y2 = 0;
         while (pos < buf_size) {
             cmd = buf[pos++];
-#ifdef DEBUG
-            av_log(NULL, AV_LOG_INFO, "cmd=%02x\n", cmd);
-#endif
+            dprintf(NULL, "cmd=%02x\n", cmd);
             switch(cmd) {
             case 0x00:
                 /* menu subpicture */
@@ -239,9 +235,7 @@
                 alpha[1] = buf[pos + 1] >> 4;
                 alpha[0] = buf[pos + 1] & 0x0f;
                 pos += 2;
-#ifdef DEBUG
-            av_log(NULL, AV_LOG_INFO, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
-#endif
+            dprintf(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
                 break;
             case 0x05:
             case 0x85:
@@ -253,10 +247,7 @@
                 y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5];
                 if (cmd & 0x80)
                     is_8bit = 1;
-#ifdef DEBUG
-                av_log(NULL, AV_LOG_INFO, "x1=%d x2=%d y1=%d y2=%d\n",
-                       x1, x2, y1, y2);
-#endif
+                dprintf(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2);
                 pos += 6;
                 break;
             case 0x06:
@@ -264,9 +255,7 @@
                     goto fail;
                 offset1 = AV_RB16(buf + pos);
                 offset2 = AV_RB16(buf + pos + 2);
-#ifdef DEBUG
-                av_log(NULL, AV_LOG_INFO, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
-#endif
+                dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
                 pos += 4;
                 break;
             case 0x86:
@@ -274,9 +263,7 @@
                     goto fail;
                 offset1 = AV_RB32(buf + pos);
                 offset2 = AV_RB32(buf + pos + 4);
-#ifdef DEBUG
-                av_log(NULL, AV_LOG_INFO, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
-#endif
+                dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
                 pos += 8;
                 break;
 
@@ -299,9 +286,7 @@
             case 0xff:
                 goto the_end;
             default:
-#ifdef DEBUG
-                av_log(NULL, AV_LOG_INFO, "unrecognised subpicture command 0x%x\n", cmd);
-#endif
+                dprintf(NULL, "unrecognised subpicture command 0x%x\n", cmd);
                 goto the_end;
             }
         }
@@ -495,9 +480,9 @@
         goto no_subtitle;
 
 #if defined(DEBUG)
-    av_log(NULL, AV_LOG_INFO, "start=%d ms end =%d ms\n",
-           sub->start_display_time,
-           sub->end_display_time);
+    dprintf(NULL, "start=%d ms end =%d ms\n",
+            sub->start_display_time,
+            sub->end_display_time);
     ppm_save("/tmp/a.ppm", sub->rects[0]->pict.data[0],
              sub->rects[0]->w, sub->rects[0]->h, sub->rects[0]->pict.data[1]);
 #endif
--- a/h261dec.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/h261dec.c	Thu Jul 30 21:00:08 2009 +0000
@@ -552,10 +552,8 @@
     int ret;
     AVFrame *pict = data;
 
-#ifdef DEBUG
-    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
+    dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
+    dprintf(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
     s->flags= avctx->flags;
     s->flags2= avctx->flags2;
 
--- a/h263.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/h263.c	Thu Jul 30 21:00:08 2009 +0000
@@ -4586,9 +4586,7 @@
    code >>= 1;
 
    code = (sign) ? (pred - code) : (pred + code);
-#ifdef DEBUG
-   av_log( s->avctx, AV_LOG_DEBUG,"H.263+ UMV Motion = %d\n", code);
-#endif
+   dprintf(s->avctx,"H.263+ UMV Motion = %d\n", code);
    return code;
 
 }
--- a/mjpegdec.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/mjpegdec.c	Thu Jul 30 21:00:08 2009 +0000
@@ -1232,9 +1232,7 @@
     }
     val = -1;
 found:
-#ifdef DEBUG
-    av_log(NULL, AV_LOG_VERBOSE, "find_marker skipped %d bytes\n", skipped);
-#endif
+    dprintf(NULL, "find_marker skipped %d bytes\n", skipped);
     *pbuf_ptr = buf_ptr;
     return val;
 }
--- a/mpegaudioenc.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/mpegaudioenc.c	Thu Jul 30 21:00:08 2009 +0000
@@ -126,10 +126,8 @@
     s->sblimit = ff_mpa_sblimit_table[table];
     s->alloc_table = ff_mpa_alloc_tables[table];
 
-#ifdef DEBUG
-    av_log(avctx, 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
+    dprintf(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
+            bitrate, freq, s->frame_size, table, s->frame_frac_incr);
 
     for(i=0;i<s->nb_channels;i++)
         s->samples_offset[i] = 0;
--- a/pngdec.c	Thu Jul 30 20:57:41 2009 +0000
+++ b/pngdec.c	Thu Jul 30 21:00:08 2009 +0000
@@ -430,13 +430,11 @@
             goto fail;
         tag32 = bytestream_get_be32(&s->bytestream);
         tag = bswap_32(tag32);
-#ifdef DEBUG
-        av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n",
-               (tag & 0xff),
-               ((tag >> 8) & 0xff),
-               ((tag >> 16) & 0xff),
-               ((tag >> 24) & 0xff), length);
-#endif
+        dprintf(avctx, "png: tag=%c%c%c%c length=%u\n",
+                (tag & 0xff),
+                ((tag >> 8) & 0xff),
+                ((tag >> 16) & 0xff),
+                ((tag >> 24) & 0xff), length);
         switch(tag) {
         case MKTAG('I', 'H', 'D', 'R'):
             if (length != 13)
@@ -454,11 +452,9 @@
             s->interlace_type = *s->bytestream++;
             crc = bytestream_get_be32(&s->bytestream);
             s->state |= PNG_IHDR;
-#ifdef DEBUG
-            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
+            dprintf(avctx, "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);
             break;
         case MKTAG('I', 'D', 'A', 'T'):
             if (!(s->state & PNG_IHDR))
@@ -518,10 +514,8 @@
                                                          s->width);
                     s->crow_size = s->pass_row_size + 1;
                 }
-#ifdef DEBUG
-                av_log(avctx, AV_LOG_DEBUG, "row_size=%d crow_size =%d\n",
-                       s->row_size, s->crow_size);
-#endif
+                dprintf(avctx, "row_size=%d crow_size =%d\n",
+                        s->row_size, s->crow_size);
                 s->image_buf = p->data[0];
                 s->image_linesize = p->linesize[0];
                 /* copy the palette if needed */