Web lists-archives.com

[MPlayer-dev-eng] [PATCH] Expunge printf from vidix/




While tracking down a case of "-really-quiet isn't really quiet" in
#mplayer yesterday, I noticed that most vidix related code uses printf
instead of mp_msg. The attached patch gets rid of printf in favour of
mp_msg. It also adds proper module attribution to a few messages in
vidix/ that were missing it (e.g. in vidix/drivers.c).

Caveats: Most messages are MSGL_STATUS. This could use some more
thought, but it should be an improvement anyway. Also, I can't really
test the vidix code, but it compiles and I don't really see how this
could have broken anything.

Regards,
Arne Bochem
Index: vidix/radeon_vid.c
===================================================================
--- vidix/radeon_vid.c	(revision 37177)
+++ vidix/radeon_vid.c	(working copy)
@@ -40,6 +40,7 @@
 #include "fourcc.h"
 #include "dha.h"
 #include "radeon.h"
+#include "mp_msg.h"
 
 #if !defined(RAGE128) && defined(CONFIG_X11)
 #include <X11/Xlib.h>
@@ -57,7 +58,7 @@
 #endif
 #endif
 
-#define RADEON_ASSERT(msg) printf(RADEON_MSG"################# FATAL:"msg);
+#define RADEON_ASSERT(msg) mp_msg(MSGT_VO, MSGL_ERR, RADEON_MSG"################# FATAL:"msg);
 
 #define VERBOSE_LEVEL 0
 static int verbosity = 0;
@@ -1189,13 +1190,13 @@
       if (!strcmp(extlist[i], "ATIFGLRXDRI")) ext_fglrx = 1;
     }
     if (ext_fgl) {
-      printf(RADEON_MSG" ATI FireGl driver detected");
+      mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" ATI FireGl driver detected");
       firegl_shift = 0x500000;
       if (!ext_fglrx) {
-        printf(", but DRI seems not to be activated\n");
-        printf(RADEON_MSG" Output may not work correctly, check your DRI configration!");
+        mp_msg(MSGT_VO, MSGL_STATUS, ", but DRI seems not to be activated\n");
+        mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Output may not work correctly, check your DRI configration!");
       }
-      printf("\n");
+      mp_msg(MSGT_VO, MSGL_STATUS, "\n");
     }
   }
 }
@@ -1210,7 +1211,7 @@
   err = pci_scan(lst,&num_pci);
   if(err)
   {
-    printf(RADEON_MSG" Error occurred during pci scan: %s\n",strerror(err));
+    mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Error occurred during pci scan: %s\n",strerror(err));
     return err;
   }
   else
@@ -1226,23 +1227,23 @@
 	if(idx == -1 && force == PROBE_NORMAL) continue;
 	dname = pci_device_name(VENDOR_ATI,lst[i].device);
 	dname = dname ? dname : "Unknown chip";
-	printf(RADEON_MSG" Found chip: %s\n",dname);
+	mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Found chip: %s\n",dname);
 #if 0
         if ((lst[i].command & PCI_COMMAND_IO) == 0)
         {
-          printf("[radeon] Device is disabled, ignoring\n");
+          mp_msg(MSGT_VO, MSGL_STATUS, "[radeon] Device is disabled, ignoring\n");
           continue;
         }
 #endif
 	memset(&besr,0,sizeof(bes_registers_t));
 	if(force > PROBE_NORMAL)
 	{
-	    printf(RADEON_MSG" Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : "");
+	    mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : "");
 	    if(idx == -1)
 #ifdef RAGE128
-		printf(RADEON_MSG" Assuming it as Rage128\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Assuming it as Rage128\n");
 #else
-		printf(RADEON_MSG" Assuming it as Radeon1\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Assuming it as Radeon1\n");
 #endif
 	    besr.chip_flags=R_100|R_OVL_SHIFT;
 	}
@@ -1258,7 +1259,7 @@
       }
     }
   }
-  if(err && verbose) printf(RADEON_MSG" Can't find chip\n");
+  if(err && verbose) mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Can't find chip\n");
   return err;
 }
 
@@ -1334,7 +1335,7 @@
 
   if(!probed)
   {
-    printf(RADEON_MSG" Driver was not probed but is being initializing\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Driver was not probed but is being initializing\n");
     return EINTR;
   }
   if((radeon_mmio_base = map_phys_mem(pci_info.base2,0xFFFF))==(void *)-1) return ENOMEM;
@@ -1347,13 +1348,13 @@
       (def_cap.device_id == DEVICE_ATI_RADEON_MOBILITY_M6 ||
        def_cap.device_id == DEVICE_ATI_RADEON_MOBILITY_M62))
   {
-      printf(RADEON_MSG" Working around buggy Radeon Mobility M6 (0 vs. 8MB ram)\n");
+      mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Working around buggy Radeon Mobility M6 (0 vs. 8MB ram)\n");
       radeon_ram_size = 8192*1024;
   }
   else if (radeon_ram_size == 0 &&
            (def_cap.device_id == DEVICE_ATI_RS482_RADEON_XPRESS))
   {
-      printf(RADEON_MSG" Working around buggy RS482 Radeon Xpress 200 Memory Detection\n");
+      mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Working around buggy RS482 Radeon Xpress 200 Memory Detection\n");
       radeon_ram_size = (INREG(CONFIG_MEMSIZE) + 0x100000) << 2;
       radeon_ram_size &=  CONFIG_MEMSIZE_MASK;
   }
@@ -1363,15 +1364,15 @@
       (def_cap.device_id == DEVICE_ATI_RAGE_MOBILITY_M3 ||
        def_cap.device_id == DEVICE_ATI_RAGE_MOBILITY_M32))
   {
-      printf(RADEON_MSG" Working around Rage Mobility M3 (0 vs. 8MB ram)\n");
+      mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Working around Rage Mobility M3 (0 vs. 8MB ram)\n");
       radeon_ram_size = 8192*1024;
   }
 #endif
   if((radeon_mem_base = map_phys_mem(pci_info.base0,radeon_ram_size))==(void *)-1) return ENOMEM;
   radeon_vid_make_default();
-  printf(RADEON_MSG" Video memory = %uMb\n",radeon_ram_size/0x100000);
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Video memory = %uMb\n",radeon_ram_size/0x100000);
   err = mtrr_set_type(pci_info.base0,radeon_ram_size,MTRR_TYPE_WRCOMB);
-  if(!err) printf(RADEON_MSG" Set write-combining type of video memory\n");
+  if(!err) mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" Set write-combining type of video memory\n");
 #ifndef RAGE128
   {
     memset(&rinfo,0,sizeof(rinfo_t));
@@ -1379,11 +1380,11 @@
 
     radeon_get_moninfo(&rinfo);
 	if(rinfo.hasCRTC2) {
-	    printf(RADEON_MSG" DVI port has %s monitor connected\n",GET_MON_NAME(rinfo.dviDispType));
-	    printf(RADEON_MSG" CRT port has %s monitor connected\n",GET_MON_NAME(rinfo.crtDispType));
+	    mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" DVI port has %s monitor connected\n",GET_MON_NAME(rinfo.dviDispType));
+	    mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" CRT port has %s monitor connected\n",GET_MON_NAME(rinfo.crtDispType));
 	}
 	else
-	    printf(RADEON_MSG" CRT port has %s monitor connected\n",GET_MON_NAME(rinfo.crtDispType));
+	    mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG" CRT port has %s monitor connected\n",GET_MON_NAME(rinfo.crtDispType));
   }
 #endif
   save_regs();
@@ -1461,17 +1462,17 @@
 static void radeon_vid_dump_regs( void )
 {
   size_t i;
-  printf(RADEON_MSG"*** Begin of DRIVER variables dump ***\n");
-  printf(RADEON_MSG"radeon_mmio_base=%p\n",radeon_mmio_base);
-  printf(RADEON_MSG"radeon_mem_base=%p\n",radeon_mem_base);
-  printf(RADEON_MSG"radeon_overlay_off=%08X\n",radeon_overlay_off);
-  printf(RADEON_MSG"radeon_ram_size=%08X\n",radeon_ram_size);
-  printf(RADEON_MSG"video mode: %ux%u@%u\n",radeon_get_xres(),radeon_get_yres(),radeon_vid_get_dbpp());
-  printf(RADEON_MSG"H_scale_ratio=%8.2f\n",H_scale_ratio);
-  printf(RADEON_MSG"*** Begin of OV0 registers dump ***\n");
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"*** Begin of DRIVER variables dump ***\n");
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"radeon_mmio_base=%p\n",radeon_mmio_base);
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"radeon_mem_base=%p\n",radeon_mem_base);
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"radeon_overlay_off=%08X\n",radeon_overlay_off);
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"radeon_ram_size=%08X\n",radeon_ram_size);
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"video mode: %ux%u@%u\n",radeon_get_xres(),radeon_get_yres(),radeon_vid_get_dbpp());
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"H_scale_ratio=%8.2f\n",H_scale_ratio);
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"*** Begin of OV0 registers dump ***\n");
   for(i=0;i<sizeof(vregs)/sizeof(video_registers_t);i++)
-	printf(RADEON_MSG"%s = %08X\n",vregs[i].sname,INREG(vregs[i].name));
-  printf(RADEON_MSG"*** End of OV0 registers dump ***\n");
+	mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"%s = %08X\n",vregs[i].sname,INREG(vregs[i].name));
+  mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"*** End of OV0 registers dump ***\n");
 }
 
 static void radeon_vid_stop_video( void )
@@ -1580,7 +1581,7 @@
     OUTREG(OV0_FOUR_TAP_COEF_4,besr.four_tap_coeff[4]);
     if(besr.swap_uv) OUTREG(OV0_TEST,INREG(OV0_TEST)|OV0_SWAP_UV);
     OUTREG(OV0_REG_LOAD_CNTL,		0);
-    if(verbosity > VERBOSE_LEVEL) printf(RADEON_MSG"we wanted: scaler=%08X\n",bes_flags);
+    if(verbosity > VERBOSE_LEVEL) mp_msg(MSGT_VO, MSGL_STATUS, RADEON_MSG"we wanted: scaler=%08X\n",bes_flags);
     if(verbosity > VERBOSE_LEVEL) radeon_vid_dump_regs();
 }
 
