Mercurial > mplayer.hg
comparison libvo/vo_sdl.c @ 1219:e169f798ff71
Sync with SF cvs. (Bugfixed YUV aalib and RGB/BGR32 converted modes.)
author | atmos4 |
---|---|
date | Sun, 24 Jun 2001 19:20:19 +0000 |
parents | 80ca716ce5e9 |
children | e7d98f8f9459 |
comparison
equal
deleted
inserted
replaced
1218:eadf9a6ad6d9 | 1219:e169f798ff71 |
---|---|
195 Uint8 mode; | 195 Uint8 mode; |
196 #define YUV 0 | 196 #define YUV 0 |
197 #define RGB 1 | 197 #define RGB 1 |
198 #define BGR 2 | 198 #define BGR 2 |
199 | 199 |
200 /* use direct blitting to surface */ | |
201 int dblit; | |
202 | |
200 /* current fullscreen mode, 0 = highest available fullscreen mode */ | 203 /* current fullscreen mode, 0 = highest available fullscreen mode */ |
201 int fullmode; | 204 int fullmode; |
202 | 205 |
203 /* YUV ints */ | 206 /* YUV ints */ |
204 int framePlaneY, framePlaneUV, framePlaneYUY; | 207 int framePlaneY, framePlaneUV, framePlaneYUY; |
255 break; | 258 break; |
256 case IMGFMT_UYVY: | 259 case IMGFMT_UYVY: |
257 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+2*(priv->width*y0+x0)+1,2*priv->width); | 260 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+2*(priv->width*y0+x0)+1,2*priv->width); |
258 break; | 261 break; |
259 default: | 262 default: |
260 if((priv->format&0xFF) == priv->bpp) | 263 if(priv->dblit) |
261 switch(priv->format) { | 264 switch(priv->format) { |
262 case IMGFMT_RGB15: | 265 case IMGFMT_RGB15: |
263 case IMGFMT_BGR15: | 266 case IMGFMT_BGR15: |
264 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+2*(y0*priv->width+x0),2*priv->width); | 267 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+2*(y0*priv->width+x0),2*priv->width); |
265 break; | 268 break; |
373 priv->sdlflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; | 376 priv->sdlflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; |
374 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; | 377 priv->sdlfullflags = SDL_SWSURFACE|SDL_FULLSCREEN|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; |
375 } | 378 } |
376 else { */ | 379 else { */ |
377 if(verbose) printf("SDL: using hardware-surface\n"); | 380 if(verbose) printf("SDL: using hardware-surface\n"); |
378 priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; | 381 priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL/*|SDL_ANYFORMAT*/; |
379 priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT|SDL_HWACCEL|SDL_ANYFORMAT; | 382 priv->sdlfullflags = SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_ASYNCBLIT|SDL_HWACCEL/*|SDL_ANYFORMAT*/; |
380 //} | 383 //} |
381 #endif | 384 #endif |
382 | 385 |
383 /* Setup Keyrepeats (500/30 are defaults) */ | 386 /* Setup Keyrepeats (500/30 are defaults) */ |
384 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/); | 387 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/); |
658 break; | 661 break; |
659 default: | 662 default: |
660 printf("SDL: Unsupported image format (0x%X)\n",format); | 663 printf("SDL: Unsupported image format (0x%X)\n",format); |
661 return -1; | 664 return -1; |
662 } | 665 } |
666 if(priv->mode) { | |
667 priv->sdlflags |= SDL_ANYFORMAT; | |
668 priv->sdlfullflags |= SDL_ANYFORMAT; | |
669 } | |
663 | 670 |
664 #ifdef HAVE_X11 | 671 #ifdef HAVE_X11 |
665 if(getenv("DISPLAY")) { | 672 if(getenv("DISPLAY")) { |
666 if(verbose) printf("SDL: deactivating XScreensaver/DPMS\n"); | 673 if(verbose) printf("SDL: deactivating XScreensaver/DPMS\n"); |
667 XDisplay = XOpenDisplay(getenv("DISPLAY")); | 674 XDisplay = XOpenDisplay(getenv("DISPLAY")); |
799 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); | 806 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
800 return -1; | 807 return -1; |
801 } | 808 } |
802 break; | 809 break; |
803 case IMGFMT_RGB32: | 810 case IMGFMT_RGB32: |
804 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000))) { | 811 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0/*0xFF000000*/))) { |
805 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); | 812 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
806 return -1; | 813 return -1; |
807 } | 814 } |
808 break; | 815 break; |
809 case IMGFMT_BGR32: | 816 case IMGFMT_BGR32: |
810 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000))) { | 817 if (!(priv->rgbsurface = SDL_CreateRGBSurface (SDL_SRCCOLORKEY, width, height, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0/*0xFF000000*/))) { |
811 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); | 818 printf ("SDL: Couldn't create a RGB surface: %s\n", SDL_GetError()); |
812 return -1; | 819 return -1; |
813 } | 820 } |
814 break; | 821 break; |
815 default: | 822 default: |
825 priv->stridePlaneUV = width/2; | 832 priv->stridePlaneUV = width/2; |
826 priv->stridePlaneYUY = width * 2; | 833 priv->stridePlaneYUY = width * 2; |
827 } | 834 } |
828 | 835 |
829 if(priv->mode) { | 836 if(priv->mode) { |
830 if((priv->format&0xFF) != priv->bpp) printf("SDL: using depth/colorspace conversion, this will slow things down (%ibpp -> %ibpp).\n", priv->format&0xFF, priv->bpp); | 837 if((priv->format&0xFF) != priv->bpp) { priv->dblit = 0; printf("SDL: using depth/colorspace conversion, this will slow things down (%ibpp -> %ibpp).\n", priv->format&0xFF, priv->bpp); } |
838 else if(strcmp(priv->driver, "x11") == 0) priv->dblit = 1; | |
831 priv->framePlaneRGB = width * height * priv->rgbsurface->format->BytesPerPixel; | 839 priv->framePlaneRGB = width * height * priv->rgbsurface->format->BytesPerPixel; |
832 priv->stridePlaneRGB = width * priv->rgbsurface->format->BytesPerPixel; | 840 priv->stridePlaneRGB = width * priv->rgbsurface->format->BytesPerPixel; |
833 } | 841 } |
834 return 0; | 842 return 0; |
835 } | 843 } |
909 case IMGFMT_BGR16: | 917 case IMGFMT_BGR16: |
910 case IMGFMT_RGB24: | 918 case IMGFMT_RGB24: |
911 case IMGFMT_BGR24: | 919 case IMGFMT_BGR24: |
912 case IMGFMT_RGB32: | 920 case IMGFMT_RGB32: |
913 case IMGFMT_BGR32: | 921 case IMGFMT_BGR32: |
914 if((priv->format&0xFF) == priv->bpp) { | 922 if(priv->dblit) { |
915 SDL_SRF_LOCK(priv->surface) | 923 SDL_SRF_LOCK(priv->surface) |
916 dst = (uint8_t *) priv->surface->pixels; | 924 dst = (uint8_t *) priv->surface->pixels; |
917 if(priv->flip) { | 925 if(priv->flip) { |
918 mysrc+=priv->framePlaneRGB; | 926 mysrc+=priv->framePlaneRGB; |
919 for(i = 0; i < priv->height; i++) { | 927 for(i = 0; i < priv->height; i++) { |
1157 case IMGFMT_BGR16: | 1165 case IMGFMT_BGR16: |
1158 case IMGFMT_RGB24: | 1166 case IMGFMT_RGB24: |
1159 case IMGFMT_BGR24: | 1167 case IMGFMT_BGR24: |
1160 case IMGFMT_RGB32: | 1168 case IMGFMT_RGB32: |
1161 case IMGFMT_BGR32: | 1169 case IMGFMT_BGR32: |
1162 if((priv->format&0xFF) != priv->bpp) { | 1170 if(!priv->dblit) { |
1163 /* blit to the RGB surface */ | 1171 /* blit to the RGB surface */ |
1164 if(SDL_BlitSurface (priv->rgbsurface, NULL, priv->surface, NULL)) | 1172 if(SDL_BlitSurface (priv->rgbsurface, NULL, priv->surface, NULL)) |
1165 printf("SDL: Blit failed: %s\n", SDL_GetError()); | 1173 printf("SDL: Blit failed: %s\n", SDL_GetError()); |
1166 } | 1174 } |
1167 | 1175 |