changeset 5937:4b18bf35f153

printf to mp_msg
author albeu
date Thu, 02 May 2002 11:00:16 +0000
parents d0f040d8f53c
children 8404cfc33bb9
files codec-cfg.c cpudetect.c postproc/swscale.c postproc/swscale_template.c postproc/yuv2rgb.c
diffstat 5 files changed, 126 insertions(+), 122 deletions(-) [+]
line wrap: on
line diff
--- a/codec-cfg.c	Thu May 02 10:52:30 2002 +0000
+++ b/codec-cfg.c	Thu May 02 11:00:16 2002 +0000
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include "config.h"
+#include "mp_msg.h"
 
 // for mmioFOURCC:
 #include "wine/avifmt.h"
@@ -31,7 +32,7 @@
 #include "libvo/img_format.h"
 #include "codec-cfg.h"
 
-#define PRINT_LINENUM printf(" at line %d\n", line_num)
+#define PRINT_LINENUM mp_msg(MSGT_CODECCFG,MSGL_ERR," at line %d\n", line_num)
 
 #define MAX_NR_TOKEN	16
 
@@ -73,13 +74,13 @@
 		goto err_out_parse_error;
 	return 1;
 err_out_duplicated:
-	printf("duplicated fourcc/format");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"duplicated fourcc/format");
 	return 0;
 err_out_too_many:
-	printf("too many fourcc/format...");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"too many fourcc/format...");
 	return 0;
 err_out_parse_error:
-	printf("parse error");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error");
 	return 0;
 }
 
@@ -92,18 +93,18 @@
 	for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++)
 		/* NOTHING */;
 	if (i == CODECS_MAX_FOURCC) {
-		printf("too many fourcc/format...");
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"too many fourcc/format...");
 		return 0;
 	}
 
         fourcc[i]=fourccmap[i]=strtoul(s,&endptr,0);
 	if (*endptr != '\0') {
-		printf("parse error");
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error");
 		return 0;
 	}
 	for (j = 0; j < i; j++)
 		if (fourcc[j] == fourcc[i]) {
-			printf("duplicated fourcc/format");
+			mp_msg(MSGT_CODECCFG,MSGL_ERR,"duplicated fourcc/format");
 			return 0;
 		}
 
@@ -196,10 +197,10 @@
         
 	return 1;
 err_out_too_many:
-	printf("too many out...");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"too many out...");
 	return 0;
 err_out_parse_error:
-	printf("parse error");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error");
 	return 0;
 }
 
@@ -268,14 +269,14 @@
 
 static int validate_codec(codecs_t *c, int type)
 {
-	int i;
+	unsigned int i;
 	char *tmp_name = strdup(c->name);
 
 	for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++)
 		/* NOTHING */;
 
 	if (i < strlen(tmp_name)) {
-		printf("\ncodec(%s) name is not valid!\n", c->name);
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) name is not valid!\n", c->name);
 		return 0;
 	}
 
@@ -284,13 +285,13 @@
 
 #if 0
 	if (c->fourcc[0] == 0xffffffff) {
-		printf("\ncodec(%s) does not have fourcc/format!\n", c->name);
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) does not have fourcc/format!\n", c->name);
 		return 0;
 	}
 
 	/* XXX fix this: shitty with 'null' codec */
 	if (!c->driver) {
-		printf("\ncodec(%s) does not have a driver!\n", c->name);
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) does not have a driver!\n", c->name);
 		return 0;
 	}
 #endif
@@ -300,7 +301,7 @@
 #warning HOL VANNAK DEFINIALVA????????????
 	if (!c->dll && (c->driver == 4 ||
 				(c->driver == 2 && type == TYPE_VIDEO))) {
-		printf("\ncodec(%s) needs a 'dll'!\n", c->name);
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) needs a 'dll'!\n", c->name);
 		return 0;
 	}
 #warning guid.f1 lehet 0? honnan lehet tudni, hogy nem adtak meg?
@@ -308,7 +309,7 @@
 
 	if (type == TYPE_VIDEO)
 		if (c->outfmt[0] == 0xffffffff) {
-			printf("\ncodec(%s) needs an 'outfmt'!\n", c->name);
+			mp_msg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) needs an 'outfmt'!\n", c->name);
 			return 0;
 		}
 #endif
@@ -326,7 +327,7 @@
 		(*d)[pos++] = '\n';
 	}
 	if (!(*d = (char *) realloc(*d, pos + strlen(s) + 1))) {
-		printf("can't allocate mem for comment. ");
+		mp_msg(MSGT_CODECCFG,MSGL_FATAL,"can't allocate mem for comment. ");
 		return 0;
 	}
 	strcpy(*d + pos, s);
