summaryrefslogtreecommitdiffstats
path: root/libvo/vo_sdl.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvo/vo_sdl.c')
-rw-r--r--libvo/vo_sdl.c90
1 files changed, 58 insertions, 32 deletions
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;
}