Index: vidix/pci.c
===================================================================
--- vidix/pci.c	(revision 37177)
+++ vidix/pci.c	(working copy)
@@ -53,6 +53,7 @@
 
 #include "dha.h"
 #include "config.h"
+#include "mp_msg.h"
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
@@ -710,7 +711,7 @@
 
     if (len != 4)
     {
-	fprintf(stderr,"pci_config_read: Reading non-dword not supported!\n");
+	mp_msg(MSGT_VO, MSGL_ERR, "[pci] pci_config_read: Reading non-dword not supported!\n");
 	return ENOTSUP;
     }
 
Index: vidix/vidix.c
===================================================================
--- vidix/vidix.c	(revision 37177)
+++ vidix/vidix.c	(working copy)
@@ -43,6 +43,7 @@
 #include "drivers.h"
 #include "libavutil/common.h"
 #include "mpbswap.h"
+#include "mp_msg.h"
 
 VDXContext *vdlOpen(const char *name,unsigned cap,int verbose)
 {
@@ -62,30 +63,30 @@
   }
 
   if (verbose)
-    printf ("vidixlib: will use %s driver\n", ctx->drv->name);
+    mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] Will use %s driver\n", ctx->drv->name);
 
   if (!ctx->drv || !ctx->drv->init)
   {
     if (verbose)
-      printf ("vidixlib: Can't init driver\n");
+      mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] Can't init driver\n");
     free (ctx);
     return NULL;
   }
 
   if (verbose)
-    printf ("vidixlib: Attempt to initialize driver at: %p\n",
+    mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] Attempt to initialize driver at: %p\n",
             ctx->drv->init);
 
   if (ctx->drv->init () !=0)
   {
     if (verbose)
-      printf ("vidixlib: Can't init driver\n");
+      mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] Can't init driver\n");
     free (ctx);
     return NULL;
   }
 
   if (verbose)
-    printf("vidixlib: '%s'successfully loaded\n", ctx->drv->name);
+    mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] '%s'successfully loaded\n", ctx->drv->name);
 
   return ctx;
 }
Index: vidix/ivtv_vid.c
===================================================================
--- vidix/ivtv_vid.c	(revision 37177)
+++ vidix/ivtv_vid.c	(working copy)
@@ -43,6 +43,7 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #define VIDIX_STATIC ivtv_
 
@@ -235,22 +236,22 @@
 	char yuv_device_name[] = "/dev/videoXXX\0";
 
 	if(verbose)
-		printf(IVTV_MSG"probe\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"probe\n");
 
 	ivtv_verbose = verbose;
 
 	err = pci_scan(lst, &num_pci);
 	if(err)	{
-		printf(IVTV_MSG"Error occured during pci scan: %s\n", strerror(err));
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Error occured during pci scan: %s\n", strerror(err));
 		return err;
 	}
 
 	if(ivtv_verbose)
-		printf(IVTV_MSG"Found %d pci devices\n", num_pci);
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Found %d pci devices\n", num_pci);
 
 	for(i = 0; i < num_pci; i++) {
 		if(2 == ivtv_verbose)
-			printf(IVTV_MSG"Found chip [%04X:%04X] '%s' '%s'\n"
+			mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Found chip [%04X:%04X] '%s' '%s'\n"
 				,lst[i].vendor
 				,lst[i].device
 				,pci_vendor_name(lst[i].vendor)
@@ -260,14 +261,14 @@
 			{
 			case DEVICE_INTERNEXT_ITVC15_MPEG_2_ENCODER:
 				if(ivtv_verbose)
-					printf(IVTV_MSG"Found PVR 350\n");
+					mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Found PVR 350\n");
 				goto card_found;
 			}
 		}
 	}
 
 	if(ivtv_verbose)
-		printf(IVTV_MSG"Can't find chip\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Can't find chip\n");
 	return ENXIO;
 
 card_found:
@@ -282,15 +283,15 @@
 	fbdev = open(device_name, O_RDWR);
 	if(-1 != fbdev) {
 		if(ioctl(fbdev, FBIOGET_VSCREENINFO, &vinfo) < 0) {
-			printf(IVTV_MSG"Unable to read screen info\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Unable to read screen info\n");
 			close(fbdev);
 			return ENXIO;
 		} else {
 			fb_width = vinfo.xres;
 			fb_height = vinfo.yres;
 			if(2 == ivtv_verbose) {
-				printf(IVTV_MSG"framebuffer width : %3.0f\n",fb_width);
-				printf(IVTV_MSG"framebuffer height: %3.0f\n",fb_height);
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"framebuffer width : %3.0f\n",fb_width);
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"framebuffer height: %3.0f\n",fb_height);
 			}
 		}
 		if(NULL != (alpha = getenv("VIDIXIVTVALPHA"))) {
@@ -299,7 +300,7 @@
 			}
 		}
 	} else {
-		printf(IVTV_MSG"Failed to open /dev/fb%u\n", fb_number);
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Failed to open /dev/fb%u\n", fb_number);
 		return ENXIO;
 	}
 
@@ -309,11 +310,11 @@
 		yuvdev = open(yuv_device_name, O_RDWR);
 		if(-1 != yuvdev) {
 			if(ivtv_verbose)
-				printf(IVTV_MSG"YUV device found /dev/video%u\n", yuv_device);
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"YUV device found /dev/video%u\n", yuv_device);
 			goto yuv_found;
 		} else {
 			if(ivtv_verbose)
-				printf(IVTV_MSG"YUV device not found: /dev/video%u\n", yuv_device);
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"YUV device not found: /dev/video%u\n", yuv_device);
 		}
 	} while(yuv_device-- > yuv_device_number);
 	return ENXIO;
@@ -322,14 +323,14 @@
 	if(0 == alpha_disable) {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
 		if(ioctl(fbdev, IVTVFB_IOCTL_GET_STATE, &fb_state_old) < 0) {
-			printf(IVTV_MSG"Unable to read fb state\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Unable to read fb state\n");
 			close(yuvdev);
 			close(fbdev);
 			return ENXIO;
 		} else {
 			if(ivtv_verbose) {
-				printf(IVTV_MSG"old alpha : %ld\n",fb_state_old.alpha);
-				printf(IVTV_MSG"old status: 0x%lx\n",fb_state_old.status);
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"old alpha : %ld\n",fb_state_old.alpha);
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"old status: 0x%lx\n",fb_state_old.status);
 			}
 			fb_state_hide.alpha = 0;
 			fb_state_hide.status = fb_state_old.status | IVTVFB_STATUS_GLOBAL_ALPHA;
@@ -338,13 +339,13 @@
 		memset(&format_old, 0, sizeof(format_old));
 		format_old.type = format_hide.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY;
 		if(ioctl(yuvdev, VIDIOC_G_FMT , &format_old) < 0) {
-			printf(IVTV_MSG"Unable to read fb state\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Unable to read fb state\n");
 			close(yuvdev);
 			close(fbdev);
 			return ENXIO;
 		} else {
 			if(ivtv_verbose) {
-				printf(IVTV_MSG"old alpha : %d\n",format_old.fmt.win.global_alpha);
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"old alpha : %d\n",format_old.fmt.win.global_alpha);
 			}
 			memcpy(&format_hide, &format_old, sizeof(format_old));
 			format_hide.fmt.win.global_alpha = 0;
