Commit 3b86ec1d authored by Jean-Paul Saman's avatar Jean-Paul Saman

Readibility cleanup

parent 4a80777b
...@@ -41,17 +41,18 @@ input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input, ...@@ -41,17 +41,18 @@ input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input,
{ {
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
if( !p_input ) RAISENULL( "Input is NULL" ); if( !p_input )
RAISENULL( "Input is NULL" );
p_input_thread = (input_thread_t*)vlc_object_get( p_input_thread = (input_thread_t*)vlc_object_get(
p_input->p_instance->p_libvlc_int, p_input->p_instance->p_libvlc_int,
p_input->i_input_id ); p_input->i_input_id );
if( !p_input_thread ) RAISENULL( "Input does not exist" ); if( !p_input_thread )
RAISENULL( "Input does not exist" );
return p_input_thread; return p_input_thread;
} }
/************************************************************************** /**************************************************************************
* Getters for stream information * Getters for stream information
...@@ -63,8 +64,9 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input, ...@@ -63,8 +64,9 @@ 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; 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 );
...@@ -78,7 +80,8 @@ vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input, ...@@ -78,7 +80,8 @@ 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; 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 );
...@@ -92,8 +95,9 @@ void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time, ...@@ -92,8 +95,9 @@ void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time,
vlc_value_t value; vlc_value_t value;
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; if( libvlc_exception_raised( p_e ) )
return;
value.i_time = time*1000LL; value.i_time = time*1000LL;
var_Set( p_input_thread, "time", value ); var_Set( p_input_thread, "time", value );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
...@@ -105,9 +109,10 @@ void libvlc_input_set_position( libvlc_input_t *p_input, float position, ...@@ -105,9 +109,10 @@ void libvlc_input_set_position( libvlc_input_t *p_input, float position,
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
vlc_value_t val; vlc_value_t val;
val.f_float = position; val.f_float = position;
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; if ( libvlc_exception_raised( p_e ) )
return;
var_Set( p_input_thread, "position", val ); var_Set( p_input_thread, "position", val );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
...@@ -120,7 +125,8 @@ float libvlc_input_get_position( libvlc_input_t *p_input, ...@@ -120,7 +125,8 @@ float libvlc_input_get_position( 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.0;
var_Get( p_input_thread, "position", &val ); var_Get( p_input_thread, "position", &val );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
...@@ -135,7 +141,8 @@ float libvlc_input_get_fps( libvlc_input_t *p_input, ...@@ -135,7 +141,8 @@ float libvlc_input_get_fps( libvlc_input_t *p_input,
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
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 0.0; if ( libvlc_exception_raised( p_e ) )
return 0.0;
if( demux2_Control( p_input_thread->input.p_demux, DEMUX_GET_FPS, &f_fps ) if( demux2_Control( p_input_thread->input.p_demux, DEMUX_GET_FPS, &f_fps )
|| f_fps < 0.1 ) || f_fps < 0.1 )
...@@ -155,7 +162,8 @@ vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input, ...@@ -155,7 +162,8 @@ vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input,
{ {
input_thread_t *p_input_thread = input_thread_t *p_input_thread =
libvlc_get_input_thread ( p_input, p_e); libvlc_get_input_thread ( p_input, p_e);
if ( libvlc_exception_raised( p_e ) ) return VLC_FALSE; if ( libvlc_exception_raised( p_e ) )
return VLC_FALSE;
if ( !p_input_thread->b_die && !p_input_thread->b_dead ) if ( !p_input_thread->b_die && !p_input_thread->b_dead )
{ {
...@@ -176,9 +184,10 @@ void libvlc_input_set_rate( libvlc_input_t *p_input, float rate, ...@@ -176,9 +184,10 @@ void libvlc_input_set_rate( libvlc_input_t *p_input, float rate,
RAISEVOID( "Rate value is invalid" ); RAISEVOID( "Rate value is invalid" );
val.i_int = 1000.0f/rate; val.i_int = 1000.0f/rate;
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; if ( libvlc_exception_raised( p_e ) )
return;
var_Set( p_input_thread, "rate", val ); var_Set( p_input_thread, "rate", val );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
...@@ -191,7 +200,8 @@ float libvlc_input_get_rate( libvlc_input_t *p_input, ...@@ -191,7 +200,8 @@ float libvlc_input_get_rate( 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.0;
var_Get( p_input_thread, "rate", &val ); var_Get( p_input_thread, "rate", &val );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
...@@ -206,7 +216,8 @@ int libvlc_input_get_state( libvlc_input_t *p_input, ...@@ -206,7 +216,8 @@ int libvlc_input_get_state( 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 0; if ( libvlc_exception_raised( p_e ) )
return 0;
var_Get( p_input_thread, "state", &val ); var_Get( p_input_thread, "state", &val );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* $Id: core.c 14187 2006-02-07 16:37:40Z courmisch $ * $Id: core.c 14187 2006-02-07 16:37:40Z courmisch $
* *
* Authors: Clment Stenac <zorglub@videolan.org> * Authors: Clent Stenac <zorglub@videolan.org>
* Filippo Carone <littlejohn@videolan.org> * Filippo Carone <littlejohn@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -62,7 +62,7 @@ static vout_thread_t *GetVout( libvlc_input_t *p_input, ...@@ -62,7 +62,7 @@ static vout_thread_t *GetVout( libvlc_input_t *p_input,
return NULL; return NULL;
} }
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
return p_vout; return p_vout;
} }
/********************************************************************** /**********************************************************************
...@@ -91,7 +91,6 @@ void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen, ...@@ -91,7 +91,6 @@ void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen,
"Unexpected error while setting fullscreen value" ); "Unexpected error while setting fullscreen value" );
vlc_object_release( p_vout1 ); vlc_object_release( p_vout1 );
} }
int libvlc_get_fullscreen( libvlc_input_t *p_input, int libvlc_get_fullscreen( libvlc_input_t *p_input,
...@@ -136,7 +135,6 @@ void libvlc_toggle_fullscreen( libvlc_input_t *p_input, ...@@ -136,7 +135,6 @@ void libvlc_toggle_fullscreen( libvlc_input_t *p_input,
"Unexpected error while setting fullscreen value" ); "Unexpected error while setting fullscreen value" );
vlc_object_release( p_vout1 ); vlc_object_release( p_vout1 );
} }
void void
...@@ -145,7 +143,7 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath, ...@@ -145,7 +143,7 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath,
{ {
vout_thread_t *p_vout = GetVout( p_input, p_e ); vout_thread_t *p_vout = GetVout( p_input, p_e );
input_thread_t *p_input_thread; input_thread_t *p_input_thread;
char path[256]; char path[256];
/* GetVout will raise the exception for us */ /* GetVout will raise the exception for us */
...@@ -162,7 +160,7 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath, ...@@ -162,7 +160,7 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath,
libvlc_exception_raise( p_e, "Input does not exist" ); libvlc_exception_raise( p_e, "Input does not exist" );
return; return;
} }
snprintf( path, 255, "%s", psz_filepath ); snprintf( path, 255, "%s", psz_filepath );
var_SetString( p_vout, "snapshot-path", path ); var_SetString( p_vout, "snapshot-path", path );
var_SetString( p_vout, "snapshot-format", "png" ); var_SetString( p_vout, "snapshot-format", "png" );
...@@ -170,9 +168,6 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath, ...@@ -170,9 +168,6 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath,
vout_Control( p_vout, VOUT_SNAPSHOT ); vout_Control( p_vout, VOUT_SNAPSHOT );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
return;
} }
int libvlc_video_get_height( libvlc_input_t *p_input, int libvlc_video_get_height( libvlc_input_t *p_input,
...@@ -211,7 +206,7 @@ vlc_bool_t libvlc_input_has_vout( libvlc_input_t *p_input, ...@@ -211,7 +206,7 @@ vlc_bool_t libvlc_input_has_vout( libvlc_input_t *p_input,
} }
vlc_object_release( p_vout ); vlc_object_release( p_vout );
return VLC_TRUE; return VLC_TRUE;
} }
...@@ -222,9 +217,8 @@ int libvlc_video_reparent( libvlc_input_t *p_input, libvlc_drawable_t d, ...@@ -222,9 +217,8 @@ int libvlc_video_reparent( libvlc_input_t *p_input, libvlc_drawable_t d,
vout_thread_t *p_vout = GetVout( p_input, p_e ); vout_thread_t *p_vout = GetVout( p_input, p_e );
vout_Control( p_vout , VOUT_REPARENT, d); vout_Control( p_vout , VOUT_REPARENT, d);
vlc_object_release( p_vout ); vlc_object_release( p_vout );
return 0; return 0;
} }
void libvlc_video_resize( libvlc_input_t *p_input, int width, int height, libvlc_exception_t *p_e ) void libvlc_video_resize( libvlc_input_t *p_input, int width, int height, libvlc_exception_t *p_e )
...@@ -332,7 +326,6 @@ int libvlc_video_destroy( libvlc_input_t *p_input, ...@@ -332,7 +326,6 @@ int libvlc_video_destroy( libvlc_input_t *p_input,
vlc_object_detach( p_vout ); vlc_object_detach( p_vout );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
vout_Destroy( p_vout ); vout_Destroy( p_vout );
return 0; return 0;
} }
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