Index: gui/app/gui.h
===================================================================
--- gui/app/gui.h	(revision 37122)
+++ gui/app/gui.h	(working copy)
@@ -48,9 +48,12 @@
 #define isInside(x, y, tx, ty, bx, by) ((x) > (tx) && (y) > (ty) && (x) < (bx) && (y) < (by))
 
 /// Check whether #guiItem @a item has a button (and thus a pressed state).
-#define hasButton(item) (item.type == itButton || item.type == itHPotmeter || item.type == itVPotmeter)
+#define hasButton(item) (item.type == itButton || item.type == itHPotmeter || item.type == itVPotmeter || item.type == itRPotmeter)
 
 /// Check whether #guiItem @a item utilizes member 'value'
-#define hasValue(item) (item.type == itHPotmeter || item.type == itVPotmeter || item.type == itPimage)
+#define hasValue(item) (item.type == itHPotmeter || item.type == itVPotmeter || item.type == itRPotmeter || item.type == itPimage)
 
+/// Two times pi
+#define M_2PI 6.28318530717958647692
+
 #endif /* MPLAYER_GUI_GUI_H */
Index: gui/app/app.h
===================================================================
--- gui/app/app.h	(revision 37122)
+++ gui/app/app.h	(working copy)
@@ -102,6 +102,7 @@
     itDLabel,
     itHPotmeter,
     itVPotmeter,
+    itRPotmeter,
     itPimage,
     itMenu,
     itPLMButton = 100,
@@ -132,6 +133,7 @@
     int pbwidth, pbheight;
     int numphases;
     float value;
+    double zeropoint, arclength;
 
     int message;
 
@@ -180,6 +182,7 @@
 guiItem *appFindItem(int event);
 int appFindMessage(const char *name);
 void appFreeStruct(void);
+double appRadian(guiItem *item, int x, int y);
 void btnModify(int event, float value);
 void btnSet(int event, int state);
 void btnValue(int event, float *value);
Index: gui/app/app.c
===================================================================
--- gui/app/app.c	(revision 37122)
+++ gui/app/app.c	(working copy)
@@ -21,6 +21,8 @@
  * @brief GUI application helpers
  */
 
+#include <math.h>
+
 #include "app.h"
 #include "gui.h"
 #include "gui/skin/font.h"
