Commit c136bb81 authored by Laurent Aimar's avatar Laurent Aimar

Added control code for "frame-next" variable.

It is ignored.
parent e2fb80c6
...@@ -544,6 +544,38 @@ bool input_EsOutIsBuffering( es_out_t *out ) ...@@ -544,6 +544,38 @@ bool input_EsOutIsBuffering( es_out_t *out )
{ {
return out->p_sys->b_buffering; return out->p_sys->b_buffering;
} }
void input_EsOutFrameNext( es_out_t *out )
{
es_out_sys_t *p_sys = out->p_sys;
es_out_id_t *p_es_video = NULL;
for( int i = 0; i < p_sys->i_es; i++ )
{
es_out_id_t *p_es = p_sys->es[i];
if( p_es->fmt.i_cat == VIDEO_ES && p_es->p_dec )
{
p_es_video = p_es;
break;
}
}
if( !p_es_video )
{
msg_Warn( p_sys->p_input, "No video track selected, ignoring 'frame next'" );
return;
}
#if 0
input_DecoderFrameNext( p_es_video->p_dec );
if( !p_sys->b_buffering )
{
TODO();
}
#endif
msg_Err( out->p_sys->p_input, "TODO input_EsOutFrameNext" );
}
/***************************************************************************** /*****************************************************************************
* *
......
...@@ -42,5 +42,6 @@ void input_EsOutChangePause( es_out_t *, bool b_paused, mtime_t i_date ); ...@@ -42,5 +42,6 @@ void input_EsOutChangePause( es_out_t *, bool b_paused, mtime_t i_date );
void input_EsOutChangePosition( es_out_t * ); void input_EsOutChangePosition( es_out_t * );
bool input_EsOutDecodersIsEmpty( es_out_t * ); bool input_EsOutDecodersIsEmpty( es_out_t * );
bool input_EsOutIsBuffering( es_out_t * ); bool input_EsOutIsBuffering( es_out_t * );
void input_EsOutFrameNext( es_out_t * );
#endif #endif
...@@ -1485,6 +1485,58 @@ static void ControlReduce( input_thread_t *p_input ) ...@@ -1485,6 +1485,58 @@ static void ControlReduce( input_thread_t *p_input )
} }
} }
} }
/* Pause input */
static void ControlPause( input_thread_t *p_input, mtime_t i_control_date )
{
int i_ret;
int i_state;
if( p_input->p->input.p_access )
i_ret = access_Control( p_input->p->input.p_access,
ACCESS_SET_PAUSE_STATE, true );
else
i_ret = demux_Control( p_input->p->input.p_demux,
DEMUX_SET_PAUSE_STATE, true );
i_state = PAUSE_S;
if( i_ret )
{
msg_Warn( p_input, "cannot set pause state" );
i_state = p_input->i_state;
}
/* Switch to new state */
input_ChangeStateWithVarCallback( p_input, i_state, false );
/* */
if( !i_ret )
input_EsOutChangePause( p_input->p->p_es_out, true, i_control_date );
}
static void ControlUnpause( input_thread_t *p_input, mtime_t i_control_date )
{
int i_ret;
if( p_input->p->input.p_access )
i_ret = access_Control( p_input->p->input.p_access,
ACCESS_SET_PAUSE_STATE, false );
else
i_ret = demux_Control( p_input->p->input.p_demux,
DEMUX_SET_PAUSE_STATE, false );
if( i_ret )
{
/* FIXME What to do ? */
msg_Warn( p_input, "cannot unset pause -> EOF" );
vlc_mutex_unlock( &p_input->p->lock_control );
input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL );
vlc_mutex_lock( &p_input->p->lock_control );
}
/* Switch to play */
input_ChangeStateWithVarCallback( p_input, PLAYING_S, false );
/* */
if( !i_ret )
input_EsOutChangePause( p_input->p->p_es_out, false, i_control_date );
}
static bool Control( input_thread_t *p_input, int i_type, static bool Control( input_thread_t *p_input, int i_type,
vlc_value_t val ) vlc_value_t val )
...@@ -1608,61 +1660,16 @@ static bool Control( input_thread_t *p_input, int i_type, ...@@ -1608,61 +1660,16 @@ static bool Control( input_thread_t *p_input, int i_type,
if( ( val.i_int == PLAYING_S && p_input->i_state == PAUSE_S ) || if( ( val.i_int == PLAYING_S && p_input->i_state == PAUSE_S ) ||
( val.i_int == PAUSE_S && p_input->i_state == PAUSE_S ) ) ( val.i_int == PAUSE_S && p_input->i_state == PAUSE_S ) )
{ {
int i_ret; ControlUnpause( p_input, i_control_date );
if( p_input->p->input.p_access )
i_ret = access_Control( p_input->p->input.p_access,
ACCESS_SET_PAUSE_STATE, false );
else
i_ret = demux_Control( p_input->p->input.p_demux,
DEMUX_SET_PAUSE_STATE, false );
if( i_ret )
{
/* FIXME What to do ? */
msg_Warn( p_input, "cannot unset pause -> EOF" );
vlc_mutex_unlock( &p_input->p->lock_control );
input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL );
vlc_mutex_lock( &p_input->p->lock_control );
}
b_force_update = true; b_force_update = true;
/* Switch to play */
input_ChangeStateWithVarCallback( p_input, PLAYING_S, false );
/* */
if( !i_ret )
input_EsOutChangePause( p_input->p->p_es_out, false, i_control_date );
} }
else if( val.i_int == PAUSE_S && p_input->i_state == PLAYING_S && else if( val.i_int == PAUSE_S && p_input->i_state == PLAYING_S &&
p_input->p->b_can_pause ) p_input->p->b_can_pause )
{ {
int i_ret, state; ControlPause( p_input, i_control_date );
if( p_input->p->input.p_access )
i_ret = access_Control( p_input->p->input.p_access,
ACCESS_SET_PAUSE_STATE, true );
else
i_ret = demux_Control( p_input->p->input.p_demux,
DEMUX_SET_PAUSE_STATE, true );
b_force_update = true; b_force_update = true;
if( i_ret )
{
msg_Warn( p_input, "cannot set pause state" );
state = p_input->i_state;
}
else
{
state = PAUSE_S;
}
/* Switch to new state */
input_ChangeStateWithVarCallback( p_input, state, false );
/* */
if( !i_ret )
input_EsOutChangePause( p_input->p->p_es_out, true, i_control_date );
} }
else if( val.i_int == PAUSE_S && !p_input->p->b_can_pause ) else if( val.i_int == PAUSE_S && !p_input->p->b_can_pause )
{ {
...@@ -2031,6 +2038,25 @@ static bool Control( input_thread_t *p_input, int i_type, ...@@ -2031,6 +2038,25 @@ static bool Control( input_thread_t *p_input, int i_type,
} }
break; break;
case INPUT_CONTROL_SET_FRAME_NEXT:
if( !p_input->p->b_can_pause )
break;
if( p_input->i_state == PAUSE_S )
{
input_EsOutFrameNext( p_input->p->p_es_out );
}
else if( p_input->i_state == PLAYING_S )
{
ControlPause( p_input, i_control_date );
}
else
{
msg_Err( p_input, "invalid state for frame next" );
}
b_force_update = true;
break;
case INPUT_CONTROL_SET_BOOKMARK: case INPUT_CONTROL_SET_BOOKMARK:
default: default:
msg_Err( p_input, "not yet implemented" ); msg_Err( p_input, "not yet implemented" );
......
...@@ -193,6 +193,8 @@ enum input_control_e ...@@ -193,6 +193,8 @@ enum input_control_e
INPUT_CONTROL_ADD_SUBTITLE, INPUT_CONTROL_ADD_SUBTITLE,
INPUT_CONTROL_SET_RECORD_STATE, INPUT_CONTROL_SET_RECORD_STATE,
INPUT_CONTROL_SET_FRAME_NEXT,
}; };
/* Internal helpers */ /* Internal helpers */
......
...@@ -64,6 +64,9 @@ static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -64,6 +64,9 @@ static int BookmarkCallback( vlc_object_t *p_this, char const *psz_cmd,
static int RecordCallback( vlc_object_t *p_this, char const *psz_cmd, static int RecordCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, vlc_value_t oldval, vlc_value_t newval,
void *p_data ); void *p_data );
static int FrameNextCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval,
void *p_data );
typedef struct typedef struct
{ {
...@@ -98,6 +101,7 @@ static const vlc_input_callback_t p_input_callbacks[] = ...@@ -98,6 +101,7 @@ static const vlc_input_callback_t p_input_callbacks[] =
CALLBACK( "audio-es", ESCallback ), CALLBACK( "audio-es", ESCallback ),
CALLBACK( "spu-es", ESCallback ), CALLBACK( "spu-es", ESCallback ),
CALLBACK( "record", RecordCallback ), CALLBACK( "record", RecordCallback ),
CALLBACK( "frame-next", FrameNextCallback ),
CALLBACK( NULL, NULL ) CALLBACK( NULL, NULL )
}; };
...@@ -139,6 +143,8 @@ void input_ControlVarInit ( input_thread_t *p_input ) ...@@ -139,6 +143,8 @@ void input_ControlVarInit ( input_thread_t *p_input )
var_Create( p_input, "rate-faster", VLC_VAR_VOID ); var_Create( p_input, "rate-faster", VLC_VAR_VOID );
var_Create( p_input, "frame-next", VLC_VAR_VOID );
/* Position */ /* Position */
var_Create( p_input, "position", VLC_VAR_FLOAT ); var_Create( p_input, "position", VLC_VAR_FLOAT );
var_Create( p_input, "position-offset", VLC_VAR_FLOAT ); var_Create( p_input, "position-offset", VLC_VAR_FLOAT );
...@@ -806,3 +812,15 @@ static int RecordCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -806,3 +812,15 @@ static int RecordCallback( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS; 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);
input_ControlPush( p_input, INPUT_CONTROL_SET_FRAME_NEXT, NULL );
return VLC_SUCCESS;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment