diff gui/interface.c @ 37081:e8559b9913ff

New GUI feature: Rotate a video. It is accessible from the context menu. Based on a complain by Linus about video players that don't easily allow rotating a video. (Thanks to compn for pointing that out.) Realize the feature by adding and/or removing appropriate video filters. Additionally, add new GUI message evSetRotation and update documentation.
author ib
date Thu, 24 Apr 2014 14:41:04 +0000
parents 0b0528ba3344
children ae4f30c4ef02
line wrap: on
line diff
--- a/gui/interface.c	Thu Apr 24 13:51:20 2014 +0000
+++ b/gui/interface.c	Thu Apr 24 14:41:04 2014 +0000
@@ -194,6 +194,7 @@
  */
 void guiInit(void)
 {
+    char **argvf;
     int ret;
     plItem *playlist;
 
@@ -226,6 +227,9 @@
     gtkASS.top_margin    = ass_top_margin;
     gtkASS.bottom_margin = ass_bottom_margin;
 
+    argvf = get_vf("rotate");
+    guiInfo.Rotation = (argvf && argvf[1] ? atoi(argvf[1]) : -1);
+
     /* initialize graphical user interfaces */
 
     wsInit(mDisplay);
@@ -576,6 +580,36 @@
         if (gtkVfPP)
             add_vf("pp", NULL);
 
+        switch (guiInfo.Rotation) {
+            static const char *argvf[] = { "_oldargs_", NULL, NULL };
+
+        case -1:
+            remove_vf("rotate");
+            remove_vf("flip");
+            remove_vf("mirror");
+            break;
+
+        case 1:
+            argvf[1] = "1";
+            add_vf("rotate", argvf);
+            remove_vf("flip");
+            remove_vf("mirror");
+            break;
+
+        case 2:
+            argvf[1] = "2";
+            add_vf("rotate", argvf);
+            remove_vf("flip");
+            remove_vf("mirror");
+            break;
+
+        case 8:
+            remove_vf("rotate");
+            add_vf("flip", NULL);
+            add_vf("mirror", NULL);
+            break;
+        }
+
         /* audio opts */
 
 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }