[Mplayer-cvslog] CVS: main/libvo vo_x11.c,1.24,1.25 vo_xv.c,1.25,1.26

Adam Tla/lka atlka at mplayer.dev.hu
Thu Aug 23 13:04:36 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv30236

Modified Files:
	vo_x11.c vo_xv.c 
Log Message:

added draw_alpha_XXXX functions, draw_alpha_func<=correct one in init


Index: vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- vo_x11.c	13 Aug 2001 11:08:18 -0000	1.24
+++ vo_x11.c	23 Aug 2001 11:04:23 -0000	1.25
@@ -49,6 +49,7 @@
 
 /* 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 @@
   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 @@
   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 @@
   }
 
  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 @@
 #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 );

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- vo_xv.c	13 Aug 2001 11:08:18 -0000	1.25
+++ vo_xv.c	23 Aug 2001 11:04:23 -0000	1.26
@@ -94,6 +94,25 @@
  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 @@
    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 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)
 {




More information about the MPlayer-cvslog mailing list