a745fea2a5e1dca1b9c945eea81b34036a081ce1
[platform/upstream/gst-plugins-good.git] / gst / goom / goom_plugin_info.h
1 #ifndef _PLUGIN_INFO_H
2 #define _PLUGIN_INFO_H
3
4 #include "goom_typedefs.h"
5
6 #include "goom_config.h"
7
8 #include "goom_graphic.h"
9 #include "goom_config_param.h"
10 #include "goom_visual_fx.h"
11 #include "goom_filters.h"
12 #include "goom_tools.h"
13
14 typedef struct {
15         char drawIFS;
16         char drawPoints;
17         char drawTentacle;
18
19         char drawScope;
20         int farScope;
21
22         int rangemin;
23         int rangemax;
24 } GoomState;
25
26 #define STATES_MAX_NB 128
27
28 /**
29  * Gives informations about the sound.
30  */
31 struct _SOUND_INFO {
32
33         /* nota : a Goom is just a sound event... */
34
35         int timeSinceLastGoom;   /* >= 0 */
36         float goomPower;         /* power of the last Goom [0..1] */
37
38         int timeSinceLastBigGoom;   /* >= 0 */
39
40         float volume;     /* [0..1] */
41         short samples[2][512];
42
43         /* other "internal" datas for the sound_tester */
44         float goom_limit; /* auto-updated limit of goom_detection */
45         float bigGoomLimit;
46         float accelvar;   /* acceleration of the sound - [0..1] */
47         float speedvar;   /* speed of the sound - [0..100] */
48         int allTimesMax;
49         int totalgoom;    /* number of goom since last reset
50                            * (a reset every 64 cycles) */
51
52         float prov_max;   /* accel max since last reset */
53
54         int cycle;
55
56         /* private */
57         PluginParam volume_p;
58         PluginParam speed_p;
59         PluginParam accel_p;
60         PluginParam goom_limit_p;
61         PluginParam goom_power_p;
62         PluginParam last_goom_p;
63         PluginParam last_biggoom_p;
64         PluginParam biggoom_speed_limit_p;
65         PluginParam biggoom_factor_p;
66
67         PluginParameters params; /* contains the previously defined parameters. */
68 };
69
70
71 /**
72  * Allows FXs to know the current state of the plugin.
73  */
74 struct _PLUGIN_INFO {
75
76         /* public datas */
77
78         int nbParams;
79         PluginParameters *params;
80
81         /* private datas */
82
83         struct _SIZE_TYPE {
84                 int width;
85                 int height;
86                 int size;   /* == screen.height * screen.width. */
87         } screen;
88
89         SoundInfo sound;
90
91         int nbVisuals;
92         VisualFX **visuals; /* pointers on all the visual fx */
93
94         /** The known FX */
95         VisualFX convolve_fx;
96         VisualFX star_fx;
97         VisualFX zoomFilter_fx;
98         VisualFX tentacles_fx;
99         VisualFX ifs_fx;
100
101         /** image buffers */
102         guint32 *pixel;
103         guint32 *back;
104         Pixel *p1, *p2;
105         Pixel *conv;
106   Pixel *outputBuf;
107
108         /** state of goom */
109         guint32 cycle;
110         GoomState states[STATES_MAX_NB];
111         int statesNumber;
112         int statesRangeMax;
113
114         GoomState *curGState;
115
116         /** effet de ligne.. */
117         GMLine *gmline1;
118         GMLine *gmline2;
119
120         /** sinus table */
121         int sintable[0x10000];
122
123         /* INTERNALS */
124         
125         /** goom_update internals.
126          * I took all static variables from goom_update and put them here.. for the moment.
127          */
128         struct {
129                 int lockvar;               /* pour empecher de nouveaux changements */
130                 int goomvar;               /* boucle des gooms */
131                 int loopvar;               /* mouvement des points */
132                 int stop_lines;
133                 int ifs_incr;              /* dessiner l'ifs (0 = non: > = increment) */
134                 int decay_ifs;             /* disparition de l'ifs */
135                 int recay_ifs;             /* dedisparition de l'ifs */
136                 int cyclesSinceLastChange; /* nombre de Cycle Depuis Dernier Changement */
137                 int drawLinesDuration;     /* duree de la transition entre afficher les lignes ou pas */
138                 int lineMode;              /* l'effet lineaire a dessiner */
139                 float switchMultAmount;    /* SWITCHMULT (29.0f/30.0f) */
140                 int switchIncrAmount;      /* 0x7f */
141                 float switchMult;          /* 1.0f */
142                 int switchIncr;            /*  = SWITCHINCR; */
143                 int stateSelectionRnd;
144                 int stateSelectionBlocker;
145                 int previousZoomSpeed;
146                 ZoomFilterData zoomFilterData;                
147         } update;
148
149         struct {
150                 void (*draw_line) (Pixel *data, int x1, int y1, int x2, int y2, int col, int screenx, int screeny);
151                 void (*zoom_filter) (int sizeX, int sizeY, Pixel *src, Pixel *dest, int *brutS, int *brutD, int buffratio, int precalCoef[16][16]);
152         } methods;
153         
154         GoomRandom *gRandom;
155 };
156
157 void plugin_info_init(PluginInfo *p, int nbVisual); 
158 void plugin_info_free(PluginInfo *p);
159
160 /* i = [0..p->nbVisual-1] */
161 void plugin_info_add_visual(PluginInfo *p, int i, VisualFX *visual);
162
163 #endif