4 * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #include "bcdisplayinfo.h"
29 #include "loadbalance.h"
31 #include "pluginvclient.h"
33 #include "scopewindow.h"
42 class VideoScopeEffect;
43 class VideoScopeWindow;
45 class VideoScopeConfig
51 class VideoScopeWindow : public ScopeGUI
54 VideoScopeWindow(VideoScopeEffect *plugin);
57 void create_objects();
59 int resize_event(int w, int h);
61 VideoScopeEffect *plugin;
64 class VideoScopeEffect : public PluginVClient
67 VideoScopeEffect(PluginServer *server);
71 PLUGIN_CLASS_MEMBERS2(VideoScopeConfig)
72 int process_realtime(VFrame *input, VFrame *output);
74 void render_gui(void *input);
75 void save_data(KeyFrame *keyframe);
76 void read_data(KeyFrame *keyframe);
78 int use_hist, use_wave, use_vector;
79 int use_hist_parade, use_wave_parade;
80 int use_wave_gain, use_vect_gain;
81 int use_smooth, use_graticule;
88 VideoScopeConfig::VideoScopeConfig()
92 VideoScopeWindow::VideoScopeWindow(VideoScopeEffect *plugin)
93 : ScopeGUI(plugin, plugin->w, plugin->h)
95 this->plugin = plugin;
98 VideoScopeWindow::~VideoScopeWindow()
102 void VideoScopeWindow::create_objects()
104 use_hist = plugin->use_hist;
105 use_wave = plugin->use_wave;
106 use_vector = plugin->use_vector;
107 use_hist_parade = plugin->use_hist_parade;
108 use_wave_parade = plugin->use_wave_parade;
109 use_wave_gain = plugin->use_wave_gain;
110 use_vect_gain = plugin->use_vect_gain;
111 use_smooth = plugin->use_smooth;
114 use_graticule = plugin->use_graticule;
116 ScopeGUI::create_objects();
119 void VideoScopeWindow::toggle_event()
121 plugin->use_hist = use_hist;
122 plugin->use_wave = use_wave;
123 plugin->use_vector = use_vector;
124 plugin->use_hist_parade = use_hist_parade;
125 plugin->use_wave_parade = use_wave_parade;
126 plugin->use_wave_gain = use_wave_gain;
127 plugin->use_vect_gain = use_vect_gain;
128 plugin->use_smooth = use_smooth;
129 plugin->use_graticule = use_graticule;
131 plugin->send_configure_change();
135 int VideoScopeWindow::resize_event(int w, int h)
137 ScopeGUI::resize_event(w, h);
141 plugin->send_configure_change();
145 REGISTER_PLUGIN(VideoScopeEffect)
147 VideoScopeEffect::VideoScopeEffect(PluginServer *server)
148 : PluginVClient(server)
163 VideoScopeEffect::~VideoScopeEffect()
167 const char* VideoScopeEffect::plugin_title() { return N_("VideoScope"); }
168 int VideoScopeEffect::is_realtime() { return 1; }
170 int VideoScopeEffect::load_configuration()
175 void VideoScopeEffect::save_data(KeyFrame *keyframe)
179 // cause data to be stored directly in text
180 output.set_shared_output(keyframe->xbuf);
181 output.tag.set_title("VIDEOSCOPE");
182 if( is_defaults() ) {
183 output.tag.set_property("W", w);
184 output.tag.set_property("H", h);
185 output.tag.set_property("USE_HIST", use_hist);
186 output.tag.set_property("USE_WAVE", use_wave);
187 output.tag.set_property("USE_VECTOR", use_vector);
188 output.tag.set_property("USE_HIST_PARADE", use_hist_parade);
189 output.tag.set_property("USE_WAVE_PARADE", use_wave_parade);
190 output.tag.set_property("USE_WAVE_GAIN", use_wave_gain);
191 output.tag.set_property("USE_VECT_GAIN", use_vect_gain);
192 output.tag.set_property("USE_SMOOTH", use_smooth);
193 output.tag.set_property("USE_GRATICULE", use_graticule);
197 output.tag.set_title("/VIDEOSCOPE");
199 output.append_newline();
200 output.terminate_string();
203 void VideoScopeEffect::read_data(KeyFrame *keyframe)
206 input.set_shared_input(keyframe->xbuf);
209 while( !(result = input.read_tag()) ) {
210 if( input.tag.title_is("VIDEOSCOPE") ) {
211 if( is_defaults() ) {
212 w = input.tag.get_property("W", w);
213 h = input.tag.get_property("H", h);
214 use_hist = input.tag.get_property("USE_HIST", use_hist);
215 use_wave = input.tag.get_property("USE_WAVE", use_wave);
216 use_vector = input.tag.get_property("USE_VECTOR", use_vector);
217 use_hist_parade = input.tag.get_property("USE_HIST_PARADE", use_hist_parade);
218 use_wave_parade = input.tag.get_property("USE_WAVE_PARADE", use_wave_parade);
219 use_wave_gain = input.tag.get_property("USE_WAVE_GAIN", use_wave_gain);
220 use_vect_gain = input.tag.get_property("USE_VECT_GAIN", use_vect_gain);
221 use_smooth = input.tag.get_property("USE_SMOOTH", use_smooth);
222 use_graticule = input.tag.get_property("USE_GRATICULE", use_graticule);
228 NEW_WINDOW_MACRO(VideoScopeEffect, VideoScopeWindow)
230 int VideoScopeEffect::process_realtime(VFrame *input, VFrame *output)
233 send_render_gui(input);
234 if( input->get_rows()[0] != output->get_rows()[0] )
235 output->copy_from(input);
239 void VideoScopeEffect::render_gui(void *input)
241 if( !thread ) return;
242 VideoScopeWindow *window = ((VideoScopeWindow*)thread->window);
243 window->lock_window();
244 this->input = (VFrame*)input;
245 window->process(this->input);
246 window->unlock_window();