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: 4e455391e1c0f8121ca7e575f371e6c7f1428020 $
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__ ) || defined( WIN32 )
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 #define intf_Eject(a,b) __intf_Eject(VLC_OBJECT(a),b)
00106 VLC_EXPORT( int, __intf_Eject, ( vlc_object_t *, const char * ) );
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, "%s", COPYRIGHT_MESSAGE ); \
00125          msg_Info( p_intf, _("\nWarning: if you can't access the GUI " \
00126                              "anymore, open a command-line window, go to the " \
00127                              "directory where you installed VLC and run " \
00128                              "\"vlc -I qt\"\n") )
00129 #else
00130 #    define CONSOLE_INTRO_MSG
00131 #endif
00132 
00133 /* Interface dialog ids for dialog providers */
00134 typedef enum vlc_dialog {
00135     INTF_DIALOG_FILE_SIMPLE = 1,
00136     INTF_DIALOG_FILE,
00137     INTF_DIALOG_DISC,
00138     INTF_DIALOG_NET,
00139     INTF_DIALOG_CAPTURE,
00140     INTF_DIALOG_SAT,
00141     INTF_DIALOG_DIRECTORY,
00142 
00143     INTF_DIALOG_STREAMWIZARD,
00144     INTF_DIALOG_WIZARD,
00145 
00146     INTF_DIALOG_PLAYLIST,
00147     INTF_DIALOG_MESSAGES,
00148     INTF_DIALOG_FILEINFO,
00149     INTF_DIALOG_PREFS,
00150     INTF_DIALOG_BOOKMARKS,
00151     INTF_DIALOG_EXTENDED,
00152 
00153     INTF_DIALOG_POPUPMENU = 20,
00154     INTF_DIALOG_AUDIOPOPUPMENU,
00155     INTF_DIALOG_VIDEOPOPUPMENU,
00156     INTF_DIALOG_MISCPOPUPMENU,
00157 
00158     INTF_DIALOG_FILE_GENERIC = 30,
00159     INTF_DIALOG_INTERACTION = 50,
00160 
00161     INTF_DIALOG_UPDATEVLC = 90,
00162     INTF_DIALOG_VLM,
00163 
00164     INTF_DIALOG_EXIT = 99
00165 } vlc_dialog_t;
00166 
00167 /* Useful text messages shared by interfaces */
00168 #define INTF_ABOUT_MSG LICENSE_MSG
00169 
00170 #define EXTENSIONS_AUDIO "*.a52;*.aac;*.ac3;*.aiff;*.aob;*.ape;" \
00171                          "*.dts;*.flac;*.it;" \
00172                          "*.m4a;*.m4p;*.mka;*.mlp;*.mod;*.mp1;*.mp2;*.mp3;*.mpc" \
00173                          "*.oga;*.ogg;*.oma;*.s3m;*.spx;" \
00174                          "*.vqf;*.w64;*.wav;*.wma;*.wv;*.xm"
00175 
00176 #define EXTENSIONS_VIDEO "*.asf;*.avi;*.divx;*.dv;*.flv;*.gxf;*.iso;*.m1v;*.m2v;" \
00177                          "*.m2t;*.m2ts;*.m4v;*.mkv;*.mov;*.mp2;*.mp4;*.mpeg;*.mpeg1;" \
00178                          "*.mpeg2;*.mpeg4;*.mpg;*.mts;*.mxf;*.nuv;" \
00179                          "*.ogg;*.ogm;*.ogv;*.ogx;*.ps;" \
00180                          "*.rec;*.rm;*.rmvb;*.tod;*.ts;*.vob;*.wmv"
00181 
00182 #define EXTENSIONS_PLAYLIST "*.asx;*.b4s;*.ifo;*.m3u;*.m3u8;*.pls;*.ram;*.rar;*.sdp;*.vlc;*.xspf;*.zip"
00183 
00184 #define EXTENSIONS_MEDIA EXTENSIONS_VIDEO ";" EXTENSIONS_AUDIO ";" \
00185                           EXTENSIONS_PLAYLIST
00186 
00187 #define EXTENSIONS_SUBTITLE "*.cdg;*.idx;*.srt;*.sub;*.utf;*.ass;*.ssa;*.aqt;" \
00188                             "*.jss;*.psb;*.rt;*.smi"
00189 
00190 /** \defgroup vlc_interaction Interaction
00191  * \ingroup vlc_interface
00192  * Interaction between user and modules
00193  * @{
00194  */
00195 
00196 /**
00197  * This structure describes a piece of interaction with the user
00198  */
00199 typedef struct interaction_dialog_t
00200 {
00201     int             i_type;             ///< Type identifier
00202     char           *psz_title;          ///< Title
00203     char           *psz_description;    ///< Descriptor string
00204     char           *psz_default_button;  ///< default button title (~OK)
00205     char           *psz_alternate_button;///< alternate button title (~NO)
00206     /// other button title (optional,~Cancel)
00207     char           *psz_other_button;
00208 
00209     char           *psz_returned[1];    ///< returned responses from the user
00210 
00211     vlc_value_t     val;                ///< value coming from core for dialogue
00212     int             i_timeToGo;         ///< time (in sec) until shown progress is finished
00213     bool      b_cancelled;        ///< was the dialogue cancelled ?
00214 
00215     void *          p_private;          ///< Private interface data
00216 
00217     int             i_status;           ///< Dialog status;
00218     int             i_action;           ///< Action to perform;
00219     int             i_flags;            ///< Misc flags
00220     int             i_return;           ///< Return status
00221 
00222     vlc_object_t   *p_parent;           ///< The vlc object that asked
00223                                         //for interaction
00224     intf_thread_t  *p_interface;
00225     vlc_mutex_t    *p_lock;
00226 } interaction_dialog_t;
00227 
00228 /**
00229  * Possible flags . Dialog types
00230  */
00231 #define DIALOG_GOT_ANSWER           0x01
00232 #define DIALOG_YES_NO_CANCEL        0x02
00233 #define DIALOG_LOGIN_PW_OK_CANCEL   0x04
00234 #define DIALOG_PSZ_INPUT_OK_CANCEL  0x08
00235 #define DIALOG_BLOCKING_ERROR       0x10
00236 #define DIALOG_NONBLOCKING_ERROR    0x20
00237 #define DIALOG_USER_PROGRESS        0x80
00238 #define DIALOG_INTF_PROGRESS        0x100
00239 
00240 /** Possible return codes */
00241 enum
00242 {
00243     DIALOG_OK_YES,
00244     DIALOG_NO,
00245     DIALOG_CANCELLED
00246 };
00247 
00248 /** Possible status  */
00249 enum
00250 {
00251     ANSWERED_DIALOG,            ///< Got "answer"
00252     DESTROYED_DIALOG,           ///< Interface has destroyed it
00253 };
00254 
00255 /** Possible actions */
00256 enum
00257 {
00258     INTERACT_NEW,
00259     INTERACT_UPDATE,
00260     INTERACT_HIDE,
00261     INTERACT_DESTROY
00262 };
00263 
00264 #define intf_UserStringInput( a, b, c, d ) (VLC_OBJECT(a),b,c,d, VLC_EGENERIC)
00265 #define interaction_Register( t ) (t, VLC_EGENERIC)
00266 #define interaction_Unregister( t ) (t, VLC_EGENERIC)
00267 
00268 
00269 /** @} */
00270 /** @} */
00271 
00272 # ifdef __cplusplus
00273 }
00274 # endif
00275 #endif

Generated on Sat Nov 21 08:05:14 2009 for VLC by  doxygen 1.5.6