@@ -180,6 +182,31 @@
 }
 
 /**
+ * @brief Calculate the radian of a point inside the visual representation of
+ *        a #guiItem item.
+ *
+ * @param item pointer to the item
+ * @param x x position of the point
+ * @param y y position of the point
+ *
+ * @return radian of the point
+ *
+ * @note The return value is a @a clockwise radian.
+ */
+double appRadian(guiItem *item, int x, int y)
+{
+    double tx, ty;
+
+    // transform the center to (0,0)
+    tx = x - item->width / 2.0;
+    ty = y - item->height / 2.0;
+
+    // the y-axis is upside down and must be mirrored
+    // the x-axis is mirrored for a clockwise radian
+    return (tx == 0.0 && ty == 0.0 ? 0.0 : atan2(-ty, -tx) + M_PI);
+}
+
+/**
  * @brief Modify the value of the item belonging to an event.
  *
  * @param event event
Index: gui/skin/skin.c
===================================================================
--- gui/skin/skin.c	(revision 37124)
+++ gui/skin/skin.c	(working copy)
@@ -590,9 +590,9 @@
 }
 
 /**
- * @brief Parse a hpotmeter or vpotmeter definition.
+ * @brief Parse a hpotmeter, vpotmeter or rpotmeter definition.
  *
- *        Parameters: button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
+ *        Parameters: button,bwidth,bheight,phases,numphases,default['x0'y0'x1'y1],x,y,width,height,message
  *
  * @param item pointer to item to store the parameters in
  * @param in definition to be analyzed
@@ -604,7 +604,7 @@
     unsigned char bfname[256];
     unsigned char phfname[256];
     unsigned char buf[512];
-    int bwidth, bheight, num, d, x, y, w, h, message;
+    int bwidth, bheight, num, d, x0, y0, x1, y1, x, y, w, h, message;
 
     if (!window_item(currItem))
         return 1;
@@ -619,11 +619,23 @@
     bheight = cutInt(in, ',', 2);
     cutStr(in, phfname, ',', 3);
     num = cutInt(in, ',', 4);
-    d   = cutInt(in, ',', 5);
-    x   = cutInt(in, ',', 6);
-    y   = cutInt(in, ',', 7);
-    w   = cutInt(in, ',', 8);
-    h   = cutInt(in, ',', 9);
+    cutStr(in, buf, ',', 5);
+
+    if ((strchr(buf, '\'') && (*currItem != 'r')) ||
+        ((*currItem == 'r') && !strchr(buf, '\''))) {
+        skin_error(MSGTR_GUI_MSG_SkinUnknownParameter, buf);
+        return 1;
+    }
+
+    d  = cutInt(buf, '\'', 0);
+    x0 = cutInt(buf, '\'', 1);
+    y0 = cutInt(buf, '\'', 2);
+    x1 = cutInt(buf, '\'', 3);
+    y1 = cutInt(buf, '\'', 4);
+    x  = cutInt(in, ',', 6);
+    y  = cutInt(in, ',', 7);
+    w  = cutInt(in, ',', 8);
+    h  = cutInt(in, ',', 9);
     cutStr(in, buf, ',', 10);
 
     if (d < 0 || d > 100) {
@@ -644,6 +656,8 @@
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    %s image: %s %d,%d %dx%d\n", currItem, phfname, x, y, w, h);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     button image: %s %dx%d\n", bfname, bwidth, bheight);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     numphases: %d, default: %d%%\n", num, d);
+    if (*currItem == 'r')
+        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     start: %dx%d, stop: %dx%d\n", x0, y0, x1, y1);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", buf, message);
 
     item->x         = x;
@@ -657,6 +671,22 @@
     item->message   = message;
     item->pressed   = btnReleased;
 
+    if (*currItem == 'r') {
+        double stop;
+
+        item->zeropoint = appRadian(item, x0, y0);
+
+        if (x0 == x1 && y0 == y1)
+            stop = item->zeropoint;
+        else
+            stop = appRadian(item, x1, y1);
+
+        item->arclength = stop - item->zeropoint;
+
+        if (item->arclength <= 0.0)
+            item->arclength += M_2PI;
+    }
+
     item->Bitmap.Image = NULL;
 
     if (strcmp(phfname, "NULL") != 0) {
@@ -736,6 +766,29 @@
 }
 
 /**
+ * @brief Parse a @a rpotmeter definition.
+ *
+ *        Syntax: rpotmeter=button,bwidth,bheight,phases,numphases,default'x0'y0'x1'y1,x,y,width,height,message
+ *
+ * @param in definition to be analyzed
+ *
+ * @return 0 (ok) or 1 (error)
+ */
+static int item_rpotmeter(char *in)
+{
+    guiItem *item;
+
+    item = next_item();
+
+    if (!item)
+        return 1;
+
+    item->type = itRPotmeter;
+
+    return parse_potmeter(item, in);
+}
+
+/**
  * @brief Parse a @a potmeter definition.
  *
  *        Syntax: potmeter=phases,numphases,default,x,y,width,height,message
@@ -1076,6 +1129,7 @@
     { "menu",       item_menu       },
     { "pimage",     item_pimage     },
     { "potmeter",   item_potmeter   }, // legacy
+    { "rpotmeter",  item_rpotmeter  },
     { "section",    item_section    },
     { "selected",   item_selected   },
     { "slabel",     item_slabel     },
Index: gui/ui/ui.h
===================================================================
--- gui/ui/ui.h	(revision 37122)
+++ gui/ui/ui.h	(working copy)
@@ -19,6 +19,14 @@
 #ifndef MPLAYER_GUI_UI_H
 #define MPLAYER_GUI_UI_H
 
+/// End stops of a rotary potentiometer (::itRPotmeter)
+enum
+{
+  NOT_STOPPED,
+  STOPPED_AT_0,
+  STOPPED_AT_100
+};
+
 extern unsigned char * menuDrawBuffer;
 extern int             mainVisible;
 
Index: gui/ui/main.c
===================================================================
--- gui/ui/main.c	(revision 37122)
+++ gui/ui/main.c	(working copy)
@@ -95,10 +95,13 @@
  static int     itemtype = 0;
         int     i;
         guiItem * item = NULL;
+ static double  last_point;
+        double  point;
         float   value = 0.0f;
 
  static int     SelectedItem = -1;
         int     currentselected = -1;
+ static int     endstop;
 
  for ( i=0;i <= guiApp.IndexOfMainItems;i++ )
   if ( ( guiApp.mainItems[i].pressed != btnDisabled )&&
@@ -135,10 +138,15 @@
                   { item->pressed=btnDisabled; }
                  break;
            }*/
