<div dir="ltr">Hi, first of all thanks for the warnings and sorry for the code, it is my first attempt to join the vlc project.<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

That's a lot of keys. I think it would make more sense to have a single<br>
key iterating through the different modes<br></blockquote><div> </div><div>I think you are right. Maybe the right way would be to create one hotkey for all the transformations. I have changed it to one hotkey that iterates through the possible transform types (90, 180, 270, hflip, vflip, transpose, antitranspose). I didn't send the patch because i need some help with the following warning you sent me.<br>
<br>-----------------------------------------------------------------------------------------------------------------------------------<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

var_SetString( p_vout, "video-filter", "transform"); </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">config_PutPsz( p_intf, "video-filter", "transform"); </blockquote>
<div><br></div>I realized that if there more than one filter then the "video-filter" string puts all the filters separated with ":". For example if there are puzzle, adjust and transform applied then if i use  <b>char *video_filter = var_GetString(p_vout,"video-filter");</b> then <b>video_filter</b> gets the value "puzzle:adjust:transform". <br>
So i understand that just putting <b>var_SetString( p_vout, "video-filter", "transform"); </b>will change the whole configuration. So i will try to pass the correct string to the function <b>var_SetString </b>and<b> </b><b>config_PutPsz. </b></div>
<div><br></div><div>Are my thoughts right? Or are there any other problems that i didn't notice about the use of <b>var_SetString</b> and <b>config_PutPsz</b> functions?<br><br></div><div>Thanks again for the help!<br>
</div><div><div> </div><div> </div><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/13 Rémi Denis-Courmont <span dir="ltr"><<a href="mailto:remi@remlab.net" target="_blank">remi@remlab.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, 13 Dec 2013 18:15:03 +0200, Stefanos Orovas<br>
<<a href="mailto:stef.orovas@gmail.com">stef.orovas@gmail.com</a>><br>
wrote:<br>
<div><div class="h5">> From: Stefanos Orovas <<a href="mailto:stef.orovas@gmail.com">stef.orovas@gmail.com</a>><br>
><br>
> ---<br>
>  include/vlc_keys.h                             |    8 ++<br>
>  modules/control/hotkeys.c                      |  100<br>
>  +++++++++++++++++++++++-<br>
>  modules/gui/qt4/components/extended_panels.cpp |   13 +--<br>
>  src/config/core.c                              |    3 +-<br>
>  src/config/keys.c                              |    7 ++<br>
>  src/libvlc-module.c                            |   46 +++++++++++<br>
>  6 files changed, 165 insertions(+), 12 deletions(-)<br>
><br>
> diff --git a/include/vlc_keys.h b/include/vlc_keys.h<br>
> index aafa589..6c015c2 100644<br>
> --- a/include/vlc_keys.h<br>
> +++ b/include/vlc_keys.h<br>
> @@ -204,6 +204,14 @@ typedef enum vlc_action {<br>
>      ACTIONID_LOOP,<br>
>      ACTIONID_WALLPAPER,<br>
>      ACTIONID_LEAVE_FULLSCREEN,<br>
> +    /* Transform */<br>
> +    ACTIONID_ROTATE_90_DEGREES,<br>
> +    ACTIONID_ROTATE_180_DEGREES,<br>
> +    ACTIONID_ROTATE_270_DEGREES,<br>
> +    ACTIONID_FLIP_HORIZONTALLY,<br>
> +    ACTIONID_FLIP_VERTICALLY,<br>
> +    ACTIONID_TRANSPOSE,<br>
> +    ACTIONID_ANTITRANSPOSE,<br>
>      /* Zoom */<br>
>      ACTIONID_ZOOM_QUARTER,<br>
>      ACTIONID_ZOOM_HALF,<br>
> diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c<br>
> index ec21bec..b0d60c0 100644<br>
> --- a/modules/control/hotkeys.c<br>
> +++ b/modules/control/hotkeys.c<br>
> @@ -877,7 +877,105 @@ static int PutAction( intf_thread_t *p_intf, int<br>
> i_action )<br>
>                 var_SetFloat( p_vout, "scale", f_scalefactor );<br>
>              }<br>
>              break;<br>
> -<br>
> +        case ACTIONID_ROTATE_90_DEGREES:<br>
> +            if( p_vout )<br>
> +            {<br>
> +             char *video_filter = var_GetString(p_vout,"video-filter");<br>
> +             char *transform_type = config_GetPsz(p_vout, "transform-type");<br>
> +             if (strcmp(video_filter,"transform") == 0 &&<br>
<br>
</div></div>This won't work. There could be more than one video filter, including<br>
transform. And it will crash if there are no filters.<br>
<div class="im"><br>
> strcmp(transform_type,"90") == 0) { // already transformed<br>
> +                 var_SetString( p_vout, "video-filter", "");<br>
<br>
</div>Same problem here.<br>
<div class="im"><br>
> +             } else {<br>
> +                 config_PutPsz( p_intf, "transform-type", "90");<br>
> +                 config_PutPsz( p_intf, "video-filter", "transform");<br>
<br>
</div>This will clobber the configuration. Please don't do this.<br>
<div class="im"><br>
> +                 var_SetString( p_vout, "video-filter", "transform");<br>
> +                     //    vlc_object_release( p_vout );<br>
> +                     }<br>
<br>
</div>And then, the code is highly repetitive. Please refactor.<br>
<div><div class="h5"><br>
> +            }<br>
> +         break;<br>
> +     case ACTIONID_ROTATE_180_DEGREES:<br>
> +            if( p_vout )<br>
> +            {<br>
> +             char *video_filter = var_GetString(p_vout,"video-filter");<br>
> +             char *transform_type = config_GetPsz(p_vout, "transform-type");<br>
> +             if (strcmp(video_filter,"transform") == 0 &&<br>
> strcmp(transform_type,"180") == 0) { // already transformed<br>
> +                 var_SetString( p_vout, "video-filter", "");<br>
> +             } else {<br>
> +                 config_PutPsz( p_intf, "transform-type", "180");<br>
> +                 config_PutPsz( p_intf, "video-filter", "transform");<br>
> +                 var_SetString( p_vout, "video-filter", "transform");<br>
> +                     }<br>
> +            }<br>
> +         break;<br>
> +     case ACTIONID_ROTATE_270_DEGREES:<br>
> +            if( p_vout )<br>
> +            {<br>
> +             char *video_filter = var_GetString(p_vout,"video-filter");<br>
> +             char *transform_type = config_GetPsz(p_vout, "transform-type");<br>
> +             if (strcmp(video_filter,"transform") == 0 &&<br>
> strcmp(transform_type,"270") == 0) { // already transformed<br>
> +                 var_SetString( p_vout, "video-filter", "");<br>
> +             } else {<br>
> +                    config_PutPsz( p_intf, "transform-type", "270");<br>
> +                    config_PutPsz( p_intf, "video-filter",<br>
"transform");<br>
> +                    var_SetString( p_vout, "video-filter",<br>
"transform");<br>
> +             }<br>
> +            }<br>
> +         break;<br>
> +     case ACTIONID_FLIP_HORIZONTALLY:<br>
> +            if( p_vout )<br>
> +            {<br>
> +             char *video_filter = var_GetString(p_vout,"video-filter");<br>
> +             char *transform_type = config_GetPsz(p_vout, "transform-type");<br>
> +             if (strcmp(video_filter,"transform") == 0 &&<br>
> strcmp(transform_type,"hflip") == 0) { // already transformed<br>
> +                 var_SetString( p_vout, "video-filter", "");<br>
> +             } else {<br>
> +                    config_PutPsz( p_intf, "transform-type", "hflip");<br>
> +                    config_PutPsz( p_intf, "video-filter",<br>
"transform");<br>
> +                    var_SetString( p_vout, "video-filter",<br>
"transform");<br>
> +             }<br>
> +            }<br>
> +         break;<br>
> +     case ACTIONID_FLIP_VERTICALLY:<br>
> +            if( p_vout )<br>
> +            {<br>
> +             char *video_filter = var_GetString(p_vout,"video-filter");<br>
> +             char *transform_type = config_GetPsz(p_vout, "transform-type");<br>
> +             if (strcmp(video_filter,"transform") == 0 &&<br>
> strcmp(transform_type,"vflip") == 0) { // already transformed<br>
> +                 var_SetString( p_vout, "video-filter", "");<br>
> +             } else {<br>
> +                    config_PutPsz( p_intf, "transform-type", "vflip");<br>
> +                    config_PutPsz( p_intf, "video-filter",<br>
"transform");<br>
> +                    var_SetString( p_vout, "video-filter",<br>
"transform");<br>
> +             }<br>
> +            }<br>
> +         break;<br>
> +     case ACTIONID_TRANSPOSE:<br>
> +            if( p_vout )<br>
> +            {<br>
> +             char *video_filter = var_GetString(p_vout,"video-filter");<br>
> +             char *transform_type = config_GetPsz(p_vout, "transform-type");<br>
> +             if (strcmp(video_filter,"transform") == 0 &&<br>
> strcmp(transform_type,"transpose") == 0) { // already transformed<br>
> +                 var_SetString( p_vout, "video-filter", "");<br>
> +             } else {<br>
> +                    config_PutPsz( p_intf, "transform-type",<br>
"transpose");<br>
> +                    config_PutPsz( p_intf, "video-filter",<br>
"transform");<br>
> +                    var_SetString( p_vout, "video-filter",<br>
"transform");<br>
> +             }<br>
> +            }<br>
> +         break;<br>
> +     case ACTIONID_ANTITRANSPOSE:<br>
> +            if( p_vout )<br>
> +            {<br>
> +             char *video_filter = var_GetString(p_vout,"video-filter");<br>
> +             char *transform_type = config_GetPsz(p_vout, "transform-type");<br>
> +             if (strcmp(video_filter,"transform") == 0 &&<br>
> strcmp(transform_type,"antitranspose") == 0) { // already transformed<br>
> +                 var_SetString( p_vout, "video-filter", "");<br>
> +             } else {<br>
> +                    config_PutPsz( p_intf, "transform-type",<br>
> "antitranspose");<br>
> +                    config_PutPsz( p_intf, "video-filter",<br>
"transform");<br>
> +                    var_SetString( p_vout, "video-filter",<br>
"transform");<br>
> +             }<br>
> +            }<br>
> +         break;<br>
>          case ACTIONID_ZOOM_QUARTER:<br>
>          case ACTIONID_ZOOM_HALF:<br>
>          case ACTIONID_ZOOM_ORIGINAL:<br>
> diff --git a/modules/gui/qt4/components/extended_panels.cpp<br>
> b/modules/gui/qt4/components/extended_panels.cpp<br>
> index 3604034..6e8545a 100644<br>
> --- a/modules/gui/qt4/components/extended_panels.cpp<br>
> +++ b/modules/gui/qt4/components/extended_panels.cpp<br>
> @@ -358,7 +358,6 @@ static void ChangeVFiltersString( struct<br>
intf_thread_t<br>
> *p_intf, const char *psz_<br>
>  {<br>
>      char *psz_string;<br>
>      const char *psz_filter_type;<br>
> -<br>
>      module_t *p_obj = module_find( psz_name );<br>
>      if( !p_obj )<br>
>      {<br>
> @@ -387,11 +386,9 @@ static void ChangeVFiltersString( struct<br>
> intf_thread_t *p_intf, const char *psz_<br>
>          msg_Err( p_intf, "Unknown video filter type." );<br>
>          return;<br>
>      }<br>
> -<br>
>      psz_string = ChangeFiltersString( p_intf, psz_filter_type,<br>
psz_name,<br>
>      b_add );<br>
>      if( !psz_string )<br>
>          return;<br>
> -<br>
>      /* Vout is not kept, so put that in the config */<br>
>      config_PutPsz( p_intf, psz_filter_type, psz_string );<br>
><br>
> @@ -499,9 +496,7 @@ void ExtVideo::initComboBoxItems( QObject *widget )<br>
>  void ExtVideo::setWidgetValue( QObject *widget )<br>
>  {<br>
>      QString module = ModuleFromWidgetName( widget->parent() );<br>
> -    //std::cout << "Module name: " << module.toStdString() <<<br>
std::endl;<br>
>      QString option = OptionFromWidgetName( widget );<br>
> -    //std::cout << "Option name: " << option.toStdString() <<<br>
std::endl;<br>
><br>
>      vlc_object_t *p_obj = ( vlc_object_t * )<br>
>          vlc_object_find_name( p_intf->p_libvlc, qtu( module ) );<br>
> @@ -591,9 +586,9 @@ void ExtVideo::setWidgetValue( QObject *widget )<br>
>  void ExtVideo::updateFilterOptions()<br>
>  {<br>
>      QString module = ModuleFromWidgetName( sender()->parent() );<br>
> -    //msg_Dbg( p_intf, "Module name: %s", qtu( module ) );<br>
> +    msg_Dbg( p_intf, "Module name: %s", qtu( module ) );<br>
>      QString option = OptionFromWidgetName( sender() );<br>
> -    //msg_Dbg( p_intf, "Option name: %s", qtu( option ) );<br>
> +    msg_Dbg( p_intf, "Option name: %s", qtu( option ) );<br>
><br>
>      vlc_object_t *p_obj = ( vlc_object_t * )<br>
>          vlc_object_find_name( p_intf->p_libvlc, qtu( module ) );<br>
> @@ -681,8 +676,8 @@ void ExtVideo::updateFilterOptions()<br>
>          msg_Warn( p_intf, "Module %s's %s variable isn't a command.<br>
>          Brute-restarting the filter.",<br>
>                   qtu( module ),<br>
>                   qtu( option ) );<br>
> -        ChangeVFiltersString( p_intf, qtu( module ), false );<br>
> -        ChangeVFiltersString( p_intf, qtu( module ), true );<br>
> +          ChangeVFiltersString( p_intf, qtu( module ), false );<br>
> +          ChangeVFiltersString( p_intf, qtu( module ), true );<br>
>      }<br>
><br>
>      if( p_obj ) vlc_object_release( p_obj );<br>
> diff --git a/src/config/core.c b/src/config/core.c<br>
> index 9882c52..6e85fa5 100644<br>
> --- a/src/config/core.c<br>
> +++ b/src/config/core.c<br>
> @@ -218,10 +218,9 @@ void config_PutPsz( vlc_object_t *p_this,<br>
>                        const char *psz_name, const char *psz_value )<br>
>  {<br>
>      module_config_t *p_config;<br>
> -<br>
> +<br>
>      p_config = config_FindConfig( p_this, psz_name );<br>
><br>
> -<br>
>      /* sanity checks */<br>
>      if( !p_config )<br>
>      {<br>
> diff --git a/src/config/keys.c b/src/config/keys.c<br>
> index 07c0d75..aa20d5a 100644<br>
> --- a/src/config/keys.c<br>
> +++ b/src/config/keys.c<br>
> @@ -270,6 +270,7 @@ struct action<br>
>  static const struct action actions[] =<br>
>  {<br>
>      /* *MUST* be sorted (ASCII order) */<br>
> +    { "antitranspose", ACTIONID_ANTITRANSPOSE, },<br>
>      { "aspect-ratio", ACTIONID_ASPECT_RATIO, },<br>
>      { "audio-track", ACTIONID_AUDIO_TRACK, },<br>
>      { "audiodelay-down", ACTIONID_AUDIODELAY_DOWN, },<br>
> @@ -288,6 +289,8 @@ static const struct action actions[] =<br>
>      { "deinterlace-mode", ACTIONID_DEINTERLACE_MODE, },<br>
>      { "disc-menu", ACTIONID_DISC_MENU, },<br>
>      { "faster", ACTIONID_FASTER, },<br>
> +    { "flip-horizontally", ACTIONID_FLIP_HORIZONTALLY, },<br>
> +    { "flip-vertically", ACTIONID_FLIP_VERTICALLY, },<br>
>      { "frame-next", ACTIONID_FRAME_NEXT, },<br>
>      { "incr-scalefactor", ACTIONID_SCALE_UP, },<br>
>      { "intf-boss", ACTIONID_INTF_BOSS, },<br>
> @@ -332,6 +335,9 @@ static const struct action actions[] =<br>
>      { "rate-normal", ACTIONID_RATE_NORMAL, },<br>
>      { "rate-slower-fine", ACTIONID_RATE_SLOWER_FINE, },<br>
>      { "record", ACTIONID_RECORD, },<br>
> +    { "rotate-180-degrees", ACTIONID_ROTATE_180_DEGREES, },<br>
> +    { "rotate-270-degrees", ACTIONID_ROTATE_270_DEGREES, },<br>
> +    { "rotate-90-degrees", ACTIONID_ROTATE_90_DEGREES, },<br>
>      { "set-bookmark1", ACTIONID_SET_BOOKMARK1, },<br>
>      { "set-bookmark10", ACTIONID_SET_BOOKMARK10, },<br>
>      { "set-bookmark2", ACTIONID_SET_BOOKMARK2, },<br>
> @@ -358,6 +364,7 @@ static const struct action actions[] =<br>
>      { "title-prev", ACTIONID_TITLE_PREV, },<br>
>      { "toggle-autoscale", ACTIONID_TOGGLE_AUTOSCALE, },<br>
>      { "toggle-fullscreen", ACTIONID_TOGGLE_FULLSCREEN, },<br>
> +    { "transpose", ACTIONID_TRANSPOSE, },<br>
>      { "uncrop-bottom", ACTIONID_UNCROP_BOTTOM, },<br>
>      { "uncrop-left", ACTIONID_UNCROP_LEFT, },<br>
>      { "uncrop-right", ACTIONID_UNCROP_RIGHT, },<br>
> diff --git a/src/libvlc-module.c b/src/libvlc-module.c<br>
> index 7c7126a..045236d 100644<br>
> --- a/src/libvlc-module.c<br>
> +++ b/src/libvlc-module.c<br>
> @@ -1321,6 +1321,27 @@ static const char *const mouse_wheel_texts[] =<br>
>  #define AUDIODELAY_DOWN_KEY_TEXT N_("Audio delay down")<br>
>  #define AUDIODELAY_DOWN_KEY_LONGTEXT N_("Select the key to decrease the<br>
>  audio delay.")<br>
><br>
> +#define ROTATE_90_DEGREES_TEXT N_("Rotate video 90 degrees")<br>
> +#define ROTATE_90_DEGREES_LONGTEXT N_("Select the key to rotate the<br>
video<br>
> by 90 degrees.")<br>
> +<br>
> +#define ROTATE_180_DEGREES_TEXT N_("Rotate video 180 degrees")<br>
> +#define ROTATE_180_DEGREES_LONGTEXT N_("Select the key to rotate the<br>
> video by 180 degrees.")<br>
> +<br>
> +#define ROTATE_270_DEGREES_TEXT N_("Rotate video 270 degrees")<br>
> +#define ROTATE_270_DEGREES_LONGTEXT N_("Select the key to rotate the<br>
> video by 270 degrees.")<br>
> +<br>
> +#define FLIP_HORIZONTALLY_TEXT N_("Flip video horizontally")<br>
> +#define FLIP_HORIZONTALLY_LONGTEXT N_("Select the key to flip the video<br>
> horizontally.")<br>
> +<br>
> +#define FLIP_VERTICALLY_TEXT N_("Flip video vertically")<br>
> +#define FLIP_VERTICALLY_LONGTEXT N_("Select the key to flip the video<br>
> vertically.")<br>
> +<br>
> +#define TRANSPOSE_TEXT N_("Transpose video")<br>
> +#define TRANSPOSE_LONGTEXT N_("Select the key to transpose the video.")<br>
> +<br>
> +#define ANTITRANSPOSE_TEXT N_("Anti-transpose video")<br>
> +#define ANTITRANSPOSE_LONGTEXT N_("Select the key to anti-transpose the<br>
> video.")<br>
> +<br>
>  #define ZOOM_QUARTER_KEY_TEXT N_("1:4 Quarter")<br>
>  #define ZOOM_HALF_KEY_TEXT N_("1:2 Half")<br>
>  #define ZOOM_ORIGINAL_KEY_TEXT N_("1:1 Original")<br>
> @@ -2354,6 +2375,16 @@ vlc_module_begin ()<br>
>  #   define KEY_CROP_RIGHT         "Alt+f"<br>
>  #   define KEY_UNCROP_RIGHT       "Alt+Shift+f"<br>
><br>
> +/* Transforming */<br>
> +#   define KEY_ROTATE_90_DEGREES  "Alt+Ctrl+9"<br>
> +#   define KEY_ROTATE_180_DEGREES "Alt+Ctrl+8"<br>
> +#   define KEY_ROTATE_270_DEGREES "Alt+Ctrl+7"<br>
> +#   define KEY_FLIP_HORIZONTALLY  "Alt+Ctrl+6"<br>
> +#   define KEY_FLIP_VERTICALLY    "Alt+Ctrl+5"<br>
> +#   define KEY_TRANSPOSE          "Alt+Ctrl+4"<br>
> +#   define KEY_ANTITRANSPOSE      "Alt+Ctrl+3"<br>
> +<br>
> +<br>
>  /* Zooming */<br>
>  #   define KEY_ZOOM_QUARTER       "Alt+1"<br>
>  #   define KEY_ZOOM_HALF          "Alt+2"<br>
> @@ -2544,6 +2575,21 @@ vlc_module_begin ()<br>
>               RANDOM_KEY_TEXT, RANDOM_KEY_LONGTEXT, false )<br>
>      add_key( "key-loop", KEY_LOOP,<br>
>               LOOP_KEY_TEXT, LOOP_KEY_LONGTEXT, false )<br>
> +<br>
> +    add_key( "key-rotate-90-degrees", KEY_ROTATE_90_DEGREES,<br>
> +             ROTATE_90_DEGREES_TEXT, ROTATE_90_DEGREES_LONGTEXT, false)<br>
> +    add_key( "key-rotate-180-degrees", KEY_ROTATE_180_DEGREES,<br>
> +             ROTATE_180_DEGREES_TEXT, ROTATE_180_DEGREES_LONGTEXT,<br>
false )<br>
> +    add_key( "key-rotate-270-degrees", KEY_ROTATE_270_DEGREES,<br>
> +             ROTATE_270_DEGREES_TEXT, ROTATE_270_DEGREES_LONGTEXT,<br>
false )<br>
> +    add_key( "key-flip-horizontally", KEY_FLIP_HORIZONTALLY,<br>
> +             FLIP_HORIZONTALLY_TEXT, FLIP_HORIZONTALLY_LONGTEXT, false<br>
)<br>
> +    add_key( "key-flip-vertically", KEY_FLIP_VERTICALLY,<br>
> +             FLIP_VERTICALLY_TEXT, FLIP_VERTICALLY_LONGTEXT, false )<br>
> +    add_key( "key-transpose", KEY_TRANSPOSE,<br>
> +             TRANSPOSE_TEXT, TRANSPOSE_LONGTEXT, false )<br>
> +    add_key( "key-antitranspose", KEY_ANTITRANSPOSE,<br>
> +             ANTITRANSPOSE_TEXT, ANTITRANSPOSE_LONGTEXT, false )<br>
<br>
</div></div>That's a lot of keys. I think it would make more sense to have a single<br>
key iterating through the different modes.<br>
<div class="im HOEnZb"><br>
><br>
>      set_section ( N_("Zoom" ), NULL )<br>
>      add_key( "key-zoom-quarter",  KEY_ZOOM_QUARTER,<br>
<br>
--<br>
</div><span class="HOEnZb"><font color="#888888">Rémi Denis-Courmont<br>
Sent from my collocated server<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
</div></div></blockquote></div><br></div>