@@ -358,17 +359,17 @@
 int ivtv_init(const char *args)
 {
 	if(ivtv_verbose)
-		printf(IVTV_MSG"init\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"init\n");
 
 	if (!probed) {
 		if(ivtv_verbose)
-			printf(IVTV_MSG"Driver was not probed but is being initialized\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Driver was not probed but is being initialized\n");
 		return EINTR;
 	}
 	outbuf = malloc((IVTVMAXHEIGHT * IVTVMAXWIDTH) + (IVTVMAXHEIGHT * IVTVMAXWIDTH / 2));
 	if(NULL == outbuf) {
 		if(ivtv_verbose)
-			printf(IVTV_MSG"Not enough memory availabe!\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Not enough memory availabe!\n");
 		return EINTR;
 	}
 	return 0;
@@ -377,7 +378,7 @@
 void ivtv_destroy(void)
 {
 	if(ivtv_verbose)
-		printf(IVTV_MSG"destroy\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"destroy\n");
 	if(-1 != yuvdev)
 		close(yuvdev);
 	if(-1 != fbdev)
@@ -389,7 +390,7 @@
 int ivtv_get_caps(vidix_capability_t *to)
 {
 	if(ivtv_verbose)
-		printf(IVTV_MSG"GetCap\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"GetCap\n");
 	memcpy(to, &ivtv_cap, sizeof(vidix_capability_t));
 	return 0;
 }
@@ -399,7 +400,7 @@
 	int supports = 0;
 
 	if(ivtv_verbose)
-		printf(IVTV_MSG"query fourcc (%x)\n", to->fourcc);
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"query fourcc (%x)\n", to->fourcc);
 
 	switch(to->fourcc)
 	{
@@ -422,12 +423,12 @@
 int ivtv_config_playback(vidix_playback_t *info)
 {
 	if(ivtv_verbose)
-		printf(IVTV_MSG"config playback\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"config playback\n");
 
 	if(2 == ivtv_verbose){
-		printf(IVTV_MSG"src : x:%d y:%d w:%d h:%d\n",
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"src : x:%d y:%d w:%d h:%d\n",
 			info->src.x, info->src.y, info->src.w, info->src.h);
-		printf(IVTV_MSG"dest: x:%d y:%d w:%d h:%d\n",
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"dest: x:%d y:%d w:%d h:%d\n",
 			info->dest.x, info->dest.y, info->dest.w, info->dest.h);
 	}
 
@@ -445,7 +446,7 @@
 	info->offset.v = info->offset.u + ((info->src.w * info->src.h)/4);
 	info->dga_addr = memBase = malloc(info->num_frames*info->frame_size);
 	if(ivtv_verbose)
-		printf(IVTV_MSG"frame_size: %d, dga_addr: %p\n",
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"frame_size: %d, dga_addr: %p\n",
 	info->frame_size, info->dga_addr);
 	return 0;
 }
@@ -453,18 +454,18 @@
 int ivtv_playback_on(void)
 {
 	if(ivtv_verbose)
-		printf(IVTV_MSG"playback on\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"playback on\n");
 
 	if(0 == alpha_disable) {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
 		if (-1 != fbdev) {
 			if (ioctl(fbdev, IVTVFB_IOCTL_SET_STATE, &fb_state_hide) < 0)
-				printf (IVTV_MSG"Failed to set fb state\n");
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Failed to set fb state\n");
 		}
 #else
 		if (-1 != yuvdev) {
 			if (ioctl(yuvdev, VIDIOC_S_FMT, &format_hide) < 0)
-				printf (IVTV_MSG"Failed to set fb state\n");
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Failed to set fb state\n");
 		}
 #endif
 	}
@@ -474,18 +475,18 @@
 int ivtv_playback_off(void)
 {
 	if(ivtv_verbose)
-		printf(IVTV_MSG"playback off\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"playback off\n");
 
 	if(0 == alpha_disable) {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
 		if (-1 != fbdev) {
 			if (ioctl(fbdev, IVTVFB_IOCTL_SET_STATE, &fb_state_old) < 0)
-				printf (IVTV_MSG"Failed to restore fb state\n");
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Failed to restore fb state\n");
 		}
 #else
 		if (-1 != yuvdev) {
 			if (ioctl(yuvdev, VIDIOC_S_FMT, &format_old) < 0)
-				printf (IVTV_MSG"Failed to restore fb state\n");
+				mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Failed to restore fb state\n");
 		}
 #endif
 	}
@@ -541,7 +542,7 @@
 #else
 	if(ioctl(yuvdev, IVTV_IOC_DMA_FRAME, &args) == -1) {
 #endif
-		printf("Ioctl IVTV_IOC_DMA_FRAME returned failed Error\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, IVTV_MSG"Ioctl IVTV_IOC_DMA_FRAME returned failed Error\n");
 	}
 	return 0;
 }
Index: vidix/unichrome_vid.c
===================================================================
--- vidix/unichrome_vid.c	(revision 37177)
+++ vidix/unichrome_vid.c	(working copy)
@@ -36,6 +36,7 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #include "unichrome_regs.h"
 
@@ -298,7 +299,7 @@
       fetch = (ALIGN_TO (sw << 2, 16) >> 4) + 1;
       break;
     default:
-      printf ("[unichrome] Unexpected pixelformat!");
+      mp_msg(MSGT_VO, MSGL_STATUS, "[unichrome] Unexpected pixelformat!");
       break;
     }
 
@@ -338,7 +339,7 @@
     case IMGFMT_BGR32:
       return V1_RGB32;
     default:
-      printf ("[unichrome] Unexpected pixelformat!");
+      mp_msg(MSGT_VO, MSGL_STATUS, "[unichrome] Unexpected pixelformat!");
       return V1_YUV422;
     }
 }
@@ -464,7 +465,7 @@
   err = pci_scan (lst, &num_pci);
   if (err)
     {
-      printf ("[unichrome] Error occurred during pci scan: %s\n",
+      mp_msg(MSGT_VO, MSGL_STATUS, "[unichrome] Error occurred during pci scan: %s\n",
 	      strerror (err));
       return err;
     }
@@ -482,10 +483,10 @@
 		continue;
 	      dname = pci_device_name (VENDOR_VIA2, lst[i].device);
 	      dname = dname ? dname : "Unknown chip";
-	      printf ("[unichrome] Found chip: %s\n", dname);
+	      mp_msg(MSGT_VO, MSGL_STATUS, "[unichrome] Found chip: %s\n", dname);
 	      if ((lst[i].command & PCI_COMMAND_IO) == 0)
 		{
-		  printf ("[unichrome] Device is disabled, ignoring\n");
+		  mp_msg(MSGT_VO, MSGL_STATUS, "[unichrome] Device is disabled, ignoring\n");
 		  continue;
 		}
 	      uc_cap.device_id = lst[i].device;
@@ -497,7 +498,7 @@
     }
 
   if (err && verbose)
-    printf ("[unichrome] Can't find chip\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[unichrome] Can't find chip\n");
   return err;
 }
 
@@ -810,7 +811,7 @@
   if ((src_w > 4096) || (src_h > 4096) ||
       (src_w < 32) || (src_h < 1) || (pitch > 0x1fff))
     {
-      printf ("[unichrome] Layer size out of bounds\n");
+      mp_msg(MSGT_VO, MSGL_STATUS, "[unichrome] Layer size out of bounds\n");
     }
 
   /* Calculate offsets */
Index: vidix/sh_veu_vid.c
===================================================================
--- vidix/sh_veu_vid.c	(revision 37177)
+++ vidix/sh_veu_vid.c	(working copy)
@@ -42,6 +42,7 @@
 #include "config.h"
 #include "vidix.h"
 #include "fourcc.h"
+#include "mp_msg.h"
 
 #include "dha.h"
 
@@ -283,29 +284,29 @@
     fb_fd = ret;
 
     if (fbi.bpp != 16) {
-        printf("sh_veu: only 16bpp supported\n");
+        mp_msg(MSGT_VO, MSGL_STATUS, "[sh_veu] only 16bpp supported\n");
         return -1;
     }
 
     ret = locate_uio_device("VEU", &uio_dev);
     if (ret < 0) {
-        printf("sh_veu: unable to locate matching UIO device\n");
+        mp_msg(MSGT_VO, MSGL_STATUS, "[sh_veu] unable to locate matching UIO device\n");
         return ret;
     }
 
     ret = setup_uio_map(&uio_dev, 0, &uio_mmio);
     if (ret < 0) {
-        printf("sh_veu: cannot setup MMIO\n");
+        mp_msg(MSGT_VO, MSGL_STATUS, "[sh_veu] cannot setup MMIO\n");
         return ret;
     }
 
     ret = setup_uio_map(&uio_dev, 1, &uio_mem);
     if (ret < 0) {
-        printf("sh_veu: cannot setup contiguous memory\n");
+        mp_msg(MSGT_VO, MSGL_STATUS, "[sh_veu] cannot setup contiguous memory\n");
         return ret;
     }
 
-    printf("sh_veu: Using %s at %s on %lux%lu %ldbpp /dev/fb0\n",
+    mp_msg(MSGT_VO, MSGL_STATUS, "[sh_veu] Using %s at %s on %lux%lu %ldbpp /dev/fb0\n",
            uio_dev.name, uio_dev.path,
            fbi.width, fbi.height, fbi.bpp);
 
@@ -568,7 +569,7 @@
         info->num_frames = VID_PLAY_MAXFRAMES;
 
     if (!info->num_frames) {
-        printf("sh_veu: %d is not enough memory for %d bytes frame\n",
+        mp_msg(MSGT_VO, MSGL_STATUS, "[sh_veu] %d is not enough memory for %d bytes frame\n",
                (int)uio_mem.size, (int)info->frame_size);
         return ENOMEM;
     }
@@ -581,13 +582,13 @@
 
     my_info = *info;
 
-    printf("sh_veu: %d frames * %d bytes, total size = %d\n",
+    mp_msg(MSGT_VO, MSGL_STATUS, "[sh_veu] %d frames * %d bytes, total size = %d\n",
            (int)info->num_frames, (int)info->frame_size,
            (int)uio_mem.size);
 
     sh_veu_setup_planes(info, &_src, &_dst);
 
-    printf("sh_veu: %dx%d->%dx%d@%dx%d -> %dx%d->%dx%d@%dx%d \n",
+    mp_msg(MSGT_VO, MSGL_STATUS, "[sh_veu] %dx%d->%dx%d@%dx%d -> %dx%d->%dx%d@%dx%d \n",
            (int)info->src.w, (int)info->src.h,
            (int)info->dest.w, (int)info->dest.h,
            (int)info->dest.x, (int)info->dest.y,
Index: vidix/cyberblade_vid.c
===================================================================
--- vidix/cyberblade_vid.c	(revision 37177)
+++ vidix/cyberblade_vid.c	(working copy)
@@ -44,6 +44,7 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #include "cyberblade_regs.h"
 
@@ -119,7 +120,7 @@
 	err = pci_scan(lst,&num_pci);
 	if(err)
 	{
-		printf("[cyberblade] Error occurred during pci scan: %s\n",strerror(err));
+		mp_msg(MSGT_VO, MSGL_STATUS, "[cyberblade] Error occurred during pci scan: %s\n",strerror(err));
 		return err;
 	}
 	else
@@ -136,11 +137,11 @@
 					continue;
 				dname = pci_device_name(VENDOR_TRIDENT, lst[i].device);
 				dname = dname ? dname : "Unknown chip";
-				printf("[cyberblade] Found chip: %s\n", dname);
+				mp_msg(MSGT_VO, MSGL_STATUS, "[cyberblade] Found chip: %s\n", dname);
 #if 0
                                 if ((lst[i].command & PCI_COMMAND_IO) == 0)
 				{
-					printf("[cyberblade] Device is disabled, ignoring\n");
+					mp_msg(MSGT_VO, MSGL_STATUS, "[cyberblade] Device is disabled, ignoring\n");
 					continue;
 				}
 #endif
@@ -152,7 +153,7 @@
 		}
 	}
 
-	if(err && verbose) printf("[cyberblade] Can't find chip\n");
+	if(err && verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[cyberblade] Can't find chip\n");
 		return err;
 }
 
@@ -464,8 +465,8 @@
 		}
                 VWinStart=(VTotal-VSync)-8;
 
-		printf("[cyberblade] HTotal: 0x%x, HSStart: 0x%x\n",HTotal,HSync);
-		printf("  VTotal: 0x%x, VStart: 0x%x\n",VTotal,VSync);
+		mp_msg(MSGT_VO, MSGL_STATUS, "[cyberblade] HTotal: 0x%x, HSStart: 0x%x\n",HTotal,HSync);
+		mp_msg(MSGT_VO, MSGL_STATUS, "[cyberblade] VTotal: 0x%x, VStart: 0x%x\n",VTotal,VSync);
 		tx1=HWinStart+info->dest.x;
 		ty1=VWinStart+info->dest.y;
 		tx2=tx1+info->dest.w;
Index: vidix/mga_vid.c
===================================================================
--- vidix/mga_vid.c	(revision 37177)
+++ vidix/mga_vid.c	(working copy)
@@ -58,6 +58,7 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #ifdef __MINGW32__
 #define ENOTSUP 134
@@ -344,7 +345,7 @@
 static int mga_frame_select(unsigned int frame)
 {
     mga_next_frame = frame;
-    if (mga_verbose>1) printf("[mga] frameselect: %d\n", mga_next_frame);
+    if (mga_verbose>1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] frameselect: %d\n", mga_next_frame);
 #if MGA_ALLOW_IRQ
     if (mga_irq == -1)
 #endif
@@ -539,12 +540,12 @@
 
 	if (mga_verbose > 1)
 	{
-	    printf("[mga] wrote BES registers\n");
-	    printf("[mga] BESCTL = 0x%08x\n",
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] wrote BES registers\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] BESCTL = 0x%08x\n",
 			readl(mga_mmio_base + BESCTL));
-	    printf("[mga] BESGLOBCTL = 0x%08x\n",
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] BESGLOBCTL = 0x%08x\n",
 			readl(mga_mmio_base + BESGLOBCTL));
-	    printf("[mga] BESSTATUS= 0x%08x\n",
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] BESSTATUS= 0x%08x\n",
 			readl(mga_mmio_base + BESSTATUS));
 	}
 #ifdef CRTC2
@@ -554,7 +555,7 @@
 	// disable CRTC2 acording to specs
 	writel(cregs.c2misc, mga_mmio_base + C2MISC);
 
-	if (mga_verbose > 1) printf("[mga] c2offset = %d\n",cregs.c2offset);
+	if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] c2offset = %d\n",cregs.c2offset);
 
 	writel(cregs.c2offset, mga_mmio_base + C2OFFSET);
 	writel(cregs.c2startadd0, mga_mmio_base + C2STARTADD0);
@@ -643,7 +644,7 @@
 
     if ((config->num_frames < 1) || (config->num_frames > 4))
     {
-	printf("[mga] illegal num_frames: %d, setting to %d\n",
+	mp_msg(MSGT_VO, MSGL_STATUS, "[mga] illegal num_frames: %d, setting to %d\n",
 	    config->num_frames, MGA_DEFAULT_FRAMES);
 	config->num_frames = MGA_DEFAULT_FRAMES;
     }
@@ -658,12 +659,12 @@
     config->dest.pitch.y=32;
     config->dest.pitch.u=config->dest.pitch.v=32;
 
-    if (mga_verbose) printf("[mga] Setting up a %dx%d-%dx%d video window (src %dx%d) format %X\n",
+    if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Setting up a %dx%d-%dx%d video window (src %dx%d) format %X\n",
            dw, dh, x, y, sw, sh, config->fourcc);
 
     if ((sw < 4) || (sh < 4) || (dw < 4) || (dh < 4))
     {
-        printf("[mga] Invalid src/dest dimensions\n");
+        mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Invalid src/dest dimensions\n");
         return EINVAL;
     }
 
@@ -683,7 +684,7 @@
 	    config->frame_size = ((sw + 31) & ~31) * sh * 2;
 	    break;
 	default:
-	    printf("[mga] Unsupported pixel format: %x\n", config->fourcc);
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Unsupported pixel format: %x\n", config->fourcc);
 	    return ENOTSUP;
     }
 
@@ -705,11 +706,11 @@
     mga_src_base = (mga_ram_size*0x100000-config->num_frames*config->frame_size);
     if (mga_src_base < 0)
     {
-    	printf("[mga] not enough memory for frames!\n");
+    	mp_msg(MSGT_VO, MSGL_STATUS, "[mga] not enough memory for frames!\n");
     	return EFAULT;
     }
     mga_src_base &= (~0xFFFF); /* 64k boundary */
-    if (mga_verbose > 1) printf("[mga] YUV buffer base: %#x\n", mga_src_base);
+    if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] YUV buffer base: %#x\n", mga_src_base);
 
     config->dga_addr = mga_mem_base + mga_src_base;
 
@@ -1047,7 +1048,7 @@
 
 static int mga_playback_on(void)
 {
-    if (mga_verbose) printf("[mga] playback on\n");
+    if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] playback on\n");
 
     vid_src_ready = 1;
     if(vid_overlay_on)
@@ -1066,7 +1067,7 @@
 
 static int mga_playback_off(void)
 {
-    if (mga_verbose) printf("[mga] playback off\n");
+    if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] playback off\n");
 
     vid_src_ready = 0;
 #if MGA_ALLOW_IRQ
@@ -1086,7 +1087,7 @@
 	unsigned int i, num_pci;
 	int err;
 
-	if (verbose) printf("[mga] probe\n");
+	if (verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] probe\n");
 
 	mga_verbose = verbose;
 
@@ -1095,43 +1096,43 @@
 	err = pci_scan(lst, &num_pci);
 	if (err)
 	{
-	    printf("[mga] Error occurred during pci scan: %s\n", strerror(err));
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Error occurred during pci scan: %s\n", strerror(err));
 	    return err;
 	}
 
 	if (mga_verbose)
-	    printf("[mga] found %d pci devices\n", num_pci);
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] found %d pci devices\n", num_pci);
 
 	for (i = 0; i < num_pci; i++)
 	{
 	    if (mga_verbose > 1)
-		printf("[mga] pci[%d] vendor: %d device: %d\n",
+		mp_msg(MSGT_VO, MSGL_STATUS, "[mga] pci[%d] vendor: %d device: %d\n",
 		    i, lst[i].vendor, lst[i].device);
 	    if (lst[i].vendor == VENDOR_MATROX)
 	    {
 #if 0
 		if ((lst[i].command & PCI_COMMAND_IO) == 0)
 		{
-			printf("[mga] Device is disabled, ignoring\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Device is disabled, ignoring\n");
 			continue;
 		}
 #endif
 		switch(lst[i].device)
 		{
 		    case DEVICE_MATROX_MGA_G550_AGP:
-			printf("[mga] Found MGA G550\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Found MGA G550\n");
 			is_g400 = 1;
 			goto card_found;
 		    case DEVICE_MATROX_MGA_G400_G450:
-			printf("[mga] Found MGA G400/G450\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Found MGA G400/G450\n");
 			is_g400 = 1;
 			goto card_found;
 		    case DEVICE_MATROX_MGA_G200_AGP:
-			printf("[mga] Found MGA G200 AGP\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Found MGA G200 AGP\n");
 			is_g400 = 0;
 			goto card_found;
 		    case DEVICE_MATROX_MGA_G200:
-			printf("[mga] Found MGA G200 PCI\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Found MGA G200 PCI\n");
 			is_g400 = 0;
 			goto card_found;
 		}
@@ -1140,7 +1141,7 @@
 
 	if (is_g400 == -1)
 	{
-		if (verbose) printf("[mga] Can't find chip\n");
+		if (verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Can't find chip\n");
 		return ENXIO;
 	}
 
@@ -1158,37 +1159,37 @@
     unsigned int card_option = 0;
     int err;
 
-    if (mga_verbose) printf("[mga] init\n");
+    if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] init\n");
 
     mga_vid_in_use = 0;
 
-    printf("Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n");
 #ifdef CRTC2
-    printf("Driver compiled with TV-out (second-head) support\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Driver compiled with TV-out (second-head) support\n");
 #endif
 
     if (!probed)
     {
-	printf("[mga] driver was not probed but is being initializing\n");
+	mp_msg(MSGT_VO, MSGL_STATUS, "[mga] driver was not probed but is being initializing\n");
 	return EINTR;
     }
 
 #ifdef MGA_PCICONFIG_MEMDETECT
     pci_config_read(pci_info.bus, pci_info.card, pci_info.func,
         0x40, 4, &card_option);
-    if (mga_verbose > 1) printf("[mga] OPTION word: 0x%08X  mem: 0x%02X  %s\n", card_option,
+    if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] OPTION word: 0x%08X  mem: 0x%02X  %s\n", card_option,
     	(card_option>>10)&0x17, ((card_option>>14)&1)?"SGRAM":"SDRAM");
 #endif
 
     if (mga_ram_size)
     {
-    	printf("[mga] RAMSIZE forced to %d MB\n", mga_ram_size);
+    	mp_msg(MSGT_VO, MSGL_STATUS, "[mga] RAMSIZE forced to %d MB\n", mga_ram_size);
     }
     else
     {
 #ifdef MGA_MEMORY_SIZE
         mga_ram_size = MGA_MEMORY_SIZE;
-        printf("[mga] hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
+        mp_msg(MSGT_VO, MSGL_STATUS, "[mga] hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
 #else
         if (is_g400)
 	{
@@ -1205,7 +1206,7 @@
 	        case 0x12:  mga_ram_size = 16; break;
 	        default:
 	    	    mga_ram_size = 16;
-		    printf("[mga] Couldn't detect RAMSIZE, assuming 16MB!\n");
+		    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Couldn't detect RAMSIZE, assuming 16MB!\n");
 	    }
 	}
 	else
@@ -1216,7 +1217,7 @@
 	    }
 	}
 
-        printf("[mga] detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
+        mp_msg(MSGT_VO, MSGL_STATUS, "[mga] detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
 #endif
     }
 
@@ -1224,42 +1225,42 @@
     {
 	if ((mga_ram_size < 4) || (mga_ram_size > 64))
 	{
-	    printf("[mga] invalid RAMSIZE: %d MB\n", mga_ram_size);
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] invalid RAMSIZE: %d MB\n", mga_ram_size);
 	    return EINVAL;
 	}
     }
 
-    if (mga_verbose > 1) printf("[mga] hardware addresses: mmio: %#x, framebuffer: %#x\n",
+    if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] hardware addresses: mmio: %#x, framebuffer: %#x\n",
         pci_info.base1, pci_info.base0);
 
     mga_mmio_base = map_phys_mem(pci_info.base1,0x4000);
     mga_mem_base = map_phys_mem(pci_info.base0,mga_ram_size*1024*1024);
 
-    if (mga_verbose > 1) printf("[mga] MMIO at %p, IRQ: %d, framebuffer: %p\n",
+    if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] MMIO at %p, IRQ: %d, framebuffer: %p\n",
         mga_mmio_base, mga_irq, mga_mem_base);
     err = mtrr_set_type(pci_info.base0,mga_ram_size*1024*1024,MTRR_TYPE_WRCOMB);
-    if(!err) printf("[mga] Set write-combining type of video memory\n");
+    if(!err) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Set write-combining type of video memory\n");
 #if MGA_ALLOW_IRQ
     if (mga_irq != -1)
     {
     	int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq);
     	if (tmp)
 	{
-    	    printf("syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp);
+    	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp);
     	    mga_irq=-1;
 	}
 	else
 	{
-	    printf("syncfb (mga): registered irq %d\n", mga_irq);
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mga] syncfb (mga): registered irq %d\n", mga_irq);
 	}
     }
     else
     {
-	printf("syncfb (mga): No valid irq was found\n");
+	mp_msg(MSGT_VO, MSGL_STATUS, "[mga] syncfb (mga): No valid irq was found\n");
 	mga_irq=-1;
     }
 #else
