]> git.sesse.net Git - vlc/blob - src/video_output/control.h
Use var_Inherit* instead of var_CreateGet*.
[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     VOUT_CONTROL_INIT,
34     VOUT_CONTROL_CLEAN,
35     VOUT_CONTROL_REINIT,                /* cfg */
36
37 #if 0
38     /* */
39     VOUT_CONTROL_START,
40     VOUT_CONTROL_STOP,
41 #endif
42     VOUT_CONTROL_SUBPICTURE,            /* subpicture */
43     VOUT_CONTROL_FLUSH_SUBPICTURE,      /* integer */
44     VOUT_CONTROL_OSD_TITLE,             /* string */
45     VOUT_CONTROL_CHANGE_FILTERS,        /* string */
46     VOUT_CONTROL_CHANGE_SUB_FILTERS,    /* string */
47     VOUT_CONTROL_CHANGE_SUB_MARGIN,     /* integer */
48
49     VOUT_CONTROL_PAUSE,
50     VOUT_CONTROL_RESET,
51     VOUT_CONTROL_FLUSH,                 /* time */
52     VOUT_CONTROL_STEP,                  /* time_ptr */
53
54     VOUT_CONTROL_FULLSCREEN,            /* bool */
55     VOUT_CONTROL_ON_TOP,                /* bool */
56     VOUT_CONTROL_DISPLAY_FILLED,        /* bool */
57     VOUT_CONTROL_ZOOM,                  /* pair */
58
59     VOUT_CONTROL_ASPECT_RATIO,          /* pair */
60     VOUT_CONTROL_CROP_BORDER,           /* border */
61     VOUT_CONTROL_CROP_RATIO,            /* pair */
62     VOUT_CONTROL_CROP_WINDOW,           /* window */
63 };
64
65 typedef struct {
66     int type;
67
68     union {
69         bool    boolean;
70         mtime_t time;
71         mtime_t *time_ptr;
72         char    *string;
73         int     integer;
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         struct {
87             unsigned left;
88             unsigned top;
89             unsigned right;
90             unsigned bottom;
91         } border;
92         struct {
93             unsigned x;
94             unsigned y;
95             unsigned width;
96             unsigned height;
97         } window;
98         const vout_configuration_t *cfg;
99         subpicture_t *subpicture;
100     } u;
101 } vout_control_cmd_t;
102
103 void vout_control_cmd_Init(vout_control_cmd_t *, int type);
104 void vout_control_cmd_Clean(vout_control_cmd_t *);
105
106 typedef struct {
107     vlc_mutex_t lock;
108     vlc_cond_t  wait_request;
109     vlc_cond_t  wait_acknowledge;
110
111     /* */
112     bool is_dead;
113     bool is_sleeping;
114     bool can_sleep;
115     bool is_processing;
116     DECL_ARRAY(vout_control_cmd_t) cmd;
117 } vout_control_t;
118
119 /* */
120 void vout_control_Init(vout_control_t *);
121 void vout_control_Clean(vout_control_t *);
122
123 /* controls outside of the vout thread */
124 void vout_control_WaitEmpty(vout_control_t *);
125
126 void vout_control_Push(vout_control_t *, vout_control_cmd_t *);
127 void vout_control_PushVoid(vout_control_t *, int type);
128 void vout_control_PushBool(vout_control_t *, int type, bool boolean);
129 void vout_control_PushInteger(vout_control_t *, int type, int integer);
130 void vout_control_PushTime(vout_control_t *, int type, mtime_t time);
131 void vout_control_PushMessage(vout_control_t *, int type, int channel, const char *string);
132 void vout_control_PushPair(vout_control_t *, int type, int a, int b);
133 void vout_control_PushString(vout_control_t *, int type, const char *string);
134 void vout_control_Wake(vout_control_t *);
135
136 /* control inside of the vout thread */
137 int vout_control_Pop(vout_control_t *, vout_control_cmd_t *, mtime_t deadline, mtime_t timeout);
138 void vout_control_Dead(vout_control_t *);
139
140 #endif
141