Readibility cleanup

This commit is contained in:
Jean-Paul Saman 2006-10-29 09:35:43 +00:00
parent 4a80777b4e
commit 3b86ec1d20
2 changed files with 35 additions and 31 deletions

View File

@ -41,17 +41,18 @@ input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input,
{
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->p_instance->p_libvlc_int,
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;
}
/**************************************************************************
* Getters for stream information
@ -63,8 +64,9 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
vlc_value_t val;
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 );
vlc_object_release( p_input_thread );
@ -78,7 +80,8 @@ vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
vlc_value_t val;
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 );
vlc_object_release( p_input_thread );
@ -92,8 +95,9 @@ void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time,
vlc_value_t value;
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;
var_Set( p_input_thread, "time", value );
vlc_object_release( p_input_thread );
@ -105,9 +109,10 @@ void libvlc_input_set_position( libvlc_input_t *p_input, float position,
input_thread_t *p_input_thread;
vlc_value_t val;
val.f_float = position;
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 );
vlc_object_release( p_input_thread );
@ -120,7 +125,8 @@ float libvlc_input_get_position( libvlc_input_t *p_input,
vlc_value_t val;
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 );
vlc_object_release( p_input_thread );
@ -135,7 +141,8 @@ float libvlc_input_get_fps( libvlc_input_t *p_input,
input_thread_t *p_input_thread;
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 )
|| f_fps < 0.1 )
@ -155,7 +162,8 @@ vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input,
{
input_thread_t *p_input_thread =
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 )
{
@ -176,9 +184,10 @@ void libvlc_input_set_rate( libvlc_input_t *p_input, float rate,
RAISEVOID( "Rate value is invalid" );
val.i_int = 1000.0f/rate;
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 );
vlc_object_release( p_input_thread );
@ -191,7 +200,8 @@ float libvlc_input_get_rate( libvlc_input_t *p_input,
vlc_value_t val;
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 );
vlc_object_release( p_input_thread );
@ -206,7 +216,8 @@ int libvlc_input_get_state( libvlc_input_t *p_input,
vlc_value_t val;
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 );
vlc_object_release( p_input_thread );

View File

@ -5,7 +5,7 @@
*
* $Id: core.c 14187 2006-02-07 16:37:40Z courmisch $
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Authors: Cl<EFBFBD>ent Stenac <zorglub@videolan.org>
* Filippo Carone <littlejohn@videolan.org>
*
* 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,
return NULL;
}
vlc_object_release( p_input_thread );
return p_vout;
}
/**********************************************************************
@ -91,7 +91,6 @@ void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen,
"Unexpected error while setting fullscreen value" );
vlc_object_release( p_vout1 );
}
int libvlc_get_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" );
vlc_object_release( p_vout1 );
}
void
@ -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 );
input_thread_t *p_input_thread;
char path[256];
/* GetVout will raise the exception for us */
@ -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" );
return;
}
snprintf( path, 255, "%s", psz_filepath );
var_SetString( p_vout, "snapshot-path", path );
var_SetString( p_vout, "snapshot-format", "png" );
@ -170,9 +168,6 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath,
vout_Control( p_vout, VOUT_SNAPSHOT );
vlc_object_release( p_vout );
vlc_object_release( p_input_thread );
return;
}
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,
}
vlc_object_release( p_vout );
return VLC_TRUE;
}
@ -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_Control( p_vout , VOUT_REPARENT, d);
vlc_object_release( p_vout );
return 0;
}
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,
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_Destroy( p_vout );
return 0;
}