-	printf("syncfb (mga): IRQ disabled in mga_vid.c\n");
+	mp_msg(MSGT_VO, MSGL_STATUS, "[mga] syncfb (mga): IRQ disabled in mga_vid.c\n");
 	mga_irq=-1;
 #endif
 
@@ -1268,7 +1269,7 @@
 
 static void mga_destroy(void)
 {
-    if (mga_verbose) printf("[mga] destroy\n");
+    if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] destroy\n");
 
     /* FIXME turn off BES */
     vid_src_ready = 0;
@@ -1291,7 +1292,7 @@
 
 static int mga_query_fourcc(vidix_fourcc_t *to)
 {
-    if (mga_verbose) printf("[mga] query fourcc (%x)\n", to->fourcc);
+    if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] query fourcc (%x)\n", to->fourcc);
 
     switch(to->fourcc)
     {
@@ -1336,7 +1337,7 @@
     /* contrast and brightness control isn't supported on G200 - alex */
     if (!is_g400)
     {
-	if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n");
+	if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] equalizer isn't supported with G200\n");
 	return ENOTSUP;
     }
 
@@ -1363,7 +1364,7 @@
     /* contrast and brightness control isn't supported on G200 - alex */
     if (!is_g400)
     {
-	if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n");
+	if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] equalizer isn't supported with G200\n");
 	return ENOTSUP;
     }
 
