[vlc-devel] [PATCH 5/5] input: change seek/volume in ControlNav()

Thomas Guillem thomas at gllm.fr
Mon Sep 4 12:33:05 CEST 2017


Change seek/volume only if the input is not a menu or if the input can't change
viewpoint.
---
 src/input/input.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/input/input.c b/src/input/input.c
index f02557370f..b6077e651b 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1776,18 +1776,24 @@ static void ControlNav( input_thread_t *p_input, int i_type )
     }
 
     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:
@@ -1824,6 +1830,22 @@ static void ControlNav( input_thread_t *p_input, int i_type )
         ViewpointApply( p_input );
         return;
     }
+
+    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,
-- 
2.11.0



More information about the vlc-devel mailing list