bg/clr color tweaks, clear borders rework, fc31 depends
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / removegaps / removegaps.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2012 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef REMOVEGAPS_H
23 #define REMOVEGAPS_H
24
25
26 #include "guicast.h"
27 #include "pluginaclient.h"
28 #include "resample.h"
29
30
31
32 class RemoveGaps;
33 class RemoveGapsWindow;
34
35 class RemoveGapsConfig
36 {
37 public:
38         RemoveGapsConfig();
39         void boundaries();
40         int equivalent(RemoveGapsConfig &src);
41         void copy_from(RemoveGapsConfig &src);
42         void interpolate(RemoveGapsConfig &prev,
43                 RemoveGapsConfig &next,
44                 int64_t prev_frame,
45                 int64_t next_frame,
46                 int64_t current_frame);
47 // Threshold to be considered a gap in DB
48         double threshold;
49 // Duration below threshold required to remove a gap in seconds
50         double duration;
51 };
52
53
54 class RemoveGapsThreshold : public BC_FPot
55 {
56 public:
57         RemoveGapsThreshold(RemoveGapsWindow *window,
58                 RemoveGaps *plugin,
59                 int x,
60                 int y);
61         int handle_event();
62         RemoveGaps *plugin;
63 };
64
65 class RemoveGapsDuration : public BC_FPot
66 {
67 public:
68         RemoveGapsDuration(RemoveGapsWindow *window,
69                 RemoveGaps *plugin,
70                 int x,
71                 int y);
72         int handle_event();
73         RemoveGaps *plugin;
74 };
75
76 class RemoveGapsWindow : public PluginClientWindow
77 {
78 public:
79         RemoveGapsWindow(RemoveGaps *plugin);
80         ~RemoveGapsWindow();
81         void create_objects();
82
83         RemoveGaps *plugin;
84         RemoveGapsThreshold *threshold;
85         RemoveGapsDuration *duration;
86 };
87
88
89
90 class RemoveGaps : public PluginAClient
91 {
92 public:
93         RemoveGaps(PluginServer *server);
94         ~RemoveGaps();
95
96         PLUGIN_CLASS_MEMBERS2(RemoveGapsConfig)
97
98         void save_data(KeyFrame *keyframe);
99         void read_data(KeyFrame *keyframe);
100         void update_gui();
101         int is_realtime();
102         int process_buffer(int64_t size,
103                 Samples *buffer,
104                 int64_t start_position,
105                 int sample_rate);
106         void render_stop();
107
108         Samples *temp;
109 // Position in temp buffer of input
110         int temp_position;
111
112 // Position being read
113         int64_t source_start;
114 // Position being written, to detect a seek operation
115         int64_t dest_start;
116 // Current samples below threshold
117         int64_t gap_length;
118         int need_reconfigure;
119 };
120
121
122 #endif
123