@@ -1371,7 +1372,7 @@
     eq->contrast = (signed short int)(regs.beslumactl & 0xFFFF) * 1000 / 128 - 1000;
     eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST;
 
-    printf("MGA GET_EQ: br=%d c=%d  \n",eq->brightness,eq->contrast);
+    mp_msg(MSGT_VO, MSGL_STATUS, "MGA GET_EQ: br=%d c=%d  \n",eq->brightness,eq->contrast);
 
     return 0;
 }
Index: vidix/sis_bridge.c
===================================================================
--- vidix/sis_bridge.c	(revision 37177)
+++ vidix/sis_bridge.c	(working copy)
@@ -31,6 +31,7 @@
 #include "sis_bridge.h"
 #include "sis_regs.h"
 #include "sis_defs.h"
+#include "mp_msg.h"
 
 
 static void sis_ddc2_delay(unsigned short delaytime)
@@ -201,16 +202,16 @@
 	if (result) {
 	    if (biosflag & 0x01) {
 		if (sis_verbose > 1) {
-		    printf
-			("[SiS] SiS30x: Detected TV connected to SCART output\n");
+		    mp_msg(MSGT_VO, MSGL_STATUS,
+			"[SiS] SiS30x: Detected TV connected to SCART output\n");
 		}
 		sis_vbflags |= TV_SCART;
 		orSISIDXREG(SISCR, 0x32, 0x04);
 		/*pSiS->postVBCR32 |= 0x04; */
 	    } else {
 		if (sis_verbose > 1) {
-		    printf
-			("[SiS] SiS30x: Detected secondary VGA connection\n");
+		    mp_msg(MSGT_VO, MSGL_STATUS,
+			"[SiS] SiS30x: Detected secondary VGA connection\n");
 		}
 		sis_vbflags |= VGA2_CONNECTED;
 		orSISIDXREG(SISCR, 0x32, 0x10);
@@ -241,8 +242,8 @@
     }
     if (result) {
 	if (sis_verbose > 1) {
-	    printf
-		("[SiS] SiS30x: Detected TV connected to SVIDEO output\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS,
+		"[SiS] SiS30x: Detected TV connected to SVIDEO output\n");
 	}
 	/* TW: So we can be sure that there IS a SVIDEO output */
 	sis_vbflags |= TV_SVIDEO;
@@ -264,8 +265,8 @@
 	}
 	if (result) {
 	    if (sis_verbose > 1) {
-		printf
-		    ("[SiS] SiS30x: Detected TV connected to COMPOSITE output\n");
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] SiS30x: Detected TV connected to COMPOSITE output\n");
 	    }
 	    sis_vbflags |= TV_AVIDEO;
 	    orSISIDXREG(SISCR, 0x32, 0x01);
@@ -312,7 +313,7 @@
 	}
     }
     if (sis_verbose > 0) {
-	printf("[SiS] %sCRT1 connection detected\n",
+	mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] %sCRT1 connection detected\n",
 	       sis_crt1_off ? "No " : "");
     }
 }
@@ -408,7 +409,7 @@
 	(TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_CHSCART |
 	 TV_CHHDTV)) {
 	if (sis_verbose > 0) {
-	    printf("[SiS] %sTV standard %s\n",
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] %sTV standard %s\n",
 		   (sis_vbflags & (TV_CHSCART | TV_CHHDTV)) ? "Using " :
 		   "Detected default ",
 		   (sis_vbflags & TV_NTSC) ? ((sis_vbflags & TV_CHHDTV) ?
@@ -459,8 +460,8 @@
 	    sis_vbflags |= VB_302LV;
 	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
 	    if (sis_verbose > 1) {
-		printf
-		    ("[SiS] Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n",
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n",
 		     temp1);
 	    }
 
@@ -468,8 +469,8 @@
 	    sis_vbflags |= VB_301LV;
 	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
 	    if (sis_verbose > 1) {
-		printf
-		    ("[SiS] Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n",
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n",
 		     temp1);
 	    }
 	} else if (temp1 >= 0xB0) {
@@ -479,16 +480,16 @@
 	    if (!(temp2 & 0x02))
 		sis_vbflags |= VB_30xBDH;
 	    if (sis_verbose > 1) {
-		printf
-		    ("[SiS] Detected SiS301B%s video bridge (Revision 0x%x)\n",
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] Detected SiS301B%s video bridge (Revision 0x%x)\n",
 		     (temp2 & 0x02) ? "" : " (DH)", temp1);
 	    }
 	} else {
 	    sis_vbflags |= VB_301;
 	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301;
 	    if (sis_verbose > 1) {
-		printf
-		    ("[SiS] Detected SiS301 video bridge (Revision 0x%x)\n",
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] Detected SiS301 video bridge (Revision 0x%x)\n",
 		     temp1);
 	    }
 	}
@@ -503,16 +504,16 @@
 	    sis_vbflags |= VB_302LV;
 	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
 	    if (sis_verbose > 1) {
-		printf
-		    ("[SiS] Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n",
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n",
 		     temp1);
 	    }
 	} else if (temp1 >= 0xD0) {
 	    sis_vbflags |= VB_301LV;
 	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
 	    if (sis_verbose > 1) {
-		printf
-		    ("[SiS] Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n",
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n",
 		     temp1);
 	    }
 	} else {
@@ -522,8 +523,8 @@
 	    if (!(temp & 0x02))
 		sis_vbflags |= VB_30xBDH;
 	    if (sis_verbose > 1) {
-		printf
-		    ("[SiS] Detected SiS302B%s video bridge (Revision 0x%x)\n",
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] Detected SiS302B%s video bridge (Revision 0x%x)\n",
 		     (temp2 & 0x02) ? "" : " (DH)", temp1);
 	    }
 	}
@@ -532,14 +533,14 @@
 
     } else if (temp == 3) {
 	if (sis_verbose > 1) {
-	    printf("[SiS] Detected SiS303 video bridge - not supported\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Detected SiS303 video bridge - not supported\n");
 	}
     } else {
 	/* big scary mess of code to handle unknown or Chrontel LVDS */
 	/* skipping it for now */
 	if (sis_verbose > 1) {
-	    printf
-		("[SiS] Detected Chrontel video bridge - not supported\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS,
+		"[SiS] Detected Chrontel video bridge - not supported\n");
 	}
     }
 
@@ -565,7 +566,7 @@
 		    }
 		}
 	    if (sis_vbflags & VB_USELCDA) {
-		/* printf("Bridge uses LCDA for low resolution and text modes\n"); */
+		/* mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Bridge uses LCDA for low resolution and text modes\n"); */
 	    }
 	}
     }
@@ -614,22 +615,22 @@
 	else {
 	    sis_vbflags = sis_vbflags & ~(CRT2_LCD);
 	    if (sis_verbose > 0) {
-		printf
-		    ("[SiS] Can't force CRT2 to LCD, no panel detected\n");
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] Can't force CRT2 to LCD, no panel detected\n");
 	    }
 	}
 	break;
     case CRT2_VGA:
 	if (sis_vbflags & VB_LVDS) {
 	    if (sis_verbose > 0) {
-		printf("[SiS] LVDS does not support secondary VGA\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] LVDS does not support secondary VGA\n");
 	    }
 	    break;
 	}
 	if (sis_vbflags & (VB_301LV | VB_302LV)) {
 	    if (sis_verbose > 0) {
-		printf
-		    ("[SiS] SiS30xLV bridge does not support secondary VGA\n");
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] SiS30xLV bridge does not support secondary VGA\n");
 	    }
 	    break;
 	}
