static int ESCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(oldval); VLC_UNUSED(p_data); if( newval.i_int < 0 ) { vlc_value_t v; /* Hack */ if( !strcmp( psz_cmd, "audio-es" ) ) v.i_int = -AUDIO_ES; else if( !strcmp( psz_cmd, "video-es" ) ) v.i_int = -VIDEO_ES; else if( !strcmp( psz_cmd, "spu-es" ) ) v.i_int = -SPU_ES; else v.i_int = 0; if( v.i_int != 0 ) input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &v ); } else { input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &newval ); } return VLC_SUCCESS; }
static int SeekpointCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; vlc_value_t val, count; VLC_UNUSED(oldval); VLC_UNUSED(p_data); if( !strcmp( psz_cmd, "next-chapter" ) ) { input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT_NEXT, NULL ); val.i_int = var_GetInteger( p_input, "chapter" ) + 1; var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &count, NULL ); if( val.i_int < count.i_int ) var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL ); } else if( !strcmp( psz_cmd, "prev-chapter" ) ) { input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT_PREV, NULL ); val.i_int = var_GetInteger( p_input, "chapter" ) - 1; if( val.i_int >= 0 ) var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL ); } else { input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT, &newval ); } return VLC_SUCCESS; }
static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(oldval); VLC_UNUSED(p_data); if( !strcmp( psz_cmd, "audio-delay" ) ) { input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval ); } else if( !strcmp( psz_cmd, "spu-delay" ) ) { input_ControlPush( p_input, INPUT_CONTROL_SET_SPU_DELAY, &newval ); } return VLC_SUCCESS; }
static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(oldval); VLC_UNUSED(p_data); if( !strcmp( psz_cmd, "time-offset" ) ) { mtime_t i_time = var_GetTime( p_input, "time" ) + newval.i_time; if( i_time < 0 ) i_time = 0; var_SetTime( p_this, "time", i_time ); } else { /* Update "position" for better intf behavour */ const mtime_t i_length = var_GetTime( p_input, "length" ); if( i_length > 0 && newval.i_time >= 0 && newval.i_time <= i_length ) { vlc_value_t val; val.f_float = (double)newval.i_time/(double)i_length; var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL ); } /* */ input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &newval ); } return VLC_SUCCESS; }
static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(oldval); VLC_UNUSED(p_data); if( !strcmp( psz_cmd, "position-offset" ) ) { float f_position = var_GetFloat( p_input, "position" ) + newval.f_float; if( f_position < 0.f ) f_position = 0.f; else if( f_position > 1.f ) f_position = 1.f; var_SetFloat( p_this, "position", f_position ); } else { /* Update "length" for better intf behaviour */ const int64_t i_length = var_GetInteger( p_input, "length" ); if( i_length > 0 && newval.f_float >= 0.f && newval.f_float <= 1.f ) { vlc_value_t val; val.i_int = i_length * newval.f_float; var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL ); } /* */ input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &newval ); } return VLC_SUCCESS; }
static int RecordCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); input_ControlPush( p_input, INPUT_CONTROL_SET_RECORD_STATE, &newval ); return VLC_SUCCESS; }
static int RateCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(oldval); VLC_UNUSED(p_data); VLC_UNUSED(psz_cmd); newval.i_int = INPUT_RATE_DEFAULT / newval.f_float; input_ControlPush( p_input, INPUT_CONTROL_SET_RATE, &newval ); return VLC_SUCCESS; }
static int FrameNextCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); VLC_UNUSED(newval); input_ControlPush( p_input, INPUT_CONTROL_SET_FRAME_NEXT, NULL ); return VLC_SUCCESS; }
static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; vlc_value_t val; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); /* Issue a title change */ val.i_int = (intptr_t)p_data; input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE, &val ); var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL ); /* And a chapter change */ input_ControlPush( p_input, INPUT_CONTROL_SET_SEEKPOINT, &newval ); var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &newval, NULL ); return VLC_SUCCESS; }
static int RateCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(oldval); VLC_UNUSED(p_data); /* Problem with this way: the "rate" variable is update after the input thread do the change */ if( !strcmp( psz_cmd, "rate-slower" ) ) { input_ControlPush( p_input, INPUT_CONTROL_SET_RATE_SLOWER, NULL ); } else if( !strcmp( psz_cmd, "rate-faster" ) ) { input_ControlPush( p_input, INPUT_CONTROL_SET_RATE_FASTER, NULL ); } else { input_ControlPush( p_input, INPUT_CONTROL_SET_RATE, &newval ); } return VLC_SUCCESS; }
static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; vlc_value_t val, count; VLC_UNUSED(oldval); VLC_UNUSED(p_data); if( !strcmp( psz_cmd, "next-title" ) ) { input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE_NEXT, NULL ); val.i_int = var_GetInteger( p_input, "title" ) + 1; var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &count, NULL ); if( val.i_int < count.i_int ) var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL ); } else if( !strcmp( psz_cmd, "prev-title" ) ) { input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE_PREV, NULL ); val.i_int = var_GetInteger( p_input, "title" ) - 1; if( val.i_int >= 0 ) var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL ); } else if( !strcmp( psz_cmd, "menu-title" ) ) { input_ControlPush( p_input, INPUT_CONTROL_NAV_MENU, NULL ); } else if( !strcmp( psz_cmd, "menu-popup" ) ) { input_ControlPush( p_input, INPUT_CONTROL_NAV_POPUP, NULL ); } else { input_ControlPush( p_input, INPUT_CONTROL_SET_TITLE, &newval ); } return VLC_SUCCESS; }
/***************************************************************************** * All Callbacks: *****************************************************************************/ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); if( newval.i_int == PLAYING_S || newval.i_int == PAUSE_S ) { input_ControlPush( p_input, INPUT_CONTROL_SET_STATE, &newval ); return VLC_SUCCESS; } return VLC_EGENERIC; }
static int EsSpuCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED( psz_cmd); VLC_UNUSED( oldval ); VLC_UNUSED( p_data ); if( newval.i_int < 0 ) newval.i_int = -SPU_ES; /* disable spu es */ else var_SetBool( p_input, "spu", true ); input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &newval ); return VLC_SUCCESS; }
static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); /* Update "length" for better intf behaviour */ const int64_t i_length = var_GetInteger( p_input, "length" ); if( i_length > 0 && newval.f_float >= 0.f && newval.f_float <= 1.f ) { vlc_value_t val; val.i_int = i_length * newval.f_float; var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL ); } input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &newval ); return VLC_SUCCESS; }
static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); /* Update "position" for better intf behaviour */ const int64_t i_length = var_GetInteger( p_input, "length" ); if( i_length > 0 && newval.i_int >= 0 && newval.i_int <= i_length ) { vlc_value_t val; val.f_float = (double)newval.i_int/(double)i_length; var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL ); /* * Notify the intf that a new event has been occurred. * XXX this is a bit hackish but it's the only way to do it now. */ var_SetInteger( p_input, "intf-event", INPUT_EVENT_POSITION ); } input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &newval ); return VLC_SUCCESS; }