VLC  2.1.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vlc_interface.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_interface.h: interface access for other threads
3  * This library provides basic functions for threads to interact with user
4  * interface, such as message output.
5  *****************************************************************************
6  * Copyright (C) 1999, 2000 VLC authors and VideoLAN
7  * $Id: 20bac6e12f1113bc7b1f086f8f3e7d70c6c69c5f $
8  *
9  * Authors: Vincent Seguin <seguin@via.ecp.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 2.1 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25 
26 #ifndef VLC_INTF_H_
27 #define VLC_INTF_H_
28 
29 # ifdef __cplusplus
30 extern "C" {
31 # endif
32 
34 
35 /**
36  * \file
37  * This file contains structures and function prototypes for
38  * interface management in vlc
39  */
40 
41 /**
42  * \defgroup vlc_interface Interface
43  * These functions and structures are for interface management
44  * @{
45  */
46 
47 typedef struct intf_sys_t intf_sys_t;
48 
49 /** Describe all interface-specific data of the interface thread */
50 typedef struct intf_thread_t
51 {
53 
54  struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
55 
56  /* Specific interfaces */
57  intf_sys_t * p_sys; /** system interface */
58 
59  /** Interface module */
61 
62  /** Specific for dialogs providers */
63  void ( *pf_show_dialog ) ( struct intf_thread_t *, int, int,
65 
68 
69 /** \brief Arguments passed to a dialogs provider
70  * This describes the arguments passed to the dialogs provider. They are
71  * mainly used with INTF_DIALOG_FILE_GENERIC.
72  */
73 struct intf_dialog_args_t
74 {
76  char *psz_title;
77 
78  char **psz_results;
79  int i_results;
80 
81  void (*pf_callback) ( intf_dialog_args_t * );
82  void *p_arg;
83 
84  /* Specifically for INTF_DIALOG_FILE_GENERIC */
85  char *psz_extensions;
86  bool b_save;
87  bool b_multiple;
88 
89  /* Specific to INTF_DIALOG_INTERACTION */
91 };
92 
93 VLC_API int intf_Create( vlc_object_t *, const char * );
94 #define intf_Create(a,b) intf_Create(VLC_OBJECT(a),b)
95 
97 
98 /**
99  * \defgroup vlc_subscription Log messages subscription
100  * These functions deal with log messages.
101  * @{
102  */
103 
104 /**
105  * Message logging callback signature.
106  * Accepts one private data pointer, the message, and an overrun counter.
107  */
108 typedef void (*msg_callback_t) (void *, int, const msg_item_t *,
109  const char *, va_list);
110 
111 /**
112  * Used by interface plugins which subscribe to the message bank.
113  */
114 typedef struct msg_subscription
115 {
116  struct msg_subscription *prev, *next;
118  void *opaque;
120 
123 
124 /*@}*/
125 
126 #if defined( WIN32 )
127 # define CONSOLE_INTRO_MSG \
128  if( !getenv( "PWD" ) ) /* detect Cygwin shell or Wine */ \
129  { \
130  AllocConsole(); \
131  freopen( "CONOUT$", "w", stdout ); \
132  freopen( "CONOUT$", "w", stderr ); \
133  freopen( "CONIN$", "r", stdin ); \
134  } \
135  msg_Info( p_intf, "VLC media player - %s", VERSION_MESSAGE ); \
136  msg_Info( p_intf, "%s", COPYRIGHT_MESSAGE ); \
137  msg_Info( p_intf, _("\nWarning: if you cannot access the GUI " \
138  "anymore, open a command-line window, go to the " \
139  "directory where you installed VLC and run " \
140  "\"vlc -I qt\"\n") )
141 #else
142 # define CONSOLE_INTRO_MSG (void)0
143 #endif
144 
145 /* Interface dialog ids for dialog providers */
146 typedef enum vlc_dialog {
176  INTF_DIALOG_EXIT = 99
178 
179 /* Useful text messages shared by interfaces */
180 #define INTF_ABOUT_MSG LICENSE_MSG
182 #define EXTENSIONS_AUDIO_CSV "3ga", "669", "a52", "aac", "ac3", "adt", "adts", "aif", "aifc", "aiff", \
183  "amr", "aob", "ape", "awb", "caf", "dts", "flac", "it", "kar", \
184  "m4a", "m4p", "m5p", "mka", "mlp", "mod", "mpa", "mp1", "mp2", "mp3", "mpc", "mpga", \
185  "oga", "ogg", "oma", "opus", "qcp", "ra", "rmi", "s3m", "spx", "thd", "tta", \
186  "voc", "vqf", "w64", "wav", "wma", "wv", "xa", "xm"
187 
188 #define EXTENSIONS_VIDEO_CSV "3g2", "3gp", "3gp2", "3gpp", "amv", "asf", "avi", "divx", "drc", "dv", \
189  "f4v", "flv", "gvi", "gxf", "iso", \
190  "m1v", "m2v", "m2t", "m2ts", "m4v", "mkv", "mov",\
191  "mp2", "mp2v", "mp4", "mp4v", "mpe", "mpeg", "mpeg1", \
192  "mpeg2", "mpeg4", "mpg", "mpv2", "mts", "mtv", "mxf", "mxg", "nsv", "nuv", \
193  "ogg", "ogm", "ogv", "ogx", "ps", \
194  "rec", "rm", "rmvb", "tod", "ts", "tts", "vob", "vro", \
195  "webm", "wm", "wmv", "wtv", "xesc"
196 
197 #define EXTENSIONS_AUDIO \
198  "*.3ga;" \
199  "*.669;" \
200  "*.a52;" \
201  "*.aac;" \
202  "*.ac3;" \
203  "*.adt;" \
204  "*.adts;" \
205  "*.aif;"\
206  "*.aifc;"\
207  "*.aiff;"\
208  "*.amr;" \
209  "*.aob;" \
210  "*.ape;" \
211  "*.awb;" \
212  "*.caf;" \
213  "*.dts;" \
214  "*.flac;"\
215  "*.it;" \
216  "*.kar;" \
217  "*.m4a;" \
218  "*.m4p;" \
219  "*.m5p;" \
220  "*.mid;" \
221  "*.mka;" \
222  "*.mlp;" \
223  "*.mod;" \
224  "*.mpa;" \
225  "*.mp1;" \
226  "*.mp2;" \
227  "*.mp3;" \
228  "*.mpc;" \
229  "*.mpga;" \
230  "*.oga;" \
231  "*.ogg;" \
232  "*.oma;" \
233  "*.opus;" \
234  "*.qcp;" \
235  "*.ra;" \
236  "*.rmi;" \
237  "*.s3m;" \
238  "*.spx;" \
239  "*.thd;" \
240  "*.tta;" \
241  "*.voc;" \
242  "*.vqf;" \
243  "*.w64;" \
244  "*.wav;" \
245  "*.wma;" \
246  "*.wv;" \
247  "*.xa;" \
248  "*.xm"
249 
250 #define EXTENSIONS_VIDEO "*.3g2;*.3gp;*.3gp2;*.3gpp;*.amv;*.asf;*.avi;*.bin;*.divx;*.drc;*.dv;*f4v;*.flv;*.gvi;*.gvi;*.gxf;*.iso;*.m1v;*.m2v;" \
251  "*.m2t;*.m2ts;*.m4v;*.mkv;*.mov;*.mp2;*.mp2v;*.mp4;*.mp4v;*.mpe;*.mpeg;*.mpeg1;" \
252  "*.mpeg2;*.mpeg4;*.mpg;*.mpv2;*.mts;*.mtv;*.mxf;*.mxg;*.nsv;*.nuv;" \
253  "*.ogg;*.ogm;*.ogv;*.ogx;*.ps;" \
254  "*.rec;*.rm;*.rmvb;*.tod;*.ts;*.tts;*.vob;*.vro;*.webm;*.wm;*.wmv;*.wtv;*.xesc"
255 
256 #define EXTENSIONS_PLAYLIST "*.asx;*.b4s;*.cue;*.ifo;*.m3u;*.m3u8;*.pls;*.ram;*.rar;*.sdp;*.vlc;*.xspf;*.wvx;*.zip;*.conf"
258 #define EXTENSIONS_MEDIA EXTENSIONS_VIDEO ";" EXTENSIONS_AUDIO ";" \
259  EXTENSIONS_PLAYLIST
260 
261 #define EXTENSIONS_SUBTITLE "*.cdg;*.idx;*.srt;" \
262  "*.sub;*.utf;*.ass;" \
263  "*.ssa;*.aqt;" \
264  "*.jss;*.psb;" \
265  "*.rt;*.smi;*.txt;" \
266  "*.smil;*.stl;*.usf;" \
267  "*.dks;*.pjs;*.mpl2;*.mks"
268 
269 /** \defgroup vlc_interaction Interaction
270  * \ingroup vlc_interface
271  * Interaction between user and modules
272  * @{
273  */
274 
275 /**
276  * This structure describes a piece of interaction with the user
277  */
278 typedef struct interaction_dialog_t
279 {
280  int i_type; ///< Type identifier
281  char *psz_title; ///< Title
282  char *psz_description; ///< Descriptor string
283  char *psz_default_button; ///< default button title (~OK)
284  char *psz_alternate_button;///< alternate button title (~NO)
285  /// other button title (optional,~Cancel)
286  char *psz_other_button;
288  char *psz_returned[1]; ///< returned responses from the user
290  vlc_value_t val; ///< value coming from core for dialogue
291  int i_timeToGo; ///< time (in sec) until shown progress is finished
292  bool b_cancelled; ///< was the dialogue cancelled ?
294  void * p_private; ///< Private interface data
296  int i_status; ///< Dialog status;
297  int i_action; ///< Action to perform;
298  int i_flags; ///< Misc flags
299  int i_return; ///< Return status
301  vlc_object_t *p_parent; ///< The vlc object that asked
302  //for interaction
306 
307 /**
308  * Possible flags . Dialog types
309  */
310 #define DIALOG_GOT_ANSWER 0x01
311 #define DIALOG_YES_NO_CANCEL 0x02
312 #define DIALOG_LOGIN_PW_OK_CANCEL 0x04
313 #define DIALOG_PSZ_INPUT_OK_CANCEL 0x08
314 #define DIALOG_BLOCKING_ERROR 0x10
315 #define DIALOG_NONBLOCKING_ERROR 0x20
316 #define DIALOG_USER_PROGRESS 0x80
317 #define DIALOG_INTF_PROGRESS 0x100
319 /** Possible return codes */
320 enum
321 {
325 };
326 
327 /** Possible status */
328 enum
329 {
330  ANSWERED_DIALOG, ///< Got "answer"
331  DESTROYED_DIALOG, ///< Interface has destroyed it
332 };
333 
334 /** Possible actions */
335 enum
336 {
337  INTERACT_NEW,
341 };
342 
343 #define intf_UserStringInput( a, b, c, d ) (VLC_OBJECT(a),b,c,d, VLC_EGENERIC)
344 #define interaction_Register( t ) (t, VLC_EGENERIC)
345 #define interaction_Unregister( t ) (t, VLC_EGENERIC)
347 
348 /** @} */
349 /** @} */
350 
351 # ifdef __cplusplus
352 }
353 # endif
354 #endif