Compilation fixes part 1 patch by (Arvind R. and Burkhard Plaum, plaum, ipf uni-stutt...
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 26 Aug 2005 19:05:44 +0000 (19:05 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 26 Aug 2005 19:05:44 +0000 (19:05 +0000)
Originally committed as revision 4540 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/a52dec.c
libavcodec/ac3dec.c
libavcodec/h263.c
libavcodec/h264.c
libavcodec/imgresample.c
libavcodec/mjpeg.c
libavcodec/motion_est.c
libavcodec/msmpeg4.c
libavcodec/parser.c

index 76c63b7..7ebea40 100644 (file)
@@ -73,9 +73,16 @@ static void* dlsymm(void* handle, const char* symbol)
 {
     void* f = dlsym(handle, symbol);
     if (!f)
-       fprintf(stderr, "A52 Decoder - function '%s' can't be resolved\n", symbol);
+        av_log( NULL, AV_LOG_ERROR, "A52 Decoder - function '%s' can't be resolved\n", symbol);
     return f;
 }
+
+int ff_a52_syncinfo( AVCodecContext * avctx, uint8_t * buf, int * flags, int * sample_rate, int * bit_rate )
+{
+    AC3DecodeState *s = avctx->priv_data;
+
+    return s->a52_syncinfo(buf, flags, sample_rate, bit_rate);
+}
 #endif
 
 static int a52_decode_init(AVCodecContext *avctx)
@@ -86,7 +93,7 @@ static int a52_decode_init(AVCodecContext *avctx)
     s->handle = dlopen(liba52name, RTLD_LAZY);
     if (!s->handle)
     {
-       fprintf(stderr, "A52 library %s could not be opened! \n%s\n", liba52name, dlerror());
+        av_log( avctx, AV_LOG_ERROR, "A52 library %s could not be opened! \n%s\n", liba52name, dlerror());
         return -1;
     }
     s->a52_init = (a52_state_t* (*)(uint32_t)) dlsymm(s->handle, "a52_init");
index fcfb314..db7189e 100644 (file)
@@ -121,7 +121,7 @@ static int ac3_decode_frame(AVCodecContext *avctx,
                        /* No specific number of channel requested */
                        avctx->channels = s->channels;
                    else if (s->channels < avctx->channels) {
-                       fprintf(stderr, "ac3dec: AC3 Source channels are less than specified: output to %d channels.. (frmsize: %d)\n", s->channels, len);
+                        av_log( avctx, AV_LOG_INFO, "ac3dec: AC3 Source channels are less than specified: output to %d channels.. (frmsize: %d)\n", s->channels, len);
                        avctx->channels = s->channels;
                    }
                    avctx->bit_rate = bit_rate;
index c9d746d..5ba6a66 100644 (file)
@@ -4540,7 +4540,7 @@ static int h263p_decode_umotion(MpegEncContext * s, int pred)
    
    code = (sign) ? (pred - code) : (pred + code);
 #ifdef DEBUG
-   fprintf(stderr,"H.263+ UMV Motion = %d\n", code);
+   av_log( s->avctx, AV_LOG_DEBUG,"H.263+ UMV Motion = %d\n", code);
 #endif
    return code;   
 
@@ -4887,11 +4887,11 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
                             }
                             if(s->error_resilience > FF_ER_COMPLIANT){
                                 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 -1;
                                 }
                                 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 -1;
                                 }
                             }
index 40f3c17..dce728d 100644 (file)
@@ -3999,7 +3999,7 @@ static int decode_ref_pic_marking(H264Context *h){
                 if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){
                     h->mmco[i].short_frame_num= (h->frame_num - get_ue_golomb(&s->gb) - 1) & ((1<<h->sps.log2_max_frame_num)-1); //FIXME fields
 /*                    if(h->mmco[i].short_frame_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_frame_num ] == NULL){
-                        fprintf(stderr, "illegal short ref in memory management control operation %d\n", mmco);
+                        av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco);
                         return -1;
                     }*/
                 }
index 2c7e112..53471f4 100644 (file)
@@ -643,11 +643,13 @@ uint8_t img2[XSIZE1 * YSIZE1];
 
 void save_pgm(const char *filename, uint8_t *img, int xsize, int ysize)
 {
+#undef fprintf
     FILE *f;
     f=fopen(filename,"w");
     fprintf(f,"P5\n%d %d\n%d\n", xsize, ysize, 255);
     fwrite(img,1, xsize * ysize,f);
     fclose(f);
+#define fprintf please_use_av_log
 }
 
 static void dump_filter(int16_t *filter)
