mediacontrol.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * control.h: global header for mediacontrol
00003  *****************************************************************************
00004  * Copyright (C) 2005 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 /**
00025  * \defgroup mediacontrol MediaControl
00026  * This is the MediaControl API, * intended to provide a generic API to movie players.
00027  *
00028  * @{
00029  */
00030 
00031 
00032 #ifndef VLC_CONTROL_H
00033 #define VLC_CONTROL_H 1
00034 
00035 # ifdef __cplusplus
00036 extern "C" {
00037 # endif
00038 
00039 #if defined( WIN32 )
00040 #include <windows.h>
00041 typedef HWND WINDOWHANDLE;
00042 #else
00043 typedef int WINDOWHANDLE;
00044 #endif
00045 
00046 #include <vlc/libvlc.h>
00047 #include <vlc/mediacontrol_structures.h>
00048 
00049 /**
00050  * mediacontrol_Instance is an opaque structure, defined in
00051  * mediacontrol_internal.h. API users do not have to mess with it.
00052  */
00053 typedef struct mediacontrol_Instance mediacontrol_Instance;
00054 
00055 /**************************************************************************
00056  *  Helper functions
00057  ***************************************************************************/
00058 
00059 /**
00060  * Free a RGBPicture structure.
00061  * \param pic: the RGBPicture structure
00062  */
00063 VLC_PUBLIC_API void mediacontrol_RGBPicture__free( mediacontrol_RGBPicture *pic );
00064 
00065 VLC_PUBLIC_API void mediacontrol_PlaylistSeq__free( mediacontrol_PlaylistSeq *ps );
00066 
00067 /**
00068  * Free a StreamInformation structure.
00069  * \param pic: the StreamInformation structure
00070  */
00071 VLC_PUBLIC_API void
00072 mediacontrol_StreamInformation__free( mediacontrol_StreamInformation* p_si );
00073 
00074 /**
00075  * Instanciate and initialize an exception structure.
00076  * \return the exception
00077  */
00078 VLC_PUBLIC_API mediacontrol_Exception *
00079   mediacontrol_exception_create( void );
00080 
00081 /**
00082  * Initialize an existing exception structure.
00083  * \param p_exception the exception to initialize.
00084  */
00085 VLC_PUBLIC_API void
00086   mediacontrol_exception_init( mediacontrol_Exception *exception );
00087 
00088 /**
00089  * Clean up an existing exception structure after use.
00090  * \param p_exception the exception to clean up.
00091  */
00092 VLC_PUBLIC_API void
00093 mediacontrol_exception_cleanup( mediacontrol_Exception *exception );
00094 
00095 /**
00096  * Free an exception structure created with mediacontrol_exception_create().
00097  * \return the exception
00098  */
00099 VLC_PUBLIC_API void mediacontrol_exception_free(mediacontrol_Exception *exception);
00100 
00101 /*****************************************************************************
00102  * Core functions
00103  *****************************************************************************/
00104 
00105 /**
00106  * Create a MediaControl instance with parameters
00107  * \param argc the number of arguments
00108  * \param argv parameters
00109  * \param exception an initialized exception pointer
00110  * \return a mediacontrol_Instance
00111  */
00112 VLC_PUBLIC_API mediacontrol_Instance *
00113 mediacontrol_new( int argc, char **argv, mediacontrol_Exception *exception );
00114 
00115 /**
00116  * Create a MediaControl instance from an existing libvlc instance
00117  * \param p_instance the libvlc instance
00118  * \param exception an initialized exception pointer
00119  * \return a mediacontrol_Instance
00120  */
00121 VLC_PUBLIC_API mediacontrol_Instance *
00122 mediacontrol_new_from_instance( libvlc_instance_t* p_instance,
00123                 mediacontrol_Exception *exception );
00124 
00125 /**
00126  * Get the associated libvlc instance
00127  * \param self: the mediacontrol instance
00128  * \return a libvlc instance
00129  */
00130 VLC_PUBLIC_API libvlc_instance_t*
00131 mediacontrol_get_libvlc_instance( mediacontrol_Instance* self );
00132 
00133 /**
00134  * Get the associated libvlc_media_player
00135  * \param self: the mediacontrol instance
00136  * \return a libvlc_media_player_t instance
00137  */
00138 VLC_PUBLIC_API libvlc_media_player_t*
00139 mediacontrol_get_media_player( mediacontrol_Instance* self );
00140 
00141 /**
00142  * Get the current position
00143  * \param self the mediacontrol instance
00144  * \param an_origin the position origin
00145  * \param a_key the position unit
00146  * \param exception an initialized exception pointer
00147  * \return a mediacontrol_Position
00148  */
00149 VLC_PUBLIC_API mediacontrol_Position * mediacontrol_get_media_position(
00150                          mediacontrol_Instance *self,
00151                          const mediacontrol_PositionOrigin an_origin,
00152                          const mediacontrol_PositionKey a_key,
00153                          mediacontrol_Exception *exception );
00154 
00155 /**
00156  * Set the position
00157  * \param self the mediacontrol instance
00158  * \param a_position a mediacontrol_Position
00159  * \param exception an initialized exception pointer
00160  */
00161 VLC_PUBLIC_API void mediacontrol_set_media_position( mediacontrol_Instance *self,
00162                                       const mediacontrol_Position *a_position,
00163                                       mediacontrol_Exception *exception );
00164 
00165 /**
00166  * Play the movie at a given position
00167  * \param self the mediacontrol instance
00168  * \param a_position a mediacontrol_Position
00169  * \param exception an initialized exception pointer
00170  */
00171 VLC_PUBLIC_API void mediacontrol_start( mediacontrol_Instance *self,
00172                          const mediacontrol_Position *a_position,
00173                          mediacontrol_Exception *exception );
00174 
00175 /**
00176  * Pause the movie at a given position
00177  * \param self the mediacontrol instance
00178  * \param exception an initialized exception pointer
00179  */
00180 VLC_PUBLIC_API void mediacontrol_pause( mediacontrol_Instance *self,
00181                          mediacontrol_Exception *exception );
00182 
00183 /**
00184  * Resume the movie at a given position
00185  * \param self the mediacontrol instance
00186  * \param exception an initialized exception pointer
00187  */
00188 VLC_PUBLIC_API void mediacontrol_resume( mediacontrol_Instance *self,
00189                           mediacontrol_Exception *exception );
00190 
00191 /**
00192  * Stop the movie at a given position
00193  * \param self the mediacontrol instance
00194  * \param exception an initialized exception pointer
00195  */
00196 VLC_PUBLIC_API void mediacontrol_stop( mediacontrol_Instance *self,
00197                         mediacontrol_Exception *exception );
00198 
00199 /**
00200  * Exit the player
00201  * \param self the mediacontrol instance
00202  */
00203 VLC_PUBLIC_API void mediacontrol_exit( mediacontrol_Instance *self );
00204 
00205 /**
00206  * Set the MRL to be played.
00207  * \param self the mediacontrol instance
00208  * \param psz_file the MRL
00209  * \param exception an initialized exception pointer
00210  */
00211 VLC_PUBLIC_API void mediacontrol_set_mrl( mediacontrol_Instance *self,
00212                                      const char* psz_file,
00213                                      mediacontrol_Exception *exception );
00214 
00215 /**
00216  * Get the MRL to be played.
00217  * \param self the mediacontrol instance
00218  * \param exception an initialized exception pointer
00219  */
00220 VLC_PUBLIC_API char * mediacontrol_get_mrl( mediacontrol_Instance *self,
00221                                             mediacontrol_Exception *exception );
00222 
00223 /*****************************************************************************
00224  * A/V functions
00225  *****************************************************************************/
00226 /**
00227  * Get a snapshot
00228  * \param self the mediacontrol instance
00229  * \param a_position the desired position (ignored for now)
00230  * \param exception an initialized exception pointer
00231  * \return a RGBpicture
00232  */
00233 VLC_PUBLIC_API mediacontrol_RGBPicture *
00234   mediacontrol_snapshot( mediacontrol_Instance *self,
00235                          const mediacontrol_Position *a_position,
00236                          mediacontrol_Exception *exception );
00237 
00238 /**
00239  *  Displays the message string, between "begin" and "end" positions.
00240  * \param self the mediacontrol instance
00241  * \param message the message to display
00242  * \param begin the begin position
00243  * \param end the end position
00244  * \param exception an initialized exception pointer
00245  */
00246 VLC_PUBLIC_API void mediacontrol_display_text( mediacontrol_Instance *self,
00247                                 const char *message,
00248                                 const mediacontrol_Position *begin,
00249                                 const mediacontrol_Position *end,
00250                                 mediacontrol_Exception *exception );
00251 
00252 /**
00253  *  Get information about a stream
00254  * \param self the mediacontrol instance
00255  * \param a_key the time unit
00256  * \param exception an initialized exception pointer
00257  * \return a mediacontrol_StreamInformation
00258  */
00259 VLC_PUBLIC_API mediacontrol_StreamInformation *
00260   mediacontrol_get_stream_information( mediacontrol_Instance *self,
00261                                        mediacontrol_PositionKey a_key,
00262                                        mediacontrol_Exception *exception );
00263 
00264 /**
00265  * Get the current audio level, normalized in [0..100]
00266  * \param self the mediacontrol instance
00267  * \param exception an initialized exception pointer
00268  * \return the volume
00269  */
00270 VLC_PUBLIC_API unsigned short
00271   mediacontrol_sound_get_volume( mediacontrol_Instance *self,
00272                                  mediacontrol_Exception *exception );
00273 /**
00274  * Set the audio level
00275  * \param self the mediacontrol instance
00276  * \param volume the volume (normalized in [0..100])
00277  * \param exception an initialized exception pointer
00278  */
00279 VLC_PUBLIC_API void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
00280                                     const unsigned short volume,
00281                                     mediacontrol_Exception *exception );
00282 
00283 /**
00284  * Set the video output window
00285  * \param self the mediacontrol instance
00286  * \param visual_id the Xid or HWND, depending on the platform
00287  * \param exception an initialized exception pointer
00288  */
00289 VLC_PUBLIC_API int mediacontrol_set_visual( mediacontrol_Instance *self,
00290                                     WINDOWHANDLE visual_id,
00291                                     mediacontrol_Exception *exception );
00292 
00293 /**
00294  * Get the current playing rate, in percent
00295  * \param self the mediacontrol instance
00296  * \param exception an initialized exception pointer
00297  * \return the rate
00298  */
00299 VLC_PUBLIC_API int mediacontrol_get_rate( mediacontrol_Instance *self,
00300                mediacontrol_Exception *exception );
00301 
00302 /**
00303  * Set the playing rate, in percent
00304  * \param self the mediacontrol instance
00305  * \param rate the desired rate
00306  * \param exception an initialized exception pointer
00307  */
00308 VLC_PUBLIC_API void mediacontrol_set_rate( mediacontrol_Instance *self,
00309                 const int rate,
00310                 mediacontrol_Exception *exception );
00311 
00312 /**
00313  * Get current fullscreen status
00314  * \param self the mediacontrol instance
00315  * \param exception an initialized exception pointer
00316  * \return the fullscreen status
00317  */
00318 VLC_PUBLIC_API int mediacontrol_get_fullscreen( mediacontrol_Instance *self,
00319                  mediacontrol_Exception *exception );
00320 
00321 /**
00322  * Set fullscreen status
00323  * \param self the mediacontrol instance
00324  * \param b_fullscreen the desired status
00325  * \param exception an initialized exception pointer
00326  */
00327 VLC_PUBLIC_API void mediacontrol_set_fullscreen( mediacontrol_Instance *self,
00328                   const int b_fullscreen,
00329                   mediacontrol_Exception *exception );
00330 
00331 # ifdef __cplusplus
00332 }
00333 # endif
00334 
00335 #endif
00336 
00337 /** @} */

Generated on Wed Aug 13 08:02:37 2008 for VLC by  doxygen 1.5.1