summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authoratlka <atlka@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-23 11:04:23 +0000
committeratlka <atlka@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-23 11:04:23 +0000
commitdb73f0bfa72dbb5597234dc0861c7f6530898390 (patch)
tree643b64f81f4f5634466878c032bac8a70e1f3b0d /libvo
parent46eff745aafe18952e9607482e73802cbd50d959 (diff)
downloadmpv-db73f0bfa72dbb5597234dc0861c7f6530898390.tar.bz2
mpv-db73f0bfa72dbb5597234dc0861c7f6530898390.tar.xz
added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1648 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_x11.c55
-rw-r--r--libvo/vo_xv.c54
2 files changed, 65 insertions, 44 deletions
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index f6bda68162..9e21ee6181 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -49,6 +49,7 @@ static vo_info_t vo_info =
/* private prototypes */
static void Display_Image ( XImage * myximage,unsigned char *ImageData );
+static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
/* since it doesn't seem to be defined on some platforms */
int XShmGetEventBase( Display* );
@@ -113,6 +114,25 @@ static void check_events(){
vo_x11_check_events(mDisplay);
}
+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,ImageData+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,ImageData+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,ImageData+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,ImageData+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 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 )
{
// int screen;
@@ -316,7 +336,17 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
DeInstallXErrorHandler();
#endif
- bpp=myximage->bits_per_pixel;
+ switch ((bpp=myximage->bits_per_pixel)){
+ case 24: draw_alpha_fnc=draw_alpha_24; break;
+ case 32: draw_alpha_fnc=draw_alpha_32; break;
+ case 15:
+ case 16: if (depth==15)
+ draw_alpha_fnc=draw_alpha_15;
+ else
+ draw_alpha_fnc=draw_alpha_16;
+ break;
+ default: draw_alpha_fnc=draw_alpha_null;
+ }
// printf( "X11 color mask: R:%lX G:%lX B:%lX\n",myximage->red_mask,myximage->green_mask,myximage->blue_mask );
@@ -334,8 +364,9 @@ static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d
}
if( format==IMGFMT_YV12 ) yuv2rgb_init( ( depth == 24 ) ? bpp : depth,mode );
-
+
XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask );
+
X_already_started++;
// vo_initthread( mThread );
@@ -385,26 +416,8 @@ static void Display_Image( XImage *myximage,uint8_t *ImageData )
#endif
}
-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- switch(bpp){
- case 24:
- vo_draw_alpha_rgb24(w,h,src,srca,stride,ImageData+3*(y0*image_width+x0),3*image_width);
- break;
- case 32:
- vo_draw_alpha_rgb32(w,h,src,srca,stride,ImageData+4*(y0*image_width+x0),4*image_width);
- break;
- case 15:
- case 16:
- if(depth==15)
- vo_draw_alpha_rgb15(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width);
- else
- vo_draw_alpha_rgb16(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width);
- break;
- }
-}
-
static void draw_osd(void)
-{ vo_draw_text(image_width,image_height,draw_alpha); }
+{ vo_draw_text(image_width,image_height,draw_alpha_fnc); }
static void flip_page( void ){
Display_Image( myximage,ImageData );
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index e748ee6f32..0f00677a98 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -94,6 +94,25 @@ static uint32_t drwcX,drwcY,dwidth,dheight,mFullscreen;
static uint32_t mdwidth,mdheight;
#endif
+
+static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
+
+static void draw_alpha_yv12(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+ vo_draw_alpha_yv12(w,h,src,srca,stride,xvimage[current_buf]->data+image_width*y0+x0,image_width);
+}
+
+static void draw_alpha_yuy2(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+ vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[current_buf]->data+2*(image_width*y0+x0),2*image_width);
+}
+
+static void draw_alpha_uyvy(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+ vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[current_buf]->data+2*(image_width*y0+x0)+1,2*image_width);
+}
+
+static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+}
+
+
/*
* connect to server, create and map window,
* allocate colors and (shared) memory
@@ -215,8 +234,18 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
if (xv_port != 0)
{
printf( "using Xvideo port %d for hw scaling\n",xv_port );
+
+ switch (xv_format){
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV: draw_alpha_fnc=draw_alpha_yv12; break;
+ case IMGFMT_YUY2:
+ case IMGFMT_YVYU: draw_alpha_fnc=draw_alpha_yuy2; break;
+ case IMGFMT_UYVY: draw_alpha_fnc=draw_alpha_uyvy; break;
+ default: draw_alpha_fnc=draw_alpha_null;
+ }
- for(current_buf=0;current_buf<num_buffers;++current_buf)
+ for(current_buf=0;current_buf<num_buffers;++current_buf)
allocate_xvimage(current_buf);
current_buf=0;
@@ -307,29 +336,8 @@ static void check_events(void)
}
}
-
-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- int x,y;
-
- switch (xv_format) {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- vo_draw_alpha_yv12(w,h,src,srca,stride,xvimage[current_buf]->data+image_width*y0+x0,image_width);
- break;
- case IMGFMT_YUY2:
- case IMGFMT_YVYU:
- vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[current_buf]->data+2*(image_width*y0+x0),2*image_width);
- break;
- case IMGFMT_UYVY:
- vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[current_buf]->data+2*(image_width*y0+x0)+1,2*image_width);
- break;
- }
-
-}
-
static void draw_osd(void)
-{ vo_draw_text(image_width,image_height,draw_alpha);}
+{ vo_draw_text(image_width,image_height,draw_alpha_fnc);}
static void flip_page(void)
{