[Mplayer-cvslog] CVS: main/libvo vo_cvidix.c,1.5,1.6

Sascha Sommer CVS faust3 at mplayerhq.hu
Wed Oct 22 20:32:42 CEST 2003


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

Modified Files:
	vo_cvidix.c 
Log Message:
added aspect && geometry support

Index: vo_cvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_cvidix.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- vo_cvidix.c	22 Oct 2003 13:22:00 -0000	1.5
+++ vo_cvidix.c	22 Oct 2003 18:32:04 -0000	1.6
@@ -1,7 +1,7 @@
 /*
-    VIDIX accelerated overlay on black background
+    VIDIX accelerated overlay on (black) background
+    
     should work on any OS
-    TODO: implement blanking, aspect, geometry,fs etc.
     
     (C) Sascha Sommer
     
@@ -17,6 +17,8 @@
 #include "config.h"
 #include "video_out.h"
 #include "video_out_internal.h"
+#include "aspect.h"
+#include "geometry.h"
 
 #include "mp_msg.h"
 
@@ -37,31 +39,61 @@
 
 /* VIDIX related */
 static char *vidix_name;
-
+static uint32_t swidth,sheight,sformat;
 
 static vidix_grkey_t gr_key;
-    
-static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_height, uint32_t flags, char *title, uint32_t format){
-  if(vidix_init(width, height, 0, 0, d_width, d_height, format, 32, 640, 480))mp_msg(MSGT_VO, MSGL_FATAL, "Can't initialize VIDIX driver: %s\n", strerror(errno));
-  /*set colorkey*/       
+
+
+static uint32_t setup_vidix(){
+  int x=vo_dx,y=vo_dy;
+  aspect(&vo_dwidth,&vo_dheight,vo_fs ? A_ZOOM : A_NOZOOM);  
+  if(vo_fs){
+    if(vo_dwidth <= vo_screenwidth)x = (vo_screenwidth - vo_dwidth)/2;
+    else x=0;
+    if(vo_dheight <= vo_screenheight)y = (vo_screenheight - vo_dheight)/2;
+    else y=0;
+  }
+  if(vo_config_count)vidix_stop();
+  if(vidix_init(swidth, sheight, x, y, vo_dwidth, vo_dheight, sformat, 32, vo_screenwidth,vo_screenheight)){
+    mp_msg(MSGT_VO, MSGL_FATAL, "Can't setup VIDIX driver: %s\n", strerror(errno));
+    return 1;
+  }
   vidix_start();
   if(vidix_grkey_support()){
     vidix_grkey_get(&gr_key);
     gr_key.key_op = KEYS_PUT;
-    if (!(vo_colorkey & 0xff000000))
-    {
-	gr_key.ckey.op = CKEY_TRUE;
-	gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
-	gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
-	gr_key.ckey.blue = vo_colorkey & 0x000000FF;
+    if (!vo_fs && !(vo_colorkey & 0xff000000)){
+	  gr_key.ckey.op = CKEY_TRUE;
+	  gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
+	  gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
+	  gr_key.ckey.blue = vo_colorkey & 0x000000FF;
     }
-    else
-	gr_key.ckey.op = CKEY_FALSE;
+    else gr_key.ckey.op = CKEY_FALSE;
     vidix_grkey_set(&gr_key);
-  }         
+  }
   return 0;
 }
 
+static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_height, uint32_t flags, char *title, uint32_t format){
+  vo_fs = flags & 0x01;
+  if(!vo_screenwidth)vo_screenwidth=640;
+  if(!vo_screenheight)vo_screenheight=480;
+  swidth = width;
+  sheight = height;
+  sformat = format;
+  vo_dwidth=d_width;
+  vo_dheight=d_height;
+  aspect_save_orig(width,height);
+  aspect_save_prescale(d_width,d_height);
+  aspect_save_screenres(vo_screenwidth,vo_screenheight);
+  if(!vo_geometry){
+    vo_dx=0;
+    vo_dy=0;
+  }
+  else geometry(&vo_dx, &vo_dy, &vo_dwidth, &vo_dheight,vo_screenwidth,vo_screenheight);
+  return setup_vidix();
+}
+
 static void check_events(void){
 }
 
@@ -121,6 +153,11 @@
   switch (request) {
   case VOCTRL_QUERY_FORMAT:
     return query_format(*((uint32_t*)data));
-  }
+  case VOCTRL_FULLSCREEN:
+    if(vo_fs)vo_fs=0;
+    else vo_fs=1;
+    setup_vidix();
+    return VO_TRUE;      
+  }  
   return vidix_control(request, data);
 }



More information about the MPlayer-cvslog mailing list