index 8f24b07..3807807 100644 (file)
@@ -2183,7 +2183,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
     s->picture.reference = 0;
     if (avctx->get_buffer(avctx, &s->picture) < 0)
     {
-       fprintf(stderr, "get_buffer() failed\n");
+        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
        return -1;
     }
 
index 6811dca..3426d34 100644 (file)
@@ -441,7 +441,7 @@ static int log_motion_search(MpegEncContext * s,
     } while (range >= 1);
 
 #ifdef DEBUG
-    fprintf(stderr, "log       - MX: %d\tMY: %d\n", mx, my);
+    av_log(s->avctx, AV_LOG_DEBUG, "log       - MX: %d\tMY: %d\n", mx, my);
 #endif
     *mx_ptr = mx;
     *my_ptr = my;
@@ -530,7 +530,7 @@ static int phods_motion_search(MpegEncContext * s,
     } while (range >= 1);
 
 #ifdef DEBUG
-    fprintf(stderr, "phods     - MX: %d\tMY: %d\n", mx, my);
+    av_log(s->avctx, AV_LOG_DEBUG, "phods     - MX: %d\tMY: %d\n", mx, my);
 #endif
 
     /* half pixel search */
index 3c28b8e..81f1479 100644 (file)
@@ -1821,9 +1821,9 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
                     if(last) i+=192;
 #ifdef ERROR_DETAILS
                 if(run==66)
-                    fprintf(stderr, "illegal vlc code in ESC3 level=%d\n", level);
+                    av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
                 else if((i>62 && i<192) || i>192+63)
-                    fprintf(stderr, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
+                    av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
 #endif
                 } else {
                     /* second escape */
@@ -1839,9 +1839,9 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
                     LAST_SKIP_BITS(re, &s->gb, 1);
 #ifdef ERROR_DETAILS
                 if(run==66)
-                    fprintf(stderr, "illegal vlc code in ESC2 level=%d\n", level);
+                    av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
                 else if((i>62 && i<192) || i>192+63)
-                    fprintf(stderr, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
+                    av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
 #endif
                 }
             } else {
@@ -1859,9 +1859,9 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
                 LAST_SKIP_BITS(re, &s->gb, 1);
 #ifdef ERROR_DETAILS
                 if(run==66)
-                    fprintf(stderr, "illegal vlc code in ESC1 level=%d\n", level);
+                    av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
                 else if((i>62 && i<192) || i>192+63)
-                    fprintf(stderr, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
+                    av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
 #endif
             }
         } else {
@@ -1870,9 +1870,9 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
             LAST_SKIP_BITS(re, &s->gb, 1);
 #ifdef ERROR_DETAILS
                 if(run==66)
-                    fprintf(stderr, "illegal vlc code level=%d\n", level);
+                    av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level);
                 else if((i>62 && i<192) || i>192+63)
-                    fprintf(stderr, "run overflow i=%d run=%d level=%d\n", i, run, level);
+                    av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level);
 #endif
         }
         if (i > 62){
index ed620db..4d5cb19 100644 (file)
@@ -748,8 +748,13 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
 }
 
 #ifdef CONFIG_AC3
+#ifdef CONFIG_A52BIN
+extern int ff_a52_syncinfo (AVCodecContext * avctx, const uint8_t * buf,
+                       int * flags, int * sample_rate, int * bit_rate);
+#else
 extern int a52_syncinfo (const uint8_t * buf, int * flags,
                          int * sample_rate, int * bit_rate);
+#endif
 
 typedef struct AC3ParseContext {
     uint8_t inbuf[4096]; /* input buffer */
@@ -796,7 +801,11 @@ static int ac3_parse(AVCodecParserContext *s1,
             s->inbuf_ptr += len;
             buf_size -= len;
             if ((s->inbuf_ptr - s->inbuf) == AC3_HEADER_SIZE) {
+#ifdef CONFIG_A52BIN
+                len = ff_a52_syncinfo(avctx, s->inbuf, &s->flags, &sample_rate, &bit_rate);
+#else
                 len = a52_syncinfo(s->inbuf, &s->flags, &sample_rate, &bit_rate);
+#endif
                 if (len == 0) {
                     /* no sync found : move by one byte (inefficient, but simple!) */
                     memmove(s->inbuf, s->inbuf + 1, AC3_HEADER_SIZE - 1);