+          if ( itemtype == itRPotmeter )
+           {
+            last_point=appRadian( item, X - item->x, Y - item->y ) - item->zeropoint;
+            endstop=False;
+           }
           break;
    case wsRLMouseButton:
           boxMoved=False;
-          if ( SelectedItem != -1 )   // NOTE TO MYSELF: only if itButton, itHPotmeter or itVPotmeter
+          if ( SelectedItem != -1 )   // NOTE TO MYSELF: only if itButton, itHPotmeter, itVPotmeter or itRPotmeter
            {
             item=&guiApp.mainItems[SelectedItem];
             item->pressed=btnReleased;
@@ -154,6 +162,14 @@
             case itVPotmeter:
                  value=100.0 - 100.0 * ( Y - item->y ) / item->height;
                  break;
+            case itRPotmeter:
+                 if ( endstop ) { itemtype=0; break; }
+                 point=appRadian( item, X - item->x, Y - item->y ) - item->zeropoint;
+                 if ( point < 0.0 ) point+=M_2PI;
+                 if ( point <= item->arclength ) value=100.0 * point / item->arclength;
+                 else if ( point < item->arclength / 2 + M_PI ) value=100.0f;
+                 else value=0.0f;
+                 break;
            }
           uiEvent( item->message,value );
           itemtype=0;
@@ -170,7 +186,7 @@
           if (currentselected != - 1)
            {
             item=&guiApp.mainItems[currentselected];
-            if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter ) )
+            if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itRPotmeter ) )
              {
               item->value=constrain(item->value + value);
               uiEvent( item->message,item->value );
@@ -189,6 +205,45 @@
             case itPRMButton:
                  if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 );
                  break;
+            case itRPotmeter:
+                 point=appRadian( item, X - item->x, Y - item->y ) - item->zeropoint;
+                 if ( point < 0.0 ) point+=M_2PI;
+                 if ( item->arclength < M_2PI )
+                 /* a potmeter with separated 0% and 100% positions */
+                  {
+                   value=item->value;
+                   if ( point - last_point > M_PI )
+                   /* turned beyond the 0% position */
+                    {
+                     if ( !endstop )
+                      {
+                       endstop=STOPPED_AT_0;
+                       value=0.0f;
+                      }
+                    }
+                   else if ( last_point - point > M_PI )
+                   /* turned back from beyond the 0% position */
+                    {
+                     if ( endstop == STOPPED_AT_0 ) endstop=False;
+                    }
+                   else if ( last_point <= item->arclength && point > item->arclength )
+                   /* turned beyond the 100% position */
+                    {
+                     if ( !endstop )
+                      {
+                       endstop=STOPPED_AT_100;
+                       value=100.0f;
+                      }
+                    }
+                   else if ( last_point > item->arclength && point <= item->arclength )
+                   /* turned back from beyond the 100% position */
+                    {
+                     if ( endstop == STOPPED_AT_100 ) endstop=False;
+                    }
+                  }
+                 if ( !endstop ) value=100.0 * point / item->arclength;
+                 last_point=point;
+                 goto potihandled;
             case itVPotmeter:
                  value=100.0 - 100.0 * ( Y - item->y ) / item->height;
                  goto potihandled;
Index: gui/ui/playbar.c
===================================================================
--- gui/ui/playbar.c	(revision 37122)
+++ gui/ui/playbar.c	(working copy)
@@ -123,10 +123,13 @@
  static int     itemtype = 0;
         int     i;
         guiItem * item = NULL;
+ static double  last_point;
+        double  point;
         float   value = 0.0f;
 
  static int     SelectedItem = -1;
         int     currentselected = -1;
+ static int     endstop;
 
  for ( i=0;i <= guiApp.IndexOfPlaybarItems;i++ )
    if ( ( guiApp.playbarItems[i].pressed != btnDisabled )&&
@@ -162,11 +165,15 @@
                  ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) )
                  { item->pressed=btnDisabled; }
                break;
+          case itRPotmeter:
+               last_point=appRadian( item, X - item->x, Y - item->y ) - item->zeropoint;
+               endstop=False;
+               break;
          }
 
         break;
    case wsRLMouseButton:
