<html><head></head><body><div class="gmail_quote">Le 3 août 2017 16:10:47 GMT+03:00, "Hugo Beauzée-Luyssen" <hugo@beauzee.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">From: Thomas Guillem <thomas@gllm.fr><br /><br />---<br /> src/misc/actions.c | 215 +++++++++++++++++++++++++++++++++--------------------<br /> 1 file changed, 136 insertions(+), 79 deletions(-)<br /><br />diff --git a/src/misc/actions.c b/src/misc/actions.c<br />index 552d8e7367..8a16a4bc53 100644<br />--- a/src/misc/actions.c<br />+++ b/src/misc/actions.c<br />@@ -779,6 +779,63 @@ static float adjust_rate_fine( playlist_t *p_playlist, const int i_dir )<br /> return f_rate;<br /> }<br /> <br />+static void do_volume_up( vlc_actions_t *p_as, vout_thread_t *p_vout,<br />+ playlist_t *p_playlist )<br />+{<br />+ float vol;<br />+ if( playlist_VolumeUp( p_playlist, 1, &vol ) == 0 )<br />+ display_volume( p_as, p_vout, vol );<br />+}<br />+<br />+static void do_volume_down( vlc_actions_t *p_as, vout_thread_t *p_vout,<br />+ playlist_t *p_playlist )<br />+{<br />+ float vol;<br />+ if( playlist_VolumeDown( p_playlist, 1, &vol ) == 0 )<br />+ display_volume( p_as, p_vout, vol );<br />+}<br />+<br />+static void do_seek( vlc_actions_t *p_as, vout_thread_t *p_notify_vout,<br />+ input_thread_t *p_input, vlc_action_id_t i_action )<br />+{<br />+ if( p_input == NULL || !var_GetBool( p_input, "can-seek" ) )<br />+ return;<br />+<br />+ const char *varname;<br />+ int sign = +1;<br />+ switch( i_action )<br />+ {<br />+ case ACTIONID_JUMP_BACKWARD_EXTRASHORT:<br />+ sign = -1;<br />+ case ACTIONID_JUMP_FORWARD_EXTRASHORT:<br />+ varname = "extrashort-jump-size";<br />+ break;<br />+ case ACTIONID_JUMP_BACKWARD_SHORT:<br />+ sign = -1;<br />+ case ACTIONID_JUMP_FORWARD_SHORT:<br />+ varname = "short-jump-size";<br />+ break;<br />+ case ACTIONID_JUMP_BACKWARD_MEDIUM:<br />+ sign = -1;<br />+ case ACTIONID_JUMP_FORWARD_MEDIUM:<br />+ varname = "medium-jump-size";<br />+ break;<br />+ case ACTIONID_JUMP_BACKWARD_LONG:<br />+ sign = -1;<br />+ case ACTIONID_JUMP_FORWARD_LONG:<br />+ varname = "long-jump-size";<br />+ break;<br />+ default:<br />+ vlc_assert_unreachable();<br />+ }<br />+<br />+ mtime_t it = var_InheritInteger( p_input, varname );<br />+ if( it < 0 )<br />+ return;<br />+ var_SetInteger( p_input, "time-offset", it * sign * CLOCK_FREQ );<br />+ display_position( p_as, p_notify_vout, p_input );<br />+}<br />+<br /> static int<br /> vlc_actions_do_va( vlc_object_t *p_obj, vlc_action_id_t i_action, bool b_notify,<br /> va_list args )<br />@@ -930,19 +987,11 @@ vlc_actions_do_va( vlc_object_t *p_obj, vlc_action_id_t i_action, bool b_notify,<br /> break;<br /> }<br /> case ACTIONID_VOL_UP:<br />- {<br />- float vol;<br />- if( playlist_VolumeUp( p_playlist, 1, &vol ) == 0 )<br />- display_volume( p_as, p_notify_vout, vol );<br />+ do_volume_up( p_as, p_notify_vout, p_playlist );<br /> break;<br />- }<br /> case ACTIONID_VOL_DOWN:<br />- {<br />- float vol;<br />- if( playlist_VolumeDown( p_playlist, 1, &vol ) == 0 )<br />- display_volume( p_as, p_notify_vout, vol );<br />+ do_volume_down( p_as, p_notify_vout, p_playlist );<br /> break;<br />- }<br /> case ACTIONID_VOL_MUTE:<br /> {<br /> int mute = playlist_MuteGet( p_playlist );<br />@@ -1370,49 +1419,8 @@ vlc_actions_do_va( vlc_object_t *p_obj, vlc_action_id_t i_action, bool b_notify,<br /> case ACTIONID_JUMP_FORWARD_MEDIUM:<br /> case ACTIONID_JUMP_BACKWARD_LONG:<br /> case ACTIONID_JUMP_FORWARD_LONG:<br />- {<br />- if( p_input == NULL || !var_GetBool( p_input, "can-seek" ) )<br />- break;<br />-<br />- const char *varname;<br />- int sign = +1;<br />- switch( i_action )<br />- {<br />- case ACTIONID_JUMP_BACKWARD_EXTRASHORT:<br />- sign = -1;<br />- /* fall through */<br />- case ACTIONID_JUMP_FORWARD_EXTRASHORT:<br />- varname = "extrashort-jump-size";<br />- break;<br />- case ACTIONID_JUMP_BACKWARD_SHORT:<br />- sign = -1;<br />- /* fall through */<br />- case ACTIONID_JUMP_FORWARD_SHORT:<br />- varname = "short-jump-size";<br />- break;<br />- case ACTIONID_JUMP_BACKWARD_MEDIUM:<br />- sign = -1;<br />- /* fall through */<br />- case ACTIONID_JUMP_FORWARD_MEDIUM:<br />- varname = "medium-jump-size";<br />- break;<br />- case ACTIONID_JUMP_BACKWARD_LONG:<br />- sign = -1;<br />- /* fall through */<br />- case ACTIONID_JUMP_FORWARD_LONG:<br />- varname = "long-jump-size";<br />- break;<br />- default:<br />- vlc_assert_unreachable();<br />- }<br />-<br />- mtime_t it = var_InheritInteger( p_input, varname );<br />- if( it < 0 )<br />- break;<br />- var_SetInteger( p_input, "time-offset", it * sign * CLOCK_FREQ );<br />- display_position( p_as, p_notify_vout, p_input );<br />+ do_seek( p_as, p_notify_vout, p_input, i_action );<br /> break;<br />- }<br /> <br /> /* Input navigation */<br /> case ACTIONID_TITLE_PREV:<br />@@ -1440,37 +1448,86 @@ vlc_actions_do_va( vlc_object_t *p_obj, vlc_action_id_t i_action, bool b_notify,<br /> input_Control( p_input, INPUT_NAV_ACTIVATE, NULL );<br /> break;<br /> case ACTIONID_NAV_UP:<br />- if( p_vout )<br />- input_UpdateViewpoint( p_input,<br />- &(vlc_viewpoint_t) { .pitch = -1.f },<br />- false );<br />- if( p_input )<br />- input_Control( p_input, INPUT_NAV_UP, NULL );<br />- break;<br /> case ACTIONID_NAV_DOWN:<br />- if( p_vout )<br />- input_UpdateViewpoint( p_input,<br />- &(vlc_viewpoint_t) { .pitch = 1.f },<br />- false );<br />- if( p_input )<br />- input_Control( p_input, INPUT_NAV_DOWN, NULL );<br />- break;<br /> case ACTIONID_NAV_LEFT:<br />- if( p_vout )<br />- input_UpdateViewpoint( p_input,<br />- &(vlc_viewpoint_t) { .yaw = -1.f },<br />- false );<br />- if( p_input )<br />- input_Control( p_input, INPUT_NAV_LEFT, NULL );<br />- break;<br /> case ACTIONID_NAV_RIGHT:<br />- if( p_vout )<br />- input_UpdateViewpoint( p_input,<br />- &(vlc_viewpoint_t) { .yaw = 1.f },<br />- false );<br />- if( p_input )<br />- input_Control( p_input, INPUT_NAV_RIGHT, NULL );<br />+ {<br />+ if( !p_input )<br />+ break;<br />+ bool b_vrnav = p_vout &&<br />+ var_GetBool( p_vout, "viewpoint-changeable" );<br />+ if( b_vrnav )<br />+ {<br />+ switch( i_action )<br />+ {<br />+ case ACTIONID_NAV_UP:<br />+ input_UpdateViewpoint( p_input,<br />+ &(vlc_viewpoint_t) {<br />+ .pitch = -1.f<br />+ },<br />+ false );<br />+ break;<br />+ case ACTIONID_NAV_DOWN:<br />+ input_UpdateViewpoint( p_input,<br />+ &(vlc_viewpoint_t) {<br />+ .pitch = 1.f<br />+ },<br />+ false );<br />+ break;<br />+ case ACTIONID_NAV_LEFT:<br />+ input_UpdateViewpoint( p_input,<br />+ &(vlc_viewpoint_t) {<br />+ .yaw = -1.f<br />+ },<br />+ false );<br />+ break;<br />+ case ACTIONID_NAV_RIGHT:<br />+ input_UpdateViewpoint( p_input,<br />+ &(vlc_viewpoint_t) {<br />+ .yaw = 1.f<br />+ },<br />+ false );<br />+ break;<br />+ default:<br />+ vlc_assert_unreachable();<br />+ }<br />+ break;<br />+ }<br />+ input_title_t *p_title = NULL;<br />+ int i_title_id = -1;<br />+ if ( input_Control( p_input, INPUT_GET_TITLE_INFO, &p_title,<br />+ &i_title_id ) == VLC_SUCCESS<br />+ && p_title->i_flags & (INPUT_TITLE_INTERACTIVE|INPUT_TITLE_MENU) )<br />+ {<br />+<br />+ input_Control( p_input, i_action - ACTIONID_NAV_ACTIVATE<br />+ + INPUT_NAV_ACTIVATE, NULL );<br />+ }<br />+ else<br />+ {<br />+ switch( i_action )<br />+ {<br />+ case ACTIONID_NAV_UP:<br />+ do_volume_up( p_as, p_notify_vout, p_playlist );<br />+ break;<br />+ case ACTIONID_NAV_DOWN:<br />+ do_volume_down( p_as, p_notify_vout, p_playlist );<br />+ break;<br />+ case ACTIONID_NAV_LEFT:<br />+ do_seek( p_as, p_notify_vout, p_input,<br />+ ACTIONID_JUMP_BACKWARD_SHORT );<br />+ break;<br />+ case ACTIONID_NAV_RIGHT:<br />+ do_seek( p_as, p_notify_vout, p_input,<br />+ ACTIONID_JUMP_FORWARD_SHORT );<br />+ break;<br />+ default:<br />+ break;<br />+ }<br />+ }<br />+ vlc_input_title_Delete( p_title );<br /> break;<br />+ }<br /> <br /> /* Video Output actions */<br /> case ACTIONID_SNAPSHOT:</pre></blockquote></div><br clear="all">This is also broken by design. The volume might not be updated, or the result may be different than requested. You can't assume that the result is known synchronously.<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>