diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-03-24 08:12:03 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-03-24 08:12:03 +0000 |
commit | eebf08b978f91243bb6eed54012267cc27183438 (patch) | |
tree | 83ce4df0814283621f24ef1d3ea4217981046993 /libvo | |
parent | 35e90f1556475ee205dee6c253b788ab073133c0 (diff) | |
download | mpv-eebf08b978f91243bb6eed54012267cc27183438.tar.bz2 mpv-eebf08b978f91243bb6eed54012267cc27183438.tar.xz |
Convert all if(verbose>X) to mp_msg_test calls.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17933 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vesa_lvo.c | 26 | ||||
-rw-r--r-- | libvo/vo_png.c | 35 | ||||
-rw-r--r-- | libvo/vo_sdl.c | 90 | ||||
-rw-r--r-- | libvo/vo_svga.c | 39 | ||||
-rw-r--r-- | libvo/vo_vesa.c | 53 | ||||
-rw-r--r-- | libvo/vo_xvmc.c | 69 | ||||
-rw-r--r-- | libvo/vosub_vidix.c | 25 |
7 files changed, 200 insertions, 137 deletions
diff --git a/libvo/vesa_lvo.c b/libvo/vesa_lvo.c index 2ab2c0d798..b108bfbfac 100644 --- a/libvo/vesa_lvo.c +++ b/libvo/vesa_lvo.c @@ -20,6 +20,7 @@ #include <string.h> #include "config.h" +#include "mp_msg.h" #include "vesa_lvo.h" #include "img_format.h" @@ -40,7 +41,6 @@ static uint8_t *lvo_mem = NULL; static uint8_t next_frame; static mga_vid_config_t mga_vid_config; static unsigned image_bpp,image_height,image_width,src_format; -extern int verbose; uint32_t vlvo_control(uint32_t request, void *data, ...); #define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8) @@ -54,7 +54,8 @@ int vlvo_preinit(const char *drvname) printf("vesa_lvo: This branch is no longer supported.\n" "vesa_lvo: Please use -vo vesa:vidix instead\n"); return -1; - if(verbose > 1) printf("vesa_lvo: vlvo_preinit(%s) was called\n",drvname); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("vesa_lvo: vlvo_preinit(%s) was called\n",drvname); } lvo_handler = open(drvname,O_RDWR); if(lvo_handler == -1) { @@ -78,7 +79,8 @@ int vlvo_init(unsigned src_width,unsigned src_height, printf("vesa_lvo: This branch is no longer supported.\n" "vesa_lvo: Please use -vo vesa:vidix instead\n"); return -1; - if(verbose > 1) printf("vesa_lvo: vlvo_init() was called\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("vesa_lvo: vlvo_init() was called\n"); } image_width = src_width; image_height = src_height; mga_vid_config.version=MGA_VID_VERSION; @@ -146,7 +148,8 @@ int vlvo_init(unsigned src_width,unsigned src_height, void vlvo_term( void ) { - if(verbose > 1) printf("vesa_lvo: vlvo_term() was called\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("vesa_lvo: vlvo_term() was called\n"); } ioctl( lvo_handler,MGA_VID_OFF,0 ); munmap(frames[0],mga_vid_config.frame_size*mga_vid_config.num_frames); if(lvo_handler != -1) close(lvo_handler); @@ -194,7 +197,8 @@ uint32_t vlvo_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,i uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) { - if(verbose > 1) printf("vesa_lvo: vlvo_draw_slice() was called\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("vesa_lvo: vlvo_draw_slice() was called\n"); } if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) vlvo_draw_slice_420(image,stride,w,h,x,y); else @@ -213,13 +217,15 @@ uint32_t vlvo_draw_frame(uint8_t *image[]) { /* Note it's very strange but sometime for YUY2 draw_frame is called */ memcpy(lvo_mem,image[0],mga_vid_config.frame_size); - if(verbose > 1) printf("vesa_lvo: vlvo_draw_frame() was called\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("vesa_lvo: vlvo_draw_frame() was called\n"); } return 0; } void vlvo_flip_page(void) { - if(verbose > 1) printf("vesa_lvo: vlvo_flip_page() was called\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("vesa_lvo: vlvo_flip_page() was called\n"); } if(vo_doublebuffering) { ioctl(lvo_handler,MGA_VID_FSEL,&next_frame); @@ -277,7 +283,8 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned void vlvo_draw_osd(void) { - if(verbose > 1) printf("vesa_lvo: vlvo_draw_osd() was called\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("vesa_lvo: vlvo_draw_osd() was called\n"); } /* TODO: hw support */ #if 0 /* disable this stuff until new fbvid.h interface will be implemented @@ -289,7 +296,8 @@ void vlvo_draw_osd(void) uint32_t vlvo_query_info(uint32_t format) { - if(verbose > 1) printf("vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format)); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format)); } return VFCAP_CSP_SUPPORTED; } diff --git a/libvo/vo_png.c b/libvo/vo_png.c index 41dcdc3290..7b2fe72540 100644 --- a/libvo/vo_png.c +++ b/libvo/vo_png.c @@ -14,6 +14,7 @@ #include <png.h> +#include "mp_msg.h" #include "config.h" #include "video_out.h" #include "video_out_internal.h" @@ -29,7 +30,6 @@ static vo_info_t info = LIBVO_EXTERN (png) -extern int verbose; int z_compression = Z_NO_COMPRESSION; static int framenum = 0; @@ -50,7 +50,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin printf("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n"); } - if(verbose) printf("PNG Compression level %i\n", z_compression); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Compression level %i\n", z_compression); } return 0; } @@ -70,13 +71,15 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int png.info_ptr = png_create_info_struct(png.png_ptr); if (!png.png_ptr) { - if(verbose > 1) printf("PNG Failed to init png pointer\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Failed to init png pointer\n"); } png.status = ERROR; return png; } if (!png.info_ptr) { - if(verbose > 1) printf("PNG Failed to init png infopointer\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Failed to init png infopointer\n"); } png_destroy_write_struct(&png.png_ptr, (png_infopp)NULL); png.status = ERROR; @@ -84,7 +87,8 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int } if (setjmp(png.png_ptr->jmpbuf)) { - if(verbose > 1) printf("PNG Internal error!\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Internal error!\n");} png_destroy_write_struct(&png.png_ptr, &png.info_ptr); fclose(png.fp); png.status = ERROR; @@ -98,7 +102,8 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int return png; } - if(verbose > 1) printf("PNG Init IO\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Init IO\n"); } png_init_io(png.png_ptr, png.fp); /* set the zlib compression level */ @@ -112,11 +117,13 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - if(verbose > 1) printf("PNG Write Info\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Write Info\n"); } png_write_info(png.png_ptr, png.info_ptr); if(swapped) { - if(verbose > 1) printf("PNG Set BGR Conversion\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Set BGR Conversion\n"); } png_set_bgr(png.png_ptr); } @@ -126,10 +133,12 @@ struct pngdata create_png (char * fname, int image_width, int image_height, int static uint8_t destroy_png(struct pngdata png) { - if(verbose > 1) printf("PNG Write End\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Write End\n"); } png_write_end(png.png_ptr, png.info_ptr); - if(verbose > 1) printf("PNG Destroy Write Struct\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Destroy Write Struct\n"); } png_destroy_write_struct(&png.png_ptr, &png.info_ptr); fclose (png.fp); @@ -155,14 +164,16 @@ static uint32_t draw_image(mp_image_t* mpi){ return 1; } - if(verbose > 1) printf("PNG Creating Row Pointers\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Creating Row Pointers\n"); } for ( k = 0; k < mpi->h; k++ ) row_pointers[k] = mpi->planes[0]+mpi->stride[0]*k; //png_write_flush(png.png_ptr); //png_set_flush(png.png_ptr, nrows); - if(verbose > 1) printf("PNG Writing Image Data\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("PNG Writing Image Data\n"); } png_write_image(png.png_ptr, row_pointers); destroy_png(png); diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c index 078951d474..da18fe463b 100644 --- a/libvo/vo_sdl.c +++ b/libvo/vo_sdl.c @@ -105,6 +105,7 @@ #include <string.h> #include <inttypes.h> +#include "mp_msg.h" #include "config.h" #include "video_out.h" #include "video_out_internal.h" @@ -123,8 +124,6 @@ #include "input/mouse.h" #include "subopt-helper.h" -extern int verbose; - static vo_info_t info = { "SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)", @@ -141,14 +140,16 @@ LIBVO_EXTERN(sdl) #ifdef SDL_ENABLE_LOCKS #define SDL_OVR_LOCK(x) if (SDL_LockYUVOverlay (priv->overlay)) { \ - if(verbose) printf("SDL: Couldn't lock YUV overlay\n"); \ + if( mp_msg_test(MSGT_VO,MSGL_V) ) { \ + printf("SDL: Couldn't lock YUV overlay\n");} \ return x; \ } #define SDL_OVR_UNLOCK SDL_UnlockYUVOverlay (priv->overlay); #define SDL_SRF_LOCK(srf, x) if(SDL_MUSTLOCK(srf)) { \ if(SDL_LockSurface (srf)) { \ - if(verbose) printf("SDL: Couldn't lock RGB surface\n"); \ + if( mp_msg_test(MSGT_VO,MSGL_V) ) { \ + printf("SDL: Couldn't lock RGB surface\n"); } \ return x; \ } \ } @@ -422,18 +423,21 @@ static int sdl_open (void *plugin, void *name) /* other default values */ #ifdef SDL_NOHWSURFACE - if(verbose) printf("SDL: using software-surface\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: using software-surface\n"); } priv->sdlflags = SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT; priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT; // XXX:FIXME: ASYNCBLIT should be enabled for SMP systems #else /*if((strcmp(priv->driver, "dga") == 0) && (priv->mode)) { - if(verbose) printf("SDL: using software-surface\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: using software-surface\n"); } priv->sdlflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; } else { */ - if(verbose) printf("SDL: using hardware-surface\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: using hardware-surface\n"); } priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE/*|SDL_ANYFORMAT*/; priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN/*|SDL_ANYFORMAT*/; // XXX:FIXME: ASYNCBLIT should be enabled for SMP systems @@ -483,7 +487,8 @@ static int sdl_open (void *plugin, void *name) priv->bpp = vidInfo->vfmt->BitsPerPixel; if (priv->mode == YUV && priv->bpp < 16) { - if(verbose) printf("SDL: Your SDL display target wants to be at a color " + if( mp_msg_test(MSGT_VO,MSGL_V) ) + printf("SDL: Your SDL display target wants to be at a color " "depth of (%d), but we need it to be at least 16 " "bits, so we need to emulate 16-bit color. This is " "going to slow things down; you might want to " @@ -561,7 +566,8 @@ static int sdl_close (void) #if 0 static SDL_Rect aspect(int srcw, int srch, int dstw, int dsth) { SDL_Rect newres; - if(verbose > 1) printf("SDL Aspect: src: %ix%i dst: %ix%i\n", srcw, srch, dstw, dsth); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL Aspect: src: %ix%i dst: %ix%i\n", srcw, srch, dstw, dsth); } newres.h = ((float)dstw / (float)srcw * (float)srch) * ((float)dsth/((float)dstw/(MONITOR_ASPECT))); if(newres.h > dsth) { newres.w = ((float)dsth / (float)newres.h) * dstw; @@ -575,7 +581,8 @@ static SDL_Rect aspect(int srcw, int srch, int dstw, int dsth) { newres.y = (dsth - newres.h) / 2; } - if(verbose) printf("SDL Aspect-Destinationres: %ix%i (x: %i, y: %i)\n", newres.w, newres.h, newres.x, newres.y); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL Aspect-Destinationres: %ix%i (x: %i, y: %i)\n", newres.w, newres.h, newres.x, newres.y); } return newres; } @@ -676,7 +683,7 @@ static void set_fullmode (int mode) { else if (mode < 0) { int i,j,imax; mode = 0; // Default to the biggest mode avaible - if (verbose) for(i=0;priv->fullmodes[i];++i) + if ( mp_msg_test(MSGT_VO,MSGL_V) ) for(i=0;priv->fullmodes[i];++i) printf("SDL Mode: %d: %d x %d\n", i, priv->fullmodes[i]->w, priv->fullmodes[i]->h); for(i = findArrayEnd(priv->fullmodes) - 1; i >=0; i--) { if( (priv->fullmodes[i]->w >= priv->dstwidth) && @@ -691,7 +698,8 @@ static void set_fullmode (int mode) { break; } } - if (verbose) printf("SET SDL Mode: %d: %d x %d\n", mode, priv->fullmodes[mode]->w, priv->fullmodes[mode]->h); + if ( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SET SDL Mode: %d: %d x %d\n", mode, priv->fullmodes[mode]->w, priv->fullmodes[mode]->h); } priv->fullmode = mode; screen_surface_h = priv->fullmodes[mode]->h; screen_surface_w = priv->fullmodes[mode]->w; @@ -800,8 +808,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin if ( vo_config_count ) sdl_close(); - if(verbose) printf("SDL: Using 0x%X (%s) image format\n", format, - vo_format_name(format)); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: Using 0x%X (%s) image format\n", format, vo_format_name(format)); } if(priv->mode != YUV) { priv->sdlflags |= SDL_ANYFORMAT; @@ -848,11 +856,13 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin // printf("SDL: flags are set to: %i\n", flags); // printf("SDL: Width: %i Height: %i D_Width %i D_Height: %i\n", width, height, d_width, d_height); if(flags&VOFLAG_FLIPPING) { - if(verbose) printf("SDL: using flipped video (only with RGB/BGR/packed YUV)\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: using flipped video (only with RGB/BGR/packed YUV)\n"); } priv->flip = 1; } if(flags&VOFLAG_FULLSCREEN) { - if(verbose) printf("SDL: setting zoomed fullscreen without modeswitching\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: setting zoomed fullscreen without modeswitching\n"); } printf("SDL: Info - please use -vm or -zoom to switch to best resolution.\n"); priv->fulltype = VOFLAG_FULLSCREEN; set_fullmode(priv->fullmode); @@ -860,14 +870,16 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin SDL_ShowCursor(0);*/ } else if(flags&VOFLAG_MODESWITCHING) { - if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: setting zoomed fullscreen with modeswitching\n"); } priv->fulltype = VOFLAG_MODESWITCHING; set_fullmode(priv->fullmode); /*if((priv->surface = SDL_SetVideoMode (d_width ? d_width : width, d_height ? d_height : height, priv->bpp, priv->sdlfullflags))) SDL_ShowCursor(0);*/ } else if(flags&VOFLAG_SWSCALE) { - if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: setting zoomed fullscreen with modeswitching\n"); } priv->fulltype = VOFLAG_SWSCALE; set_fullmode(priv->fullmode); } @@ -878,11 +890,13 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin ||(strcmp(priv->driver, "Quartz") == 0) ||(strcmp(priv->driver, "cgx") == 0) ||((strcmp(priv->driver, "aalib") == 0) && priv->X)){ - if(verbose) printf("SDL: setting windowed mode\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: setting windowed mode\n"); } set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags); } else { - if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: setting zoomed fullscreen with modeswitching\n"); } priv->fulltype = VOFLAG_SWSCALE; set_fullmode(priv->fullmode); } @@ -1167,7 +1181,8 @@ static void check_events (void) priv->windowsize.w = priv->surface->w; priv->windowsize.h = priv->surface->h; //} - if(verbose > 2) printf("SDL: Window resize\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { + printf("SDL: Window resize\n"); } break; case SDL_MOUSEBUTTONDOWN: @@ -1207,7 +1222,8 @@ static void check_events (void) case SDL_KEYDOWN: #endif keypressed = event.key.keysym.sym; - if(verbose > 1) printf("SDL: Key pressed: '%i'\n", keypressed); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("SDL: Key pressed: '%i'\n", keypressed); } /* c key pressed. c cycles through available fullscreenmodes, if we have some */ if ( ((keypressed == SDLK_c)) && (priv->fullmodes) ) { @@ -1216,7 +1232,8 @@ static void check_events (void) if (priv->fullmode > (findArrayEnd(priv->fullmodes) - 1)) priv->fullmode = 0; set_fullmode(priv->fullmode); - if(verbose > 1) printf("SDL: Set next available fullscreen mode.\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("SDL: Set next available fullscreen mode.\n"); } } else if ( keypressed == SDLK_n ) { @@ -1227,13 +1244,15 @@ static void check_events (void) set_video_mode(priv->dstwidth, priv->dstheight, priv->bpp, priv->sdlflags); priv->windowsize.w = priv->surface->w; priv->windowsize.h = priv->surface->h; - if(verbose > 1) printf("SDL: Normal size\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("SDL: Normal size\n"); } } else if (priv->surface->w != priv->dstwidth * 2 || priv->surface->h != priv->dstheight * 2) { set_video_mode(priv->dstwidth * 2, priv->dstheight * 2, priv->bpp, priv->sdlflags); priv->windowsize.w = priv->surface->w; priv->windowsize.h = priv->surface->h; - if(verbose > 1) printf("SDL: Double size\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("SDL: Double size\n"); } } } @@ -1555,7 +1574,8 @@ uninit(void) #ifdef HAVE_X11 struct sdl_priv_s *priv = &sdl_priv; if(priv->X) { - if(verbose) printf("SDL: activating XScreensaver/DPMS\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: activating XScreensaver/DPMS\n"); } vo_x11_uninit(); } #endif @@ -1565,7 +1585,8 @@ uninit(void) if(SDL_WasInit(SDL_INIT_VIDEO)) SDL_QuitSubSystem(SDL_INIT_VIDEO); - if(verbose > 2) printf("SDL: Closed Plugin\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { + printf("SDL: Closed Plugin\n"); } } @@ -1591,7 +1612,8 @@ static int preinit(const char *arg) priv->overlay = NULL; priv->surface = NULL; - if(verbose > 2) printf("SDL: Opening Plugin\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { + printf("SDL: Opening Plugin\n"); } if(sdl_driver) { setenv("SDL_VIDEODRIVER", sdl_driver, 1); @@ -1626,11 +1648,13 @@ static int preinit(const char *arg) priv->X = 0; #ifdef HAVE_X11 if(vo_init()) { - if(verbose) printf("SDL: deactivating XScreensaver/DPMS\n"); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: deactivating XScreensaver/DPMS\n"); } priv->XWidth = vo_screenwidth; priv->XHeight = vo_screenheight; priv->X = 1; - if(verbose) printf("SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("SDL: X11 Resolution %ix%i\n", priv->XWidth, priv->XHeight); } } #endif @@ -1695,10 +1719,12 @@ static int control(uint32_t request, void *data, ...) if (priv->surface->flags & SDL_FULLSCREEN) { set_video_mode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags); SDL_ShowCursor(1); - if(verbose > 1) printf("SDL: Windowed mode\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("SDL: Windowed mode\n"); } } else if (priv->fullmodes) { set_fullmode(priv->fullmode); - if(verbose > 1) printf("SDL: Set fullscreen mode\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { + printf("SDL: Set fullscreen mode\n"); } } return VO_TRUE; } diff --git a/libvo/vo_svga.c b/libvo/vo_svga.c index aa9158b093..ebc51a3a19 100644 --- a/libvo/vo_svga.c +++ b/libvo/vo_svga.c @@ -52,7 +52,6 @@ TODO: //silence warnings, probably it have to go in some global header #define UNUSED(x) ((void)(x)) -extern int verbose; static int query_format(uint32_t format); static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, @@ -172,7 +171,7 @@ char s[64]; force_vm=vga_getmodenumber(s); if(force_vm>0) { - if(verbose) printf("vo_svga: Forcing mode %i\n",force_vm); + if( mp_msg_test(MSGT_VO,MSGL_V) ) printf("vo_svga: Forcing mode %i\n",force_vm); }else{ force_vm = 0; } @@ -191,7 +190,7 @@ uint8_t * rgbplane; int i; if (mode_capabilities&CAP_ACCEL_CLEAR){ - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: clearing box %d,%d - %d,%d with HW acceleration\n", x,y,w,h); if(mode_capabilities&CAP_ACCEL_BACKGR) @@ -201,7 +200,7 @@ int i; return; } if (mode_capabilities & CAP_LINEAR){ - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: clearing box %d,%d - %d,%d with memset\n",x,y,w,h); rgbplane=PageStore[0].vbase + (y*mode_stride) + (x*modeinfo->bytesperpixel); for(i=0;i<h;i++){ @@ -213,7 +212,7 @@ int i; return; } //native - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: clearing box %d,%d - %d,%d with native draw \n",x,y,w,h); if(modeinfo->bytesperpixel!=0) w*=modeinfo->bytesperpixel; for(i=0;i<h;i++){ @@ -229,7 +228,7 @@ int bytesperline; int page; if(mpi->flags & MP_IMGFLAG_DIRECT){ - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: drawing direct rendered surface\n"); cpage=(uint32_t)mpi->priv; assert((cpage>=0)&&(cpage<max_pages)); @@ -259,7 +258,7 @@ int page; (stride == mode_stride) ){ //only monolite image can be accelerated w=(stride*8)/mpi->bpp;//we transfer pixels in the stride so the source //ACCELERATE - if(verbose>2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: using HW PutImage (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h); if(mode_capabilities & CAP_ACCEL_BACKGR) vga_accel(ACCEL_SYNC); @@ -270,7 +269,7 @@ int page; if( mode_capabilities&CAP_LINEAR){ //DIRECT - if(verbose>2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: using Direct memcpy (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h); bytesperline=(w*mpi->bpp)/8; base=PageStore[cpage].vbase + (y*mode_stride) + (x*mpi->bpp)/8; @@ -292,7 +291,7 @@ int page; //one byte per pixel! svgalib innovation if(mpi->imgfmt==IMGFMT_RG4B || mpi->imgfmt==IMGFMT_BG4B) length=w; - if(verbose>2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: using Native vga_draw(x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h); y+=PageStore[cpage].yoffset;//y position of the page beggining for(i=0;i<h;i++){ @@ -328,7 +327,7 @@ int find_best_svga_mode(int req_w,int req_h, int req_bpp){ for(i=1;i<=lastmode;i++){ vminfo = vga_getmodeinfo(i); if( vminfo == NULL ) continue; - if(verbose>3) + if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) printf("vo_svga: testing mode %d (%s)\n",i,vga_getmodename(i)); if( vga_hasmode(i) == 0 ) continue; if( req_bpp != bpp_from_vminfo(vminfo) )continue; @@ -341,7 +340,7 @@ int find_best_svga_mode(int req_w,int req_h, int req_bpp){ if( bestmode==0 || prev_badness >= badness ){//modeX etc... prev_badness=badness; bestmode=i; - if(verbose>3) + if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) printf("vo_svga: found good mode %d with badness %d\n",i,badness); } } @@ -404,7 +403,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, int32_t req_bpp; uint32_t accflags; - if(verbose) + if( mp_msg_test(MSGT_VO,MSGL_V) ) printf("vo_svga: config(%i, %i, %i, %i, %08x, %s, %08x)\n", width, height, d_width, d_height, flags, title, format); //Only RGB modes supported @@ -414,7 +413,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, if( vo_dbpp!=0 && vo_dbpp!=req_bpp) {assert(0);return-1;} if(!force_vm) { - if (verbose) { + if ( mp_msg_test(MSGT_VO,MSGL_V) ) { printf("vo_svga: Looking for the best resolution...\n"); printf("vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,req_bpp); } @@ -593,7 +592,7 @@ UNUSED(src); static void draw_osd(void) { - if(verbose > 3) + if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) printf("vo_svga: draw_osd()\n"); //only modes with bytesperpixel>0 can draw OSD if(modeinfo->bytesperpixel==0) return; @@ -622,10 +621,10 @@ static void flip_page(void) { PageStore[old_page].locks=PAGE_EMPTY; PageStore[cpage].locks=PAGE_BUSY; - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: viewing page %d\n",cpage); if(sync_flip && old_page!=cpage){ - if(verbose > 2) printf("vo_svga:vga_waitretrace\n"); + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga:vga_waitretrace\n"); vga_waitretrace(); } vga_setdisplaystart(PageStore[cpage].doffset); @@ -650,7 +649,7 @@ int32_t req_bpp,flags; int i,lastmode; vga_modeinfo * vminfo; - if (verbose >3) + if ( mp_msg_test(MSGT_VO,MSGL_DBG4) ) printf("vo_svga: query_format=%X \n",format); //only RGB modes supported if( (!IMGFMT_IS_RGB(format)) && (!IMGFMT_IS_BGR(format)) ) return 0; @@ -688,7 +687,7 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) { char* base; - if(verbose>2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: draw_alpha(x0=%d,y0=%d,w=%d,h=%d,src=%p,srca=%p,stride=%d\n", x0,y0,w,h,src,srca,stride); if(!blackbar_osd) { @@ -697,7 +696,7 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, y0+=y_pos; } - if(verbose>3) + if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) printf("vo_svga: OSD draw in page %d\n",cpage); base=PageStore[cpage].vbase + y0*mode_stride + x0*modeinfo->bytesperpixel; switch (mode_bpp) { @@ -745,7 +744,7 @@ int page; mpi->planes[0] = PageStore[page].vbase + y_pos*mode_stride + (x_pos*mpi->bpp)/8; mpi->priv=(void *)page; - if(verbose>2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_svga: direct render allocated! page=%d\n",page); return(VO_TRUE); } diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c index 80f98df911..705b6f2ed7 100644 --- a/libvo/vo_vesa.c +++ b/libvo/vo_vesa.c @@ -43,6 +43,7 @@ #ifdef CONFIG_VIDIX #include "vosub_vidix.h" #endif +#include "mp_msg.h" #include "postproc/swscale.h" #include "libmpcodecs/vf_scale.h" @@ -52,8 +53,6 @@ extern vo_functions_t video_out_png; #endif -extern int verbose; - extern char *monitor_hfreq_str; extern char *monitor_vfreq_str; extern char *monitor_dotclock_str; @@ -280,7 +279,7 @@ static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; uint8_t *dst[3]= {dga_buffer, NULL, NULL}; int dstStride[3]; - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_vesa: draw_slice was called: w=%u h=%u x=%u y=%u\n",w,h,x,y); dstStride[0]=dstride*((dstBpp+7)/8); dstStride[1]= @@ -361,7 +360,7 @@ static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsi static void draw_osd(void) { uint32_t w,h; - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_vesa: draw_osd was called\n"); { #ifdef OSD_OUTSIDE_MOVIE @@ -377,7 +376,7 @@ static void draw_osd(void) static void flip_page(void) { - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_vesa: flip_page was called\n"); if(flip_trigger) { @@ -412,7 +411,7 @@ static void flip_page(void) /* is called for rgb only */ static int draw_frame(uint8_t *src[]) { - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_vesa: draw_frame was called\n"); if(sws) { @@ -463,7 +462,7 @@ static uint32_t parseSubDevice(const char *sd) static int query_format(uint32_t format) { - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_vesa: query_format was called: %x (%s)\n",format,vo_format_name(format)); #ifdef CONFIG_VIDIX if(vidix_name)return(vidix_query_fourcc(format)); @@ -538,7 +537,8 @@ unsigned fillMultiBuffer( unsigned long vsize, unsigned nbuffs ) screen_size = video_mode_info.XResolution*video_mode_info.YResolution*((dstBpp+7)/8); if(screen_size%64) screen_size=((screen_size/64)*64)+64; total = vsize / screen_size; - if(verbose) printf("vo_vesa: Can use up to %u video buffers\n",total); + if( mp_msg_test(MSGT_VO,MSGL_V) ) + printf("vo_vesa: Can use up to %u video buffers\n",total); i = 0; offset = 0; total = min(total,nbuffs); @@ -715,7 +715,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin dstFourcc = IMGFMT_BGR16; break; } - if(verbose) + if( mp_msg_test(MSGT_VO,MSGL_V) ) { printf("vo_vesa: Requested mode: %ux%u@%u (%s)\n",width,height,bpp,vo_format_name(format)); printf("vo_vesa: Total modes found: %u\n",num_modes); @@ -758,7 +758,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin best_mode_idx = i; } } - if(verbose) + if( mp_msg_test(MSGT_VO,MSGL_V) ) { printf("vo_vesa: Mode (%03u): mode=%04X %ux%u@%u attr=%04X\n" "vo_vesa: #planes=%u model=%u(%s) #pages=%u\n" @@ -783,7 +783,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin PRINT_VBE_ERR("vbeGetMode",err); return -1; } - if(verbose) printf("vo_vesa: Initial video mode: %x\n",init_mode); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("vo_vesa: Initial video mode: %x\n",init_mode); } if((err=vbeGetModeInfo(video_mode,&video_mode_info)) != VBE_OK) { PRINT_VBE_ERR("vbeGetModeInfo",err); @@ -828,7 +829,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin printf("vo_vesa: Can't initialize SwScaler\n"); return -1; } - else if(verbose) printf("vo_vesa: Using SW BES emulator\n"); + else if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("vo_vesa: Using SW BES emulator\n"); } } if((video_mode_info.WinAAttributes & FRAME_MODE) == FRAME_MODE) win.idx = 0; /* frame A */ @@ -855,7 +857,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin printf("vo_vesa: Using DGA (physical resources: %08lXh, %08lXh)" ,video_mode_info.PhysBasePtr ,vsize); - if(verbose) printf(" at %08lXh",(unsigned long)lfb); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf(" at %08lXh",(unsigned long)lfb); } printf("\n"); if(!(multi_size = fillMultiBuffer(vsize,2))) return -1; if(vo_doublebuffering && multi_size < 2) @@ -891,7 +894,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin if(video_mode_info.YResolution > dstH) y_offset = (video_mode_info.YResolution - dstH) / 2; else y_offset = 0; - if(verbose) + if( mp_msg_test(MSGT_VO,MSGL_V) ) printf("vo_vesa: image: %ux%u screen = %ux%u x_offset = %u y_offset = %u\n" ,dstW,dstH ,video_mode_info.XResolution,video_mode_info.YResolution @@ -915,7 +918,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin printf("vo_vesa: Can't allocate temporary buffer\n"); return -1; } - if(verbose) printf("vo_vesa: dga emulator was allocated = %p\n",dga_buffer); + if( mp_msg_test(MSGT_VO,MSGL_V) ) { + printf("vo_vesa: dga emulator was allocated = %p\n",dga_buffer); } } } if((err=vbeSaveState(&init_state)) != VBE_OK) @@ -956,7 +960,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin } /* Now we are in video mode!!!*/ /* Below 'return -1' is impossible */ - if(verbose) + if( mp_msg_test(MSGT_VO,MSGL_V) ) { printf("vo_vesa: Graphics mode was activated\n"); fflush(stdout); @@ -1013,7 +1017,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin printf("vo_vesa: Can't find mode for: %ux%u@%u\n",width,height,bpp); return -1; } - if(verbose) + if( mp_msg_test(MSGT_VO,MSGL_V) ) { printf("vo_vesa: VESA initialization complete\n"); fflush(stdout); @@ -1024,13 +1028,13 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin { win.ptr = dga_buffer = video_base + multi_buff[i]; clear_screen(); /* Clear screen for stupid BIOSes */ - if(verbose>1) paintBkGnd(); + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) paintBkGnd(); } } else { clear_screen(); /* Clear screen for stupid BIOSes */ - if(verbose>1) + if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) { int x; x = (video_mode_info.XResolution/video_mode_info.XCharSize)/2-strlen(title)/2; @@ -1047,14 +1051,14 @@ uninit(void) { // not inited vesa_term(); - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_vesa: uninit was called\n"); } static void check_events(void) { - if(verbose > 2) + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) printf("vo_vesa: check_events was c |