@@ -375,7 +376,7 @@
 	char c;
 
 	if (max >= MAX_NR_TOKEN) {
-		printf("get_token(): max >= MAX_NR_TOKEN!");
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"get_token(): max >= MAX_NR_TOKEN!");
 		goto out_eof;
 	}
 
@@ -453,15 +454,15 @@
 
 	if(cfgfile==NULL)return 0; 
 	
-	printf("Reading %s: ", cfgfile);
+	mp_msg(MSGT_CODECCFG,MSGL_INFO,"Reading %s: ", cfgfile);
 
 	if ((fp = fopen(cfgfile, "r")) == NULL) {
-		printf("can't open '%s': %s\n", cfgfile, strerror(errno));
+		mp_msg(MSGT_CODECCFG,MSGL_ERR,"can't open '%s': %s\n", cfgfile, strerror(errno));
 		return 0;
 	}
 
 	if ((line = (char *) malloc(MAX_LINE_LEN + 1)) == NULL) {
-		printf("can't get memory for 'line': %s\n", strerror(errno));
+		mp_msg(MSGT_CODECCFG,MSGL_FATAL,"can't get memory for 'line': %s\n", strerror(errno));
 		return 0;
 	}
 
@@ -495,13 +496,13 @@
 				codecsp = &audio_codecs;
 #ifdef DEBUG
 			} else {
-				printf("picsba\n");
+				mp_msg(MSGT_CODECCFG,MSGL_ERR,"picsba\n");
 				goto err_out;
 #endif
 			}
 		        if (!(*codecsp = (codecs_t *) realloc(*codecsp,
 				sizeof(codecs_t) * (*nr_codecsp + 2)))) {
-			    printf("can't realloc '*codecsp': %s\n", strerror(errno));
+			    mp_msg(MSGT_CODECCFG,MSGL_FATAL,"can't realloc '*codecsp': %s\n", strerror(errno));
 			    goto err_out;
 		        }
 			codec=*codecsp + *nr_codecsp;
@@ -516,19 +517,19 @@
 			for (i = 0; i < *nr_codecsp - 1; i++) {
 				if(( (*codecsp)[i].name!=NULL) && 
 				    (!strcmp(token[0], (*codecsp)[i].name)) ) {
-					printf("codec name '%s' isn't unique", token[0]);
+					mp_msg(MSGT_CODECCFG,MSGL_ERR,"codec name '%s' isn't unique", token[0]);
 					goto err_out_print_linenum;
 				}
 			}
 			if (!(codec->name = strdup(token[0]))) {
-				printf("can't strdup -> 'name': %s\n", strerror(errno));
+				mp_msg(MSGT_CODECCFG,MSGL_ERR,"can't strdup -> 'name': %s\n", strerror(errno));
 				goto err_out;
 			}
 		} else if (!strcmp(token[0], "info")) {
 			if (codec->info || get_token(1, 1) < 0)
 				goto err_out_parse_error;
 			if (!(codec->info = strdup(token[0]))) {
-				printf("can't strdup -> 'info': %s\n", strerror(errno));
+				mp_msg(MSGT_CODECCFG,MSGL_ERR,"can't strdup -> 'info': %s\n", strerror(errno));
 				goto err_out;
 			}
 		} else if (!strcmp(token[0], "comment")) {
@@ -556,7 +557,7 @@
 			if (get_token(1, 1) < 0)
 				goto err_out_parse_error;
 			if (!(codec->dll = strdup(token[0]))) {
-				printf("can't strdup -> 'dll': %s\n", strerror(errno));
+				mp_msg(MSGT_CODECCFG,MSGL_ERR,"can't strdup -> 'dll': %s\n", strerror(errno));
 				goto err_out;
 			}
 		} else if (!strcmp(token[0], "guid")) {
@@ -627,7 +628,7 @@
 	}
 	if (!validate_codec(codec, codec_type))
 		goto err_out_not_valid;
-	printf("%d audio & %d video codecs\n", nr_acodecs, nr_vcodecs);
+	mp_msg(MSGT_CODECCFG,MSGL_INFO,"%d audio & %d video codecs\n", nr_acodecs, nr_vcodecs);
 	if(video_codecs) video_codecs[nr_vcodecs].name = NULL;
 	if(audio_codecs) audio_codecs[nr_acodecs].name = NULL;
 out:
@@ -637,7 +638,7 @@
 	return 1;
 
 err_out_parse_error:
-	printf("parse error");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error");
 err_out_print_linenum:
 	PRINT_LINENUM;
 err_out:
