]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/atmo/AtmoDefs.h
enhanced & corrected AtmoLight filter module
[vlc] / modules / video_filter / atmo / AtmoDefs.h
index 7ee1c4ed1237e7468ba1fe53e37a2e7b579cbefa..f9195971bf7f017f15fd4bd298a43828d326ad45 100644 (file)
 #ifndef _AtmoDefs_h_
 #define _AtmoDefs_h_
 
-#if defined(__LIBVLC__)
-#   include "config.h"
 
-#   define __STDC_CONSTANT_MACROS 1
-#   include <inttypes.h>
+#if defined(__LIBVLC__)
 
-#   include <vlc_common.h>
+#   include "config.h"
+#   include <vlc/vlc.h>
 
 /* some things need to be changed if this code is used inside VideoLan Filter Module */
 #   define _ATMO_VLC_PLUGIN_
-#   define ATMO_BOOL bool
-#   define ATMO_TRUE true
-#   define ATMO_FALSE false
+#   define get_time mdate()
+#   define do_sleep(a) msleep(a)
 
 #else
 
-    typedef int ATMO_BOOL;
-#   define ATMO_TRUE   1
-#   define ATMO_FALSE  0
-#   define MakeWord(ch1,ch2)  ((((int)(ch1)&255)<<8) | \
-                           ((int)(ch2)&255))
-
 #   define MakeDword(ch1,ch2,ch3,ch4) ((((DWORD)(ch1)&255) << 24) | \
                                    (((DWORD)(ch2)&255) << 16) | \
                                    (((DWORD)(ch3)&255) << 8) | \
                                    (((DWORD)(ch4)&255)))
 
+#  define get_time 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)
 
@@ -68,33 +79,54 @@ typedef struct
 
 
 
+// maximal Anzahl Kanäle... original 5!
+#define CAP_MAX_NUM_ZONES  64
+// only for classic to avoid changing too much code!
+// #define ATMO_MAX_NUM_CHANNELS 5
 
+// capture width/height
 
+// #define CAP_WIDTH    88
 
-
-// maximal Anzahl Kanäle...
-#define ATMO_NUM_CHANNELS   5
-
-// capture width/height
-#define CAP_WIDTH    64
-#define CAP_HEIGHT   48
+#ifdef CAP_16x9
+# define CAP_WIDTH    88
+# define CAP_HEIGHT   48
+#else
+# define CAP_WIDTH    64
+# define CAP_HEIGHT   48
+#endif
 
 // imagesize
 #define IMAGE_SIZE   (CAP_WIDTH * CAP_HEIGHT)
 
+/*
+  number of pixel the atmo zones should overlap - based on CAP_WIDTH and CAP_HEIGHT
+*/
+#define CAP_ZONE_OVERLAP  2
+
+
 
 enum AtmoConnectionType
 {
-      actSerialPort = 0,
+      actClassicAtmo = 0,
       actDummy = 1,
-      actDMX = 2
+      actDMX = 2,
+      actNUL = 3,
+      actMultiAtmo = 4,
+      actMondolight = 5,
+      actMoMoLight  = 6
 };
 static const char *AtmoDeviceTypes[] = {
-      "Atmo",
+      "Atmo-Classic",
       "Dummy",
-      "DMX"
+      "DMX",
+      "Nul-Device",
+      "Multi-Atmo",
+      "Mondolight",
+      "MoMoLight"
+
   };
-#define ATMO_DEVICE_COUNT 3
+#define ATMO_DEVICE_COUNT 7
 
 #if defined(_ATMO_VLC_PLUGIN_)
 enum EffectMode {
@@ -103,7 +135,14 @@ enum EffectMode {
       emStaticColor = 1,
       emLivePicture = 2
    };
+
+enum LivePictureSource {
+       lpsDisabled = 0,
+       lpsExtern = 2
+     };
+
 #else
+
 enum EffectMode {
       emUndefined = -1,
       emDisabled = 0,
@@ -112,10 +151,20 @@ enum EffectMode {
       emColorChange = 3,
       emLrColorChange = 4
    };
-#endif
 
+enum LivePictureSource {
+       lpsDisabled = 0,
+       lpsScreenCapture = 1,
+       lpsExtern = 2
+     };
 
+#endif
 
+enum AtmoGammaCorrect {
+     agcNone = 0,
+     agcPerColor = 1,
+     agcGlobal = 2
+};
 
 enum AtmoFilterMode {
      afmNoFilter,
@@ -123,12 +172,6 @@ enum AtmoFilterMode {
      afmPercent
 };
 
-typedef struct {
-    ATMO_BOOL system;
-    char name[64];
-    int mappings[ATMO_NUM_CHANNELS];
-} tChannelAssignment;
-
 
 // --- tRGBColor --------------------------------------------------------------
 typedef struct
@@ -139,8 +182,23 @@ typedef struct
 // --- tColorPacket -----------------------------------------------------------
 typedef struct
 {
-  tRGBColor channel[ATMO_NUM_CHANNELS];
-} tColorPacket;
+   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
@@ -151,14 +209,28 @@ typedef struct
 // --- tColorPacketLongInt ----------------------------------------------------
 typedef struct
 {
-  tRGBColorLongInt channel[ATMO_NUM_CHANNELS];
-} tColorPacketLongInt;
+  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[ATMO_NUM_CHANNELS];
+  int channel[CAP_MAX_NUM_ZONES];
 } tWeightPacket;
+*/
 
 // --- tHSVColor --------------------------------------------------------------
 typedef struct