Commit 347e1ecf authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* WARNING: Libvlc API change

 - VLC_Set VLC_Get were changed to VLC_VariableGet VLC_VariableSet
 - VLC_ClearPlaylist was changed to VLC_PlaylistClear
 - Added a lot of new calls: 
   VLC_PositionGet, VLC_PositionSet, VLC_TimeGet, VLC_TimeSet,
   VLC_LengthGet, VLC_SpeedFaster, VLC_SpeedSlower, VLC_PlaylistIndex,
   VLC_PlaylistNumberOfItems, VLC_PlaylistNext, VLC_PlaylistPrev, 
   VLC_VolumeGet, VLC_VolumeSet, VLC_VolumeMute.
 - everything doxygenized.
 - There are NO mozilla functions of these additions yet. (someone else please?) 
parent b4e738fd
......@@ -155,7 +155,7 @@ char const * VLC_Error ( int i_err );
*
* \return vlc object id or an error code
*/
int VLC_Create ( void );
int VLC_Create( void );
/**
* Initialize a vlc_t structure
......@@ -171,7 +171,7 @@ int VLC_Create ( void );
* \param ppsz_argv an array of arguments
* \return VLC_SUCCESS on success
*/
int VLC_Init ( int, int, char *[] );
int VLC_Init( int, int, char *[] );
/**
* Add an interface
......@@ -187,7 +187,7 @@ int VLC_Init ( int, int, char *[] );
* \param b_play start playing when the interface is done loading
* \return VLC_SUCCESS on success
*/
int VLC_AddIntf ( int, char const *, vlc_bool_t, vlc_bool_t );
int VLC_AddIntf( int, char const *, vlc_bool_t, vlc_bool_t );
/**
* Ask vlc to die
......@@ -198,7 +198,7 @@ int VLC_AddIntf ( int, char const *, vlc_bool_t, vlc_bool_t );
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_Die ( int );
int VLC_Die( int );
/**
* Clean up all the intf, playlist, vout and aout
......@@ -206,10 +206,12 @@ int VLC_Die ( int );
* This function requests all intf, playlist, vout and aout objects to finish
* and CleanUp. Only a blank VLC object should remain after this.
*
* \note This function was previously called VLC_Stop
*
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_CleanUp ( int );
int VLC_CleanUp( int );
/**
* Destroy all threads and the VLC object
......@@ -221,19 +223,21 @@ int VLC_CleanUp ( int );
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_Destroy ( int );
int VLC_Destroy( int );
/**
* Set a VLC variable
*
* This function sets a variable of VLC
*
* \note Was previously called VLC_Set
*
* \param i_object a vlc object id
* \param psz_var a vlc variable name
* \param value a vlc_value_t structure
* \return VLC_SUCCESS on success
*/
int VLC_Set ( int, char const *, vlc_value_t );
int VLC_VariableSet( int, char const *, vlc_value_t );
/**
* Get a VLC variable
......@@ -241,12 +245,14 @@ int VLC_Set ( int, char const *, vlc_value_t );
* This function gets the value of a variable of VLC
* It stores it in the p_value argument
*
* \note Was previously called VLC_Get
*
* \param i_object a vlc object id
* \param psz_var a vlc variable name
* \param p_value a pointer to a vlc_value_t structure
* \return VLC_SUCCESS on success
*/
int VLC_Get ( int, char const *, vlc_value_t * );
int VLC_VariableGet( int, char const *, vlc_value_t * );
/**
* Add a target to the current playlist
......@@ -262,7 +268,7 @@ int VLC_Get ( int, char const *, vlc_value_t * );
* \param i_pos the position at which to add the new target (PLAYLIST_END for end)
* \return VLC_SUCCESS on success
*/
int VLC_AddTarget ( int, char const *, const char **, int, int, int );
int VLC_AddTarget( int, char const *, const char **, int, int, int );
/**
* Start the playlist and play the currently selected playlist item
......@@ -274,7 +280,7 @@ int VLC_AddTarget ( int, char const *, const char **, int, int, int );
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_Play ( int );
int VLC_Play( int );
/**
* Pause the currently playing item. Resume it if already paused
......@@ -285,7 +291,7 @@ int VLC_Play ( int );
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_Pause ( int );
int VLC_Pause( int );
/**
* Stop the playlist
......@@ -293,10 +299,12 @@ int VLC_Pause ( int );
* If an item is currently playing then stop it.
* Set the playlist to a stopped state.
*
* \note This function is new. The old VLC_Stop is now called VLC_CleanUp
*
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_Stop ( int );
int VLC_Stop( int );
/**
* Stop the playlist
......@@ -307,17 +315,166 @@ int VLC_Stop ( int );
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
vlc_bool_t VLC_IsPlaying ( int );
vlc_bool_t VLC_IsPlaying( int );
/**
* Get the current position in a input
*
* Return the current position as a float
* This method should be used for time sliders etc
* \note For some inputs, this will be unknown.
*
* \param i_object a vlc object id
* \return a float in the range of 0.0 - 1.0
*/
float VLC_PositionGet( int );
/**
* Set the current position in a input
*
* Set the current position as a float
* This method should be used for time sliders etc
* \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, 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 );
/**
* 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, int, vlc_bool_t );
/**
* 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 );
/**
* 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 );
/**
* 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 );
/**
* Return the current playlist item
*
* \param i_object a vlc object id
* \return the index of the playlistitem that is currently selected for play
*/
int VLC_PlaylistIndex( int );
/**
* Total amount of items in the playlist
*
* \param i_object a vlc object id
* \return amount of playlist items
*/
int VLC_PlaylistNumberOfItems( int );
/**
* Next playlist item
*
* Skip to the next playlistitem and play it.
*
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_PlaylistNext( int );
/**
* Previous playlist item
*
* Skip to the previous playlistitem and play it.
*
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_PlaylistPrev( int );
/**
* Clear the contents of the playlist
*
* Completly empty the entire playlist.
*
* \note Was previously called VLC_ClearPlaylist
*
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_PlaylistClear( int );
/**
* Change the volume
*
* \param i_object a vlc object id
* \param i_volume something in a range from 0-200
* \return the new volume (range 0-200 %)
*/
int VLC_VolumeSet( int );
/**
* Get the current volume
*
* Retrieve the current volume.
*
* \param i_object a vlc object id
* \return the current volume (range 0-200 %)
*/
int VLC_VolumeGet( int );
/**
* Mute/Unmute the volume
*
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_ClearPlaylist( int );
int VLC_VolumeMute( int );
/**
* Toggle Fullscreen mode
......@@ -327,7 +484,7 @@ int VLC_ClearPlaylist( int );
* \param i_object a vlc object id
* \return VLC_SUCCESS on success
*/
int VLC_FullScreen ( int );
int VLC_FullScreen( int );
# ifdef __cplusplus
......
......@@ -196,7 +196,7 @@ int16 NPP_HandleEvent( NPP instance, void * event )
if (pouetEvent->what == 6)
{
value.i_int = 1;
VLC_Set( p_plugin->i_vlc, "drawableredraw", value );
VLC_VariableSet( p_plugin->i_vlc, "drawableredraw", value );
return true;
}
......@@ -342,11 +342,11 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
}
value.psz_string = "dummy";
VLC_Set( p_plugin->i_vlc, "conf::intf", value );
VLC_VariableSet( p_plugin->i_vlc, "conf::intf", value );
value.psz_string = VOUT_PLUGINS;
VLC_Set( p_plugin->i_vlc, "conf::vout", value );
VLC_VariableSet( p_plugin->i_vlc, "conf::vout", value );
value.psz_string = AOUT_PLUGINS;
VLC_Set( p_plugin->i_vlc, "conf::aout", value );
VLC_VariableSet( p_plugin->i_vlc, "conf::aout", value );
#else
p_plugin->i_vlc = 1;
......@@ -392,7 +392,7 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
if( !strcmp( argv[i], "yes" ) )
{
value.b_bool = VLC_TRUE;
VLC_Set( p_plugin->i_vlc, "conf::loop", value );
VLC_VariableSet( p_plugin->i_vlc, "conf::loop", value );
}
}
else if( !strcmp( argn[i], "fullscreen" ) )
......@@ -400,7 +400,7 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
if( !strcmp( argv[i], "yes" ) )
{
value.b_bool = VLC_TRUE;
VLC_Set( p_plugin->i_vlc, "conf::fullscreen", value );
VLC_VariableSet( p_plugin->i_vlc, "conf::fullscreen", value );
}
}
#endif
......@@ -478,12 +478,12 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
#ifdef XP_MACOSX
value.i_int = ((NP_Port*) (window->window))->port;
VLC_Set( p_plugin->i_vlc, "drawable", value );
VLC_VariableSet( p_plugin->i_vlc, "drawable", value );
valueportx.i_int = ((NP_Port*) (window->window))->portx;
valueporty.i_int = ((NP_Port*) (window->window))->porty;
VLC_Set( p_plugin->i_vlc, "drawableportx", valueportx );
VLC_Set( p_plugin->i_vlc, "drawableporty", valueporty );
VLC_VariableSet( p_plugin->i_vlc, "drawableportx", valueportx );
VLC_VariableSet( p_plugin->i_vlc, "drawableporty", valueporty );
valuex.i_int = window->x;
valuey.i_int = window->y;
......@@ -494,14 +494,14 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
valueb.i_int = window->clipRect.bottom;
valuer.i_int = window->clipRect.right;
VLC_Set( p_plugin->i_vlc, "drawablet", valuet );
VLC_Set( p_plugin->i_vlc, "drawablel", valuel );
VLC_Set( p_plugin->i_vlc, "drawableb", valueb );
VLC_Set( p_plugin->i_vlc, "drawabler", valuer );
VLC_Set( p_plugin->i_vlc, "drawablex", valuex );
VLC_Set( p_plugin->i_vlc, "drawabley", valuey );
VLC_Set( p_plugin->i_vlc, "drawablew", valuew );
VLC_Set( p_plugin->i_vlc, "drawableh", valueh );
VLC_VariableSet( p_plugin->i_vlc, "drawablet", valuet );
VLC_VariableSet( p_plugin->i_vlc, "drawablel", valuel );
VLC_VariableSet( p_plugin->i_vlc, "drawableb", valueb );
VLC_VarialbeSet( p_plugin->i_vlc, "drawabler", valuer );
VLC_VariableSet( p_plugin->i_vlc, "drawablex", valuex );
VLC_VariableSet( p_plugin->i_vlc, "drawabley", valuey );
VLC_VariableSet( p_plugin->i_vlc, "drawablew", valuew );
VLC_VariableSet( p_plugin->i_vlc, "drawableh", valueh );
p_plugin->window = window;
......@@ -527,7 +527,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
#else
/* FIXME: this cast sucks */
value.i_int = (int) (ptrdiff_t) (void *) window->window;
VLC_Set( p_plugin->i_vlc, "drawable", value );
VLC_VariableSet( p_plugin->i_vlc, "drawable", value );
#endif
#endif
......
......@@ -7,6 +7,7 @@
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>
* Derk-Jan Hartman <hartman at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -874,9 +875,9 @@ int VLC_Destroy( int i_object )
}
/*****************************************************************************
* VLC_Set: set a vlc variable
* VLC_VariableSet: set a vlc variable
*****************************************************************************/
int VLC_Set( int i_object, char const *psz_var, vlc_value_t value )
int VLC_VariableSet( int i_object, char const *psz_var, vlc_value_t value )
{
vlc_t *p_vlc = vlc_current_object( i_object );
int i_ret;
......@@ -924,7 +925,7 @@ int VLC_Set( int i_object, char const *psz_var, vlc_value_t value )
}
/*****************************************************************************
* VLC_Get: get a vlc variable
* VLC_VariableGet: get a vlc variable
*****************************************************************************/
int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value )
{
......@@ -1098,18 +1099,427 @@ vlc_bool_t VLC_IsPlaying( int i_object )
}
b_playing = playlist_IsPlaying( p_playlist );
vlc_object_release( p_playlist );
if( i_object ) vlc_object_release( p_vlc );
return b_playing;
}
/**
* Get the current position in a input
*
* Return the current position as a float
* \note For some inputs, this will be unknown.
*
* \param i_object a vlc object id
* \return a float in the range of 0.0 - 1.0
*/
float VLC_PositionGet( 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, "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 * 1000000;
var_Set( p_input, "time-offset", val );
}
else
{
val.i_time = i_seconds * 1000000;
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 / 1000000;
}
/**
* 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 / DEFAULT_RATE;
}
/**
* 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 / DEFAULT_RATE;
}
/**
* 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;
playlist_t * p_playlist;
vlc_t *p_vlc = vlc_current_object( i_object );
/* Check that the handle is valid */
if( !p_vlc )
{
return VLC_ENOOBJ;
}
p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_CHILD );
if( !p_playlist )
{
if( i_object ) vlc_object_release( p_vlc );
return VLC_ENOOBJ;
}
i_index = p_playlist->i_index;
vlc_object_release( p_playlist );
if( i_object ) vlc_object_release( p_vlc );
return i_index;
}
return b_playing;
/**
* Total amount of items in the playlist
*
* \param i_object a vlc object id
* \return amount of playlist items
*/
int VLC_PlaylistNumberOfItems( int i_object )
{
int i_size;
playlist_t * p_playlist;
vlc_t *p_vlc = vlc_current_object( i_object );
/* Check that the handle is valid */
if( !p_vlc )