]> git.sesse.net Git - vlc/blob - src/video_output/control.h
Moved out text_style_* to src/misc/text_style.c
[vlc] / src / video_output / control.h
1 /*****************************************************************************
2  * control.h : vout internal control
3  *****************************************************************************
4  * Copyright (C) 2009-2010 Laurent Aimar
5  * $Id$
6  *
7  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
25 # error This header file can only be included from LibVLC.
26 #endif
27
28 #ifndef _VOUT_INTERNAL_CONTROL_H
29 #define _VOUT_INTERNAL_CONTROL_H
30
31 /* */
32 enum {
33 #if 0
34     VOUT_CONTROL_INIT,
35     VOUT_CONTROL_EXIT,
36
37     /* */
38     VOUT_CONTROL_START,
39     VOUT_CONTROL_STOP,
40
41     /* Controls */
42
43     VOUT_CONTROL_SOURCE_ASPECT,
44     VOUT_CONTROL_SOURCE_CROP_BORDER,
45     VOUT_CONTROL_SOURCE_CROP_RATIO,
46     VOUT_CONTROL_SOURCE_CROP_WINDOW,
47
48     /* OSD */
49     VOUT_CONTROL_OSD_MESSAGE,
50     VOUT_CONTROL_OSD_TEXT,
51     VOUT_CONTROL_OSD_SLIDER,
52     VOUT_CONTROL_OSD_ICON,
53     VOUT_CONTROL_OSD_SUBPICTURE,
54 #endif
55     VOUT_CONTROL_OSD_TITLE,             /* string */
56     VOUT_CONTROL_CHANGE_FILTERS,        /* string */
57
58     VOUT_CONTROL_PAUSE,
59     VOUT_CONTROL_RESET,
60     VOUT_CONTROL_FLUSH,                 /* time */
61     VOUT_CONTROL_STEP,                  /* time_ptr */
62
63     VOUT_CONTROL_FULLSCREEN,            /* bool */
64     VOUT_CONTROL_ON_TOP,                /* bool */
65     VOUT_CONTROL_DISPLAY_FILLED,        /* bool */
66     VOUT_CONTROL_ZOOM,                  /* pair */
67 };
68
69 typedef struct {
70     int type;
71
72     union {
73         bool    boolean;
74         mtime_t time;
75         mtime_t *time_ptr;
76         char    *string;
77         struct {
78             int a;
79             int b;
80         } pair;
81         struct {
82             bool is_on;
83             mtime_t date;
84         } pause;
85         struct {
86             int channel;
87             char *string;
88         } message;
89 #if 0
90         struct {
91             int channel;
92             char *string;
93             text_style_t *style;
94             int flags;
95             int hmargin;
96             int vmargin;
97             mtime_t start;
98             mtime_t stop;
99         } text;
100         struct {
101             unsigned left;
102             unsigned top;
103             unsigned right;
104             unsigned bottom;
105         } border;
106         struct {
107             unsigned x;
108             unsigned y;
109             unsigned width;
110             unsigned height;
111         } window;
112         struct {
113             int   channel;
114             int   type;
115             float position;
116         } slider;
117         struct {
118             int channel;
119             int icon;
120         } icon;
121         subpicture_t *subpicture;
122 #endif
123     } u;
124 } vout_control_cmd_t;
125
126 void vout_control_cmd_Init(vout_control_cmd_t *, int type);
127 void vout_control_cmd_Clean(vout_control_cmd_t *);
128
129 typedef struct {
130     vlc_mutex_t lock;
131     vlc_cond_t  wait_request;
132     vlc_cond_t  wait_acknowledge;
133
134     /* */
135     bool is_dead;
136     bool is_sleeping;
137     bool can_sleep;
138     bool is_processing;
139     DECL_ARRAY(vout_control_cmd_t) cmd;
140 } vout_control_t;
141
142 /* */
143 void vout_control_Init(vout_control_t *);
144 void vout_control_Clean(vout_control_t *);
145
146 /* controls outside of the vout thread */
147 void vout_control_WaitEmpty(vout_control_t *);
148
149 void vout_control_Push(vout_control_t *, vout_control_cmd_t *);
150 void vout_control_PushVoid(vout_control_t *, int type);
151 void vout_control_PushBool(vout_control_t *, int type, bool boolean);
152 void vout_control_PushTime(vout_control_t *, int type, mtime_t time);
153 void vout_control_PushMessage(vout_control_t *, int type, int channel, const char *string);
154 void vout_control_PushPair(vout_control_t *, int type, int a, int b);
155 void vout_control_PushString(vout_control_t *, int type, const char *string);
156 void vout_control_Wake(vout_control_t *);
157
158 /* control inside of the vout thread */
159 int vout_control_Pop(vout_control_t *, vout_control_cmd_t *, mtime_t deadline, mtime_t timeout);
160 void vout_control_Dead(vout_control_t *);
161
162 #endif
163