vlc_interface.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlc_interface.h: interface access for other threads
00003  * This library provides basic functions for threads to interact with user
00004  * interface, such as message output.
00005  *****************************************************************************
00006  * Copyright (C) 1999, 2000 the VideoLAN team
00007  * $Id: ed9b64edf48717f3566d223bc0f27a11f87b4b18 $
00008  *
00009  * Authors: Vincent Seguin <seguin@via.ecp.fr>
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00024  *****************************************************************************/
00025 
00026 #ifndef VLC_INTF_H_
00027 #define VLC_INTF_H_
00028 
00029 # ifdef __cplusplus
00030 extern "C" {
00031 # endif
00032 
00033 typedef struct intf_dialog_args_t intf_dialog_args_t;
00034 
00035 /**
00036  * \file
00037  * This file contains structures and function prototypes for
00038  * interface management in vlc
00039  */
00040 
00041 /**
00042  * \defgroup vlc_interface Interface
00043  * These functions and structures are for interface management
00044  * @{
00045  */
00046 
00047 typedef struct intf_sys_t intf_sys_t;
00048 
00049 /** Describe all interface-specific data of the interface thread */
00050 typedef struct intf_thread_t
00051 {
00052     VLC_COMMON_MEMBERS
00053 
00054     struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
00055     /* Thread properties and locks */
00056 #if defined( __APPLE__ )
00057     bool          b_should_run_on_first_thread;
00058 #endif
00059 
00060     /* Specific interfaces */
00061     intf_sys_t *        p_sys;                          /** system interface */
00062     char *              psz_intf;                    /** intf name specified */
00063 
00064     /** Interface module */
00065     module_t *   p_module;
00066     void      ( *pf_run )    ( struct intf_thread_t * ); /** Run function */
00067 
00068     /** Specific for dialogs providers */
00069     void ( *pf_show_dialog ) ( struct intf_thread_t *, int, int,
00070                                intf_dialog_args_t * );
00071 
00072     config_chain_t *p_cfg;
00073 } intf_thread_t;
00074 
00075 /** \brief Arguments passed to a dialogs provider
00076  *  This describes the arguments passed to the dialogs provider. They are
00077  *  mainly used with INTF_DIALOG_FILE_GENERIC.
00078  */
00079 struct intf_dialog_args_t
00080 {
00081     intf_thread_t *p_intf;
00082     char *psz_title;
00083 
00084     char **psz_results;
00085     int  i_results;
00086 
00087     void (*pf_callback) ( intf_dialog_args_t * );
00088     void *p_arg;
00089 
00090     /* Specifically for INTF_DIALOG_FILE_GENERIC */
00091     char *psz_extensions;
00092     bool b_save;
00093     bool b_multiple;
00094 
00095     /* Specific to INTF_DIALOG_INTERACTION */
00096     struct interaction_dialog_t *p_dialog;
00097 };
00098 
00099 /*****************************************************************************
00100  * Prototypes
00101  *****************************************************************************/
00102 VLC_EXPORT( int, intf_Create, ( vlc_object_t *, const char * ) );
00103 #define intf_Create(a,b) intf_Create(VLC_OBJECT(a),b)
00104 
00105 VLC_EXPORT( int, intf_Eject, ( vlc_object_t *, const char * ) );
00106 #define intf_Eject(a,b) intf_Eject(VLC_OBJECT(a),b)
00107 
00108 VLC_EXPORT( void, libvlc_Quit, ( libvlc_int_t * ) );
00109 
00110 /*@}*/
00111 
00112 /*****************************************************************************
00113  * Macros
00114  *****************************************************************************/
00115 #if defined( WIN32 ) && !defined( UNDER_CE )
00116 #    define CONSOLE_INTRO_MSG \
00117          if( !getenv( "PWD" ) || !getenv( "PS1" ) ) /* detect cygwin shell */ \
00118          { \
00119          AllocConsole(); \
00120          freopen( "CONOUT$", "w", stdout ); \
00121          freopen( "CONOUT$", "w", stderr ); \
00122          freopen( "CONIN$", "r", stdin ); \
00123          } \
00124          msg_Info( p_intf, "VLC media player - %s", VERSION_MESSAGE ); \
00125          msg_Info( p_intf, "%s", COPYRIGHT_MESSAGE ); \
00126          msg_Info( p_intf, _("\nWarning: if you can't access the GUI " \
00127                              "anymore, open a command-line window, go to the " \
00128                              "directory where you installed VLC and run " \
00129                              "\"vlc -I qt\"\n") )
00130 #else
00131 #    define CONSOLE_INTRO_MSG
00132 #endif
00133 
00134 /* Interface dialog ids for dialog providers */
00135 typedef enum vlc_dialog {
00136     INTF_DIALOG_FILE_SIMPLE = 1,
00137     INTF_DIALOG_FILE,
00138     INTF_DIALOG_DISC,
00139     INTF_DIALOG_NET,
00140     INTF_DIALOG_CAPTURE,
00141     INTF_DIALOG_SAT,
00142     INTF_DIALOG_DIRECTORY,
00143 
00144     INTF_DIALOG_STREAMWIZARD,
00145     INTF_DIALOG_WIZARD,
00146 
00147     INTF_DIALOG_PLAYLIST,
00148     INTF_DIALOG_MESSAGES,
00149     INTF_DIALOG_FILEINFO,
00150     INTF_DIALOG_PREFS,
00151     INTF_DIALOG_BOOKMARKS,
00152     INTF_DIALOG_EXTENDED,
00153 
00154     INTF_DIALOG_POPUPMENU = 20,
00155     INTF_DIALOG_AUDIOPOPUPMENU,
00156     INTF_DIALOG_VIDEOPOPUPMENU,
00157     INTF_DIALOG_MISCPOPUPMENU,
00158 
00159     INTF_DIALOG_FILE_GENERIC = 30,
00160     INTF_DIALOG_INTERACTION = 50,
00161 
00162     INTF_DIALOG_UPDATEVLC = 90,
00163     INTF_DIALOG_VLM,
00164 
00165     INTF_DIALOG_EXIT = 99
00166 } vlc_dialog_t;
00167 
00168 /* Useful text messages shared by interfaces */
00169 #define INTF_ABOUT_MSG LICENSE_MSG
00170 
00171 #define EXTENSIONS_AUDIO \
00172     "*.a52;" \
00173     "*.aac;" \
00174     "*.ac3;" \
00175     "*.adt;" \
00176     "*.adts;" \
00177     "*.aif;"\
00178     "*.aifc;"\
00179     "*.aiff;"\
00180     "*.amr;" \
00181     "*.aob;" \
00182     "*.ape;" \
00183     "*.cda;" \
00184     "*.dts;" \
00185     "*.flac;"\
00186     "*.it;"  \
00187     "*.m4a;" \
00188     "*.m4p;" \
00189     "*.mid;" \
00190     "*.mka;" \
00191     "*.mlp;" \
00192     "*.mod;" \
00193     "*.mp1;" \
00194     "*.mp2;" \
00195     "*.mp3;" \
00196     "*.mpc;" \
00197     "*.oga;" \
00198     "*.ogg;" \
00199     "*.oma;" \
00200     "*.rmi;" \
00201     "*.s3m;" \
00202     "*.spx;" \
00203     "*.tta;" \
00204     "*.voc;" \
00205     "*.vqf;" \
00206     "*.w64;" \
00207     "*.wav;" \
00208     "*.wma;" \
00209     "*.wv;"  \
00210     "*.xa;"  \
00211     "*.xm"
00212 
00213 #define EXTENSIONS_VIDEO "*.3g2;*.3gp;*.3gp2;*.3gpp;*.amv;*.asf;*.avi;*.bin;*.cue;*.divx;*.dv;*.flv;*.gxf;*.iso;*.m1v;*.m2v;" \
00214                          "*.m2t;*.m2ts;*.m4v;*.mkv;*.mov;*.mp2;*.mp2v;*.mp4;*.mp4v;*.mpa;*.mpe;*.mpeg;*.mpeg1;" \
00215                          "*.mpeg2;*.mpeg4;*.mpg;*.mpv2;*.mts;*.mxf;*.nsv;*.nuv;" \
00216                          "*.ogg;*.ogm;*.ogv;*.ogx;*.ps;" \
00217                          "*.rec;*.rm;*.rmvb;*.tod;*.ts;*.tts;*.vob;*.vro;*.webm;*.wmv"
00218 
00219 #define EXTENSIONS_PLAYLIST "*.asx;*.b4s;*.ifo;*.m3u;*.m3u8;*.pls;*.ram;*.rar;*.sdp;*.vlc;*.xspf;*.zip"
00220 
00221 #define EXTENSIONS_MEDIA EXTENSIONS_VIDEO ";" EXTENSIONS_AUDIO ";" \
00222                           EXTENSIONS_PLAYLIST
00223 
00224 #define EXTENSIONS_SUBTITLE "*.cdg;*.idx;*.srt;*.sub;*.utf;*.ass;*.ssa;*.aqt;" \
00225                             "*.jss;*.psb;*.rt;*.smi"
00226 
00227 /** \defgroup vlc_interaction Interaction
00228  * \ingroup vlc_interface
00229  * Interaction between user and modules
00230  * @{
00231  */
00232 
00233 /**
00234  * This structure describes a piece of interaction with the user
00235  */
00236 typedef struct interaction_dialog_t
00237 {
00238     int             i_type;             ///< Type identifier
00239     char           *psz_title;          ///< Title
00240     char           *psz_description;    ///< Descriptor string
00241     char           *psz_default_button;  ///< default button title (~OK)
00242     char           *psz_alternate_button;///< alternate button title (~NO)
00243     /// other button title (optional,~Cancel)
00244     char           *psz_other_button;
00245 
00246     char           *psz_returned[1];    ///< returned responses from the user
00247 
00248     vlc_value_t     val;                ///< value coming from core for dialogue
00249     int             i_timeToGo;         ///< time (in sec) until shown progress is finished
00250     bool      b_cancelled;        ///< was the dialogue cancelled ?
00251 
00252     void *          p_private;          ///< Private interface data
00253 
00254     int             i_status;           ///< Dialog status;
00255     int             i_action;           ///< Action to perform;
00256     int             i_flags;            ///< Misc flags
00257     int             i_return;           ///< Return status
00258 
00259     vlc_object_t   *p_parent;           ///< The vlc object that asked
00260                                         //for interaction
00261     intf_thread_t  *p_interface;
00262     vlc_mutex_t    *p_lock;
00263 } interaction_dialog_t;
00264 
00265 /**
00266  * Possible flags . Dialog types
00267  */
00268 #define DIALOG_GOT_ANSWER           0x01
00269 #define DIALOG_YES_NO_CANCEL        0x02
00270 #define DIALOG_LOGIN_PW_OK_CANCEL   0x04
00271 #define DIALOG_PSZ_INPUT_OK_CANCEL  0x08
00272 #define DIALOG_BLOCKING_ERROR       0x10
00273 #define DIALOG_NONBLOCKING_ERROR    0x20
00274 #define DIALOG_USER_PROGRESS        0x80
00275 #define DIALOG_INTF_PROGRESS        0x100
00276 
00277 /** Possible return codes */
00278 enum
00279 {
00280     DIALOG_OK_YES,
00281     DIALOG_NO,
00282     DIALOG_CANCELLED
00283 };
00284 
00285 /** Possible status  */
00286 enum
00287 {
00288     ANSWERED_DIALOG,            ///< Got "answer"
00289     DESTROYED_DIALOG,           ///< Interface has destroyed it
00290 };
00291 
00292 /** Possible actions */
00293 enum
00294 {
00295     INTERACT_NEW,
00296     INTERACT_UPDATE,
00297     INTERACT_HIDE,
00298     INTERACT_DESTROY
00299 };
00300 
00301 #define intf_UserStringInput( a, b, c, d ) (VLC_OBJECT(a),b,c,d, VLC_EGENERIC)
00302 #define interaction_Register( t ) (t, VLC_EGENERIC)
00303 #define interaction_Unregister( t ) (t, VLC_EGENERIC)
00304 
00305 
00306 /** @} */
00307 /** @} */
00308 
00309 # ifdef __cplusplus
00310 }
00311 # endif
00312 #endif

Generated on Mon Nov 22 07:55:20 2010 for VLC by  doxygen 1.5.6