[MPlayer-cvslog] r37177 - in trunk: Changelog DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml gui/app/app.c gui/app/app.h gui/dialog/menu.c gui/dialog/pixmaps/rotate.xpm gui/dialog/pixmaps/rotate0.xpm gui/dialog/pixmaps/...

ib subversion at mplayerhq.hu
Thu Apr 24 16:41:04 CEST 2014


Author: ib
Date: Thu Apr 24 16:41:04 2014
New Revision: 37177

Log:
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.

Added:
   trunk/gui/dialog/pixmaps/rotate.xpm
   trunk/gui/dialog/pixmaps/rotate0.xpm
   trunk/gui/dialog/pixmaps/rotate180.xpm
   trunk/gui/dialog/pixmaps/rotate90ccw.xpm
   trunk/gui/dialog/pixmaps/rotate90cw.xpm
Modified:
   trunk/Changelog
   trunk/gui/app/app.c
   trunk/gui/app/app.h
   trunk/gui/dialog/menu.c
   trunk/gui/interface.c
   trunk/gui/interface.h
   trunk/gui/ui/actions.c
   trunk/gui/win32/skinload.c
   trunk/gui/win32/skinload.h

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/xml/de/skin.xml
   trunk/DOCS/xml/en/skin.xml
   trunk/help/help_mp-de.h
   trunk/help/help_mp-en.h

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/Changelog	Thu Apr 24 16:41:04 2014	(r37177)
@@ -46,6 +46,8 @@ MPlayer
     * Updated skins (avifile, Blue, Blue-small, Clearlooks, Corelian,
       disappearer, mentalic, mplayer_red, nativeRed, neutron, phony, plastic,
       slim, softgrip, standard, trium, tvisor, xanim)
+    * Video can be rotated
+    * New GUI message: evSetRotation
 
   1.1: "We gave up on 1.0"
 

