[MPlayer-cvslog] r29574 - in trunk/libvo: osx_common.c osx_common.h vo_quartz.c

reimar subversion at mplayerhq.hu
Fri Aug 28 15:25:30 CEST 2009


Author: reimar
Date: Fri Aug 28 15:25:30 2009
New Revision: 29574

Log:
Move aspect change handling from vo_quartz to osx_common.
This could probably be even moved to video_out, though the names should
be improved.

Modified:
   trunk/libvo/osx_common.c
   trunk/libvo/osx_common.h
   trunk/libvo/vo_quartz.c

Modified: trunk/libvo/osx_common.c
==============================================================================
--- trunk/libvo/osx_common.c	Fri Aug 28 14:54:33 2009	(r29573)
+++ trunk/libvo/osx_common.c	Fri Aug 28 15:25:30 2009	(r29574)
@@ -43,3 +43,31 @@ int convert_key(unsigned key, unsigned c
         return mpkey;
     return charcode;
 }
+
+static int our_aspect_change;
+static float old_movie_aspect;
+
+/**
+ * Sends MPlayer a command to change aspect to the requested value.
+ * @param new_aspect desired new aspect, < 0 means restore original.
+ */
+void change_movie_aspect(float new_aspect)
+{
+    char cmd_str[64];
+    if (new_aspect < 0)
+        new_aspect = old_movie_aspect;
+    our_aspect_change = 1;
+    snprintf(cmd_str, 64, "switch_ratio %f", old_movie_aspect);
+    mp_input_queue_cmd(mp_input_parse_cmd(cmd_str));
+}
+
+/**
+ * Call in config to save the original movie aspect.
+ * This will ignore config calls caused by change_movie_aspect.
+ */
+void config_movie_aspect(float config_aspect)
+{
+    if (!our_aspect_change)
+        old_movie_aspect = config_aspect;
+    our_aspect_change = 0;
+}

Modified: trunk/libvo/osx_common.h
==============================================================================
--- trunk/libvo/osx_common.h	Fri Aug 28 14:54:33 2009	(r29573)
+++ trunk/libvo/osx_common.h	Fri Aug 28 15:25:30 2009	(r29574)
@@ -1 +1,3 @@
 int convert_key(unsigned key, unsigned charcode);
+void change_movie_aspect(float new_aspect);
+void config_movie_aspect(float config_aspect);

Modified: trunk/libvo/vo_quartz.c
==============================================================================
--- trunk/libvo/vo_quartz.c	Fri Aug 28 14:54:33 2009	(r29573)
+++ trunk/libvo/vo_quartz.c	Fri Aug 28 15:25:30 2009	(r29574)
@@ -87,8 +87,6 @@ static int EnterMoviesDone = 0;
 static int get_image_done = 0;
 
 static int vo_quartz_fs; // we are in fullscreen
-static int our_aspect_change;
-static float old_movie_aspect;
 
 static int winLevel = 1;
 int levelList[] =
@@ -420,19 +418,15 @@ static OSStatus WindowEventHandler(Event
             break;
 
         case kAspectOrgCmd:
-            our_aspect_change = 1;
-            sprintf(cmd_str, "switch_ratio %f", old_movie_aspect);
-            mp_input_queue_cmd(mp_input_parse_cmd(cmd_str));
+            change_movie_aspect(-1);
             break;
 
         case kAspectFullCmd:
-            our_aspect_change = 1;
-            mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.6667"));
+            change_movie_aspect(4.0 / 3.0);
             break;
 
         case kAspectWideCmd:
-            our_aspect_change = 1;
-            mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.7778"));
+            change_movie_aspect(16.0 / 9.0);
             break;
 
         case kPanScanCmd:
@@ -615,9 +609,7 @@ static int config(uint32_t width, uint32
     OSErr qterr;
     CGRect tmpBounds;
 
-    if (!our_aspect_change)
-        old_movie_aspect = (float)d_width / d_height;
-    our_aspect_change = 0;
+    config_movie_aspect((float)d_width / d_height);
 
     // misc mplayer setup/////////////////////////////////////////////////////
     SetRect(&imgRect, 0, 0, width, height);


More information about the MPlayer-cvslog mailing list