@@ -653,7 +654,7 @@
 	fclose(fp);
 	return 0;
 err_out_not_valid:
-	printf("codec is not defined correctly");
+	mp_msg(MSGT_CODECCFG,MSGL_ERR,"codec is not defined correctly");
 	goto err_out_print_linenum;
 }
 
@@ -733,11 +734,11 @@
 		if (audioflag) {
 			i = nr_acodecs;
 			c = audio_codecs;
-			printf("ac:      afm: status:   info:  [lib/dll]\n");
+			mp_msg(MSGT_CODECCFG,MSGL_INFO,"ac:      afm: status:   info:  [lib/dll]\n");
 		} else {
 			i = nr_vcodecs;
 			c = video_codecs;
-			printf("vc:      vfm: status:   info:  [lib/dll]\n");
+			mp_msg(MSGT_CODECCFG,MSGL_INFO,"vc:      vfm: status:   info:  [lib/dll]\n");
 		}
 		if(!i) return;
 		for (/* NOTHING */; i--; c++) {
@@ -749,9 +750,9 @@
 			  case CODECS_STATUS_UNTESTED:    s="untested";break;
 			}
 			if(c->dll)
-			  printf("%-11s%2d  %s  %s  [%s]\n",c->name,c->driver,s,c->info,c->dll);
+			  mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s%2d  %s  %s  [%s]\n",c->name,c->driver,s,c->info,c->dll);
 			else
-			  printf("%-11s%2d  %s  %s\n",c->name,c->driver,s,c->info);
+			  mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s%2d  %s  %s\n",c->name,c->driver,s,c->info);
 			
 		}
 
--- a/cpudetect.c	Thu May 02 10:52:30 2002 +0000
+++ b/cpudetect.c	Thu May 02 11:00:16 2002 +0000
@@ -1,5 +1,6 @@
 #include "config.h"
 #include "cpudetect.h"
+#include "mp_msg.h"
 
 CpuCaps gCpuCaps;
 
@@ -94,11 +95,11 @@
 
 	memset(caps, 0, sizeof(*caps));
 	if (!has_cpuid()) {
-	    printf("CPUID not supported!???\n");
+	    mp_msg(MSGT_CPUDETECT,MSGL_ERR,"CPUID not supported!???\n");
 	    return;
 	}
 	do_cpuid(0x00000000, regs); // get _max_ cpuid level and vendor name
-	printf("CPU vendor name: %.4s%.4s%.4s  max cpuid level: %d\n",
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU vendor name: %.4s%.4s%.4s  max cpuid level: %d\n",
 			(char*) (regs+1),(char*) (regs+3),(char*) (regs+2), regs[0]);
 	if (regs[0]>=0x00000001)
 	{
@@ -107,7 +108,7 @@
 		do_cpuid(0x00000001, regs2);
 
 		tmpstr=GetCpuFriendlyName(regs, regs2);
-		printf("CPU: %s ",tmpstr);
+		mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: %s ",tmpstr);
 		free(tmpstr);
 
 		caps->cpuType=(regs2[0] >> 8)&0xf;
@@ -116,7 +117,7 @@
 		    caps->cpuType=8+((regs2[0]>>20)&255);
 		}
 		caps->cpuStepping=regs2[0] & 0xf;
-		printf("(Type: %d, Stepping: %d)\n",
+		mp_msg(MSGT_CPUDETECT,MSGL_INFO,"(Type: %d, Stepping: %d)\n",
 		    caps->cpuType, caps->cpuStepping);
 
 		// general feature flags:
@@ -127,7 +128,7 @@
 	}
 	do_cpuid(0x80000000, regs);
 	if (regs[0]>=0x80000001) {
-		printf("extended cpuid-level: %d\n",regs[0]&0x7FFFFFFF);
+		mp_msg(MSGT_CPUDETECT,MSGL_INFO,"extended cpuid-level: %d\n",regs[0]&0x7FFFFFFF);
 		do_cpuid(0x80000001, regs2);
 		caps->hasMMX  |= (regs2[3] & (1 << 23 )) >> 23; // 0x0800000
 		caps->hasMMX2 |= (regs2[3] & (1 << 22 )) >> 22; // 0x400000
@@ -135,7 +136,7 @@
 		caps->has3DNowExt = (regs2[3] & (1 << 30 )) >> 30;
 	}
 #if 0
