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