]> git.sesse.net Git - vlc/blob - include/vlc_interface.h
* Get rid of the Manager thread by making blocking interfaces listen to
[vlc] / include / vlc_interface.h
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 the VideoLAN team
7  * $Id$
8  *
9  * Authors: Vincent Seguin <seguin@via.ecp.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 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 General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26
27 typedef struct intf_dialog_args_t intf_dialog_args_t;
28
29 /**
30  * \file
31  * This file contains structures and function prototypes for
32  * interface management in vlc
33  */
34
35
36 /*****************************************************************************
37  * intf_thread_t: describe an interface thread
38  *****************************************************************************
39  * This struct describes all interface-specific data of the main (interface)
40  * thread.
41  *****************************************************************************/
42
43 /**
44  * \defgroup vlc_interface Interface
45  * These functions and structures are for interface management
46  * @{
47  */
48 struct intf_thread_t
49 {
50     VLC_COMMON_MEMBERS
51
52     /* Thread properties and locks */
53     vlc_bool_t          b_block;
54     vlc_bool_t          b_play;
55
56     /* Specific interfaces */
57     intf_console_t *    p_console;                               /** console */
58     intf_sys_t *        p_sys;                          /** system interface */
59
60     /** Interface module */
61     module_t *   p_module;
62     void      ( *pf_run )    ( intf_thread_t * ); /** Run function */
63
64     /** Specific for dialogs providers */
65     void ( *pf_show_dialog ) ( intf_thread_t *, int, int,
66                                intf_dialog_args_t * );
67
68     /** Interaction stuff */
69     vlc_bool_t b_interaction;
70
71     /** Video window callbacks */
72     void * ( *pf_request_window ) ( intf_thread_t *, vout_thread_t *,
73                                     int *, int *,
74                                     unsigned int *, unsigned int * );
75     void   ( *pf_release_window ) ( intf_thread_t *, void * );
76     int    ( *pf_control_window ) ( intf_thread_t *, void *, int, va_list );
77
78     /* XXX: new message passing stuff will go here */
79     vlc_mutex_t  change_lock;
80     vlc_bool_t   b_menu_change;
81     vlc_bool_t   b_menu;
82
83     /* Provides the ability to switch an interface on the fly */
84     char *psz_switch_intf;
85 };
86
87 /*****************************************************************************
88  * intf_dialog_args_t: arguments structure passed to a dialogs provider.
89  *****************************************************************************
90  * This struct describes the arguments passed to the dialogs provider.
91  * For now they are only used with INTF_DIALOG_FILE_GENERIC.
92  *****************************************************************************/
93 struct intf_dialog_args_t
94 {
95     intf_thread_t *p_intf;
96     char *psz_title;
97
98     char **psz_results;
99     int  i_results;
100
101     void (*pf_callback) ( intf_dialog_args_t * );
102     void *p_arg;
103
104     /* Specifically for INTF_DIALOG_FILE_GENERIC */
105     char *psz_extensions;
106     vlc_bool_t b_save;
107     vlc_bool_t b_multiple;
108
109     /* Specific to INTF_DIALOG_INTERACTION */
110     interaction_dialog_t *p_dialog;
111 };
112
113 /*****************************************************************************
114  * Prototypes
115  *****************************************************************************/
116 #define intf_Create(a,b,c,d) __intf_Create(VLC_OBJECT(a),b,c,d)
117 VLC_EXPORT( intf_thread_t *, __intf_Create,     ( vlc_object_t *, const char *, int, char ** ) );
118 VLC_EXPORT( int,               intf_RunThread,  ( intf_thread_t * ) );
119 VLC_EXPORT( void,              intf_StopThread, ( intf_thread_t * ) );
120 VLC_EXPORT( void,              intf_Destroy,    ( intf_thread_t * ) );
121
122 /* If the interface is in the main thread, it should listen both to
123  * p_intf->b_die and p_libvlc->b_die */
124 #define intf_ShouldDie( p_intf ) (p_intf->b_die || (p_intf->b_block && p_intf->p_libvlc->b_die ) )
125
126 /*@}*/
127
128 /*****************************************************************************
129  * Macros
130  *****************************************************************************/
131 #if defined( WIN32 ) && !defined( UNDER_CE )
132 #    define CONSOLE_INTRO_MSG \
133          if( !getenv( "PWD" ) || !getenv( "PS1" ) ) /* detect cygwin shell */ \
134          { \
135          AllocConsole(); \
136          freopen( "CONOUT$", "w", stdout ); \
137          freopen( "CONOUT$", "w", stderr ); \
138          freopen( "CONIN$", "r", stdin ); \
139          } \
140          msg_Info( p_intf, COPYRIGHT_MESSAGE ); \
141          msg_Info( p_intf, _("\nWarning: if you can't access the GUI " \
142                              "anymore, open a command-line window, go to the " \
143                              "directory where you installed VLC and run " \
144                              "\"vlc -I wx\"\n") )
145 #else
146 #    define CONSOLE_INTRO_MSG
147 #endif
148
149 /* Interface dialog ids for dialog providers */
150 #define INTF_DIALOG_FILE_SIMPLE 1
151 #define INTF_DIALOG_FILE        2
152 #define INTF_DIALOG_DISC        3
153 #define INTF_DIALOG_NET         4
154 #define INTF_DIALOG_CAPTURE     5
155 #define INTF_DIALOG_SAT         6
156
157 #define INTF_DIALOG_DIRECTORY   7
158
159 #define INTF_DIALOG_STREAMWIZARD 8
160 #define INTF_DIALOG_WIZARD 9
161
162 #define INTF_DIALOG_PLAYLIST   10
163 #define INTF_DIALOG_MESSAGES   11
164 #define INTF_DIALOG_FILEINFO   12
165 #define INTF_DIALOG_PREFS      13
166 #define INTF_DIALOG_BOOKMARKS  14
167
168 #define INTF_DIALOG_POPUPMENU  20
169 #define INTF_DIALOG_AUDIOPOPUPMENU  21
170 #define INTF_DIALOG_VIDEOPOPUPMENU  22
171 #define INTF_DIALOG_MISCPOPUPMENU  23
172
173 #define INTF_DIALOG_FILE_GENERIC 30
174 #define INTF_DIALOG_INTERACTION 50
175
176 #define INTF_DIALOG_UPDATEVLC   90
177 #define INTF_DIALOG_VLM   91
178
179 #define INTF_DIALOG_EXIT       99
180
181 /* Useful text messages shared by interfaces */
182 #define INTF_ABOUT_MSG LICENSE_MSG
183
184 #define EXTENSIONS_AUDIO "*.a52;*.aac;*.ac3;*.dts;*.flac;*.m4a;*.m4p;*.mka;" \
185                          "*.mod;*.mp1;*.mp2;*.mp3;*.ogg;*.spx;*.wav;*.wma;*.xm"
186
187 #define EXTENSIONS_VIDEO "*.asf;*.avi;*.divx;*.dv;*.m1v;*.m2v;*.m4v;*.mkv;" \
188                          "*.mov;*.mp2;*.mp4;*.mpeg;*.mpeg1;*.mpeg2;*.mpeg4;" \
189                          "*.mpg;*.ogg;*.ogm;*.ps;*.ts;*.vob;*.wmv"
190
191 #define EXTENSIONS_PLAYLIST "*.asx;*.b4s;*.m3u;*.pls;*.vlc;*.xspf"
192
193 #define EXTENSIONS_MEDIA EXTENSIONS_VIDEO ";" EXTENSIONS_AUDIO ";" \
194                           EXTENSIONS_PLAYLIST
195
196 #define EXTENSIONS_SUBTITLE "*.idx;*.srt;*.sub;*.utf"