-	printf("cpudetect: MMX=%d MMX2=%d SSE=%d SSE2=%d 3DNow=%d 3DNowExt=%d\n",
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"cpudetect: MMX=%d MMX2=%d SSE=%d SSE2=%d 3DNow=%d 3DNowExt=%d\n",
 		gCpuCaps.hasMMX,
 		gCpuCaps.hasMMX2,
 		gCpuCaps.hasSSE,
@@ -159,27 +160,27 @@
 //		caps->hasMMX = 0;
 
 #ifndef HAVE_MMX
-	if(caps->hasMMX) printf("MMX supported but disabled\n");
+	if(caps->hasMMX) mp_msg(MSGT_CPUDETECT,MSGL_INFO,"MMX supported but disabled\n");
 	caps->hasMMX=0;
 #endif
 #ifndef HAVE_MMX2
-	if(caps->hasMMX2) printf("MMX2 supported but disabled\n");
+	if(caps->hasMMX2) mp_msg(MSGT_CPUDETECT,MSGL_INFO,"MMX2 supported but disabled\n");
 	caps->hasMMX2=0;
 #endif
 #ifndef HAVE_SSE
-	if(caps->hasSSE) printf("SSE supported but disabled\n");
+	if(caps->hasSSE) mp_msg(MSGT_CPUDETECT,MSGL_INFO,"SSE supported but disabled\n");
 	caps->hasSSE=0;
 #endif
 #ifndef HAVE_SSE2
-	if(caps->hasSSE2) printf("SSE2 supported but disabled\n");
+	if(caps->hasSSE2) mp_msg(MSGT_CPUDETECT,MSGL_INFO,"SSE2 supported but disabled\n");
 	caps->hasSSE2=0;
 #endif
 #ifndef HAVE_3DNOW
-	if(caps->has3DNow) printf("3DNow supported but disabled\n");
+	if(caps->has3DNow) mp_msg(MSGT_CPUDETECT,MSGL_INFO,"3DNow supported but disabled\n");
 	caps->has3DNow=0;
 #endif
 #ifndef HAVE_3DNOWEX
-	if(caps->has3DNowExt) printf("3DNowExt supported but disabled\n");
+	if(caps->has3DNowExt) mp_msg(MSGT_CPUDETECT,MSGL_INFO,"3DNowExt supported but disabled\n");
 	caps->has3DNowExt=0;
 #endif
 }
@@ -199,7 +200,7 @@
 	int i;
 
 	if (NULL==(retname=(char*)malloc(256))) {
-		printf("Error: GetCpuFriendlyName() not enough memory\n");
+		mp_msg(MSGT_CPUDETECT,MSGL_FATAL,"Error: GetCpuFriendlyName() not enough memory\n");
 		exit(1);
 	}
 
@@ -211,13 +212,13 @@
 				snprintf(retname,255,"%s %s",cpuvendors[i].name,cpuname[i][CPUID_FAMILY][CPUID_MODEL]);
 			} else {
 				snprintf(retname,255,"unknown %s %d. Generation CPU",cpuvendors[i].name,CPUID_FAMILY); 
-				printf("unknown %s CPU:\n",cpuvendors[i].name);
-				printf("Vendor:   %s\n",cpuvendors[i].string);
-				printf("Type:     %d\n",CPUID_TYPE);
-				printf("Family:   %d (ext: %d)\n",CPUID_FAMILY,CPUID_EXTFAMILY);
-				printf("Model:    %d (ext: %d)\n",CPUID_MODEL,CPUID_EXTMODEL);
-				printf("Stepping: %d\n",CPUID_STEPPING);
-				printf("Please send the above info along with the exact CPU name"
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"unknown %s CPU:\n",cpuvendors[i].name);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Vendor:   %s\n",cpuvendors[i].string);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Type:     %d\n",CPUID_TYPE);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Family:   %d (ext: %d)\n",CPUID_FAMILY,CPUID_EXTFAMILY);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Model:    %d (ext: %d)\n",CPUID_MODEL,CPUID_EXTMODEL);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Stepping: %d\n",CPUID_STEPPING);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Please send the above info along with the exact CPU name"
 				       "to the MPlayer-Developers, so we can add it to the list!\n");
 			}
 		}
