upgrades/fixes for tracer plugin, add vdpau,vaapi build depends
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / tracer / tracer.h
1 /*
2  * CINELERRA
3  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21
22
23 #ifndef __TRACER_H__
24 #define __TRACER_H__
25
26 #include "loadbalance.h"
27 #include "pluginvclient.h"
28
29 class Tracer;
30
31 enum { PT_X, PT_Y, PT_SZ };
32
33 class TracerPoint
34 {
35 public:
36         float x, y;
37
38         TracerPoint(float x, float y);
39         ~TracerPoint();
40 };
41 class TracerPoints : public ArrayList<TracerPoint *>
42 {
43 public:
44         TracerPoints() {}
45         ~TracerPoints() { remove_all_objects(); }
46 };
47
48 class TracerConfig
49 {
50 public:
51         TracerConfig();
52         ~TracerConfig();
53
54         int equivalent(TracerConfig &that);
55         void copy_from(TracerConfig &that);
56         void interpolate(TracerConfig &prev, TracerConfig &next,
57                 long prev_frame, long next_frame, long current_frame);
58         void limits();
59
60         TracerPoints points;
61         int add_point(float x, float y);
62         int add_point();
63         void del_point(int i);
64
65         int drag, draw, fill;
66         int invert, feather;
67         float radius; 
68         int selected;
69 };
70
71 class TracePoint
72 {
73 public:
74         int x, y, n;
75         TracePoint() {}
76         TracePoint(int x, int y) {
77                 this->x = x; this->y = y;
78                 this->n = 0;
79         }
80 };
81
82 class TracePoints : public ArrayList<TracePoint>
83 {
84 public:
85         TracePoints() {}
86         void add(int x, int y) {
87                 TracePoint *np = &append();
88                 np->x = x;  np->y = y;
89         }
90         void clear() { remove_all(); }
91 };
92
93
94 class Tracer : public PluginVClient
95 {
96 public:
97         Tracer(PluginServer *server);
98         ~Tracer();
99 // required for all realtime plugins
100         PLUGIN_CLASS_MEMBERS2(TracerConfig)
101         int is_realtime();
102         void update_gui();
103         int new_point();
104         void save_data(KeyFrame *keyframe);
105         void read_data(KeyFrame *keyframe);
106         int process_buffer(VFrame *frame, int64_t start_position, double frame_rate);
107         void draw_edge();
108         void draw_mask();
109         void draw_point(TracerPoint *pt);
110         void draw_points();
111         int step();
112         void trace(int i0, int i1);
113         int smooth();
114         void feather(int r, double s);
115         int load_configuration1();
116
117         VFrame *edg, *msk, *frm;
118         uint8_t **edg_rows;
119         uint8_t **msk_rows;
120         uint8_t **frm_rows;
121         TracePoints points;
122         int w, w1, h, h1, pts;
123         int ax, ay, bx, by, cx, cy;
124         int ex, ey, nx, ny;
125         int color_model, bpp;
126         int is_float, is_yuv, has_alpha;
127         int comps, comp;
128 };
129
130 #endif