free( p_input );
}
-/**************************************************************************
- * Getters for stream information
- **************************************************************************/
-vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
- libvlc_exception_t *p_exception )
+/*
+ * Retrieve the input thread. Be sure to release the object
+ * once you are done with it.
+ */
+input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input,
+ libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread;
- vlc_value_t val;
if( !p_input )
{
- libvlc_exception_raise( p_exception, "Input is NULL" );
+ libvlc_exception_raise( p_e, "Input is NULL" );
return -1;
}
p_input->i_input_id );
if( !p_input_thread )
{
- libvlc_exception_raise( p_exception, "Input does not exist" );
- return -1;
+ libvlc_exception_raise( p_e, "Input does not exist" );
+ return NULL;
}
+
+ return p_input_thread;
+}
+
+
+
+/**************************************************************************
+ * Getters for stream information
+ **************************************************************************/
+vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
+ libvlc_exception_t *p_exception )
+{
+ input_thread_t *p_input_thread;
+ vlc_value_t val;
+
+ p_input_thread = libvlc_get_input_thread ( p_input, p_exception);
+
+ if ( libvlc_exception_raised( p_exception ) )
+ return -1.0;
+
var_Get( p_input_thread, "length", &val );
vlc_object_release( p_input_thread );
input_thread_t *p_input_thread;
vlc_value_t val;
- if( !p_input )
- {
- libvlc_exception_raise( p_exception, "Input is NULL" );
- return -1;
- }
- p_input_thread = (input_thread_t*)vlc_object_get(
- p_input->p_instance->p_vlc,
- p_input->i_input_id );
- if( !p_input_thread )
- {
- libvlc_exception_raise( p_exception, "Input does not exist" );
- return -1;
- }
+ p_input_thread = libvlc_get_input_thread ( p_input, p_exception);
+
+ if ( libvlc_exception_raised( p_exception ) )
+ return -1.0;
+
var_Get( p_input_thread , "time", &val );
vlc_object_release( p_input_thread );
input_thread_t *p_input_thread;
vlc_value_t val;
- if( !p_input )
- {
- libvlc_exception_raise( p_exception, "Input is NULL" );
- return -1;
- }
+ p_input_thread = libvlc_get_input_thread ( p_input, p_exception);
- p_input_thread = (input_thread_t*)vlc_object_get(
- p_input->p_instance->p_vlc,
- p_input->i_input_id );
- if( !p_input_thread )
- {
- libvlc_exception_raise( p_exception, "Input does not exist" );
+ if ( libvlc_exception_raised( p_exception ) )
return -1.0;
- }
+
var_Get( p_input_thread, "position", &val );
vlc_object_release( p_input_thread );
{
input_thread_t *p_input_thread;
- if( !p_input )
- {
- libvlc_exception_raise( p_exception, "Input is NULL" );
- return VLC_FALSE;
- }
-
- p_input_thread = (input_thread_t*)vlc_object_get(
- p_input->p_instance->p_vlc,
- p_input->i_input_id );
+ p_input_thread = libvlc_get_input_thread ( p_input, p_exception);
- if( !p_input_thread )
- {
- libvlc_exception_raise( p_exception, "Input does not exist" );
+ if ( libvlc_exception_raised( p_exception ) )
return VLC_FALSE;
- }
if ( !p_input_thread->b_die && !p_input_thread->b_dead )
{