@@ -238,7 +239,7 @@
 #if defined(__linux__) && defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC)
 static void sigill_handler_sse( int signal, struct sigcontext sc )
 {
-   printf( "SIGILL, " );
+   mp_msg(MSGT_CPUDETECT,MSGL_FATAL, "SIGILL, " );
 
    /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1"
     * instructions are 3 bytes long.  We must increment the instruction
@@ -257,7 +258,7 @@
 
 static void sigfpe_handler_sse( int signal, struct sigcontext sc )
 {
-   printf( "SIGFPE, " );
+   mp_msg(MSGT_CPUDETECT,MSGL_FATAL, "SIGFPE, " );
 
    if ( sc.fpstate->magic != 0xffff ) {
       /* Our signal context has the extended FPU state, so reset the
@@ -269,8 +270,8 @@
    } else {
       /* If we ever get here, we're completely hosed.
        */
-      printf( "\n\n" );
-      printf( "SSE enabling test failed badly!" );
+      mp_msg(MSGT_CPUDETECT,MSGL_FATAL, "\n\n" );
+      mp_msg(MSGT_CPUDETECT,MSGL_FATAL, "SSE enabling test failed badly!" );
    }
 }
 #endif /* __linux__ && _POSIX_SOURCE && X86_FXSR_MAGIC */
@@ -311,15 +312,15 @@
     * does.
     */
    if ( gCpuCaps.hasSSE ) {
-      printf( "Testing OS support for SSE... " );
+      mp_msg(MSGT_CPUDETECT,MSGL_INFO, "Testing OS support for SSE... " );
 
 //      __asm __volatile ("xorps %%xmm0, %%xmm0");
       __asm __volatile ("xorps %xmm0, %xmm0");
 
       if ( gCpuCaps.hasSSE ) {
-	 printf( "yes.\n" );
+	 mp_msg(MSGT_CPUDETECT,MSGL_INFO, "yes.\n" );
       } else {
-	 printf( "no!\n" );
+	 mp_msg(MSGT_CPUDETECT,MSGL_INFO, "no!\n" );
       }
    }
 
@@ -337,14 +338,14 @@
     * and therefore to be safe I'm going to leave this test in here.
     */
    if ( gCpuCaps.hasSSE ) {
-      printf( "Testing OS support for SSE unmasked exceptions... " );
+      mp_msg(MSGT_CPUDETECT,MSGL_INFO, "Testing OS support for SSE unmasked exceptions... " );
 
 //      test_os_katmai_exception_support();
 
       if ( gCpuCaps.hasSSE ) {
-	 printf( "yes.\n" );
+	 mp_msg(MSGT_CPUDETECT,MSGL_INFO, "yes.\n" );
       } else {
-	 printf( "no!\n" );
+	 mp_msg(MSGT_CPUDETECT,MSGL_INFO, "no!\n" );
       }
    }
 
@@ -357,21 +358,21 @@
     * safe to go ahead and hook out the SSE code throughout Mesa.
     */
    if ( gCpuCaps.hasSSE ) {
-      printf( "Tests of OS support for SSE passed.\n" );
+      mp_msg(MSGT_CPUDETECT,MSGL_INFO, "Tests of OS support for SSE passed.\n" );
    } else {
-      printf( "Tests of OS support for SSE failed!\n" );
+      mp_msg(MSGT_CPUDETECT,MSGL_INFO, "Tests of OS support for SSE failed!\n" );
    }
 #else
    /* We can't use POSIX signal handling to test the availability of
     * SSE, so we disable it by default.
     */
-   printf( "Cannot test OS support for SSE, disabling to be safe.\n" );
+   mp_msg(MSGT_CPUDETECT,MSGL_WARN, "Cannot test OS support for SSE, disabling to be safe.\n" );
    gCpuCaps.hasSSE=0;
 #endif /* _POSIX_SOURCE && X86_FXSR_MAGIC */
 #else
    /* Do nothing on other platforms for now.
     */
-   printf( "Not testing OS support for SSE, leaving disabled.\n" );
+   mp_msg(MSGT_CPUDETECT,MSGL_WARN, "Not testing OS support for SSE, leaving disabled.\n" );
    gCpuCaps.hasSSE=0;
 #endif /* __linux__ */
 }
--- a/postproc/swscale.c	Thu May 02 10:52:30 2002 +0000
+++ b/postproc/swscale.c	Thu May 02 11:00:16 2002 +0000
@@ -62,6 +62,7 @@
 #include "../libvo/img_format.h"
 #include "rgb2rgb.h"
 #include "../libvo/fastmemcpy.h"
+#include "../mp_msg.h"
 #undef MOVNTQ
 #undef PAVGB
 
@@ -936,8 +937,8 @@
 	filter= (double*)memalign(8, filterSize*dstW*sizeof(double));
 	*outFilterSize= filterSize;
 
