1 #include "bcdisplayinfo.h"
5 #include "overlayframe.h"
15 #define _(String) gettext(String)
16 #define gettext_noop(String) String
17 #define N_(String) gettext_noop (String)
19 REGISTER_PLUGIN(WipeMain)
25 WipeLeft::WipeLeft(WipeMain *plugin,
31 plugin->direction == 0,
34 this->plugin = plugin;
35 this->window = window;
38 int WipeLeft::handle_event()
41 plugin->direction = 0;
42 window->right->update(0);
43 plugin->send_configure_change();
47 WipeRight::WipeRight(WipeMain *plugin,
53 plugin->direction == 1,
56 this->plugin = plugin;
57 this->window = window;
60 int WipeRight::handle_event()
63 plugin->direction = 1;
64 window->left->update(0);
65 plugin->send_configure_change();
76 WipeWindow::WipeWindow(WipeMain *plugin, int x, int y)
77 : BC_Window(plugin->gui_string,
88 this->plugin = plugin;
92 int WipeWindow::close_event()
98 void WipeWindow::create_objects()
101 add_subwindow(new BC_Title(x, y, _("Direction:")));
103 add_subwindow(left = new WipeLeft(plugin,
108 add_subwindow(right = new WipeRight(plugin,
119 PLUGIN_THREAD_OBJECT(WipeMain, WipeThread, WipeWindow)
126 WipeMain::WipeMain(PluginServer *server)
127 : PluginVClient(server)
130 PLUGIN_CONSTRUCTOR_MACRO
133 WipeMain::~WipeMain()
135 PLUGIN_DESTRUCTOR_MACRO
138 char* WipeMain::plugin_title() { return _("Wipe"); }
139 int WipeMain::is_video() { return 1; }
140 int WipeMain::is_transition() { return 1; }
141 int WipeMain::uses_gui() { return 1; }
142 SHOW_GUI_MACRO(WipeMain, WipeThread);
143 SET_STRING_MACRO(WipeMain)
144 RAISE_WINDOW_MACRO(WipeMain)
147 VFrame* WipeMain::new_picon()
149 return new VFrame(picon_png);
152 int WipeMain::load_defaults()
154 char directory[BCTEXTLEN];
155 // set the default directory
156 sprintf(directory, "%swipe.rc", BCASTDIR);
159 defaults = new Defaults(directory);
162 direction = defaults->get("DIRECTION", direction);
166 int WipeMain::save_defaults()
168 defaults->update("DIRECTION", direction);
173 void WipeMain::save_data(KeyFrame *keyframe)
176 output.set_shared_string(keyframe->data, MESSAGESIZE);
177 output.tag.set_title("WIPE");
178 output.tag.set_property("DIRECTION", direction);
180 output.terminate_string();
183 void WipeMain::read_data(KeyFrame *keyframe)
187 input.set_shared_string(keyframe->data, strlen(keyframe->data));
189 while(!input.read_tag())
191 if(input.tag.title_is("WIPE"))
193 direction = input.tag.get_property("DIRECTION", direction);
198 void WipeMain::load_configuration()
200 read_data(get_prev_keyframe(get_source_position()));
208 #define WIPE(type, components) \
212 for(int j = 0; j < h; j++) \
214 type *in_row = (type*)incoming->get_rows()[j]; \
215 type *out_row = (type*)outgoing->get_rows()[j]; \
216 int x = incoming->get_w() * \
217 PluginClient::get_source_position() / \
218 PluginClient::get_total_len(); \
220 for(int k = 0; k < x; k++) \
222 out_row[k * components + 0] = in_row[k * components + 0]; \
223 out_row[k * components + 1] = in_row[k * components + 1]; \
224 out_row[k * components + 2] = in_row[k * components + 2]; \
225 if(components == 4) out_row[k * components + 3] = in_row[k * components + 3]; \
231 for(int j = 0; j < h; j++) \
233 type *in_row = (type*)incoming->get_rows()[j]; \
234 type *out_row = (type*)outgoing->get_rows()[j]; \
235 int x = incoming->get_w() - incoming->get_w() * \
236 PluginClient::get_source_position() / \
237 PluginClient::get_total_len(); \
239 for(int k = x; k < w; k++) \
241 out_row[k * components + 0] = in_row[k * components + 0]; \
242 out_row[k * components + 1] = in_row[k * components + 1]; \
243 out_row[k * components + 2] = in_row[k * components + 2]; \
244 if(components == 4) out_row[k * components + 3] = in_row[k * components + 3]; \
254 int WipeMain::process_realtime(VFrame *incoming, VFrame *outgoing)
256 load_configuration();
258 int w = incoming->get_w();
259 int h = incoming->get_h();
262 switch(incoming->get_color_model())
266 WIPE(unsigned char, 3)
270 WIPE(unsigned char, 4)
276 case BC_RGBA16161616:
277 case BC_YUVA16161616: