vlc | branch: master | Thomas Guillem <[email protected]> | Thu Jul 12 11:23:04 2018 +0200| [ac0aaab376a18883423d8a76b603459a35aef28a] | committer: Thomas Guillem
input: remove controls that depend on a variable This commit is done to ease future the input controller/manager integration. The goal is to remove all variables dependency of the input thread. PS: Variable is still the mean way to control an input_thread for now. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ac0aaab376a18883423d8a76b603459a35aef28a --- include/vlc_input.h | 44 ---------------- src/input/control.c | 144 +--------------------------------------------------- 2 files changed, 1 insertion(+), 187 deletions(-) diff --git a/include/vlc_input.h b/include/vlc_input.h index 9ded0a16de..f863007271 100644 --- a/include/vlc_input.h +++ b/include/vlc_input.h @@ -393,31 +393,6 @@ typedef enum input_event_type_e */ enum input_query_e { - /* input variable "position" */ - INPUT_GET_POSITION, /* arg1= double * res= */ - INPUT_SET_POSITION, /* arg1= double res=can fail */ - - /* input variable "length" */ - INPUT_GET_LENGTH, /* arg1= int64_t * res=can fail */ - - /* input variable "time" */ - INPUT_GET_TIME, /* arg1= int64_t * res= */ - INPUT_SET_TIME, /* arg1= int64_t res=can fail */ - - /* input variable "rate" (nominal is INPUT_RATE_DEFAULT) */ - INPUT_GET_RATE, /* arg1= int * res= */ - INPUT_SET_RATE, /* arg1= int res=can fail */ - - /* input variable "state" */ - INPUT_GET_STATE, /* arg1= int * res= */ - INPUT_SET_STATE, /* arg1= int res=can fail */ - - /* input variable "audio-delay" and "sub-delay" */ - INPUT_GET_AUDIO_DELAY, /* arg1 = vlc_tick_t* res=can fail */ - INPUT_SET_AUDIO_DELAY, /* arg1 = vlc_tick_t res=can fail */ - INPUT_GET_SPU_DELAY, /* arg1 = vlc_tick_t* res=can fail */ - INPUT_SET_SPU_DELAY, /* arg1 = vlc_tick_t res=can fail */ - /* Menu (VCD/DVD/BD) Navigation */ /** Activate the navigation item selected. res=can fail */ INPUT_NAV_ACTIVATE, @@ -450,12 +425,8 @@ enum input_query_e INPUT_SET_BOOKMARK, /* arg1= int res=can fail */ /* titles */ - INPUT_GET_TITLE_INFO, /* arg1=input_title_t** arg2= int * res=can fail */ INPUT_GET_FULL_TITLE_INFO, /* arg1=input_title_t*** arg2= int * res=can fail */ - /* seekpoints */ - INPUT_GET_SEEKPOINTS, /* arg1=seekpoint_t*** arg2= int * res=can fail */ - /* Attachments */ INPUT_GET_ATTACHMENTS, /* arg1=input_attachment_t***, arg2=int* res=can fail */ INPUT_GET_ATTACHMENT, /* arg1=input_attachment_t**, arg2=char* res=can fail */ @@ -465,10 +436,6 @@ enum input_query_e * arg3= bool forced, arg4= bool notify, * arg5= bool check_extension */ - /* On the fly record while playing */ - INPUT_SET_RECORD_STATE, /* arg1=bool res=can fail */ - INPUT_GET_RECORD_STATE, /* arg1=bool* res=can fail */ - /* ES */ INPUT_RESTART_ES, /* arg1=int (-AUDIO/VIDEO/SPU_ES for the whole category) */ @@ -527,17 +494,6 @@ VLC_API void input_SetPosition( input_thread_t *, float f_position, bool b_fast VLC_API input_item_t* input_GetItem( input_thread_t * ) VLC_USED; /** - * It will return the current state of the input. - * Provided for convenience. - */ -static inline input_state_e input_GetState( input_thread_t * p_input ) -{ - input_state_e state = INIT_S; - input_Control( p_input, INPUT_GET_STATE, &state ); - return state; -} - -/** * Return one of the video output (if any). If possible, you should use * INPUT_GET_VOUTS directly and process _all_ video outputs instead. * @param p_input an input thread from which to get a video output diff --git a/src/input/control.c b/src/input/control.c index 133f76ebed..3e6fd4607b 100644 --- a/src/input/control.c +++ b/src/input/control.c @@ -68,77 +68,13 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) seekpoint_t *p_bkmk, ***ppp_bkmk; int i_bkmk = 0; int *pi_bkmk; - - int i_int, *pi_int; - bool b_bool, *pb_bool; - double f, *pf; - int64_t i_64, *pi_64; + bool b_bool; char *psz; vlc_value_t val; switch( i_query ) { - case INPUT_GET_POSITION: - pf = va_arg( args, double * ); - *pf = var_GetFloat( p_input, "position" ); - return VLC_SUCCESS; - - case INPUT_SET_POSITION: - f = va_arg( args, double ); - return var_SetFloat( p_input, "position", f ); - - case INPUT_GET_LENGTH: - pi_64 = va_arg( args, int64_t * ); - *pi_64 = var_GetInteger( p_input, "length" ); - return VLC_SUCCESS; - - case INPUT_GET_TIME: - pi_64 = va_arg( args, int64_t * ); - *pi_64 = var_GetInteger( p_input, "time" ); - return VLC_SUCCESS; - - case INPUT_SET_TIME: - i_64 = va_arg( args, int64_t ); - return var_SetInteger( p_input, "time", i_64 ); - - case INPUT_GET_RATE: - pi_int = va_arg( args, int * ); - *pi_int = INPUT_RATE_DEFAULT / var_GetFloat( p_input, "rate" ); - return VLC_SUCCESS; - - case INPUT_SET_RATE: - i_int = va_arg( args, int ); - return var_SetFloat( p_input, "rate", - (float)INPUT_RATE_DEFAULT / (float)i_int ); - - case INPUT_GET_STATE: - pi_int = va_arg( args, int * ); - *pi_int = var_GetInteger( p_input, "state" ); - return VLC_SUCCESS; - - case INPUT_SET_STATE: - i_int = va_arg( args, int ); - return var_SetInteger( p_input, "state", i_int ); - - case INPUT_GET_AUDIO_DELAY: - pi_64 = va_arg( args, vlc_tick_t * ); - *pi_64 = var_GetInteger( p_input, "audio-delay" ); - return VLC_SUCCESS; - - case INPUT_GET_SPU_DELAY: - pi_64 = va_arg( args, vlc_tick_t * ); - *pi_64 = var_GetInteger( p_input, "spu-delay" ); - return VLC_SUCCESS; - - case INPUT_SET_AUDIO_DELAY: - i_64 = va_arg( args, vlc_tick_t ); - return var_SetInteger( p_input, "audio-delay", i_64 ); - - case INPUT_SET_SPU_DELAY: - i_64 = va_arg( args, vlc_tick_t ); - return var_SetInteger( p_input, "spu-delay", i_64 ); - case INPUT_NAV_ACTIVATE: case INPUT_NAV_UP: case INPUT_NAV_DOWN: @@ -317,30 +253,6 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) vlc_mutex_unlock( &priv->p_item->lock ); return VLC_SUCCESS; - case INPUT_GET_TITLE_INFO: - { - input_title_t **p_title = va_arg( args, input_title_t ** ); - int *pi_req_title_offset = va_arg( args, int * ); - - vlc_mutex_lock( &priv->p_item->lock ); - - int i_current_title = var_GetInteger( p_input, "title" ); - if ( *pi_req_title_offset < 0 ) /* return current title if -1 */ - *pi_req_title_offset = i_current_title; - - if( priv->i_title && priv->i_title > *pi_req_title_offset ) - { - *p_title = vlc_input_title_Duplicate( priv->title[*pi_req_title_offset] ); - vlc_mutex_unlock( &priv->p_item->lock ); - return VLC_SUCCESS; - } - else - { - vlc_mutex_unlock( &priv->p_item->lock ); - return VLC_EGENERIC; - } - } - case INPUT_GET_FULL_TITLE_INFO: { vlc_mutex_lock( &priv->p_item->lock ); @@ -363,50 +275,6 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) return VLC_SUCCESS; } - case INPUT_GET_SEEKPOINTS: - { - seekpoint_t ***array = va_arg( args, seekpoint_t *** ); - int *pi_title_to_fetch = va_arg( args, int * ); - - vlc_mutex_lock( &priv->p_item->lock ); - - if ( *pi_title_to_fetch < 0 ) /* query current title if -1 */ - *pi_title_to_fetch = var_GetInteger( p_input, "title" ); - - if( priv->i_title == 0 || priv->i_title <= *pi_title_to_fetch ) - { - vlc_mutex_unlock( &priv->p_item->lock ); - return VLC_EGENERIC; - } - - const input_title_t *p_title = priv->title[*pi_title_to_fetch]; - - /* set arg2 to the number of seekpoints we found */ - const int i_chapters = p_title->i_seekpoint; - *pi_title_to_fetch = i_chapters; - - if ( i_chapters == 0 ) - { - vlc_mutex_unlock( &priv->p_item->lock ); - return VLC_SUCCESS; - } - - *array = calloc( p_title->i_seekpoint, sizeof(**array) ); - if( unlikely(*array == NULL) ) - { - vlc_mutex_unlock( &priv->p_item->lock ); - return VLC_ENOMEM; - } - for( int i = 0; i < i_chapters; i++ ) - { - (*array)[i] = vlc_seekpoint_Duplicate( p_title->seekpoint[i] ); - } - - vlc_mutex_unlock( &priv->p_item->lock ); - - return VLC_SUCCESS; - } - case INPUT_ADD_SLAVE: { enum slave_type type = (enum slave_type) va_arg( args, enum slave_type ); @@ -493,16 +361,6 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) return VLC_EGENERIC; } - case INPUT_SET_RECORD_STATE: - b_bool = va_arg( args, int ); - var_SetBool( p_input, "record", b_bool ); - return VLC_SUCCESS; - - case INPUT_GET_RECORD_STATE: - pb_bool = va_arg( args, bool* ); - *pb_bool = var_GetBool( p_input, "record" ); - return VLC_SUCCESS; - case INPUT_RESTART_ES: val.i_int = va_arg( args, int ); input_ControlPushHelper( p_input, INPUT_CONTROL_RESTART_ES, &val ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