-	if((flags&SWS_PRINT_INFO) && verbose)
-		printf("SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
+	if(flags&SWS_PRINT_INFO)
+		mp_msg(MSGT_SWS,MSGL_V,"SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
 	/* try to reduce the filter-size (step2 reduce it) */
 	for(i=0; i<dstW; i++)
 	{
@@ -1452,19 +1453,19 @@
 
 	if(!isSupportedIn(srcFormat)) 
 	{
-		fprintf(stderr, "swScaler: %s is not supported as input format\n", vo_format_name(srcFormat));
+		mp_msg(MSGT_SWS,MSGL_ERR,"swScaler: %s is not supported as input format\n", vo_format_name(srcFormat));
 		return NULL;
 	}
 	if(!isSupportedOut(dstFormat))
 	{
-		fprintf(stderr, "swScaler: %s is not supported as output format\n", vo_format_name(dstFormat));
+		 mp_msg(MSGT_SWS,MSGL_ERR,"swScaler: %s is not supported as output format\n", vo_format_name(dstFormat));
 		return NULL;
 	}
 
 	/* sanity check */
 	if(srcW<4 || srcH<1 || dstW<8 || dstH<1) //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code
 	{
-		fprintf(stderr, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n", 
+		 mp_msg(MSGT_SWS,MSGL_ERR,"swScaler: %dx%d -> %dx%d is invalid scaling dimension\n", 
 			srcW, srcH, dstW, dstH);
 		return NULL;
 	}
@@ -1513,7 +1514,7 @@
 			c->swScale= planarYuvToBgr;
 
 			if(flags&SWS_PRINT_INFO)
-				printf("SwScaler: using unscaled %s -> %s special converter\n", 
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
 					vo_format_name(srcFormat), vo_format_name(dstFormat));
 			return c;
 		}
@@ -1524,7 +1525,7 @@
 			c->swScale= simpleCopy;
 
 			if(flags&SWS_PRINT_INFO)
-				printf("SwScaler: using unscaled %s -> %s special converter\n", 
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
 					vo_format_name(srcFormat), vo_format_name(dstFormat));
 			return c;
 		}
@@ -1536,7 +1537,7 @@
 			c->swScale= bgr32to24Wrapper;
 
 			if(flags&SWS_PRINT_INFO)
-				printf("SwScaler: using unscaled %s -> %s special converter\n", 
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
 					vo_format_name(srcFormat), vo_format_name(dstFormat));
 			return c;
 		}
@@ -1548,7 +1549,7 @@
 			c->swScale= bgr24to32Wrapper;
 
 			if(flags&SWS_PRINT_INFO)
-				printf("SwScaler: using unscaled %s -> %s special converter\n", 
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
 					vo_format_name(srcFormat), vo_format_name(dstFormat));
 			return c;
 		}
@@ -1559,7 +1560,7 @@
 			c->swScale= bgr15to16Wrapper;
 
 			if(flags&SWS_PRINT_INFO)
-				printf("SwScaler: using unscaled %s -> %s special converter\n", 
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
 					vo_format_name(srcFormat), vo_format_name(dstFormat));
 			return c;
 		}
@@ -1570,7 +1571,7 @@
 			c->swScale= bgr24toyv12Wrapper;
 
 			if(flags&SWS_PRINT_INFO)
-				printf("SwScaler: using unscaled %s -> %s special converter\n", 
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using unscaled %s -> %s special converter\n", 
 					vo_format_name(srcFormat), vo_format_name(dstFormat));
 			return c;
 		}
@@ -1582,7 +1583,7 @@
 		if(!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR))
 		{
 			if(flags&SWS_PRINT_INFO)
-				fprintf(stderr, "SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n");
+				mp_msg(MSGT_SWS,MSGL_WARN,"SwScaler: output Width is not a multiple of 32 -> no MMX2 scaler\n");
 		}
 	}
 	else
@@ -1720,35 +1721,35 @@
 		char *dither= "";
 #endif
 		if(flags&SWS_FAST_BILINEAR)
-			fprintf(stderr, "\nSwScaler: FAST_BILINEAR scaler, ");
+			mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: FAST_BILINEAR scaler, ");
 		else if(flags&SWS_BILINEAR)
-			fprintf(stderr, "\nSwScaler: BILINEAR scaler, ");
+			mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: BILINEAR scaler, ");
 		else if(flags&SWS_BICUBIC)
-			fprintf(stderr, "\nSwScaler: BICUBIC scaler, ");
+			mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: BICUBIC scaler, ");
 		else if(flags&SWS_X)
-			fprintf(stderr, "\nSwScaler: Experimental scaler, ");
+			mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: Experimental scaler, ");
 		else if(flags&SWS_POINT)
-			fprintf(stderr, "\nSwScaler: Nearest Neighbor / POINT scaler, ");
+			mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: Nearest Neighbor / POINT scaler, ");
 		else if(flags&SWS_AREA)