Modified: trunk/gui/app/app.c
==============================================================================
--- trunk/gui/app/app.c	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/gui/app/app.c	Thu Apr 24 16:41:04 2014	(r37177)
@@ -75,6 +75,7 @@ static const evName evNames[] = {
     { evFullScreen,        "evFullScreen"        },
     { evNormalSize,        "evNormalSize"        },
     { evSetAspect,         "evSetAspect"         },
+    { evSetRotation,       "evSetRotation"       },
     { evIncVolume,         "evIncVolume"         },
     { evDecVolume,         "evDecVolume"         },
     { evSetVolume,         "evSetVolume"         },

Modified: trunk/gui/app/app.h
==============================================================================
--- trunk/gui/app/app.h	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/gui/app/app.h	Thu Apr 24 16:41:04 2014	(r37177)
@@ -55,6 +55,7 @@ enum {
     evFullScreen,
     evNormalSize,
     evSetAspect,
+    evSetRotation,
     evIncVolume,
     evDecVolume,
     evSetVolume,

Modified: trunk/gui/dialog/menu.c
==============================================================================
--- trunk/gui/dialog/menu.c	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/gui/dialog/menu.c	Thu Apr 24 16:41:04 2014	(r37177)
@@ -98,6 +98,11 @@
 #include "pixmaps/tv.xpm"
 #endif
 #include "pixmaps/empty1px.xpm"
+#include "pixmaps/rotate.xpm"
+#include "pixmaps/rotate0.xpm"
+#include "pixmaps/rotate180.xpm"
+#include "pixmaps/rotate90ccw.xpm"
+#include "pixmaps/rotate90cw.xpm"
 
 int gtkPopupMenu;
 int gtkPopupMenuParam;
@@ -442,6 +447,7 @@ GtkWidget * DVDChapterMenu;
 GtkWidget * DVDAudioLanguageMenu;
 GtkWidget * DVDSubtitleLanguageMenu;
 GtkWidget * AspectMenu;
+GtkWidget * RotationMenu;
 GtkWidget * VCDSubMenu;
 GtkWidget * VCDTitleMenu;
 GtkWidget * CDSubMenu;
@@ -614,8 +620,26 @@ GtkWidget * CreatePopUpMenu( void )
 
   if ( guiInfo.VideoWindow )
    {
-    int a11 = False, a169 = False, a43 = False, a235 = False;
     AddSeparator( Menu );
+    RotationMenu=AddSubMenu( window1, (const char*)rotate_xpm, Menu,MSGTR_GUI_Rotation );
+    N=AddMenuCheckItem( window1, (const char*)rotate0_xpm, RotationMenu,MSGTR_GUI__none_, guiInfo.Rotation == -1, evSetRotation );
+    D=AddMenuCheckItem( window1, (const char*)rotate90cw_xpm, RotationMenu,MSGTR_GUI_Rotation90CW, guiInfo.Rotation == 1, evSetRotation + ( 90 << 16 ) );
+    F=AddMenuCheckItem( window1, (const char*)rotate90ccw_xpm, RotationMenu,MSGTR_GUI_Rotation90CCW, guiInfo.Rotation == 2, evSetRotation + ( -90 << 16 ) );
+    H=AddMenuCheckItem( window1, (const char*)rotate180_xpm, RotationMenu,MSGTR_GUI_Rotation180, guiInfo.Rotation == 8, evSetRotation + ( 180 << 16 ) );
+
+    if ( !guiInfo.Playing )
+     {
+      gtk_widget_set_sensitive( N,FALSE );
+      gtk_widget_set_sensitive( D,FALSE );
+      gtk_widget_set_sensitive( F,FALSE );
+      gtk_widget_set_sensitive( H,FALSE );
+     }
+   }
+
+  if ( guiInfo.VideoWindow )
+   {
+    int a11 = False, a169 = False, a43 = False, a235 = False;
+
     if (movie_aspect == -1.0f) a11 = True;
     else
      {

Added: trunk/gui/dialog/pixmaps/rotate.xpm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/gui/dialog/pixmaps/rotate.xpm	Thu Apr 24 16:41:04 2014	(r37177)
@@ -0,0 +1,70 @@
+/* XPM */
+static const char * const rotate_xpm[] = {
+"16 16 50 1 0 0",
+"  c #000000",
+"! c #6E6E70",
+"# c #8C99A6",
+"$ c #929FAB",
+"% c #97A2AE",
+"& c #9AA4AF",
+"' c #9FA8B1",
+"( c #A3AAB2",
+") c #A8AEB5",
+"* c #A0A4AA",
+"+ c #A4B4C3",
+", c #A9B7C7",
+"- c #ADB9C8",
+". c #AFBBC8",
+"/ c #B2BDC9",
+"0 c #B6BEC9",
+"1 c #B8C1CA",
+"2 c #A0B0C2",
+"3 c #A6B5C7",
+"4 c #A9B7C8",
+"5 c #B0BBC8",
+"6 c #B1B9C3",
+"7 c #9EAEC1",
+"8 c #A3B4C7",
+"9 c #A7B5C7",
+": c #B4BDC9",
+"; c #AEB7C1",
+"< c #9CAEC3",
+"= c #A0B1C5",
+"> c #AAB7C8",
+"? c #A9B4BF",
+"@ c #9CAFC4",
+"A c #9EB0C5",
+"B c #A1B1C5",
+"C c #A7B6C7",
+"D c #AEBBC8",
+"E c #A6B1BD",
+"F c #9AAEC4",
+"G c #A4B4C7",
+"H c #AAB8C8",
+"I c #A1AEBB",
+"J c #91A2B6",
+"K c #8C9EB2",
+"L c #8FA0B4",
+"M c #8FA0B2",
+"N c #91A1B1",
+"O c #95A3B2",
+"P c #9AA7B5",
+"Q c #95A1AD",
+"R c None",
+"RRRRRRRRRR   RRR",
+"RRRRRRRRR R  !RR",
+"RRRRRRRR RRRR RR",
+"RRR!!!!!!!!!! RR",
+"RRR!#$%&'()*! RR",
+"RRR!+,-./01     ",
+"RRR!234-5/06   R",
+"RRR!7894-5:;! RR",
+"RR !<=89>-5?!RRR",
+"R   @AB8C>DE!RRR",
+"     FA=GCHI!RRR",
+"RR !JKLMNOPQ!RRR",
+"RR !!!!!!!!!!RRR",
+"RR RRRR RRRRRRRR",
+"RR!  R RRRRRRRRR",
+"RRR   RRRRRRRRRR"
+};

Added: trunk/gui/dialog/pixmaps/rotate0.xpm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/gui/dialog/pixmaps/rotate0.xpm	Thu Apr 24 16:41:04 2014	(r37177)
@@ -0,0 +1,23 @@
+/* XPM */
+static const char * const rotate0_xpm[] = {
+"16 16 3 1 0 0",
+"  c #6E6E70",
+"! c #4E4E50",
+"# c None",
+"################",
+"################",
+"#######  #######",
+"###### !! ######",
+"##### !!!! #####",
+"#### !!!!!! ####",
+"### !!!!!!!! ###",
+"####!# !! #!####",
+"###### !! ######",
+"###### !! ######",
+"###### !! ######",
+"###### !! ######",
+"###### !! ######",
+"###### !! ######",
+"#######  #######",
+"################"
+};

Added: trunk/gui/dialog/pixmaps/rotate180.xpm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/gui/dialog/pixmaps/rotate180.xpm	Thu Apr 24 16:41:04 2014	(r37177)
@@ -0,0 +1,22 @@
+/* XPM */
+static const char * const rotate180_xpm[] = {
+"16 16 2 1 0 0",
+"  c #4E4E50",
+"! c None",
+"!!!!!!! !!!!!!!!",
+"!!!!!!!  !!!!!!!",
+"!!!!!!!   !!!!!!",
+"!!!!!      !  !!",
+"!!!        !   !",
+"!!   !!   !!!   ",
+"!  !!!!  !!!!!  ",
+"   !!!! !!!!!!  ",
+"  !!!!!! !!!!   ",
+"  !!!!!  !!!!  !",
+"   !!!   !!   !!",
+"!   !        !!!",
+"!!  !      !!!!!",
+"!!!!!!   !!!!!!!",
+"!!!!!!!  !!!!!!!",
+"!!!!!!!! !!!!!!!"
+};

Added: trunk/gui/dialog/pixmaps/rotate90ccw.xpm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/gui/dialog/pixmaps/rotate90ccw.xpm	Thu Apr 24 16:41:04 2014	(r37177)
@@ -0,0 +1,25 @@
+/* XPM */
+static const char * const rotate90ccw_xpm[] = {
+"16 16 5 1 0 0",
+"  c #4E4E50",
+"! c #4E4E51",
+"# c #4F4F50",
+"$ c #4F4F51",
+"% c None",
+"%%%%%%%%%%%%%%%%",
+"%%%%%%%%%%%%%%%%",
+"%%%%%%%%    %%%%",
+"%%%%%%        %%",
+"%%%%%     %%%%!%",
+"%%%%    %%%%%%%%",
+"%%%%   #%%%%%%%%",
+"%%%    %%%%%%%%%",
+"%%%    %%%%%%%%%",
+"%$%    %$%%%%%%%",
+"%$      $%%%%%%%",
+"%%      %%%%%%%%",
+"%%%    %%%%%%%%%",
+"%%%%$$%%%%%%%%%%",
+"%%%%%%%%%%%%%%%%",
+"%%%%%%%%%%%%%%%%"
+};

Added: trunk/gui/dialog/pixmaps/rotate90cw.xpm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/gui/dialog/pixmaps/rotate90cw.xpm	Thu Apr 24 16:41:04 2014	(r37177)
@@ -0,0 +1,25 @@
+/* XPM */
+static const char * const rotate90cw_xpm[] = {
+"16 16 5 1 0 0",
+"  c #4E4E50",
+"! c #4E4E51",
+"# c #4F4F50",
+"$ c #4F4F51",
+"% c None",
+"%%%%%%%%%%%%%%%%",
+"%%%%%%%%%%%%%%%%",
+"%%%%    %%%%%%%%",
+"%%        %%%%%%",
+"%!%%%%     %%%%%",
+"%%%%%%%%    %%%%",
+"%%%%%%%%#   %%%%",
+"%%%%%%%%%    %%%",
+"%%%%%%%%%    %%%",
+"%%%%%%%$%    %$%",
+"%%%%%%%$      $%",
+"%%%%%%%%      %%",
+"%%%%%%%%%    %%%",
+"%%%%%%%%%%$$%%%%",
+"%%%%%%%%%%%%%%%%",
+"%%%%%%%%%%%%%%%%"
+};

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/gui/interface.c	Thu Apr 24 16:41:04 2014	(r37177)
@@ -194,6 +194,7 @@ static void remove_vf(char *vf)
  */
 void guiInit(void)
 {
+    char **argvf;
     int ret;
     plItem *playlist;
 
@@ -226,6 +227,9 @@ void guiInit(void)
     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 @@ int gui(int what, void *data)
         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; }

Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/gui/interface.h	Thu Apr 24 16:41:04 2014	(r37177)
@@ -103,6 +103,8 @@ typedef struct {
     int VideoWidth;
     int VideoHeight;
 
+    int Rotation;
+
     char *CodecName;
 
     int StreamType;

Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/gui/ui/actions.c	Thu Apr 24 16:41:04 2014	(r37177)
@@ -466,6 +466,31 @@ play:
 
         break;
 
+    case evSetRotation:
+
+        switch (iparam) {
+        case 90:
+            guiInfo.Rotation = 1;
+            break;
+
+        case -90:
+            guiInfo.Rotation = 2;
+            break;
+
+        case 180:
+            guiInfo.Rotation = 8;
+            break;
+
+        case 0:
+        default:
+            guiInfo.Rotation = -1;
+            break;
+        }
+
+        guiInfo.MediumChanged = GUI_MEDIUM_SAME;
+
+        break;
+
 /* timer events */
     case ivRedraw:
     {

Modified: trunk/gui/win32/skinload.c
==============================================================================
--- trunk/gui/win32/skinload.c	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/gui/win32/skinload.c	Thu Apr 24 16:41:04 2014	(r37177)
@@ -81,6 +81,7 @@ static const evName evNames[] =
     {   evFullScreen,           "evFullScreen"          },
     {   evNormalSize,           "evNormalSize"          },
     {   evSetAspect,            "evSetAspect"           },
+    {   evSetRotation,          "evSetRotation"         },
     {   evIncVolume,            "evIncVolume"           },
     {   evDecVolume,            "evDecVolume"           },
     {   evSetVolume,            "evSetVolume"           },

Modified: trunk/gui/win32/skinload.h
==============================================================================
--- trunk/gui/win32/skinload.h	Thu Apr 24 15:51:20 2014	(r37176)
+++ trunk/gui/win32/skinload.h	Thu Apr 24 16:41:04 2014	(r37177)
@@ -168,6 +168,7 @@ enum
   evFullScreen,
   evNormalSize,
   evSetAspect,
+  evSetRotation,
   evIncVolume,
   evDecVolume,
   evSetVolume,


More information about the MPlayer-cvslog mailing list