]> git.sesse.net Git - vlc/blob - src/video_output/control.h
Cosmetics (vout).
[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 #endif
41     VOUT_CONTROL_OSD_TITLE,             /* string */
42     VOUT_CONTROL_CHANGE_FILTERS,        /* string */
43
44     VOUT_CONTROL_PAUSE,
45     VOUT_CONTROL_RESET,
46     VOUT_CONTROL_FLUSH,                 /* time */
47     VOUT_CONTROL_STEP,                  /* time_ptr */
48
49     VOUT_CONTROL_FULLSCREEN,            /* bool */
50     VOUT_CONTROL_ON_TOP,                /* bool */
51     VOUT_CONTROL_DISPLAY_FILLED,        /* bool */
52     VOUT_CONTROL_ZOOM,                  /* pair */
53
54     VOUT_CONTROL_ASPECT_RATIO,          /* pair */
55     VOUT_CONTROL_CROP_BORDER,           /* border */
56     VOUT_CONTROL_CROP_RATIO,            /* pair */
57     VOUT_CONTROL_CROP_WINDOW,           /* window */
58 };
59
60 typedef struct {
61     int type;
62
63     union {
64         bool    boolean;
65         mtime_t time;
66         mtime_t *time_ptr;
67         char    *string;
68         struct {
69             int a;
70             int b;
71         } pair;
72         struct {
73             bool is_on;
74             mtime_t date;
75         } pause;
76         struct {
77             int channel;
78             char *string;
79         } message;
80         struct {
81             unsigned left;
82             unsigned top;
83             unsigned right;
84             unsigned bottom;
85         } border;
86         struct {
87             unsigned x;
88             unsigned y;
89             unsigned width;
90             unsigned height;
91         } window;
92     } u;
93 } vout_control_cmd_t;
94
95 void vout_control_cmd_Init(vout_control_cmd_t *, int type);
96 void vout_control_cmd_Clean(vout_control_cmd_t *);
97
98 typedef struct {
99     vlc_mutex_t lock;
100     vlc_cond_t  wait_request;
101     vlc_cond_t  wait_acknowledge;
102
103     /* */
104     bool is_dead;
105     bool is_sleeping;
106     bool can_sleep;
107     bool is_processing;
108     DECL_ARRAY(vout_control_cmd_t) cmd;
109 } vout_control_t;
110
111 /* */
112 void vout_control_Init(vout_control_t *);
113 void vout_control_Clean(vout_control_t *);
114
115 /* controls outside of the vout thread */
116 void vout_control_WaitEmpty(vout_control_t *);
117
118 void vout_control_Push(vout_control_t *, vout_control_cmd_t *);
119 void vout_control_PushVoid(vout_control_t *, int type);
120 void vout_control_PushBool(vout_control_t *, int type, bool boolean);
121 void vout_control_PushTime(vout_control_t *, int type, mtime_t time);
122 void vout_control_PushMessage(vout_control_t *, int type, int channel, const char *string);
123 void vout_control_PushPair(vout_control_t *, int type, int a, int b);
124 void vout_control_PushString(vout_control_t *, int type, const char *string);
125 void vout_control_Wake(vout_control_t *);
126
127 /* control inside of the vout thread */
128 int vout_control_Pop(vout_control_t *, vout_control_cmd_t *, mtime_t deadline, mtime_t timeout);
129 void vout_control_Dead(vout_control_t *);
130
131 #endif
132