-        if ( SelectedItem != -1 )   // NOTE TO MYSELF: only if itButton, itHPotmeter or itVPotmeter
+        if ( SelectedItem != -1 )   // NOTE TO MYSELF: only if itButton, itHPotmeter, itVPotmeter or itRPotmeter
          {
           item=&guiApp.playbarItems[SelectedItem];
           item->pressed=btnReleased;
@@ -183,6 +190,14 @@
           case itVPotmeter:
                value=100.0 - 100.0 * ( Y - item->y ) / item->height;
                break;
+          case itRPotmeter:
+               if ( endstop ) { itemtype=0; break; }
+               point=appRadian( item, X - item->x, Y - item->y ) - item->zeropoint;
+               if ( point < 0.0 ) point+=M_2PI;
+               if ( point <= item->arclength ) value=100.0 * point / item->arclength;
+               else if ( point < item->arclength / 2 + M_PI ) value=100.0f;
+               else value=0.0f;
+               break;
          }
         uiEvent( item->message,value );
 
@@ -195,7 +210,7 @@
         if (currentselected != - 1)
          {
           item=&guiApp.playbarItems[currentselected];
-          if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter ) )
+          if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itRPotmeter ) )
            {
             item->value=constrain(item->value + value);
             uiEvent( item->message,item->value );
@@ -210,6 +225,45 @@
           case itPRMButton:
                if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 );
                break;
+          case itRPotmeter:
+               point=appRadian( item, X - item->x, Y - item->y ) - item->zeropoint;
+               if ( point < 0.0 ) point+=M_2PI;
+               if ( item->arclength < M_2PI )
+               /* a potmeter with separated 0% and 100% positions */
+                {
+                 value=item->value;
+                 if ( point - last_point > M_PI )
+                 /* turned beyond the 0% position */
+                  {
+                   if ( !endstop )
+                    {
+                     endstop=STOPPED_AT_0;
+                     value=0.0f;
+                    }
+                  }
+                 else if ( last_point - point > M_PI )
+                 /* turned back from beyond the 0% position */
+                  {
+                   if ( endstop == STOPPED_AT_0 ) endstop=False;
+                  }
+                 else if ( last_point <= item->arclength && point > item->arclength )
+                 /* turned beyond the 100% position */
+                  {
+                   if ( !endstop )
+                    {
+                     endstop=STOPPED_AT_100;
+                     value=100.0f;
+                    }
+                  }
+                 else if ( last_point > item->arclength && point <= item->arclength )
+                 /* turned back from beyond the 100% position */
+                  {
+                   if ( endstop == STOPPED_AT_100 ) endstop=False;
+                  }
+                }
+               if ( !endstop ) value=100.0 * point / item->arclength;
+               last_point=point;
+               goto potihandled;
           case itVPotmeter:
                value=100.0 - 100.0 * ( Y - item->y ) / item->height;
                goto potihandled;
Index: gui/ui/render.c
===================================================================
--- gui/ui/render.c	(revision 37122)
+++ gui/ui/render.c	(working copy)
@@ -21,6 +21,7 @@
  * @brief GUI rendering
  */
 
+#include <math.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -35,6 +36,7 @@
 #include "access_mpcontext.h"
 #include "help_mp.h"
 #include "libavutil/avstring.h"
+#include "libavutil/common.h"
 #include "osdep/timer.h"
 #include "stream/stream.h"
 
@@ -479,6 +481,29 @@
             PutImage(item->x, item->y + (item->height - item->pbheight) * (1.0 - item->value / 100.0), db, dw, &item->Mask, 3, index, True);
             break;
 
+        case itRPotmeter:
+
+            PutImage(item->x, item->y, db, dw, &item->Bitmap, item->numphases, (item->numphases - 1) * item->value / 100.0, True);
+
+            if (item->Mask.Image) {
+                double radius, radian;
+                int y;
+
+                // keep the button inside the potmeter outline
+                radius = (FFMIN(item->width, item->height) - FFMAX(item->pbwidth, item->pbheight)) / 2.0;
+
+                radian = item->value / 100.0 * item->arclength + item->zeropoint;
+
+                // coordinates plus a correction for a non-square item
+                // (remember: both axes are mirrored, we have a clockwise radian)
+                x = radius * (1 + cos(radian)) + FFMAX(0, (item->width - item->height) / 2.0) + 0.5;
+                y = radius * (1 + sin(radian)) + FFMAX(0, (item->height - item->width) / 2.0) + 0.5;
+
+                PutImage(item->x + x, item->y + y, db, dw, &item->Mask, 3, index, True);
+            }
+
+            break;
+
         case itSLabel:
 
             if (item->width == -1)
