diff libvo/aspect.c @ 36171:94979f661d38

Add support for rotating the video via OpenGL.
author reimar
date Mon, 13 May 2013 19:34:43 +0000
parents aca925e56969
children 153031444853
line wrap: on
line diff
--- a/libvo/aspect.c	Mon May 13 19:34:40 2013 +0000
+++ b/libvo/aspect.c	Mon May 13 19:34:43 2013 +0000
@@ -46,25 +46,44 @@
   int orgh; // real height
   int prew; // prescaled width
   int preh; // prescaled height
+  int orgw_norot;
+  int orgh_norot;
+  int prew_norot;
+  int preh_norot;
   int scrw; // horizontal resolution
   int scrh; // vertical resolution
   float asp;
 } aspdat;
 
+static void aspect_rotate(void) {
+  int i;
+  if (vo_rotate & 1) {
+    aspdat.orgw = aspdat.orgh_norot;
+    aspdat.orgh = aspdat.orgw_norot;
+    aspdat.prew = aspdat.preh_norot;
+    aspdat.preh = aspdat.prew_norot;
+  } else {
+    aspdat.orgw = aspdat.orgw_norot;
+    aspdat.orgh = aspdat.orgh_norot;
+    aspdat.prew = aspdat.prew_norot;
+    aspdat.preh = aspdat.preh_norot;
+  }
+}
+
 void aspect_save_orig(int orgw, int orgh){
 #ifdef ASPECT_DEBUG
   printf("aspect_save_orig %dx%d \n",orgw,orgh);
 #endif
-  aspdat.orgw = orgw;
-  aspdat.orgh = orgh;
+  aspdat.orgw_norot = orgw;
+  aspdat.orgh_norot = orgh;
 }
 
 void aspect_save_prescale(int prew, int preh){
 #ifdef ASPECT_DEBUG
   printf("aspect_save_prescale %dx%d \n",prew,preh);
 #endif
-  aspdat.prew = prew;
-  aspdat.preh = preh;
+  aspdat.prew_norot = prew;
+  aspdat.preh_norot = preh;
 }
 
 void aspect_save_screenres(int scrw, int scrh){
@@ -92,6 +111,7 @@
 void aspect_fit(int *srcw, int *srch, int fitw, int fith){
   int tmpw;
 
+  aspect_rotate();
 #ifdef ASPECT_DEBUG
   printf("aspect(0) fitin: %dx%d screenaspect: %.2f\n",aspdat.scrw,aspdat.scrh,
       monitor_aspect);
@@ -139,6 +159,7 @@
 void aspect(int *srcw, int *srch, int zoom){
   int fitw;
   int fith;
+  aspect_rotate();
   get_max_dims(&fitw, &fith, zoom);
   if( !zoom && geometry_wh_changed ) {
 #ifdef ASPECT_DEBUG
@@ -161,6 +182,7 @@
  int fwidth,fheight;
  int vo_panscan_area;
  int max_w, max_h;
+ aspect_rotate();
  get_max_dims(&max_w, &max_h, zoom);
 
  if (vo_panscanrange > 0) {