[vlc-commits] input: change seek/volume in ControlNav()

Thomas Guillem git at videolan.org
Tue Sep 5 10:20:49 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Sep  4 12:06:31 2017 +0200| [6cc64e52490af2fe96a50aee47157510607a4bfd] | committer: Thomas Guillem

input: change seek/volume in ControlNav()

Change seek/volume only if the input is not a menu or if the input can't change
viewpoint.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6cc64e52490af2fe96a50aee47157510607a4bfd
---

 src/input/input.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/input/input.c b/src/input/input.c
index f3a8e6f26a..d76640121e 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1779,18 +1779,24 @@ static void ControlNav( input_thread_t *p_input, int i_type )
 
     /* Handle Up/Down/Left/Right if the demux can't navigate */
     vlc_viewpoint_t vp = {};
+    int vol_direction = 0;
+    int seek_direction = 0;
     switch( i_type )
     {
         case INPUT_CONTROL_NAV_UP:
+            vol_direction = 1;
             vp.pitch = -1.f;
             break;
         case INPUT_CONTROL_NAV_DOWN:
+            vol_direction = -1;
             vp.pitch = 1.f;
             break;
         case INPUT_CONTROL_NAV_LEFT:
+            seek_direction = -1;
             vp.yaw = -1.f;
             break;
         case INPUT_CONTROL_NAV_RIGHT:
+            seek_direction = 1;
             vp.yaw = 1.f;
             break;
         case INPUT_CONTROL_NAV_ACTIVATE:
@@ -1825,6 +1831,23 @@ static void ControlNav( input_thread_t *p_input, int i_type )
         ViewpointApply( p_input );
         return;
     }
+
+    /* Seek or change volume if the input doesn't have navigation or viewpoint */
+    if( seek_direction != 0 )
+    {
+        mtime_t it = var_InheritInteger( p_input, "short-jump-size" );
+        var_SetInteger( p_input, "time-offset", it * seek_direction * CLOCK_FREQ );
+    }
+    else
+    {
+        assert( vol_direction != 0 );
+        audio_output_t *p_aout = input_resource_HoldAout( priv->p_resource );
+        if( p_aout )
+        {
+            aout_VolumeUpdate( p_aout, vol_direction, NULL );
+            vlc_object_release( p_aout );
+        }
+    }
 }
 
 static bool Control( input_thread_t *p_input,



More information about the vlc-commits mailing list