@@ -687,7 +688,7 @@
     }
 
     if (sis_verbose > 0) {
-	printf("[SiS] Using hardware overlay on CRT%d\n",
+	mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Using hardware overlay on CRT%d\n",
 	       sis_overlay_on_crt1 ? 1 : 2);
     }
 
Index: vidix/nvidia_vid.c
===================================================================
--- vidix/nvidia_vid.c	(revision 37177)
+++ vidix/nvidia_vid.c	(working copy)
@@ -39,6 +39,7 @@
 #include "pci_names.h"
 #include "libavutil/common.h"
 #include "mpbswap.h"
+#include "mp_msg.h"
 
 
 static pciinfo_t pci_info;
@@ -332,10 +333,10 @@
     int err;
 
     if (force)
-	    printf("[nvidia_vid]: warning: forcing not supported yet!\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid]: warning: forcing not supported yet!\n");
     err = pci_scan(lst,&num_pci);
     if(err){
-	printf("[nvidia_vid] Error occurred during pci scan: %s\n",strerror(err));
+	mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] Error occurred during pci scan: %s\n",strerror(err));
 	return err;
     }
     else {
@@ -349,9 +350,9 @@
 		    continue;
 		dname = pci_device_name(lst[i].vendor, lst[i].device);
 		dname = dname ? dname : "Unknown chip";
-		printf("[nvidia_vid] Found chip: %s\n", dname);
+		mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] Found chip: %s\n", dname);
 		if ((lst[i].command & PCI_COMMAND_IO) == 0){
-			printf("[nvidia_vid] Device is disabled, ignoring\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] Device is disabled, ignoring\n");
 			continue;
 		}
 		nvidia_cap.device_id = lst[i].device;
@@ -361,7 +362,7 @@
 	    }
 	}
     }
-    if(err && verbose) printf("[nvidia_vid] Can't find chip\n");
+    if(err && verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] Can't find chip\n");
     return err;
 }
 
@@ -534,7 +535,7 @@
 	/* NV3 (0x10100010): NV03_PMC_ENABLE_PMEDIA, NV03_PMC_ENABLE_PFB, NV03_PMC_ENABLE_PVIDEO */
 
 	if ((reg & 0x10100010) != 0x10100010) {
-		printf("PVIDEO and PFB disabled, enabling...\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] PVIDEO and PFB disabled, enabling...\n");
 		VID_OR32 (info->chip.PMC, 0x000200, 0x10100010);
 	}
 
@@ -637,7 +638,7 @@
 #endif
 		break;
 	}
-	//printf("[nvidia_vid] depth=%d %08X \n", info->depth, chromakey);
+	//mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] depth=%d %08X \n", info->depth, chromakey);
     switch (info->chip.arch) {
 	  case NV_ARCH_10:
 	  case NV_ARCH_20:
@@ -884,7 +885,7 @@
   info = calloc(1,sizeof(rivatv_info));
   info->control_base = map_phys_mem(pci_info.base0, 0x00C00000 + 0x00008000);
   info->chip.arch =  nvidia_card_ids[find_chip(pci_info.device)].arch;
-  printf("[nvidia_vid] arch %x register base %p\n",info->chip.arch,info->control_base);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] arch %x register base %p\n",info->chip.arch,info->control_base);
   info->chip.PFIFO  = (uint32_t *) (info->control_base + 0x00002000);
   info->chip.FIFO   = (uint32_t *) (info->control_base + 0x00800000);
   info->chip.PMC    = (uint32_t *) (info->control_base + 0x00000000);
@@ -943,16 +944,16 @@
 	}
   }
 
-  printf("[nvidia_vid] detected memory size %u MB\n",(uint32_t)(info->chip.fbsize /1024/1024));
+  mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] detected memory size %u MB\n",(uint32_t)(info->chip.fbsize /1024/1024));
 
   if ((mtrr = mtrr_set_type(pci_info.base1, info->chip.fbsize, MTRR_TYPE_WRCOMB))!= 0)
-	  printf("[nvidia_vid] unable to setup MTRR: %s\n", strerror(mtrr));
+	  mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] unable to setup MTRR: %s\n", strerror(mtrr));
   else
-	  printf("[nvidia_vid] MTRR set up\n");
+	  mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] MTRR set up\n");
 
   nv_getscreenproperties(info);
-  if(!info->depth)printf("[nvidia_vid] text mode: %ux%u\n",info->screen_x,info->screen_y);
-  else printf("[nvidia_vid] video mode: %ux%u@%u\n",info->screen_x,info->screen_y, info->depth);
+  if(!info->depth) mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] text mode: %ux%u\n",info->screen_x,info->screen_y);
+  else mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] video mode: %ux%u@%u\n",info->screen_x,info->screen_y, info->depth);
 
 
   rivatv_enable_PMEDIA(info);
@@ -1001,7 +1002,7 @@
 
 static int nv_config_playback(vidix_playback_t *vinfo){
     uint32_t i;
-//    printf("called %s\n", __FUNCTION__);
+//    mp_msg(MSGT_VO, MSGL_STATUS, "called %s\n", __FUNCTION__);
     if (! is_supported_fourcc(vinfo->fourcc))
 	    return ENOSYS;
 
@@ -1014,7 +1015,7 @@
     info->wy = vinfo->dest.y;
     info->format = vinfo->fourcc;
 
-    printf("[nvidia_vid] setting up a %dx%d-%dx%d video window (src %dx%d), format 0x%X\n",
+    mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] setting up a %dx%d-%dx%d video window (src %dx%d), format 0x%X\n",
 		    info->d_width, info->d_height, info->wx, info->wy, info->width, info->height, vinfo->fourcc);
 
 
@@ -1040,7 +1041,7 @@
     info->num_frames = vinfo->num_frames= (info->chip.fbsize - info->picture_offset)/vinfo->frame_size;
     if(vinfo->num_frames > MAX_FRAMES)vinfo->num_frames = MAX_FRAMES;
 //    vinfo->num_frames = 1;
-//    printf("[nvidia_vid] Number of frames %i\n",vinfo->num_frames);
+//    mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] Number of frames %i\n",vinfo->num_frames);
     for(i=0;i <vinfo->num_frames;i++)vinfo->offsets[i] = vinfo->frame_size*i;
     return 0;
 }
