Commit 57980f40 authored by Filippo Carone's avatar Filippo Carone

libvlc input and video update:

* video.c: added 1 release object in GetVout
* input.c: added libvlc_get_input_thread helper
parent 65c56bb9
......@@ -32,18 +32,18 @@ void libvlc_input_free( libvlc_input_t *p_input )
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;
}
......@@ -52,9 +52,29 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
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 );
......@@ -67,20 +87,12 @@ vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
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 );
......@@ -93,20 +105,11 @@ float libvlc_input_get_position( libvlc_input_t *p_input,
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 );
......@@ -118,21 +121,10 @@ vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input,
{
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 )
{
......
......@@ -51,9 +51,12 @@ static vout_thread_t *GetVout( libvlc_input_t *p_input,
p_vout = vlc_object_find( p_input_thread, VLC_OBJECT_VOUT, FIND_CHILD );
if( !p_vout )
{
vlc_object_release( p_input_thread );
libvlc_exception_raise( p_exception, "No active video output" );
return NULL;
}
vlc_object_release( p_input_thread );
return p_vout;
}
/**********************************************************************
......
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