CVS: main/libvo vo_sdl.c,1.32,1.33
Update of /cvsroot/mplayer/main/libvo In directory usw-pr-cvs1:/tmp/cvs-serv18584 Modified Files: vo_sdl.c Log Message: Added flipped video support and activate/deactivate screensaver under X. Index: vo_sdl.c =================================================================== RCS file: /cvsroot/mplayer/main/libvo/vo_sdl.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** vo_sdl.c 2001/05/11 17:21:15 1.32 --- vo_sdl.c 2001/05/11 21:36:30 1.33 *************** *** 109,112 **** --- 109,117 ---- #include "sub.h" + #ifdef HAVE_X11 + #include <X11/Xlib.h> + #include "x11_common.h" + #endif + LIBVO_EXTERN(sdl) *************** *** 172,175 **** --- 177,184 ---- /* RGB ints */ int framePlaneRGB; + int stridePlaneRGB; + + /* Flip image */ + int flip; int width,height; *************** *** 350,354 **** * with keys need to be pressed twice, to be recognized. */ ! #ifndef BUGGY_SDL SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); --- 359,363 ---- * with keys need to be pressed twice, to be recognized. */ ! #ifndef BUGGY_SDL SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); *************** *** 358,362 **** SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); SDL_EventState(SDL_USEREVENT, SDL_IGNORE); ! #endif /* Success! */ --- 367,371 ---- SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); SDL_EventState(SDL_USEREVENT, SDL_IGNORE); ! #endif /* Success! */ *************** *** 454,462 **** static uint32_t ! init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) //static int sdl_setup (int width, int height) { struct sdl_priv_s *priv = &sdl_priv; unsigned int sdl_format; sdl_format = format; --- 463,476 ---- static uint32_t ! init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) //static int sdl_setup (int width, int height) { struct sdl_priv_s *priv = &sdl_priv; unsigned int sdl_format; + #ifdef HAVE_X11 + static Display *XDisplay; + #endif + + //priv->flip = 1; // debugging only sdl_format = format; *************** *** 515,518 **** --- 529,540 ---- sdl_open (NULL, NULL); + #ifdef HAVE_X11 + if(getenv("DISPLAY")) { + if(verbose) printf("SDL: deactivating XScreensaver/DPMS\n"); + XDisplay = XOpenDisplay(getenv("DISPLAY")); + saver_off(XDisplay); + XCloseDisplay(XDisplay); + } + #endif /* Set output window title */ *************** *** 533,542 **** * bit 1 (0x02) means mode switching (-vm) * bit 2 (0x04) enables software scaling (-zoom) ! */ ! // printf("SDL: fullscreenflag is set to: %i\n", fullscreen); // printf("SDL: Width: %i Height: %i D_Width %i D_Height: %i\n", width, height, d_width, d_height); ! switch(fullscreen){ ! case 0x01: ! case 0x05: priv->width = width; priv->height = height; --- 555,571 ---- * bit 1 (0x02) means mode switching (-vm) * bit 2 (0x04) enables software scaling (-zoom) ! * bit 3 (0x08) enables flipping (-flip) ! */ ! #define FS 0x01 ! #define VM 0x02 ! #define ZOOM 0x04 ! #define FLIP 0x08 ! // 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&FLIP) { // flipping flag set, use it ! if(verbose) printf("SDL: using flipped video (only with RGB/BGR)\n"); ! priv->flip = 1; ! } ! if(flags&FS) { priv->width = width; priv->height = height; *************** *** 545,567 **** if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlfullflags))) SDL_ShowCursor(0); ! break; ! case 0x02: if(verbose) printf("SDL: setting nonzoomed fullscreen with modeswitching\n"); printf("SDL: Info - please use -zoom switch to scale video\n"); if((priv->surface = SDL_SetVideoMode (d_width ? d_width : width, d_height ? d_height : height, priv->bpp, priv->sdlfullflags))) SDL_ShowCursor(0); ! break; ! case 0x04: ! case 0x06: if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); printf("SDL: Info - please use -vm switch instead if you don't want scaled video\n"); priv->surface=NULL; set_fullmode(priv->fullmode); ! break; ! default: ! if(verbose) printf("SDL: setting windowed mode\n"); if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlflags)) && (strcmp(priv->driver, "dga") == 0)) SDL_ShowCursor(0); //TODO: other sdl drivers that are fullscreen only? ! } if(!priv->surface) { // cannot SetVideoMode printf("SDL: failed to set video mode: %s\n", SDL_GetError()); --- 574,596 ---- if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlfullflags))) SDL_ShowCursor(0); ! } else ! if(flags&VM) { if(verbose) printf("SDL: setting nonzoomed fullscreen with modeswitching\n"); printf("SDL: Info - please use -zoom switch to scale video\n"); 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&ZOOM) { if(verbose) printf("SDL: setting zoomed fullscreen with modeswitching\n"); printf("SDL: Info - please use -vm switch instead if you don't want scaled video\n"); priv->surface=NULL; set_fullmode(priv->fullmode); ! } ! else { ! if(verbose) printf("SDL: setting windowed mode\n"); if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlflags)) && (strcmp(priv->driver, "dga") == 0)) SDL_ShowCursor(0); //TODO: other sdl drivers that are fullscreen only? ! } ! if(!priv->surface) { // cannot SetVideoMode printf("SDL: failed to set video mode: %s\n", SDL_GetError()); *************** *** 640,643 **** --- 669,673 ---- if(priv->mode) { priv->framePlaneRGB = width * height * priv->rgbsurface->format->BytesPerPixel; + priv->stridePlaneRGB = width * priv->rgbsurface->format->BytesPerPixel; } return 0; *************** *** 657,660 **** --- 687,692 ---- struct sdl_priv_s *priv = &sdl_priv; uint8_t *dst; + int i; + uint8_t *mysrc = src[0]; switch(priv->format){ *************** *** 702,706 **** }*/ dst = (uint8_t *) priv->rgbsurface->pixels; ! memcpy (dst, src[0], priv->framePlaneRGB); /*if(SDL_MUSTLOCK(priv->rgbsurface)) SDL_UnlockSurface (priv->rgbsurface);*/ --- 734,746 ---- }*/ dst = (uint8_t *) priv->rgbsurface->pixels; ! if(priv->flip) { ! mysrc+=priv->framePlaneRGB; ! for(i = 0; i < priv->height; i++) { ! mysrc-=priv->stridePlaneRGB; ! memcpy (dst, mysrc, priv->stridePlaneRGB); ! dst+=priv->stridePlaneRGB; ! } ! } ! else memcpy (dst, src[0], priv->framePlaneRGB); /*if(SDL_MUSTLOCK(priv->rgbsurface)) SDL_UnlockSurface (priv->rgbsurface);*/ *************** *** 997,1000 **** --- 1037,1049 ---- uninit(void) { + #ifdef HAVE_X11 + static Display *XDisplay; + if(getenv("DISPLAY")) { + if(verbose) printf("SDL: activating XScreensaver/DPMS\n"); + XDisplay = XOpenDisplay(getenv("DISPLAY")); + saver_on(XDisplay); + XCloseDisplay(XDisplay); + } + #endif sdl_close(); } _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
participants (1)
-
Felix Buenemann