Mercurial > mplayer.hg
changeset 5935:5074aa8fae5a
printf to mp_msg
author | albeu |
---|---|
date | Thu, 02 May 2002 10:49:55 +0000 |
parents | 42127864a2b3 |
children | d0f040d8f53c |
files | libvo/osd.c libvo/vo_x11.c libvo/vo_xv.c |
diffstat | 3 files changed, 47 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/osd.c Thu May 02 10:43:27 2002 +0000 +++ b/libvo/osd.c Thu May 02 10:49:55 2002 +0000 @@ -7,6 +7,7 @@ #include "config.h" #include "osd.h" +#include "mp_msg.h" //#define ENABLE_PROFILE #include "../my_profile.h" #include <inttypes.h> @@ -248,27 +249,27 @@ #ifdef CAN_COMPILE_X86_ASM // ordered per speed fasterst first if(gCpuCaps.hasMMX2) - printf("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); else if(gCpuCaps.has3DNow) - printf("Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); else if(gCpuCaps.hasMMX) - printf("Using MMX Optimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n"); else - printf("Using X86 Optimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n"); #else - printf("Using Unoptimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n"); #endif #else //RUNTIME_CPUDETECT #ifdef HAVE_MMX2 - printf("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); #elif defined (HAVE_3DNOW) - printf("Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); #elif defined (HAVE_MMX) - printf("Using MMX Optimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n"); #elif defined (ARCH_X86) - printf("Using X86 Optimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n"); #else - printf("Using Unoptimized OnScreenDisplay\n"); + mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n"); #endif #endif //!RUNTIME_CPUDETECT }
--- a/libvo/vo_x11.c Thu May 02 10:43:27 2002 +0000 +++ b/libvo/vo_x11.c Thu May 02 10:49:55 2002 +0000 @@ -74,7 +74,7 @@ #include <X11/extensions/XShm.h> static int Shmem_Flag; -static int Quiet_Flag; +//static int Quiet_Flag; Here also what is this for. It's used but isn't inited ? static XShmSegmentInfo Shminfo[1]; static int gXErrorFlag; static int CompletionType=-1; @@ -133,7 +133,7 @@ else { Shmem_Flag=0; - if ( !Quiet_Flag ) printf( "Shared memory not supported\nReverting to normal Xlib\n" ); + mp_msg(MSGT_VO,MSGL_WARN, "Shared memory not supported\nReverting to normal Xlib\n" ); } if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; @@ -143,7 +143,7 @@ if ( myximage == NULL ) { if ( myximage != NULL ) XDestroyImage( myximage ); - if ( !Quiet_Flag ) printf( "Shared memory error,disabling ( Ximage error )\n" ); + mp_msg(MSGT_VO,MSGL_WARN,"Shared memory error,disabling ( Ximage error )\n" ); goto shmemerror; } Shminfo[0].shmid=shmget( IPC_PRIVATE, @@ -152,12 +152,9 @@ if ( Shminfo[0].shmid < 0 ) { XDestroyImage( myximage ); - if ( !Quiet_Flag ) - { - printf( "%s\n",strerror( errno ) ); - perror( strerror( errno ) ); - printf( "Shared memory error,disabling ( seg id error )\n" ); - } + mp_msg(MSGT_VO,MSGL_V, "%s\n",strerror( errno ) ); + //perror( strerror( errno ) ); + mp_msg(MSGT_VO,MSGL_WARN,"Shared memory error,disabling ( seg id error )\n" ); goto shmemerror; } Shminfo[0].shmaddr=( char * ) shmat( Shminfo[0].shmid,0,0 ); @@ -166,7 +163,7 @@ { XDestroyImage( myximage ); if ( Shminfo[0].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[0].shmaddr ); - if ( !Quiet_Flag ) printf( "Shared memory error,disabling ( address error )\n" ); + mp_msg(MSGT_VO,MSGL_WARN, "Shared memory error,disabling ( address error )\n" ); goto shmemerror; } myximage->data=Shminfo[0].shmaddr; @@ -180,7 +177,7 @@ { XDestroyImage( myximage ); shmdt( Shminfo[0].shmaddr ); - if ( !Quiet_Flag ) printf( "Shared memory error,disabling.\n" ); + mp_msg(MSGT_VO,MSGL_WARN, "Shared memory error,disabling.\n" ); gXErrorFlag=0; goto shmemerror; } @@ -189,8 +186,8 @@ { static int firstTime=1; - if ( !Quiet_Flag && firstTime){ - printf( "Sharing memory.\n" ); + if ( firstTime){ + mp_msg(MSGT_VO,MSGL_V, "Sharing memory.\n" ); firstTime=0; } } @@ -415,16 +412,16 @@ #ifdef WORDS_BIGENDIAN if(mode==MODE_BGR && bpp!=32){ - printf("BGR%d not supported, please contact the developers\n", bpp); + mp_msg(MSGT_VO,MSGL_ERR,"BGR%d not supported, please contact the developers\n", bpp); return -1; } if(mode==MODE_RGB && bpp==32){ - printf("RGB32 not supported on big-endian systems, please contact the developers\n"); + mp_msg(MSGT_VO,MSGL_ERR,"RGB32 not supported on big-endian systems, please contact the developers\n"); return -1; } #else if(mode==MODE_BGR){ - printf("BGR not supported, please contact the developers\n"); + mp_msg(MSGT_VO,MSGL_ERR,"BGR not supported, please contact the developers\n"); return -1; } #endif @@ -566,8 +563,7 @@ static uint32_t query_format( uint32_t format ) { - if(verbose > 2) - printf("vo_x11: query_format was called: %x (%s)\n",format,vo_format_name(format)); + mp_msg(MSGT_VO,MSGL_DBG2,"vo_x11: query_format was called: %x (%s)\n",format,vo_format_name(format)); if (IMGFMT_IS_BGR(format)) { if (IMGFMT_BGR_DEPTH(format) == vo_depthonscreen) @@ -614,7 +610,7 @@ { if(arg) { - printf("vo_x11: Unknown subdevice: %s\n",arg); + mp_msg(MSGT_VO,MSGL_ERR,"vo_x11: Unknown subdevice: %s\n",arg); return ENOSYS; }
--- a/libvo/vo_xv.c Thu May 02 10:43:27 2002 +0000 +++ b/libvo/vo_xv.c Thu May 02 10:49:55 2002 +0000 @@ -22,6 +22,7 @@ #include <string.h> #include "config.h" +#include "mp_msg.h" #include "video_out.h" #include "video_out_internal.h" @@ -79,7 +80,7 @@ #include <X11/extensions/XShm.h> static int Shmem_Flag; -static int Quiet_Flag; +//static int Quiet_Flag; <-- What is that for ? Albeu. static XShmSegmentInfo Shminfo[NUM_BUFFERS]; static int gXErrorFlag; static int CompletionType = -1; @@ -126,7 +127,7 @@ )) { was_reset = 1; - if(verbose > 1) printf("vo_xv: reset gamma correction\n"); + mp_msg(MSGT_VO,MSGL_V,"vo_xv: reset gamma correction\n"); xv_atomka = XInternAtom(mDisplay, attributes[i].name, True); XvSetPortAttribute(mDisplay, xv_port, xv_atomka, attributes[i].max_value); } @@ -182,8 +183,7 @@ port_max = xv_max; port_mid = (port_min + port_max) / 2; port_value = port_mid + (port_value * (port_max - port_min)) / 2000; - if(verbose > 1) - printf("vo_xv: set gamma %s to %i (min %i max %i mid %i)\n",attributes[i].name,port_value,port_min,port_max,port_mid); + mp_msg(MSGT_VO,MSGL_V,"vo_xv: set gamma %s to %i (min %i max %i mid %i)\n",attributes[i].name,port_value,port_min,port_max,port_mid); XvSetPortAttribute(mDisplay, xv_port, xv_atomka, port_value); } } @@ -217,14 +217,14 @@ { int port_value,port_min,port_max,port_mid; XvGetPortAttribute(mDisplay, xv_port, xv_atomka, &port_value); - if(verbose>1) printf("vo_xv: get: %s = %i\n",attributes[i].name,port_value); + mp_msg(MSGT_VO,MSGL_V,"vo_xv: get: %s = %i\n",attributes[i].name,port_value); port_min = xv_min; port_max = xv_max; port_mid = (port_min + port_max) / 2; port_value = ((port_value - port_mid)*2000)/(port_max-port_min); - if(verbose>1) printf("vo_xv: assume: %s = %i\n",attributes[i].name,port_value); + mp_msg(MSGT_VO,MSGL_V,"vo_xv: assume: %s = %i\n",attributes[i].name,port_value); if(strcmp(attributes[i].name,"XV_BRIGHTNESS") == 0) { @@ -346,7 +346,7 @@ xv_format=0; if(format==IMGFMT_BGR24) format=IMGFMT_YV12; for(i = 0; i < formats; i++){ - printf("Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id,(char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); + mp_msg(MSGT_VO,MSGL_V,"Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id,(char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); if (fo[i].id == format) xv_format = fo[i].id; } if (!xv_format) return -1; @@ -447,7 +447,7 @@ } #endif - printf( "using Xvideo port %d for hw scaling\n",xv_port ); + mp_msg(MSGT_VO,MSGL_V, "using Xvideo port %d for hw scaling\n",xv_port ); switch (xv_format){ case IMGFMT_YV12: @@ -469,7 +469,7 @@ XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); drwX=0; drwY=0; XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); - printf( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + mp_msg(MSGT_VO,MSGL_V, "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); aspect(&dwidth,&dheight,A_NOZOOM); if ( vo_fs ) @@ -481,7 +481,7 @@ drwcY+=drwY; drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); - printf( "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); } saver_off(mDisplay); // turning off screen saver return 0; @@ -500,7 +500,7 @@ else { Shmem_Flag = 0; - if ( !Quiet_Flag ) printf( "Shared memory not supported\nReverting to normal Xv\n" ); + mp_msg(MSGT_VO,MSGL_INFO, "Shared memory not supported\nReverting to normal Xv\n" ); } if ( Shmem_Flag ) { @@ -551,7 +551,7 @@ XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); drwX=0; drwY=0; XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); - printf( "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + mp_msg(MSGT_VO,MSGL_V, "[xv] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); aspect(&dwidth,&dheight,A_NOZOOM); if ( vo_fs ) @@ -563,7 +563,7 @@ drwcY+=drwY; drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); - printf( "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); } } if ( e & VO_EVENT_EXPOSE ) @@ -797,7 +797,7 @@ XvPortID xv_p; if(arg) { - printf("vo_xv: Unknown subdevice: %s\n",arg); + mp_msg(MSGT_VO,MSGL_ERR,"vo_xv: Unknown subdevice: %s\n",arg); return ENOSYS; } if (!vo_init()) return -1; @@ -805,30 +805,31 @@ xv_port = 0; /* check for Xvideo extension */ if (Success != XvQueryExtension(mDisplay,&ver,&rel,&req,&ev,&err)){ - printf("Sorry, Xv not supported by this X11 version/driver\n"); - printf("******** Try with -vo x11 or -vo sdl *********\n"); + mp_msg(MSGT_VO,MSGL_ERR,"Sorry, Xv not supported by this X11 version/driver\n"); + mp_msg(MSGT_VO,MSGL_ERR,"******** Try with -vo x11 or -vo sdl *********\n"); return -1; } /* check for Xvideo support */ if (Success != XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay), &adaptors,&ai)){ - printf("Xv: XvQueryAdaptors failed"); + mp_msg(MSGT_VO,MSGL_ERR,"Xv: XvQueryAdaptors failed"); return -1; } /* check adaptors */ for (i = 0; i < adaptors && xv_port == 0; i++){ - if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) + if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) { for (xv_p = ai[i].base_id; xv_p < ai[i].base_id+ai[i].num_ports; ++xv_p) if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) { xv_port = xv_p; break; } else { - printf("Xv: could not grab port %i\n", (int)xv_p); + mp_msg(MSGT_VO,MSGL_ERR,"Xv: could not grab port %i\n", (int)xv_p); } + } } if(!xv_port){ - printf("Couldn't find free Xvideo port - maybe other applications keep open it\n"); + mp_msg(MSGT_VO,MSGL_ERR,"Couldn't find free Xvideo port - maybe other applications keep open it\n"); return -1; }