]> git.sesse.net Git - vlc/blob - include/vlc_interface.h
* src/libvlc.c, include/vlc_interface.h: don't open a win32 console when using a...
[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 VideoLAN
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 typedef struct intf_dialog_args_t intf_dialog_args_t;
27
28 /**
29  * \file
30  * This file contains structures and function prototypes for
31  * interface management in vlc
32  */
33
34
35 /*****************************************************************************
36  * intf_thread_t: describe an interface thread
37  *****************************************************************************
38  * This struct describes all interface-specific data of the main (interface)
39  * thread.
40  *****************************************************************************/
41
42 /**
43  * \defgroup vlc_interface Interface
44  * These functions and structures are for interface management
45  * @{
46  */
47 struct intf_thread_t
48 {
49     VLC_COMMON_MEMBERS
50
51     /* Thread properties and locks */
52     vlc_bool_t          b_block;
53     vlc_bool_t          b_play;
54
55     /* Specific interfaces */
56     intf_console_t *    p_console;                               /** console */
57     intf_sys_t *        p_sys;                          /** system interface */
58
59     /** Interface module */
60     module_t *   p_module;
61     void      ( *pf_run )    ( intf_thread_t * ); /** Run function */
62
63     /** Specific for dialogs providers */
64     void ( *pf_show_dialog ) ( intf_thread_t *, int, int,
65                                intf_dialog_args_t * );
66
67     /** Video window callbacks */
68     void * ( *pf_request_window ) ( intf_thread_t *, vout_thread_t *,
69                                     int *, int *,
70                                     unsigned int *, unsigned int * );
71     void   ( *pf_release_window ) ( intf_thread_t *, void * );
72     int    ( *pf_control_window ) ( intf_thread_t *, void *, int, va_list );
73
74     /* XXX: new message passing stuff will go here */
75     vlc_mutex_t  change_lock;
76     vlc_bool_t   b_menu_change;
77     vlc_bool_t   b_menu;
78
79     /* Provides the ability to switch an interface on the fly */
80     char *psz_switch_intf;
81 };
82
83 /*****************************************************************************
84  * intf_dialog_args_t: arguments structure passed to a dialogs provider.
85  *****************************************************************************
86  * This struct describes the arguments passed to the dialogs provider.
87  * For now they are only used with INTF_DIALOG_FILE_GENERIC.
88  *****************************************************************************/
89 struct intf_dialog_args_t
90 {
91     char *psz_title;
92
93     char **psz_results;
94     int  i_results;
95
96     void (*pf_callback) ( intf_dialog_args_t * );
97     void *p_arg;
98
99     /* Specifically for INTF_DIALOG_FILE_GENERIC */
100     char *psz_extensions;
101     vlc_bool_t b_save;
102     vlc_bool_t b_multiple;
103 };
104
105 /*****************************************************************************
106  * Prototypes
107  *****************************************************************************/
108 #define intf_Create(a,b) __intf_Create(VLC_OBJECT(a),b)
109 VLC_EXPORT( intf_thread_t *, __intf_Create,     ( vlc_object_t *, const char * ) );
110 VLC_EXPORT( int,               intf_RunThread,  ( intf_thread_t * ) );
111 VLC_EXPORT( void,              intf_StopThread, ( intf_thread_t * ) );
112 VLC_EXPORT( void,              intf_Destroy,    ( intf_thread_t * ) );
113
114 /*@}*/
115
116 /*****************************************************************************
117  * Macros
118  *****************************************************************************/
119 #if defined( WIN32 ) && !defined( UNDER_CE )
120 #    define CONSOLE_INTRO_MSG \
121          if( !getenv( "PWD" ) || !getenv( "PS1" ) ) /* detect cygwin shell */ \
122          { \
123          AllocConsole(); \
124          freopen( "CONOUT$", "w", stdout ); \
125          freopen( "CONOUT$", "w", stderr ); \
126          freopen( "CONIN$", "r", stdin ); \
127          } \
128          msg_Info( p_intf, COPYRIGHT_MESSAGE ); \
129          msg_Info( p_intf, _("\nWarning: if you can't access the GUI " \
130                              "anymore, open a dos command box, go to the " \
131                              "directory where you installed VLC and run " \
132                              "\"vlc -I wxwin\"\n") )
133 #else
134 #    define CONSOLE_INTRO_MSG
135 #endif
136
137 /* Interface dialog ids for dialog providers */
138 #define INTF_DIALOG_FILE_SIMPLE 1
139 #define INTF_DIALOG_FILE        2
140 #define INTF_DIALOG_DISC        3
141 #define INTF_DIALOG_NET         4
142 #define INTF_DIALOG_CAPTURE     5
143 #define INTF_DIALOG_SAT         6
144
145 #define INTF_DIALOG_STREAMWIZARD 8
146 #define INTF_DIALOG_WIZARD 9
147
148 #define INTF_DIALOG_PLAYLIST   10
149 #define INTF_DIALOG_MESSAGES   11
150 #define INTF_DIALOG_FILEINFO   12
151 #define INTF_DIALOG_PREFS      13
152 #define INTF_DIALOG_BOOKMARKS  14
153
154 #define INTF_DIALOG_POPUPMENU  20
155
156 #define INTF_DIALOG_FILE_GENERIC 30
157
158 #define INTF_DIALOG_EXIT       99
159
160 /* Useful text messages shared by interfaces */
161 #define INTF_ABOUT_MSG \
162     _( "VLC is an open-source and cross-platform multimedia " \
163        "player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, " \
164        "DivX, mp3, Ogg, ...) as well as DVDs, VCDs, CD audio, and various " \
165        "streaming protocols.\n\n" \
166        "VLC is also a streaming server with transcoding capabilities " \
167        "(UDP unicast and multicast, HTTP, ...) mainly designed for " \
168        "high-bandwidth networks.\n\n"\
169        "For more information, have a look at the web site." )