Mercurial > mplayer.hg
changeset 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 | 9e3b2b71a146 |
files | 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/rotate180.xpm gui/dialog/pixmaps/rotate90ccw.xpm gui/dialog/pixmaps/rotate90cw.xpm gui/interface.c gui/interface.h gui/ui/actions.c gui/win32/skinload.c gui/win32/skinload.h help/help_mp-de.h help/help_mp-en.h |
diffstat | 18 files changed, 279 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Changelog Thu Apr 24 13:51:20 2014 +0000 +++ b/Changelog Thu Apr 24 14:41:04 2014 +0000 @@ -46,6 +46,8 @@ * 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"
--- a/DOCS/xml/de/skin.xml Thu Apr 24 13:51:20 2014 +0000 +++ b/DOCS/xml/de/skin.xml Thu Apr 24 14:41:04 2014 +0000 @@ -1292,6 +1292,14 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term><emphasis role="bold">evSetRotation</emphasis></term> + <listitem> + <para> + Bringe das Video in seine Originalorientierung. + </para> + </listitem> + </varlistentry> </variablelist> <variablelist>
--- a/DOCS/xml/en/skin.xml Thu Apr 24 13:51:20 2014 +0000 +++ b/DOCS/xml/en/skin.xml Thu Apr 24 14:41:04 2014 +0000 @@ -1087,6 +1087,12 @@ Set the video window to its original aspect ratio. </para></listitem> </varlistentry> +<varlistentry> + <term><emphasis role="bold">evSetRotation</emphasis></term> + <listitem><para> + Set the video to its original orientation. + </para></listitem> +</varlistentry> </variablelist> <variablelist>
--- a/gui/app/app.c Thu Apr 24 13:51:20 2014 +0000 +++ b/gui/app/app.c Thu Apr 24 14:41:04 2014 +0000 @@ -75,6 +75,7 @@ { evFullScreen, "evFullScreen" }, { evNormalSize, "evNormalSize" }, { evSetAspect, "evSetAspect" }, + { evSetRotation, "evSetRotation" }, { evIncVolume, "evIncVolume" }, { evDecVolume, "evDecVolume" }, { evSetVolume, "evSetVolume" },
--- a/gui/app/app.h Thu Apr 24 13:51:20 2014 +0000 +++ b/gui/app/app.h Thu Apr 24 14:41:04 2014 +0000 @@ -55,6 +55,7 @@ evFullScreen, evNormalSize, evSetAspect, + evSetRotation, evIncVolume, evDecVolume, evSetVolume,
--- a/gui/dialog/menu.c Thu Apr 24 13:51:20 2014 +0000 +++ b/gui/dialog/menu.c Thu Apr 24 14:41:04 2014 +0000 @@ -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 * DVDAudioLanguageMenu; GtkWidget * DVDSubtitleLanguageMenu; GtkWidget * AspectMenu; +GtkWidget * RotationMenu; GtkWidget * VCDSubMenu; GtkWidget * VCDTitleMenu; GtkWidget * CDSubMenu; @@ -614,8 +620,26 @@ if ( guiInfo.VideoWindow ) { + 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; - AddSeparator( Menu ); + if (movie_aspect == -1.0f) a11 = True; else {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/dialog/pixmaps/rotate.xpm Thu Apr 24 14:41:04 2014 +0000 @@ -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" +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/dialog/pixmaps/rotate0.xpm Thu Apr 24 14:41:04 2014 +0000 @@ -0,0 +1,23 @@ +/* XPM */ +static const char * const rotate0_xpm[] = { +"16 16 3 1 0 0", +" c #6E6E70", +"! c #4E4E50", +"# c None", +"################", +"################", +"####### #######", +"###### !! ######", +"##### !!!! #####", +"#### !!!!!! ####", +"### !!!!!!!! ###", +"####!# !! #!####", +"###### !! ######", +"###### !! ######", +"###### !! ######", +"###### !! ######", +"###### !! ######", +"###### !! ######", +"####### #######", +"################" +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/dialog/pixmaps/rotate180.xpm Thu Apr 24 14:41:04 2014 +0000 @@ -0,0 +1,22 @@ +/* XPM */ +static const char * const rotate180_xpm[] = { +"16 16 2 1 0 0", +" c #4E4E50", +"! c None", +"!!!!!!! !!!!!!!!", +"!!!!!!! !!!!!!!", +"!!!!!!! !!!!!!", +"!!!!! ! !!", +"!!! ! !", +"!! !! !!! ", +"! !!!! !!!!! ", +" !!!! !!!!!! ", +" !!!!!! !!!! ", +" !!!!! !!!! !", +" !!! !! !!", +"! ! !!!", +"!! ! !!!!!", +"!!!!!! !!!!!!!", +"!!!!!!! !!!!!!!", +"!!!!!!!! !!!!!!!" +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/dialog/pixmaps/rotate90ccw.xpm Thu Apr 24 14:41:04 2014 +0000 @@ -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", +"%%%%%%%%%%%%%%%%", +"%%%%%%%%%%%%%%%%", +"%%%%%%%% %%%%", +"%%%%%% %%", +"%%%%% %%%%!%", +"%%%% %%%%%%%%", +"%%%% #%%%%%%%%", +"%%% %%%%%%%%%", +"%%% %%%%%%%%%", +"%$% %$%%%%%%%", +"%$ $%%%%%%%", +"%% %%%%%%%%", +"%%% %%%%%%%%%", +"%%%%$$%%%%%%%%%%", +"%%%%%%%%%%%%%%%%", +"%%%%%%%%%%%%%%%%" +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/dialog/pixmaps/rotate90cw.xpm Thu Apr 24 14:41:04 2014 +0000 @@ -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", +"%%%%%%%%%%%%%%%%", +"%%%%%%%%%%%%%%%%", +"%%%% %%%%%%%%", +"%% %%%%%%", +"%!%%%% %%%%%", +"%%%%%%%% %%%%", +"%%%%%%%%# %%%%", +"%%%%%%%%% %%%", +"%%%%%%%%% %%%", +"%%%%%%%$% %$%", +"%%%%%%%$ $%", +"%%%%%%%% %%", +"%%%%%%%%% %%%", +"%%%%%%%%%%$$%%%%", +"%%%%%%%%%%%%%%%%", +"%%%%%%%%%%%%%%%%" +};
--- 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; }
--- a/gui/interface.h Thu Apr 24 13:51:20 2014 +0000 +++ b/gui/interface.h Thu Apr 24 14:41:04 2014 +0000 @@ -103,6 +103,8 @@ int VideoWidth; int VideoHeight; + int Rotation; + char *CodecName; int StreamType;
--- a/gui/ui/actions.c Thu Apr 24 13:51:20 2014 +0000 +++ b/gui/ui/actions.c Thu Apr 24 14:41:04 2014 +0000 @@ -466,6 +466,31 @@ 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: {
--- a/gui/win32/skinload.c Thu Apr 24 13:51:20 2014 +0000 +++ b/gui/win32/skinload.c Thu Apr 24 14:41:04 2014 +0000 @@ -81,6 +81,7 @@ { evFullScreen, "evFullScreen" }, { evNormalSize, "evNormalSize" }, { evSetAspect, "evSetAspect" }, + { evSetRotation, "evSetRotation" }, { evIncVolume, "evIncVolume" }, { evDecVolume, "evDecVolume" }, { evSetVolume, "evSetVolume" },
--- a/gui/win32/skinload.h Thu Apr 24 13:51:20 2014 +0000 +++ b/gui/win32/skinload.h Thu Apr 24 14:41:04 2014 +0000 @@ -168,6 +168,7 @@ evFullScreen, evNormalSize, evSetAspect, + evSetRotation, evIncVolume, evDecVolume, evSetVolume,
--- a/help/help_mp-de.h Thu Apr 24 13:51:20 2014 +0000 +++ b/help/help_mp-de.h Thu Apr 24 14:41:04 2014 +0000 @@ -979,6 +979,10 @@ #define MSGTR_GUI_RearLeft "Hinten links" #define MSGTR_GUI_RearRight "Hinten rechts" #define MSGTR_GUI_Remove "Entfernen" +#define MSGTR_GUI_Rotation "Drehung" +#define MSGTR_GUI_Rotation180 "180°" +#define MSGTR_GUI_Rotation90CCW "90° gegen den Uhrzeigersinn" +#define MSGTR_GUI_Rotation90CW "90° im Uhrzeigersinn" #define MSGTR_GUI_Saturation "Sättigung" #define MSGTR_GUI_SaveWindowPositions "Fensterpositionen speichern" #define MSGTR_GUI_ScaleMode "Skalierung"
--- a/help/help_mp-en.h Thu Apr 24 13:51:20 2014 +0000 +++ b/help/help_mp-en.h Thu Apr 24 14:41:04 2014 +0000 @@ -770,6 +770,10 @@ #define MSGTR_GUI_RearLeft "Rear left" #define MSGTR_GUI_RearRight "Rear right" #define MSGTR_GUI_Remove "Remove" +#define MSGTR_GUI_Rotation "Rotation" +#define MSGTR_GUI_Rotation180 "180°" +#define MSGTR_GUI_Rotation90CCW "90° counterclockwise" +#define MSGTR_GUI_Rotation90CW "90° clockwise" #define MSGTR_GUI_Saturation "Saturation" #define MSGTR_GUI_SaveWindowPositions "Save window positions" #define MSGTR_GUI_ScaleMode "Scale mode"