changeset 2846:40765c51a7a9 libavcodec

Compilation fixes part 1 patch by (Arvind R. and Burkhard Plaum, plaum, ipf uni-stuttgart de)
author michael
date Fri, 26 Aug 2005 19:05:44 +0000
parents d9f4b93e81c5
children 712c84b9d8ce
files a52dec.c ac3dec.c h263.c h264.c imgresample.c mjpeg.c motion_est.c msmpeg4.c parser.c
diffstat 9 files changed, 36 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/a52dec.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/a52dec.c	Fri Aug 26 19:05:44 2005 +0000
@@ -73,9 +73,16 @@
 {
     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 @@
     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");
--- a/ac3dec.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/ac3dec.c	Fri Aug 26 19:05:44 2005 +0000
@@ -121,7 +121,7 @@
 			/* 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;
--- a/h263.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/h263.c	Fri Aug 26 19:05:44 2005 +0000
@@ -4540,7 +4540,7 @@
    
    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 @@
                             }
                             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;
                                 }
                             }
--- a/h264.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/h264.c	Fri Aug 26 19:05:44 2005 +0000
@@ -3999,7 +3999,7 @@
                 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;
                     }*/
                 }
--- a/imgresample.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/imgresample.c	Fri Aug 26 19:05:44 2005 +0000
@@ -643,11 +643,13 @@
 
 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)
--- a/mjpeg.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/mjpeg.c	Fri Aug 26 19:05:44 2005 +0000
@@ -2183,7 +2183,7 @@
     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;
     }
 
--- a/motion_est.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/motion_est.c	Fri Aug 26 19:05:44 2005 +0000
@@ -441,7 +441,7 @@
     } 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 @@
     } 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 */
--- a/msmpeg4.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/msmpeg4.c	Fri Aug 26 19:05:44 2005 +0000
@@ -1821,9 +1821,9 @@
                     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 @@
                     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 @@
                 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 @@
             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){
--- a/parser.c	Fri Aug 26 15:41:28 2005 +0000
+++ b/parser.c	Fri Aug 26 19:05:44 2005 +0000
@@ -748,8 +748,13 @@
 }
 
 #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 @@
             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);