Commit f8cece22 authored by Damien Fouilleul's avatar Damien Fouilleul

- added input state & input rate in control APIs

parent ad446ef0
...@@ -270,6 +270,9 @@ void libvlc_input_set_time ( libvlc_input_t *, vlc_int64_t, libvlc_ ...@@ -270,6 +270,9 @@ void libvlc_input_set_time ( libvlc_input_t *, vlc_int64_t, libvlc_
float libvlc_input_get_position ( libvlc_input_t *, libvlc_exception_t *); float libvlc_input_get_position ( libvlc_input_t *, libvlc_exception_t *);
void libvlc_input_set_position ( libvlc_input_t *, float, libvlc_exception_t *); void libvlc_input_set_position ( libvlc_input_t *, float, libvlc_exception_t *);
vlc_bool_t libvlc_input_will_play ( libvlc_input_t *, libvlc_exception_t *); vlc_bool_t libvlc_input_will_play ( libvlc_input_t *, libvlc_exception_t *);
float libvlc_input_get_rate ( libvlc_input_t *, libvlc_exception_t *);
void libvlc_input_set_rate ( libvlc_input_t *, float, libvlc_exception_t *);
int libvlc_input_get_state ( libvlc_input_t *, libvlc_exception_t *);
/** @} */ /** @} */
......
...@@ -63,12 +63,12 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input, ...@@ -63,12 +63,12 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
vlc_value_t val; vlc_value_t val;
p_input_thread = libvlc_get_input_thread ( p_input, p_e); p_input_thread = libvlc_get_input_thread ( p_input, p_e);
if( libvlc_exception_raised( p_e ) ) return -1.0; if( libvlc_exception_raised( p_e ) ) return -1;
var_Get( p_input_thread, "length", &val ); var_Get( p_input_thread, "length", &val );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
return val.i_time / 1000; return val.i_time;
} }
vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input, vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
...@@ -78,11 +78,11 @@ vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input, ...@@ -78,11 +78,11 @@ vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
vlc_value_t val; vlc_value_t val;
p_input_thread = libvlc_get_input_thread ( p_input, p_e ); p_input_thread = libvlc_get_input_thread ( p_input, p_e );
if( libvlc_exception_raised( p_e ) ) return -1.0; if( libvlc_exception_raised( p_e ) ) return -1;
var_Get( p_input_thread , "time", &val ); var_Get( p_input_thread , "time", &val );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
return val.i_time / 1000; return val.i_time;
} }
void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time, void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time,
...@@ -165,3 +165,48 @@ vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input, ...@@ -165,3 +165,48 @@ vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input,
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
return VLC_FALSE; return VLC_FALSE;
} }
void libvlc_input_set_rate( libvlc_input_t *p_input, float rate,
libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread;
vlc_value_t val;
val.i_int = rate*1000.0f;
p_input_thread = libvlc_get_input_thread ( p_input, p_e);
if ( libvlc_exception_raised( p_e ) ) return;
var_Set( p_input_thread, "rate", val );
vlc_object_release( p_input_thread );
}
float libvlc_input_get_rate( libvlc_input_t *p_input,
libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread;
vlc_value_t val;
p_input_thread = libvlc_get_input_thread ( p_input, p_e);
if ( libvlc_exception_raised( p_e ) ) return -1.0;
var_Get( p_input_thread, "rate", &val );
vlc_object_release( p_input_thread );
return (float)val.i_int/1000.0f;
}
int libvlc_input_get_state( libvlc_input_t *p_input,
libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread;
vlc_value_t val;
p_input_thread = libvlc_get_input_thread ( p_input, p_e);
if ( libvlc_exception_raised( p_e ) ) return 0;
var_Get( p_input_thread, "state", &val );
vlc_object_release( p_input_thread );
return val.i_int;
}
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