-			fprintf(stderr, "\nSwScaler: Area Averageing scaler, ");
+			mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: Area Averageing scaler, ");
 		else
-			fprintf(stderr, "\nSwScaler: ehh flags invalid?! ");
+			mp_msg(MSGT_SWS,MSGL_INFO,"\nSwScaler: ehh flags invalid?! ");
 
 		if(dstFormat==IMGFMT_BGR15 || dstFormat==IMGFMT_BGR16)
-			fprintf(stderr, "from %s to%s %s ", 
+			mp_msg(MSGT_SWS,MSGL_INFO,"from %s to%s %s ", 
 				vo_format_name(srcFormat), dither, vo_format_name(dstFormat));
 		else
-			fprintf(stderr, "from %s to %s ", 
+			mp_msg(MSGT_SWS,MSGL_INFO,"from %s to %s ", 
 				vo_format_name(srcFormat), vo_format_name(dstFormat));
 
 		if(cpuCaps.hasMMX2)
-			fprintf(stderr, "using MMX2\n");
+			mp_msg(MSGT_SWS,MSGL_INFO,"using MMX2\n");
 		else if(cpuCaps.has3DNow)
-			fprintf(stderr, "using 3DNOW\n");
+			mp_msg(MSGT_SWS,MSGL_INFO,"using 3DNOW\n");
 		else if(cpuCaps.hasMMX)
-			fprintf(stderr, "using MMX\n");
+			mp_msg(MSGT_SWS,MSGL_INFO,"using MMX\n");
 		else
-			fprintf(stderr, "using C\n");
+			mp_msg(MSGT_SWS,MSGL_INFO,"using C\n");
 	}
 
 	if((flags & SWS_PRINT_INFO) && verbose)
@@ -1756,70 +1757,70 @@
 		if(cpuCaps.hasMMX)
 		{
 			if(c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
-				printf("SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
 			else
 			{
 				if(c->hLumFilterSize==4)
-					printf("SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n");
+					mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 4-tap MMX scaler for horizontal luminance scaling\n");
 				else if(c->hLumFilterSize==8)
-					printf("SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n");
+					mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 8-tap MMX scaler for horizontal luminance scaling\n");
 				else
-					printf("SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n");
+					mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using n-tap MMX scaler for horizontal luminance scaling\n");
 
 				if(c->hChrFilterSize==4)
-					printf("SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n");
+					mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 4-tap MMX scaler for horizontal chrominance scaling\n");
 				else if(c->hChrFilterSize==8)
-					printf("SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n");
+					mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 8-tap MMX scaler for horizontal chrominance scaling\n");
 				else
-					printf("SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n");
+					mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using n-tap MMX scaler for horizontal chrominance scaling\n");
 			}
 		}
 		else
 		{
 #ifdef ARCH_X86
-			printf("SwScaler: using X86-Asm scaler for horizontal scaling\n");
+			mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using X86-Asm scaler for horizontal scaling\n");
 #else
 			if(flags & SWS_FAST_BILINEAR)
-				printf("SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n");
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using FAST_BILINEAR C scaler for horizontal scaling\n");
 			else
-				printf("SwScaler: using C scaler for horizontal scaling\n");
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using C scaler for horizontal scaling\n");
 #endif
 		}
 		if(isPlanarYUV(dstFormat))
 		{
 			if(c->vLumFilterSize==1)
-				printf("SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C");
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C");
 			else
-				printf("SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C");
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using n-tap %s scaler for vertical scaling (YV12 like)\n", cpuCaps.hasMMX ? "MMX" : "C");
 		}
 		else
 		{
 			if(c->vLumFilterSize==1 && c->vChrFilterSize==2)
-				printf("SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
 				       "SwScaler:       2-tap scaler for vertical chrominance scaling (BGR)\n",cpuCaps.hasMMX ? "MMX" : "C");
 			else if(c->vLumFilterSize==2 && c->vChrFilterSize==2)
-				printf("SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C");
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using 2-tap linear %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C");
 			else
-				printf("SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C");
+				mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using n-tap %s scaler for vertical scaling (BGR)\n", cpuCaps.hasMMX ? "MMX" : "C");
 		}
 
 		if(dstFormat==IMGFMT_BGR24)
-			printf("SwScaler: using %s YV12->BGR24 Converter\n",
+			mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using %s YV12->BGR24 Converter\n",
 				cpuCaps.hasMMX2 ? "MMX2" : (cpuCaps.hasMMX ? "MMX" : "C"));
 		else if(dstFormat==IMGFMT_BGR32)
-			printf("SwScaler: using %s YV12->BGR32 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
+			mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using %s YV12->BGR32 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
 		else if(dstFormat==IMGFMT_BGR16)
-			printf("SwScaler: using %s YV12->BGR16 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
+			mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using %s YV12->BGR16 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
 		else if(dstFormat==IMGFMT_BGR15)
-			printf("SwScaler: using %s YV12->BGR15 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
+			mp_msg(MSGT_SWS,MSGL_V,"SwScaler: using %s YV12->BGR15 Converter\n", cpuCaps.hasMMX ? "MMX" : "C");
 
-		printf("SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
+		mp_msg(MSGT_SWS,MSGL_V,"SwScaler: %dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
 	}
 	if((flags & SWS_PRINT_INFO) && verbose>1)
 	{
-		printf("SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
+		mp_msg(MSGT_SWS,MSGL_DBG2,"SwScaler:Lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
 			c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
-		printf("SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
+		mp_msg(MSGT_SWS,MSGL_DBG2,"SwScaler:Chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
 			c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
 	}
 
--- a/postproc/swscale_template.c	Thu May 02 10:52:30 2002 +0000
+++ b/postproc/swscale_template.c	Thu May 02 11:00:16 2002 +0000
@@ -2667,7 +2667,7 @@
 		static int firstTime=1; //FIXME move this into the context perhaps
 		if(flags & SWS_PRINT_INFO && firstTime)
 		{
-			fprintf(stderr, "SwScaler: Warning: dstStride is not aligned!\n"
+			mp_msg(MSGT_SWS,MSGL_WARN,"SwScaler: Warning: dstStride is not aligned!\n"
 					"SwScaler:          ->cannot do aligned memory acesses anymore\n");
 			firstTime=0;
 		}
--- a/postproc/yuv2rgb.c	Thu May 02 10:52:30 2002 +0000
+++ b/postproc/yuv2rgb.c	Thu May 02 11:00:16 2002 +0000
@@ -37,6 +37,7 @@
 #include "rgb2rgb.h"
 #include "../cpudetect.h"
 #include "../mangle.h"
+#include "../mp_msg.h"
 
 #ifdef HAVE_MLIB
 #include "yuv2rgb_mlib.c"
@@ -157,9 +158,9 @@
 	if (yuv2rgb == NULL /*&& (config.flags & VO_MMX_ENABLE)*/) {
 		yuv2rgb = yuv2rgb_init_MMX2 (bpp, mode);
 		if (yuv2rgb != NULL)
-			printf ("Using MMX2 for colorspace transform\n");
+			mp_msg(MSGT_SWS,MSGL_INFO,"Using MMX2 for colorspace transform\n");
 		else
-			printf ("Cannot init MMX2 colorspace transform\n");
+			mp_msg(MSGT_SWS,MSGL_WARN,"Cannot init MMX2 colorspace transform\n");
 	}
     }
     else if(gCpuCaps.hasMMX)
@@ -167,9 +168,9 @@
 	if (yuv2rgb == NULL /*&& (config.flags & VO_MMX_ENABLE)*/) {
 		yuv2rgb = yuv2rgb_init_MMX (bpp, mode);
 		if (yuv2rgb != NULL)
-			printf ("Using MMX for colorspace transform\n");
+			mp_msg(MSGT_SWS,MSGL_INFO,"Using MMX for colorspace transform\n");
 		else
-			printf ("Cannot init MMX colorspace transform\n");
+			mp_msg(MSGT_SWS,MSGL_WARN,"Cannot init MMX colorspace transform\n");
 	}
     }
 #endif
@@ -177,11 +178,11 @@
     if (yuv2rgb == NULL /*&& (config.flags & VO_MLIB_ENABLE)*/) {
 	yuv2rgb = yuv2rgb_init_mlib (bpp, mode);
 	if (yuv2rgb != NULL)
-	    printf ("Using mlib for colorspace transform\n");
+	    mp_msg(MSGT_SWS,MSGL_INFO,"Using mlib for colorspace transform\n");
     }
 #endif
     if (yuv2rgb == NULL) {
-	printf ("No accelerated colorspace conversion found\n");
+	mp_msg(MSGT_SWS,MSGL_INFO,"No accelerated colorspace conversion found\n");
 	yuv2rgb_c_init (bpp, mode);
 	yuv2rgb = (yuv2rgb_fun)yuv2rgb_c;
     }
@@ -489,7 +490,7 @@
 	break;
 
     default:
-	printf ("%ibpp not supported by yuv2rgb\n", bpp);
+	mp_msg(MSGT_SWS,MSGL_ERR,"%ibpp not supported by yuv2rgb\n", bpp);
 	//exit (1);
     }