]> git.sesse.net Git - vlc/blobdiff - include/vlc/vlc.h
A bit of vlc/libvlc cleanup:
[vlc] / include / vlc / vlc.h
index b1e573cbc4046b1984e02e0884b36b12da29a502..0f1144632852385750424fde6f073d11324f3908 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
- * vlc.h: global header for vlc
+ * vlc.h: global header for libvlc (old-style)
  *****************************************************************************
- * Copyright (C) 1998-2004 VideoLAN
+ * Copyright (C) 1998-2004 the VideoLAN team
  * $Id$
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /**
- * \defgroup libvlc Libvlc
+ * \defgroup libvlc_old Libvlc Old
  * This is libvlc, the base library of the VLC program.
+ * This is the legacy API. Please consider using the new libvlc API
  *
  * @{
  */
@@ -46,6 +47,33 @@ typedef int vlc_bool_t;
 typedef struct vlc_list_t vlc_list_t;
 typedef struct vlc_object_t vlc_object_t;
 
+#if (defined( WIN32 ) || defined( UNDER_CE )) && !defined( __MINGW32__ )
+typedef signed __int64 vlc_int64_t;
+# else
+typedef signed long long vlc_int64_t;
+#endif
+
+/**
+ * \defgroup var_type Variable types
+ * These are the different types a vlc variable can have.
+ * @{
+ */
+#define VLC_VAR_VOID      0x0010
+#define VLC_VAR_BOOL      0x0020
+#define VLC_VAR_INTEGER   0x0030
+#define VLC_VAR_HOTKEY    0x0031
+#define VLC_VAR_STRING    0x0040
+#define VLC_VAR_MODULE    0x0041
+#define VLC_VAR_FILE      0x0042
+#define VLC_VAR_DIRECTORY 0x0043
+#define VLC_VAR_VARIABLE  0x0044
+#define VLC_VAR_FLOAT     0x0050
+#define VLC_VAR_TIME      0x0060
+#define VLC_VAR_ADDRESS   0x0070
+#define VLC_VAR_MUTEX     0x0080
+#define VLC_VAR_LIST      0x0090
+/**@}*/
+
 /**
  * VLC value structure
  */
@@ -58,12 +86,7 @@ typedef union
     void *          p_address;
     vlc_object_t *  p_object;
     vlc_list_t *    p_list;
-
-#if defined( WIN32 ) && !defined( __MINGW32__ )
-    signed __int64   i_time;
-# else
-    signed long long i_time;
-#endif
+    vlc_int64_t     i_time;
 
     struct { char *psz_name; int i_object_id; } var;
 
@@ -100,6 +123,7 @@ struct vlc_list_t
 #define VLC_EBADVAR        -31                         /* Bad variable value */
 
 #define VLC_EEXIT         -255                             /* Program exited */
+#define VLC_EEXITSUCCESS  -999                /* Program exited successfully */
 #define VLC_EGENERIC      -666                              /* Generic error */
 
 /*****************************************************************************
@@ -114,24 +138,25 @@ struct vlc_list_t
 
 /* Used by VLC_AddTarget() */
 #define PLAYLIST_INSERT          0x0001
-#define PLAYLIST_REPLACE         0x0002
-#define PLAYLIST_APPEND          0x0004
-#define PLAYLIST_GO              0x0008
-#define PLAYLIST_CHECK_INSERT    0x0010
+#define PLAYLIST_APPEND          0x0002
+#define PLAYLIST_GO              0x0004
+#define PLAYLIST_PREPARSE        0x0008
+#define PLAYLIST_SPREPARSE       0x0010
 
 #define PLAYLIST_END           -666
 
 /*****************************************************************************
  * Required internal headers
  *****************************************************************************/
-#if defined( __VLC__ )
+#if defined( __LIBVLC__ )
 #   include "vlc_common.h"
 #endif
 
 /*****************************************************************************
  * Exported libvlc API
  *****************************************************************************/
-
+#if !defined( __LIBVLC__ )
+/* Otherwise they are declared and exported in vlc_common.h */
 /**
  * Retrieve libvlc version
  *
@@ -139,6 +164,48 @@ struct vlc_list_t
  */
 char const * VLC_Version ( void );
 
+/**
+ * Retrieve libvlc compile time
+ *
+ * \return a string containing the libvlc compile time
+ */
+char const * VLC_CompileTime ( void );
+
+/**
+ * Retrieve the username of the libvlc builder
+ *
+ * \return a string containing the username of the libvlc builder
+ */
+char const * VLC_CompileBy ( void );
+
+/**
+ * Retrieve the host of the libvlc builder
+ *
+ * \return a string containing the host of the libvlc builder
+ */
+char const * VLC_CompileHost ( void );
+
+/**
+ * Retrieve the domain name of the host of the libvlc builder
+ *
+ * \return a string containing the domain name of the host of the libvlc builder
+ */
+char const * VLC_CompileDomain ( void );
+
+/**
+ * Retrieve libvlc compiler version
+ *
+ * \return a string containing the libvlc compiler version
+ */
+char const * VLC_Compiler ( void );
+
+/**
+ * Retrieve libvlc changeset
+ *
+ * \return a string containing the libvlc subversion changeset
+ */
+char const * VLC_Changeset ( void );
+
 /**
  * Return an error string
  *
@@ -147,6 +214,8 @@ char const * VLC_Version ( void );
  */
 char const * VLC_Error ( int i_err );
 
+#endif /* __LIBVLC__ */
+
 /**
  * Initialize libvlc
  *
@@ -155,7 +224,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 +240,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 +256,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 +267,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,34 +275,38 @@ 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
  *
  * This function requests the running threads to finish, waits for their
  * termination, and destroys their structure.
- * Then it will de-init all VLC object initializations. 
+ * Then it will de-init all VLC object initializations.
  *
  * \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 +314,27 @@ 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 * );
+
+/**
+ * Get a VLC variable type
+ *
+ * This function gets the type of a variable of VLC
+ * It stores it in the p_type argument
+ *
+ * \param i_object a vlc object id
+ * \param psz_var a vlc variable name
+ * \param pi_type a pointer to an integer
+ * \return VLC_SUCCESS on success
+ */
+int     VLC_VariableType( int, char const *, int * );
 
 /**
  * Add a target to the current playlist
@@ -262,7 +350,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 +362,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 +373,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,31 +381,182 @@ 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
+ * Tell if VLC is playing
  *
- * If an item is currently playing then stop it.
- * Set the playlist to a stopped state.
+ * If an item is currently playing, it returns
+ * VLC_TRUE, else VLC_FALSE
+ *
+ * \param i_object a vlc object id
+ * \return VLC_TRUE or VLC_FALSE
+ */
+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
  */
-vlc_bool_t VLC_IsPlaying ( int );
+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, 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,11 +566,17 @@ 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
 }
 # endif
 
+#define LICENSE_MSG \
+  _("This program comes with NO WARRANTY, to the extent permitted by " \
+    "law.\nYou may redistribute it under the terms of the GNU General " \
+    "Public License;\nsee the file named COPYING for details.\n" \
+    "Written by the VideoLAN team; see the AUTHORS file.\n")
+
 #endif /* <vlc/vlc.h> */