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