diff gifdec.c @ 4652:6679d37a3338 libavcodec

Give context to dprintf
author mbardiaux
date Mon, 12 Mar 2007 12:36:41 +0000
parents 9bf957e669f0
children dd9ad0da0a51
line wrap: on
line diff
--- a/gifdec.c	Sun Mar 11 21:01:33 2007 +0000
+++ b/gifdec.c	Mon Mar 12 12:36:41 2007 +0000
@@ -53,6 +53,8 @@
     /* aux buffers */
     uint8_t global_palette[256 * 3];
     uint8_t local_palette[256 * 3];
+
+  AVCodecContext* avctx;
 } GifState;
 
 static const uint8_t gif87a_sig[6] = "GIF87a";
@@ -73,7 +75,7 @@
     has_local_palette = flags & 0x80;
     bits_per_pixel = (flags & 0x07) + 1;
 #ifdef DEBUG
-    dprintf("gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height);
+    dprintf(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height);
 #endif
 
     if (has_local_palette) {
@@ -164,7 +166,7 @@
     ext_code = bytestream_get_byte(&s->bytestream);
     ext_len = bytestream_get_byte(&s->bytestream);
 #ifdef DEBUG
-    dprintf("gif: ext_code=0x%x len=%d\n", ext_code, ext_len);
+    dprintf(s->avctx, "gif: ext_code=0x%x len=%d\n", ext_code, ext_len);
 #endif
     switch(ext_code) {
     case 0xf9:
@@ -180,7 +182,7 @@
             s->transparent_color_index = -1;
         s->gce_disposal = (gce_flags >> 2) & 0x7;
 #ifdef DEBUG
-        dprintf("gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n",
+        dprintf(s->avctx, "gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n",
                gce_flags, s->gce_delay,
                s->transparent_color_index, s->gce_disposal);
 #endif
@@ -195,7 +197,7 @@
             bytestream_get_byte(&s->bytestream);
         ext_len = bytestream_get_byte(&s->bytestream);
 #ifdef DEBUG
-        dprintf("gif: ext_len1=%d\n", ext_len);
+        dprintf(s->avctx, "gif: ext_len1=%d\n", ext_len);
 #endif
     }
     return 0;
@@ -230,7 +232,7 @@
     s->background_color_index = bytestream_get_byte(&s->bytestream);
     bytestream_get_byte(&s->bytestream);                /* ignored */
 #ifdef DEBUG
-    dprintf("gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n",
+    dprintf(s->avctx, "gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n",
            s->screen_width, s->screen_height, s->bits_per_pixel,
            has_global_palette);
 #endif
@@ -248,7 +250,7 @@
     for (;;) {
         code = bytestream_get_byte(&s->bytestream);
 #ifdef DEBUG
-        dprintf("gif: code=%02x '%c'\n", code, code);
+        dprintf(s->avctx, "gif: code=%02x '%c'\n", code, code);
 #endif
         switch (code) {
         case ',':
@@ -279,6 +281,8 @@
 {
     GifState *s = avctx->priv_data;
 
+    s->avctx = avctx;
+
     avcodec_get_frame_defaults(&s->picture);
     avctx->coded_frame= &s->picture;
     s->picture.data[0] = NULL;