+ /* Check that the handle is valid */
+ if( !p_vlc )
+ {
+ return VLC_ENOOBJ;
+ }
+
+ p_input = vlc_object_find( p_vlc, VLC_OBJECT_INPUT, FIND_CHILD );
+
+ if( !p_input )
+ {
+ if( i_object ) vlc_object_release( p_vlc );
+ return VLC_ENOOBJ;
+ }
+
+ var_Get( p_input, "position", &val );
+ vlc_object_release( p_input );
+
+ if( i_object ) vlc_object_release( p_vlc );
+ return val.f_float;
+}
+
+/**
+ * Set the current position in a input
+ *
+ * Set the current position in a input and then return
+ * the current position as a float.
+ * \note For some inputs, this will be unknown.
+ *
+ * \param i_object a vlc object id
+ * \param i_position a float in the range of 0.0 - 1.0
+ * \return a float in the range of 0.0 - 1.0
+ */
+float VLC_PositionSet( int i_object, float i_position )
+{
+ input_thread_t *p_input;
+ vlc_value_t val;
+ vlc_t *p_vlc = vlc_current_object( i_object );
+
+ /* Check that the handle is valid */
+ if( !p_vlc )
+ {
+ return VLC_ENOOBJ;
+ }
+
+ p_input = vlc_object_find( p_vlc, VLC_OBJECT_INPUT, FIND_CHILD );
+
+ if( !p_input )
+ {
+ if( i_object ) vlc_object_release( p_vlc );
+ return VLC_ENOOBJ;
+ }
+
+ val.f_float = i_position;
+ var_Set( p_input, "position", val );
+ var_Get( p_input, "position", &val );
+ vlc_object_release( p_input );
+
+ if( i_object ) vlc_object_release( p_vlc );
+ return val.f_float;
+}
+
+/**
+ * Get the current position in a input
+ *
+ * Return the current position in seconds from the start.
+ * \note For some inputs, this will be unknown.
+ *
+ * \param i_object a vlc object id
+ * \return the offset from 0:00 in seconds
+ */
+int VLC_TimeGet( int i_object )
+{
+ input_thread_t *p_input;
+ vlc_value_t val;
+ vlc_t *p_vlc = vlc_current_object( i_object );
+
+ /* Check that the handle is valid */
+ if( !p_vlc )
+ {
+ return VLC_ENOOBJ;
+ }
+
+ p_input = vlc_object_find( p_vlc, VLC_OBJECT_INPUT, FIND_CHILD );
+
+ if( !p_input )
+ {
+ if( i_object ) vlc_object_release( p_vlc );
+ return VLC_ENOOBJ;
+ }
+
+ var_Get( p_input, "time", &val );
+ vlc_object_release( p_input );
+
+ if( i_object ) vlc_object_release( p_vlc );
+ return val.i_time / 1000000;
+}
+
+/**
+ * Seek to a position in the current input
+ *
+ * Seek i_seconds in the current input. If b_relative is set,
+ * then the seek will be relative to the current position, otherwise
+ * it will seek to i_seconds from the beginning of the input.
+ * \note For some inputs, this will be unknown.
+ *
+ * \param i_object a vlc object id
+ * \param i_seconds seconds from current position or from beginning of input
+ * \param b_relative seek relative from current position
+ * \return VLC_SUCCESS on success
+ */
+int VLC_TimeSet( int i_object, int i_seconds, vlc_bool_t b_relative )
+{
+ input_thread_t *p_input;
+ vlc_value_t val;
+ vlc_t *p_vlc = vlc_current_object( i_object );
+
+ /* Check that the handle is valid */
+ if( !p_vlc )
+ {
+ return VLC_ENOOBJ;
+ }
+
+ p_input = vlc_object_find( p_vlc, VLC_OBJECT_INPUT, FIND_CHILD );
+
+ if( !p_input )
+ {
+ if( i_object ) vlc_object_release( p_vlc );
+ return VLC_ENOOBJ;
+ }
+
+ if( b_relative )
+ {
+ val.i_time = i_seconds;
+ val.i_time = val.i_time * 1000000L;
+ var_Set( p_input, "time-offset", val );
+ }
+ else
+ {
+ val.i_time = i_seconds;
+ val.i_time = val.i_time * 1000000L;
+ var_Set( p_input, "time", val );
+ }
+ vlc_object_release( p_input );
+
+ if( i_object ) vlc_object_release( p_vlc );
+ return VLC_SUCCESS;
+}
+
+/**
+ * Get the total length of a input
+ *
+ * Return the total length in seconds from the current input.
+ * \note For some inputs, this will be unknown.
+ *
+ * \param i_object a vlc object id
+ * \return the length in seconds
+ */
+int VLC_LengthGet( int i_object )
+{
+ input_thread_t *p_input;
+ vlc_value_t val;
+ vlc_t *p_vlc = vlc_current_object( i_object );
+
+ /* Check that the handle is valid */
+ if( !p_vlc )
+ {
+ return VLC_ENOOBJ;
+ }
+
+ p_input = vlc_object_find( p_vlc, VLC_OBJECT_INPUT, FIND_CHILD );
+
+ if( !p_input )
+ {
+ if( i_object ) vlc_object_release( p_vlc );
+ return VLC_ENOOBJ;
+ }
+
+ var_Get( p_input, "length", &val );
+ vlc_object_release( p_input );
+
+ if( i_object ) vlc_object_release( p_vlc );
+ return val.i_time / 1000000L;
+}
+
+/**
+ * Play the input faster than realtime
+ *
+ * 2x, 4x, 8x faster than realtime
+ * \note For some inputs, this will be impossible.
+ *
+ * \param i_object a vlc object id
+ * \return the current speedrate
+ */
+float VLC_SpeedFaster( int i_object )
+{
+ input_thread_t *p_input;
+ vlc_value_t val;
+ vlc_t *p_vlc = vlc_current_object( i_object );
+
+ /* Check that the handle is valid */
+ if( !p_vlc )
+ {
+ return VLC_ENOOBJ;
+ }
+
+ p_input = vlc_object_find( p_vlc, VLC_OBJECT_INPUT, FIND_CHILD );
+
+ if( !p_input )
+ {
+ if( i_object ) vlc_object_release( p_vlc );
+ return VLC_ENOOBJ;
+ }
+
+ val.b_bool = VLC_TRUE;
+ var_Set( p_input, "rate-faster", val );
+ var_Get( p_input, "rate", &val );
+ vlc_object_release( p_input );
+
+ if( i_object ) vlc_object_release( p_vlc );
+ return val.f_float / INPUT_RATE_DEFAULT;
+}
+
+/**
+ * Play the input slower than realtime
+ *
+ * 1/2x, 1/4x, 1/8x slower than realtime
+ * \note For some inputs, this will be impossible.
+ *
+ * \param i_object a vlc object id
+ * \return the current speedrate
+ */
+float VLC_SpeedSlower( int i_object )
+{
+ input_thread_t *p_input;
+ vlc_value_t val;
+ vlc_t *p_vlc = vlc_current_object( i_object );
+
+ /* Check that the handle is valid */
+ if( !p_vlc )
+ {
+ return VLC_ENOOBJ;
+ }
+
+ p_input = vlc_object_find( p_vlc, VLC_OBJECT_INPUT, FIND_CHILD );
+
+ if( !p_input )
+ {
+ if( i_object ) vlc_object_release( p_vlc );
+ return VLC_ENOOBJ;
+ }
+
+ val.b_bool = VLC_TRUE;
+ var_Set( p_input, "rate-slower", val );
+ var_Get( p_input, "rate", &val );
+ vlc_object_release( p_input );
+
+ if( i_object ) vlc_object_release( p_vlc );
+ return val.f_float / INPUT_RATE_DEFAULT;
+}
+
+/**
+ * Return the current playlist item
+ *
+ * Returns the index of the playlistitem that is currently selected for play.
+ * This is valid even if nothing is currently playing.
+ *
+ * \param i_object a vlc object id
+ * \return the current index
+ */
+int VLC_PlaylistIndex( int i_object )
+{
+ int i_index;