]> git.sesse.net Git - vlc/blob - modules/video_filter/atmo/AtmoDefs.h
Revert "atmo: add support for new device fnordlicht"
[vlc] / modules / video_filter / atmo / AtmoDefs.h
1 /*
2  * AtmoDefs.h: a lot of globals defines for the color computation - most of this file
3  * is an one  to one copy of "defs.h" from Atmo VDR Plugin
4  *
5  * See the README.txt file for copyright information and how to reach the author(s).
6  *
7  * $Id$
8  */
9
10 #ifndef _AtmoDefs_h_
11 #define _AtmoDefs_h_
12
13
14 #if defined(__LIBVLC__)
15
16 #   include "config.h"
17 #   include <vlc_common.h>
18
19 /* some things need to be changed if this code is used inside VideoLan Filter Module */
20 #   define _ATMO_VLC_PLUGIN_
21 #   define get_time mdate()
22 #   define do_sleep(a) msleep(a)
23
24 #else
25
26 #   define MakeDword(ch1,ch2,ch3,ch4) ((((DWORD)(ch1)&255) << 24) | \
27                                    (((DWORD)(ch2)&255) << 16) | \
28                                    (((DWORD)(ch3)&255) << 8) | \
29                                    (((DWORD)(ch4)&255)))
30
31 #  define get_time GetTickCount()
32 #  define do_sleep(a) Sleep(a)
33
34 #endif
35
36 #define ATMO_BOOL   bool
37 #define ATMO_TRUE   true
38 #define ATMO_FALSE  false
39
40
41 /*
42   can't use the VLC_TWOCC macro because the byte order there is CPU dependent
43   but for the use in Atmo I need for this single purpose Intel Byte Order
44   every time!
45 */
46
47 #define MakeIntelWord(ch1,ch2)  ((((int)(ch1)&255)<<8) | \
48                            ((int)(ch2)&255))
49
50 // my own min max macros
51 #define ATMO_MIN(X, Y)  ((X) < (Y) ? (X) : (Y))
52 #define ATMO_MAX(X, Y)  ((X) > (Y) ? (X) : (Y))
53
54
55 #if !defined(WIN32)
56
57 #define INVALID_HANDLE_VALUE -1
58 typedef int HANDLE;
59 typedef unsigned long DWORD;
60
61 #define BI_RGB 0L
62
63 #if !defined(_BITMAPFILEHEADER_)
64 #define _BITMAPFILEHEADER_
65 typedef struct
66 #ifdef HAVE_ATTRIBUTE_PACKED
67     __attribute__((__packed__))
68 #endif
69 {
70         uint16_t   bfType;
71         uint32_t   bfSize;
72         uint16_t   bfReserved1;
73         uint16_t   bfReserved2;
74         uint32_t   bfOffBits;
75 } BITMAPFILEHEADER, *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;
76 #endif
77
78 #endif
79
80
81
82 // maximal Anzahl Kanäle... original 5!
83 #define CAP_MAX_NUM_ZONES  64
84 // only for classic to avoid changing too much code!
85 // #define ATMO_MAX_NUM_CHANNELS 5
86
87 // capture width/height
88
89 // #define CAP_WIDTH    88
90
91 #ifdef CAP_16x9
92 # define CAP_WIDTH    88
93 # define CAP_HEIGHT   48
94 #else
95 # define CAP_WIDTH    64
96 # define CAP_HEIGHT   48
97 #endif
98
99 // imagesize
100 #define IMAGE_SIZE   (CAP_WIDTH * CAP_HEIGHT)
101
102 /*
103   number of pixel the atmo zones should overlap - based on CAP_WIDTH and CAP_HEIGHT
104 */
105 #define CAP_ZONE_OVERLAP  2
106
107
108
109 enum AtmoConnectionType
110 {
111       actClassicAtmo = 0,
112       actDummy = 1,
113       actDMX = 2,
114       actNUL = 3,
115       actMultiAtmo = 4,
116       actMondolight = 5,
117       actMoMoLight  = 6
118 };
119 static const char *AtmoDeviceTypes[] = {
120       "Atmo-Classic",
121       "Dummy",
122       "DMX",
123       "Nul-Device",
124       "Multi-Atmo",
125       "Mondolight",
126       "MoMoLight"
127
128   };
129 #define ATMO_DEVICE_COUNT 7
130
131 #if defined(_ATMO_VLC_PLUGIN_)
132 enum EffectMode {
133       emUndefined = -1,
134       emDisabled = 0,
135       emStaticColor = 1,
136       emLivePicture = 2
137    };
138
139 enum LivePictureSource {
140        lpsDisabled = 0,
141        lpsExtern = 2
142      };
143
144 #else
145
146 enum EffectMode {
147       emUndefined = -1,
148       emDisabled = 0,
149       emStaticColor = 1,
150       emLivePicture = 2,
151       emColorChange = 3,
152       emLrColorChange = 4
153    };
154
155 enum LivePictureSource {
156        lpsDisabled = 0,
157        lpsScreenCapture = 1,
158        lpsExtern = 2
159      };
160
161 #endif
162
163 enum AtmoGammaCorrect {
164      agcNone = 0,
165      agcPerColor = 1,
166      agcGlobal = 2
167 };
168
169 enum AtmoFilterMode {
170      afmNoFilter,
171      afmCombined,
172      afmPercent
173 };
174
175
176 // --- tRGBColor --------------------------------------------------------------
177 typedef struct
178 {
179   unsigned char r, g, b;
180 } tRGBColor;
181
182 // --- tColorPacket -----------------------------------------------------------
183 typedef struct
184 {
185    int numColors;
186    tRGBColor zone[1];
187 } xColorPacket;
188 typedef xColorPacket* pColorPacket;
189 #define AllocColorPacket(packet, numColors_) packet = (pColorPacket)new char[sizeof(xColorPacket) + (numColors_)*sizeof(tRGBColor)]; \
190                                              packet->numColors = numColors_;
191
192 #define DupColorPacket(dest, source) dest = NULL; \
193                                      if(source) { \
194                                          dest = (pColorPacket)new char[sizeof(xColorPacket) + (source->numColors)*sizeof(tRGBColor)]; \
195                                          memcpy(dest, source, sizeof(xColorPacket) + (source->numColors)*sizeof(tRGBColor)); \
196                                      }
197
198 #define CopyColorPacket( source, dest)  memcpy(dest, source, sizeof(xColorPacket) + (source->numColors)*sizeof(tRGBColor) );
199
200
201 #define ZeroColorPacket( packet ) memset( &((packet)->zone[0]), 0, (packet->numColors)*sizeof(tRGBColor));
202
203 // --- tRGBColorLongInt -------------------------------------------------------
204 typedef struct
205 {
206   long int r, g, b;
207 } tRGBColorLongInt;
208
209 // --- tColorPacketLongInt ----------------------------------------------------
210 typedef struct
211 {
212   int numColors;
213   tRGBColorLongInt longZone[1];
214 } xColorPacketLongInt;
215 typedef xColorPacketLongInt* pColorPacketLongInt;
216 #define AllocLongColorPacket(packet, numColors_) packet = (pColorPacketLongInt)new char[sizeof(xColorPacketLongInt) + (numColors_)*sizeof(tRGBColorLongInt)]; \
217                                              packet->numColors = numColors_;
218
219 #define DupLongColorPacket(dest, source) dest = NULL; \
220                                      if(source) { \
221                                          dest = (pColorPacketLongInt)new char[sizeof(xColorPacketLongInt) + (source->numColors)*sizeof(tRGBColorLongInt)]; \
222                                          memcpy(dest, source, sizeof(xColorPacketLongInt) + (source->numColors)*sizeof(tRGBColorLongInt)); \
223                                      }
224 #define ZeroLongColorPacket( packet ) memset( &((packet)->longZone[0]), 0, (packet->numColors)*sizeof(tRGBColorLongInt));
225
226
227 // --- tWeightPacket ----------------------------------------------------------
228 /*
229 typedef struct
230 {
231   int channel[CAP_MAX_NUM_ZONES];
232 } tWeightPacket;
233 */
234
235 // --- tHSVColor --------------------------------------------------------------
236 typedef struct
237 {
238   unsigned char h, s, v;
239 } tHSVColor;
240
241 #endif