diff mpeg12.c @ 1598:932d306bf1dc libavcodec

av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
author michael
date Mon, 03 Nov 2003 13:26:22 +0000
parents b69b086f5570
children 721a76648a4b
line wrap: on
line diff
--- a/mpeg12.c	Sun Nov 02 23:19:47 2003 +0000
+++ b/mpeg12.c	Mon Nov 03 13:26:22 2003 +0000
@@ -994,7 +994,7 @@
 
     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 @@
     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 @@
     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 @@
     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 @@
         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 @@
         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 @@
                 }
             }
             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 @@
                 }
             }
             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 @@
                 }
             }
             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 @@
                 }
             }
             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 @@
     }
     
     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 @@
             );
     
     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 @@
     }
    
     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 @@
     
     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 @@
         //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 @@
             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 @@
 
     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 @@
     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 @@
 
                 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 @@
             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 @@
                         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 @@
         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 */