@@ -1059,19 +1060,19 @@
   if (grkey->ckey.op == CKEY_FALSE)
   {
     info->use_colorkey = 0;
-    printf("[nvidia_vid] colorkeying disabled\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] colorkeying disabled\n");
   }
   else {
   info->use_colorkey = 1;
   info->vidixcolorkey = ((grkey->ckey.red<<16)|(grkey->ckey.green<<8)|grkey->ckey.blue);
-  printf("[nvidia_vid] set colorkey 0x%x\n",info->vidixcolorkey);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[nvidia_vid] set colorkey 0x%x\n",info->vidixcolorkey);
   }
   if(info->d_width && info->d_height)rivatv_overlay_start(info,0);
   return 0;
 }
 
 static int nv_frame_sel(unsigned int frame){
-//  printf("selecting buffer %d\n", frame);
+//  mp_msg(MSGT_VO, MSGL_STATUS, "selecting buffer %d\n", frame);
   rivatv_overlay_start(info, frame);
   if (info->num_frames >= 1)
 	  info->cur_frame = frame/*(frame+1)%info->num_frames*/;
@@ -1129,20 +1130,20 @@
 
 int main(int argc,char* argv[]){
   if(nv_probe(0,0)){
-        printf("no supported chip found\n");
+        mp_msg(MSGT_VO, MSGL_STATUS, "no supported chip found\n");
         return 1;
   }
   if(nv_init()){
-	printf("could not init\n");
+	mp_msg(MSGT_VO, MSGL_STATUS, "could not init\n");
 	return 1;
   }
   if(info->chip.arch >= NV_ARCH_10){
-    printf("NV_PVIDEO_BASE (0x900) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x900));
-    printf("NV_PVIDEO_LIMIT (0x908) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x908));
-    printf("NV_PVIDEO_OFFSET (0x920) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x920));
-    printf("NV_PVIDEO_FORMAT (0x958) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x958));
-    printf("NV_PVIDEO_STOP (0x704) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x704));
-    printf("NV_PVIDEO_BUFFER (0x700) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x700));
+    mp_msg(MSGT_VO, MSGL_STATUS, "NV_PVIDEO_BASE (0x900) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x900));
+    mp_msg(MSGT_VO, MSGL_STATUS, "NV_PVIDEO_LIMIT (0x908) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x908));
+    mp_msg(MSGT_VO, MSGL_STATUS, "NV_PVIDEO_OFFSET (0x920) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x920));
+    mp_msg(MSGT_VO, MSGL_STATUS, "NV_PVIDEO_FORMAT (0x958) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x958));
+    mp_msg(MSGT_VO, MSGL_STATUS, "NV_PVIDEO_STOP (0x704) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x704));
+    mp_msg(MSGT_VO, MSGL_STATUS, "NV_PVIDEO_BUFFER (0x700) 0x%x\n",VID_RD32(info->chip.PVIDEO, 0x700));
   }
 
   nv_destroy();
Index: vidix/drivers.c
===================================================================
--- vidix/drivers.c	(revision 37177)
+++ vidix/drivers.c	(working copy)
@@ -29,6 +29,7 @@
 #include "drivers.h"
 #include "libavutil/common.h"
 #include "mpbswap.h"
+#include "mp_msg.h"
 #include "config.h"
 
 VDXDriver *first_driver = NULL;
@@ -111,7 +112,7 @@
   vidix_capability_t vid_cap;
 
   if (verbose)
-    printf ("vidixlib: PROBING: %s\n", drv->name);
+    mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] PROBING: %s\n", drv->name);
 
   if (!drv->probe || drv->probe (verbose, PROBE_NORMAL) != 0)
     return 0;
@@ -122,13 +123,13 @@
   if ((vid_cap.type & cap) != cap)
   {
     if (verbose)
-      printf ("vidixlib: Found %s but has no required capability\n",
+      mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] Found %s but has no required capability\n",
               drv->name);
      return 0;
   }
 
   if (verbose)
-    printf ("vidixlib: %s probed o'k\n", drv->name);
+    mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] %s probed o'k\n", drv->name);
 
   ctx->drv = drv;
   return 1;
@@ -138,14 +139,14 @@
 {
   VDXDriver *drv;
 
-  printf ("Available VIDIX drivers:\n");
+  mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] Available VIDIX drivers:\n");
 
   drv = first_driver;
   while (drv)
   {
     vidix_capability_t cap;
     drv->get_caps (&cap);
-    printf (" * %s - %s\n", drv->name, cap.name);
+    mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib]  * %s - %s\n", drv->name, cap.name);
     drv = drv->next;
   }
 }
@@ -187,7 +188,7 @@
   }
 
   if (verbose)
-    printf ("vidixlib: No suitable driver can be found.\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[vidixlib] No suitable driver can be found.\n");
   ctx->drv = NULL;
   return 0;
 }
Index: vidix/mach64_vid.c
===================================================================
--- vidix/mach64_vid.c	(revision 37177)
+++ vidix/mach64_vid.c	(working copy)
@@ -38,6 +38,7 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #include "mach64.h"
 
@@ -291,7 +292,7 @@
     int yres= mach64_get_yres();
 
     if(!supports_lcd_v_stretch){
-        if(verbosity > 0) printf("[mach64] vertical stretching not supported\n");
+        if(verbosity > 0) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] vertical stretching not supported\n");
         return 1<<16;
     }
 
@@ -314,7 +315,7 @@
 
     OUTREG(LCD_INDEX, lcd_index);
 
-    if(verbosity > 0) printf("[mach64] vertical stretching factor= %d\n", ret);
+    if(verbosity > 0) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] vertical stretching factor= %d\n", ret);
 
     return ret;
 }
@@ -337,19 +338,19 @@
 static void mach64_vid_dump_regs( void )
 {
   size_t i;
-  printf("[mach64] *** Begin of DRIVER variables dump ***\n");
-  printf("[mach64] mach64_mmio_base=%p\n",mach64_mmio_base);
-  printf("[mach64] mach64_mem_base=%p\n",mach64_mem_base);
-  printf("[mach64] mach64_overlay_off=%08X\n",mach64_overlay_offset);
-  printf("[mach64] mach64_ram_size=%08X\n",mach64_ram_size);
-  printf("[mach64] video mode: %ux%u@%u\n",mach64_get_xres(),mach64_get_yres(),mach64_vid_get_dbpp());
-  printf("[mach64] *** Begin of OV0 registers dump ***\n");
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] *** Begin of DRIVER variables dump ***\n");
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] mach64_mmio_base=%p\n",mach64_mmio_base);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] mach64_mem_base=%p\n",mach64_mem_base);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] mach64_overlay_off=%08X\n",mach64_overlay_offset);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] mach64_ram_size=%08X\n",mach64_ram_size);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] video mode: %ux%u@%u\n",mach64_get_xres(),mach64_get_yres(),mach64_vid_get_dbpp());
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] *** Begin of OV0 registers dump ***\n");
   for(i=0;i<sizeof(vregs)/sizeof(video_registers_t);i++)
   {
 	mach64_wait_for_idle();
-	printf("[mach64] %s = %08X\n",vregs[i].sname,INREG(vregs[i].name));
+	mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] %s = %08X\n",vregs[i].sname,INREG(vregs[i].name));
   }
-  printf("[mach64] *** End of OV0 registers dump ***\n");
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] *** End of OV0 registers dump ***\n");
 }
 
 
@@ -414,7 +415,7 @@
   err = pci_scan(lst,&num_pci);
   if(err)
   {
-    printf("[mach64] Error occurred during pci scan: %s\n",strerror(err));
+    mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Error occurred during pci scan: %s\n",strerror(err));
     return err;
   }
   else
@@ -430,19 +431,19 @@
 	if(idx == -1 && force == PROBE_NORMAL) continue;
 	dname = pci_device_name(VENDOR_ATI,lst[i].device);
 	dname = dname ? dname : "Unknown chip";
-	printf("[mach64] Found chip: %s\n",dname);
+	mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Found chip: %s\n",dname);
 #if 0
 	if ((lst[i].command & PCI_COMMAND_IO) == 0)
 	{
-		printf("[mach64] Device is disabled, ignoring\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Device is disabled, ignoring\n");
 		continue;
 	}
 #endif
 	if(force > PROBE_NORMAL)
 	{
-	    printf("[mach64] Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : "");
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : "");
 	    if(idx == -1)
-		printf("[mach64] Assuming it as Mach64\n");
+		mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Assuming it as Mach64\n");
 	}
 	mach64_cap.device_id = lst[i].device;
 	err = 0;
@@ -452,7 +453,7 @@
       }
     }
   }
-  if(err && verbose) printf("[mach64] Can't find chip\n");
+  if(err && verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Can't find chip\n");
   return err;
 }
 
@@ -472,7 +473,7 @@
   int err;
   if(!probed)
   {
-    printf("[mach64] Driver was not probed but is being initializing\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Driver was not probed but is being initializing\n");
     return EINTR;
   }
 
@@ -485,9 +486,9 @@
   mach64_ram_size *= 0x400; /* KB -> bytes */
   if((mach64_mem_base = map_phys_mem(pci_info.base0,mach64_ram_size))==(void *)-1) return ENOMEM;
   memset(&besr,0,sizeof(bes_registers_t));
-  printf("[mach64] Video memory = %uMb\n",mach64_ram_size/0x100000);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Video memory = %uMb\n",mach64_ram_size/0x100000);
   err = mtrr_set_type(pci_info.base0,mach64_ram_size,MTRR_TYPE_WRCOMB);
-  if(!err) printf("[mach64] Set write-combining type of video memory\n");
+  if(!err) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Set write-combining type of video memory\n");
 
   /* save this */
   mach64_wait_for_idle();
@@ -508,8 +509,8 @@
 
 	if(INREG(SCALER_BUF0_OFFSET_U)) 	supports_planar=1;
   }
