]> git.sesse.net Git - vlc/blob - src/video_output/control.h
4949f4e30bd1a8438c30a1438462ff5d759bf792
[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     /* */
42     VOUT_CONTROL_RESET,
43     VOUT_CONTROL_FLUSH,
44     VOUT_CONTROL_PAUSE,
45     VOUT_CONTROL_STEP,
46
47     /* Controls */
48     VOUT_CONTROL_FULLSCREEN,
49     VOUT_CONTROL_DISPLAY_FILLED,
50     VOUT_CONTROL_ZOOM,
51     VOUT_CONTROL_ON_TOP,
52
53     VOUT_CONTROL_SOURCE_ASPECT,
54     VOUT_CONTROL_SOURCE_CROP_BORDER,
55     VOUT_CONTROL_SOURCE_CROP_RATIO,
56     VOUT_CONTROL_SOURCE_CROP_WINDOW,
57
58     /* OSD */
59     VOUT_CONTROL_OSD_MESSAGE,
60     VOUT_CONTROL_OSD_TEXT,
61     VOUT_CONTROL_OSD_SLIDER,
62     VOUT_CONTROL_OSD_ICON,
63     VOUT_CONTROL_OSD_SUBPICTURE,
64 #endif
65     VOUT_CONTROL_OSD_TITLE,
66 };
67
68 typedef struct {
69     int type;
70
71     union {
72         bool    boolean;
73         mtime_t time;
74         struct {
75             int a;
76             int b;
77         } pair;
78         struct {
79             bool is_on;
80             mtime_t date;
81         } pause;
82         struct {
83             int channel;
84             char *string;
85         } message;
86 #if 0
87         struct {
88             int channel;
89             char *string;
90             text_style_t *style;
91             int flags;
92             int hmargin;
93             int vmargin;
94             mtime_t start;
95             mtime_t stop;
96         } text;
97         struct {
98             unsigned left;
99             unsigned top;
100             unsigned right;
101             unsigned bottom;
102         } border;
103         struct {
104             unsigned x;
105             unsigned y;
106             unsigned width;
107             unsigned height;
108         } window;
109         struct {
110             int   channel;
111             int   type;
112             float position;
113         } slider;
114         struct {
115             int channel;
116             int icon;
117         } icon;
118         subpicture_t *subpicture;
119 #endif
120     } u;
121 } vout_control_cmd_t;
122
123 void vout_control_cmd_Init(vout_control_cmd_t *, int type);
124 void vout_control_cmd_Clean(vout_control_cmd_t *);
125
126 typedef struct {
127     vlc_mutex_t lock;
128     vlc_cond_t  wait_request;
129     vlc_cond_t  wait_acknowledge;
130
131     /* */
132     bool is_dead;
133     bool is_sleeping;
134     bool can_sleep;
135     bool is_processing;
136     DECL_ARRAY(vout_control_cmd_t) cmd;
137 } vout_control_t;
138
139 /* */
140 void vout_control_Init(vout_control_t *);
141 void vout_control_Clean(vout_control_t *);
142
143 /* controls outside of the vout thread */
144 void vout_control_WaitEmpty(vout_control_t *);
145
146 void vout_control_Push(vout_control_t *, vout_control_cmd_t *);
147 void vout_control_PushVoid(vout_control_t *, int type);
148 void vout_control_PushBool(vout_control_t *, int type, bool boolean);
149 void vout_control_PushTime(vout_control_t *, int type, mtime_t time);
150 void vout_control_PushMessage(vout_control_t *, int type, int channel, const char *string);
151 void vout_control_PushPair(vout_control_t *, int type, int a, int b);
152 void vout_control_Wake(vout_control_t *);
153
154 /* control inside of the vout thread */
155 int vout_control_Pop(vout_control_t *, vout_control_cmd_t *, mtime_t deadline, mtime_t timeout);
156 void vout_control_Dead(vout_control_t *);
157
158 #endif
159