]> git.sesse.net Git - vlc/blob - include/interface.h
* ./src/interface/main.c: we no longer segfault if argc == 0.
[vlc] / include / interface.h
1 /*****************************************************************************
2  * 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: interface.h,v 1.28 2002/04/24 00:36:24 sam Exp $
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 /*****************************************************************************
27  * intf_thread_t: describe an interface thread
28  *****************************************************************************
29  * This structe describes all interface-specific data of the main (interface)
30  * thread.
31  *****************************************************************************/
32 typedef struct intf_thread_s
33 {
34     boolean_t           b_die;                                 /* `die' flag */
35
36     /* Specific interfaces */
37     p_intf_console_t    p_console;                                /* console */
38     p_intf_sys_t        p_sys;                           /* system interface */
39     
40     /* Plugin used and shortcuts to access its capabilities */
41     struct module_s *   p_module;
42     int              ( *pf_open )   ( struct intf_thread_s * );
43     void             ( *pf_close )  ( struct intf_thread_s * );
44     void             ( *pf_run )    ( struct intf_thread_s * );
45
46     /* Interface callback */
47     void             ( *pf_manage ) ( struct intf_thread_s * );
48
49     /* XXX: new message passing stuff will go here */
50     vlc_mutex_t         change_lock;
51     boolean_t           b_menu_change;
52     boolean_t           b_menu;
53     
54 } intf_thread_t;
55
56 /*****************************************************************************
57  * msg_item_t
58  *****************************************************************************
59  * Store a single message. Messages have a maximal size of INTF_MSG_MSGSIZE.
60  *****************************************************************************/
61 typedef struct
62 {
63     int     i_type;                               /* message type, see below */
64     char *  psz_msg;                                   /* the message itself */
65
66 #if 0
67     mtime_t date;                                     /* date of the message */
68     char *  psz_file;               /* file in which the function was called */
69     char *  psz_function;     /* function from which the function was called */
70     int     i_line;                 /* line at which the function was called */
71 #endif
72 } msg_item_t;
73
74 /* Message types */
75 #define INTF_MSG_STD    0                                /* standard message */
76 #define INTF_MSG_ERR    1                                   /* error message */
77 #define INTF_MSG_WARN   2                                 /* warning message */
78 #define INTF_MSG_STAT   3                               /* statistic message */
79
80 /*****************************************************************************
81  * intf_subscription_t
82  *****************************************************************************
83  * Used by interface plugins which subscribe to the message queue.
84  *****************************************************************************/
85 typedef struct intf_subscription_s
86 {
87     int   i_start;
88     int*  pi_stop;
89
90     msg_item_t*  p_msg;
91     vlc_mutex_t* p_lock;
92 } intf_subscription_t;
93
94 /*****************************************************************************
95  * Prototypes
96  *****************************************************************************/
97 intf_thread_t * intf_Create       ( void );
98 void            intf_Destroy      ( intf_thread_t * p_intf );
99
100 void            intf_MsgCreate    ( void );
101 void            intf_MsgDestroy   ( void );
102
103 #ifndef __PLUGIN__
104 intf_subscription_t* intf_MsgSub    ( void );
105 void                 intf_MsgUnsub  ( intf_subscription_t * );
106 #else
107 #   define intf_MsgSub p_symbols->intf_MsgSub
108 #   define intf_MsgUnsub p_symbols->intf_MsgUnsub
109 #endif
110