[Mplayer-cvslog] CVS: main/libvo vo_vesa.c,1.16,1.17
Nick Kurshev
nick at mplayer.dev.hu
Sun Oct 21 17:04:20 CEST 2001
- Previous message: [Mplayer-cvslog] CVS: main/libvo vo_vesa.c,1.15,1.16
- Next message: [Mplayer-cvslog] CVS: main/libmpdemux asfheader.c,1.23,1.24 aviheader.c,1.29,1.30 demux_asf.c,1.17,1.18 demux_avi.c,1.32,1.33 demux_mov.c,1.10,1.11 demux_mpg.c,1.32,1.33 demuxer.c,1.35,1.36 stheader.h,1.17,1.18 test.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv22402/main/libvo
Modified Files:
vo_vesa.c
Log Message:
OSD support
Index: vo_vesa.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_vesa.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- vo_vesa.c 21 Oct 2001 14:30:36 -0000 1.16
+++ vo_vesa.c 21 Oct 2001 15:04:04 -0000 1.17
@@ -26,8 +26,7 @@
#include "fastmemcpy.h"
#include "yuv2rgb.h"
-
-#include "linux/lrmi.h"
+#include "sub.h"
#include "linux/vbelib.h"
#include "bswap.h"
@@ -82,6 +81,7 @@
static unsigned video_mode; /* selected video mode for playback */
static struct VesaModeInfoBlock video_mode_info;
static int flip_trigger = 0;
+static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
#define MOVIE_MODE (MODE_ATTR_COLOR | MODE_ATTR_GRAPHICS)
#define FRAME_MODE (MODE_WIN_RELOCATABLE | MODE_WIN_READABLE | MODE_WIN_WRITEABLE)
@@ -113,7 +113,7 @@
int err;
if((err=vbeRestoreState(init_state)) != VBE_OK) PRINT_VBE_ERR("vbeRestoreState",err);
if((err=vbeSetMode(init_mode,NULL)) != VBE_OK) PRINT_VBE_ERR("vbeSetMode",err);
- free(yuv_buffer);
+ if(yuv_buffer) free(yuv_buffer);
vbeDestroy();
}
@@ -258,9 +258,29 @@
return 0;
}
+static void draw_alpha_32(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+ vo_draw_alpha_rgb32(w,h,src,srca,stride,yuv_buffer+4*(y0*image_width+x0),4*image_width);
+}
+
+static void draw_alpha_24(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+ vo_draw_alpha_rgb24(w,h,src,srca,stride,yuv_buffer+3*(y0*image_width+x0),3*image_width);
+}
+
+static void draw_alpha_16(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+ vo_draw_alpha_rgb16(w,h,src,srca,stride,yuv_buffer+2*(y0*image_width+x0),2*image_width);
+}
+
+static void draw_alpha_15(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+ vo_draw_alpha_rgb15(w,h,src,srca,stride,yuv_buffer+2*(y0*image_width+x0),2*image_width);
+}
+
+static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+}
+
+
static void draw_osd(void)
{
-/* nothing to do for now */
+ if(yuv_buffer) vo_draw_text(image_width,image_height,draw_alpha_fnc);
}
static void flip_page(void)
@@ -354,7 +374,7 @@
uint32_t w,h;
unsigned short *mode_ptr,win_seg;
unsigned bpp,best_x = UINT_MAX,best_y=UINT_MAX,best_mode_idx = UINT_MAX;
- int err,fs_mode;
+ int err,fs_mode,yuv_fmt;
image_width = width;
image_height = height;
fs_mode = 0;
@@ -401,11 +421,11 @@
num_modes = 0;
mode_ptr = vib.VideoModePtr;
while(*mode_ptr++ != 0xffff) num_modes++;
+ yuv_fmt = format == IMGFMT_YV12 || format == IMGFMT_I420 || format == IMGFMT_IYUV;
if(vo_dbpp)
{
bpp = vo_dbpp;
- if(format == IMGFMT_YV12 || format == IMGFMT_I420 || format == IMGFMT_IYUV)
- yuv2rgb_init(bpp, MODE_RGB);
+ if(yuv_fmt) yuv2rgb_init(bpp, MODE_RGB);
}
else
switch(format)
@@ -426,6 +446,14 @@
case IMGFMT_BGR32:
case IMGFMT_RGB32: bpp = 32; break;
}
+ switch(bpp)
+ {
+ case 15: draw_alpha_fnc = draw_alpha_15; break;
+ case 16: draw_alpha_fnc = draw_alpha_16; break;
+ case 24: draw_alpha_fnc = draw_alpha_24; break;
+ case 32: draw_alpha_fnc = draw_alpha_32; break;
+ default: draw_alpha_fnc = draw_alpha_null; break;
+ }
if(verbose)
{
printf("vo_vesa: Requested mode: %ux%u@%u (%s)\n",width,height,bpp,vo_format_name(format));
@@ -557,23 +585,24 @@
,image_width,image_height
,video_mode_info.XResolution,video_mode_info.YResolution
,x_offset,y_offset);
- if(!(yuv_buffer = malloc(image_width*image_height*bpp)))
- {
- printf("vo_vesa: Can't allocate temporary buffer\n");
- return -1;
- }
+ if(yuv_fmt)
+ if(!(yuv_buffer = malloc(image_width*image_height*bpp)))
+ {
+ printf("vo_vesa: Can't allocate temporary buffer\n");
+ return -1;
+ }
if((err=vbeSaveState(&init_state)) != VBE_OK)
{
PRINT_VBE_ERR("vbeSaveState",err);
return -1;
}
-/* Below 'return -1' is impossible */
if((err=vbeSetMode(video_mode,NULL)) != VBE_OK)
{
PRINT_VBE_ERR("vbeSetMode",err);
return -1;
}
/* Now we are in video mode!!!*/
+ /* Below 'return -1' is impossible */
if(verbose)
{
printf("vo_vesa: Graphics mode was activated\n");
- Previous message: [Mplayer-cvslog] CVS: main/libvo vo_vesa.c,1.15,1.16
- Next message: [Mplayer-cvslog] CVS: main/libmpdemux asfheader.c,1.23,1.24 aviheader.c,1.29,1.30 demux_asf.c,1.17,1.18 demux_avi.c,1.32,1.33 demux_mov.c,1.10,1.11 demux_mpg.c,1.32,1.33 demuxer.c,1.35,1.36 stheader.h,1.17,1.18 test.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list