[Mplayer-cvslog] CVS: main/libvo vo_gl.c,1.52,1.53

Reimar Döffinger CVS syncmail at mplayerhq.hu
Sun Oct 10 16:05:31 CEST 2004


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv1501/libvo

Modified Files:
	vo_gl.c 
Log Message:
aspect scaling and panscan support for vo_gl.c


Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- vo_gl.c	10 Oct 2004 12:26:58 -0000	1.52
+++ vo_gl.c	10 Oct 2004 14:05:29 -0000	1.53
@@ -51,6 +51,7 @@
 static GLuint osdDispList[MAX_OSD_PARTS];
 static int osdtexCnt = 0;
 
+static int use_aspect;
 static uint32_t image_width;
 static uint32_t image_height;
 static uint32_t image_bytes;
@@ -72,6 +73,17 @@
 
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
+  if (vo_fs && use_aspect) {
+    int new_w, new_h;
+    GLdouble scale_x, scale_y;
+    aspect(&new_w, &new_h, A_ZOOM);
+    panscan_calc();
+    new_w += vo_panscan_x;
+    new_h += vo_panscan_y;
+    scale_x = (GLdouble) new_w / (GLdouble) x;
+    scale_y = (GLdouble) new_h / (GLdouble) y;
+    glScaled(scale_x, scale_y, 1);
+  }
   glOrtho(0, image_width, image_height, 0, -1,1);
 
   glMatrixMode(GL_MODELVIEW);
@@ -181,6 +193,7 @@
   sub_bg_alpha = 255; // We need alpha = 255 for invisible part of the OSD
 	int_pause = 0;
 
+	panscan_init();
 	aspect_save_orig(width,height);
 	aspect_save_prescale(d_width,d_height);
 	aspect_save_screenres(vo_screenwidth,vo_screenheight);
@@ -257,7 +270,7 @@
   texture_height=texture_width;
 
   ImageData=malloc(texture_width*texture_height*image_bytes);
-  memset(ImageData,128,texture_width*texture_height*image_bytes);
+  memset(ImageData,0,texture_width*texture_height*image_bytes);
 
   glDisable(GL_BLEND); 
   glDisable(GL_DEPTH_TEST);
@@ -291,7 +304,7 @@
 
   resize(d_width,d_height);
 
-  glClearColor( 1.0f,0.0f,1.0f,0.0f );
+  glClearColor( 0.0f,0.0f,0.0f,0.0f );
   glClear( GL_COLOR_BUFFER_BIT );
 
 //  printf("OpenGL setup OK!\n");
@@ -448,6 +461,8 @@
   glFinish();
   glXSwapBuffers( mDisplay,vo_window );
  
+  if (vo_fs && use_aspect)
+    glClear(GL_COLOR_BUFFER_BIT);
 }
 
 //static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num)
@@ -510,6 +525,7 @@
     unsigned int parse_pos = 0;
     many_fmts = 0;
     use_osd = 1;
+    use_aspect = 1;
     slice_height = 4;
     if(arg) 
     {
@@ -526,6 +542,12 @@
             } else if (strncmp (&arg[parse_pos], "noosd", 5) == 0) {
                 parse_pos += 5;
                 use_osd = 0;
+            } else if (strncmp (&arg[parse_pos], "aspect", 6) == 0) {
+                parse_pos += 6;
+                use_aspect = 1;
+            } else if (strncmp (&arg[parse_pos], "noaspect", 8) == 0) {
+                parse_pos += 8;
+                use_aspect = 0;
             } else if (strncmp (&arg[parse_pos], "slice-height=", 13) == 0) {
                 int val;
                 char *end;
@@ -557,6 +579,8 @@
               "    Slice size for texture transfer, 0 for whole image\n"
               "  noosd\n"
               "    Do not use OpenGL OSD code\n"
+              "  noaspect\n"
+              "    Do not do aspect scaling\n"
               "\n" );
       return -1;
     }
@@ -584,6 +608,13 @@
   case VOCTRL_FULLSCREEN:
     vo_x11_fullscreen();
     return VO_TRUE;
+  case VOCTRL_GET_PANSCAN:
+    if (!use_aspect) return VO_NOTIMPL;
+    return VO_TRUE;
+  case VOCTRL_SET_PANSCAN:
+    if (!use_aspect) return VO_NOTIMPL;
+    resize (vo_dwidth, vo_dheight);
+    return VO_TRUE;
   }
   return VO_NOTIMPL;
 }




More information about the MPlayer-cvslog mailing list