-  if(supports_planar)	printf("[mach64] Planar YUV formats are supported :)\n");
-  else			printf("[mach64] Planar YUV formats are not supported :(\n");
+  if(supports_planar)	mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Planar YUV formats are supported :)\n");
+  else			mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Planar YUV formats are not supported :(\n");
 
   if(   mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_P_M
      || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_P_M2
@@ -768,7 +769,7 @@
     besr.fourcc = config->fourcc;
     ecp = (INPLL(PLL_VCLK_CNTL) & PLL_ECP_DIV) >> 4;
 
-    if(verbosity > 0) printf("[mach64] ecp: %d\n", ecp);
+    if(verbosity > 0) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] ecp: %d\n", ecp);
     v_inc = src_h * mach64_get_vert_stretch();
 
     if(mach64_is_interlace()) v_inc<<=1;
@@ -921,7 +922,7 @@
     uint32_t off[6];
     int i;
     int last_frame= (frame-1+num_mach64_buffers) % num_mach64_buffers;
-//printf("Selecting frame %d\n", frame);
+//mp_msg(MSGT_VO, MSGL_STATUS, "Selecting frame %d\n", frame);
     /*
     buf3-5 always should point onto second buffer for better
     deinterlacing and TV-in
Index: vidix/s3_vid.c
===================================================================
--- vidix/s3_vid.c	(revision 37177)
+++ vidix/s3_vid.c	(working copy)
@@ -36,6 +36,7 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #include "s3_regs.h"
 
@@ -507,7 +508,7 @@
   info->screen_y |= (VGAIN8 (vgaCRReg) & 0x40) << 3;
   ++info->screen_y;
 
-  printf ("[s3_vid] x = %d, y = %d, bpp = %d\n", info->screen_x, info->screen_y, info->bpp);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] x = %d, y = %d, bpp = %d\n", info->screen_x, info->screen_y, info->bpp);
 }
 
 static void S3StreamsOff (void)
@@ -552,11 +553,11 @@
   int err;
 
   if (force)
-    printf ("[s3_vid] Warning: forcing not supported yet!\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Warning: forcing not supported yet!\n");
   err = pci_scan (lst, &num_pci);
   if (err)
   {
-    printf ("[s3_vid] Error occurred during pci scan: %s\n", strerror (err));
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Error occurred during pci scan: %s\n", strerror (err));
     return err;
   }
   else
@@ -573,11 +574,11 @@
           continue;
         dname = pci_device_name (lst[i].vendor, lst[i].device);
         dname = dname ? dname : "Unknown chip";
-        printf ("[s3_vid] Found chip: %s\n", dname);
+        mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Found chip: %s\n", dname);
         // FIXME: whats wrong here?
         if ((lst[i].command & PCI_COMMAND_IO) == 0)
         {
-          printf ("[s3_vid] Device is disabled, ignoring\n");
+          mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Device is disabled, ignoring\n");
           continue;
         }
         s3_cap.device_id = lst[i].device;
@@ -588,7 +589,7 @@
     }
   }
   if (err && verbose)
-    printf ("[s3_vid] Can't find chip\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Can't find chip\n");
   return err;
 }
 
@@ -686,7 +687,7 @@
     break;
   }
 
-  printf ("[s3_vid] VideoRam = %d\n", videoRam);
+  mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] VideoRam = %d\n", videoRam);
   info->chip.fbsize = videoRam * 1024;
 
   if (info->chip.arch <= S3_SAVAGE3D)
@@ -695,9 +696,9 @@
     mtrr = mtrr_set_type (pci_info.base1, info->chip.fbsize, MTRR_TYPE_WRCOMB);
 
   if (mtrr != 0)
-    printf ("[s3_vid] Unable to setup MTRR: %s\n", strerror (mtrr));
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Unable to setup MTRR: %s\n", strerror (mtrr));
   else
-    printf ("[s3_vid] MTRR set up\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] MTRR set up\n");
 
   S3GetScrProp (info);
   S3StreamsOn ();
@@ -767,13 +768,13 @@
   {
     info->use_colorkey = 0;
     info->vidixcolorkey = 0;
-    printf ("[s3_vid] Colorkeying disabled\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Colorkeying disabled\n");
   }
   else
   {
     info->use_colorkey = 1;
     info->vidixcolorkey = ((grkey->ckey.red << 16) | (grkey->ckey.green << 8) | grkey->ckey.blue);
-    printf ("[s3_vid] Set colorkey 0x%x\n", info->vidixcolorkey);
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Set colorkey 0x%x\n", info->vidixcolorkey);
   }
   if (S3SetColorKey)
     S3SetColorKey ();
@@ -858,7 +859,7 @@
   info->picture_offset = info->screen_x * info->screen_y * (info->bpp >> 3);
   if (info->picture_offset > (info->chip.fbsize - vinfo->frame_size))
   {
-    printf ("[s3_vid] Not enough memory for overlay\n");
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] Not enough memory for overlay\n");
     return -1;
   }
 
@@ -869,7 +870,7 @@
 
   if (info->video_base == NULL)
   {
-    printf ("[s3_vid] errno = %s\n", strerror (errno));
+    mp_msg(MSGT_VO, MSGL_STATUS, "[s3_vid] errno = %s\n", strerror (errno));
     return -1;
   }
 
Index: vidix/sis_vid.c
===================================================================
--- vidix/sis_vid.c	(revision 37177)
+++ vidix/sis_vid.c	(working copy)
@@ -36,6 +36,7 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #include "sis_bridge.h"
 #include "sis_regs.h"
@@ -251,7 +252,7 @@
     force = force;
     err = pci_scan(lst, &num_pci);
     if (err) {
-	printf("[SiS] Error occurred during pci scan: %s\n", strerror(err));
+	mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Error occurred during pci scan: %s\n", strerror(err));
 	return err;
     } else {
 	err = ENXIO;
@@ -265,7 +266,7 @@
 		dname = pci_device_name(VENDOR_SIS, lst[i].device);
 		dname = dname ? dname : "Unknown chip";
 		if (sis_verbose > 0)
-		    printf("[SiS] Found chip: %s (0x%X)\n",
+		    mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Found chip: %s (0x%X)\n",
 			   dname, lst[i].device);
 		sis_device_id = sis_cap.device_id = lst[i].device;
 		err = 0;
@@ -312,8 +313,8 @@
 			}
 			if (sis_has_two_overlays) {
 			    if (sis_verbose > 0)
-				printf
-				    ("[SiS] detected M650/651 with 2 overlays\n");
+				mp_msg(MSGT_VO, MSGL_STATUS,
+				    "[SiS] detected M650/651 with 2 overlays\n");
 			}
 			disable_app_io();
 		    }
@@ -328,7 +329,7 @@
 	}
     }
     if (err && sis_verbose) {
-	printf("[SiS] Can't find chip\n");
+	mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Can't find chip\n");
     } else {
 	sis_probed = 1;
     }
@@ -342,13 +343,13 @@
     char *env_overlay_crt;
 
     if (!sis_probed) {
-	printf("[SiS] driver was not probed but is being initialized\n");
+	mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] driver was not probed but is being initialized\n");
 	return EINTR;
     }
 
     if (enable_app_io() != 0)
     {
-      printf("[SiS] can't enable register I/O\n");
+      mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] can't enable register I/O\n");
       return EINTR;
     }
 
@@ -387,8 +388,8 @@
 	if (crt == 1 || crt == 2) {
 	    sis_overlay_on_crt1 = (crt == 1);
 	    if (sis_verbose > 0) {
-		printf
-		    ("[SiS] override: using overlay on CRT%d from VIDIX_CRT\n",
+		mp_msg(MSGT_VO, MSGL_STATUS,
+		    "[SiS] override: using overlay on CRT%d from VIDIX_CRT\n",
 		     crt);
 	    }
 	}
@@ -485,7 +486,7 @@
     switch (sis_displaymode) {
     case DISPMODE_SINGLE1:	/* TW: CRT1 only */
 	if (sis_verbose > 2) {
-	    printf("[SiS] Setting up overlay on CRT1\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Setting up overlay on CRT1\n");
 	}
 	if (sis_has_two_overlays) {
 	    setsrregmask(0x06, 0x00, 0xc0);
@@ -497,7 +498,7 @@
 	break;
     case DISPMODE_SINGLE2:	/* TW: CRT2 only */
 	if (sis_verbose > 2) {
-	    printf("[SiS] Setting up overlay on CRT2\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Setting up overlay on CRT2\n");
 	}
 	if (sis_has_two_overlays) {
 	    setsrregmask(0x06, 0x80, 0xc0);
@@ -510,7 +511,7 @@
     case DISPMODE_MIRROR:	/* TW: CRT1 + CRT2 */
     default:
 	if (sis_verbose > 2) {
-	    printf("[SiS] Setting up overlay on CRT1 AND CRT2!\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Setting up overlay on CRT1 AND CRT2!\n");
 	}
 	setsrregmask(0x06, 0x80, 0xc0);
 	setsrregmask(0x32, 0x80, 0xc0);
@@ -1028,7 +1029,7 @@
 	watchdog = WATCHDOG_DELAY;
 	while ((!pOverlay->VBlankActiveFunc()) && --watchdog);
 	if (!watchdog && sis_verbose > 0) {
-	    printf("[SiS]: timed out waiting for vertical retrace\n");
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[SiS]: timed out waiting for vertical retrace\n");
 	}
     }
 
Index: vidix/pm2_vid.c
===================================================================
--- vidix/pm2_vid.c	(revision 37177)
+++ vidix/pm2_vid.c	(working copy)
@@ -33,6 +33,7 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #include "glint_regs.h"
 
@@ -40,8 +41,8 @@
 #define PM2_VIDMEM 6
 
 #if 0
-#define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__)
-#define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__)
+#define TRACE_ENTER() mp_msg(MSGT_VO, MSGL_DBG2, "[pm2] %s: enter\n", __FUNCTION__)
+#define TRACE_EXIT() mp_msg(MSGT_VO, MSGL_DBG2, "[pm2] %s: exit\n", __FUNCTION__)
 #else
 #define TRACE_ENTER()
 #define TRACE_EXIT()
@@ -101,7 +102,7 @@
     err = pci_scan(lst,&num_pci);
     if(err)
     {
-	printf("[pm2] Error occurred during pci scan: %s\n",strerror(err));
+	mp_msg(MSGT_VO, MSGL_STATUS, "[pm2] Error occurred during pci scan: %s\n",strerror(err));
 	return err;
     }
     else
@@ -116,21 +117,21 @@
 		continue;
 	    dname = pci_device_name(lst[i].vendor, lst[i].device);
 	    dname = dname ? dname : "Unknown chip";
-	    printf("[pm2] Found chip: %s\n", dname);
+	    mp_msg(MSGT_VO, MSGL_STATUS, "[pm2] Found chip: %s\n", dname);
 	    pm2_cap.device_id = lst[i].device;
 	    err = 0;
 	    memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
 	    break;
 	}
     }
-    if(err && verbose) printf("[pm2] Can't find chip.\n");
+    if(err && verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[pm2] Can't find chip.\n");
     return err;
 }
 
 #define PRINT_REG(reg)							\
 {									\
     long _foo = READ_REG(reg);						\
-    printf("[pm2] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo);	\
+    mp_msg(MSGT_VO, MSGL_STATUS, "[pm2] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo);	\
 }
 
 static int pm2_init(void)
Index: vidix/pm3_vid.c
===================================================================
--- vidix/pm3_vid.c	(revision 37177)
+++ vidix/pm3_vid.c	(working copy)
@@ -32,12 +32,13 @@
 #include "dha.h"
 #include "pci_ids.h"
 #include "pci_names.h"
+#include "mp_msg.h"
 
 #include "pm3_regs.h"
 
 #if 0
-#define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__)
-#define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__)
+#define TRACE_ENTER() mp_msg(MSGT_VO, MSGL_DBG2, "[pm3] %s: enter\n", __FUNCTION__)
+#define TRACE_EXIT() mp_msg(MSGT_VO, MSGL_DBG2, "[pm3] %s: exit\n", __FUNCTION__)
 #else
 #define TRACE_ENTER()
 #define TRACE_EXIT()
@@ -89,7 +90,7 @@
     err = pci_scan(lst,&num_pci);
     if(err)
     {
-	printf("[pm3] Error occurred during pci scan: %s\n",strerror(err));
+	mp_msg(MSGT_VO, MSGL_STATUS, "[pm3] Error occurred during pci scan: %s\n",strerror(err));
 	return err;
     }
     else
@@ -106,11 +107,11 @@
 		    continue;
 		dname = pci_device_name(VENDOR_3DLABS, lst[i].device);
 		dname = dname ? dname : "Unknown chip";
-		printf("[pm3] Found chip: %s\n", dname);
+		mp_msg(MSGT_VO, MSGL_STATUS, "[pm3] Found chip: %s\n", dname);
 #if 0
 		if ((lst[i].command & PCI_COMMAND_IO) == 0)
 		{
-			printf("[pm3] Device is disabled, ignoring\n");
+			mp_msg(MSGT_VO, MSGL_STATUS, "[pm3] Device is disabled, ignoring\n");
 			continue;
 		}
 #endif
@@ -121,14 +122,14 @@
 	    }
 	}
     }
-    if(err && verbose) printf("[pm3] Can't find chip\n");
+    if(err && verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[pm3] Can't find chip\n");
     return err;
 }
 
 #define PRINT_REG(reg)							\
 {									\
     long _foo = READ_REG(reg);						\
-    printf("[pm3] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo);	\
+    mp_msg(MSGT_VO, MSGL_STATUS, "[pm3] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo);	\
 }
 
 static int pm3_init(void)
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng