1 #include "bcdisplayinfo.h"
6 #include "overlayframe.h"
16 REGISTER_PLUGIN(WipeMain)
22 WipeLeft::WipeLeft(WipeMain *plugin,
28 plugin->direction == 0,
31 this->plugin = plugin;
32 this->window = window;
35 int WipeLeft::handle_event()
38 plugin->direction = 0;
39 window->right->update(0);
40 plugin->send_configure_change();
44 WipeRight::WipeRight(WipeMain *plugin,
50 plugin->direction == 1,
53 this->plugin = plugin;
54 this->window = window;
57 int WipeRight::handle_event()
60 plugin->direction = 1;
61 window->left->update(0);
62 plugin->send_configure_change();
73 WipeWindow::WipeWindow(WipeMain *plugin, int x, int y)
74 : BC_Window(plugin->gui_string,
85 this->plugin = plugin;
89 int WipeWindow::close_event()
95 void WipeWindow::create_objects()
98 add_subwindow(new BC_Title(x, y, _("Direction:")));
100 add_subwindow(left = new WipeLeft(plugin,
105 add_subwindow(right = new WipeRight(plugin,
116 PLUGIN_THREAD_OBJECT(WipeMain, WipeThread, WipeWindow)
123 WipeMain::WipeMain(PluginServer *server)
124 : PluginVClient(server)
127 PLUGIN_CONSTRUCTOR_MACRO
130 WipeMain::~WipeMain()
132 PLUGIN_DESTRUCTOR_MACRO
135 char* WipeMain::plugin_title() { return N_("Wipe"); }
136 int WipeMain::is_video() { return 1; }
137 int WipeMain::is_transition() { return 1; }
138 int WipeMain::uses_gui() { return 1; }
140 SHOW_GUI_MACRO(WipeMain, WipeThread);
141 SET_STRING_MACRO(WipeMain)
142 RAISE_WINDOW_MACRO(WipeMain)
145 VFrame* WipeMain::new_picon()
147 return new VFrame(picon_png);
150 int WipeMain::load_defaults()
152 char directory[BCTEXTLEN];
153 // set the default directory
154 sprintf(directory, "%swipe.rc", BCASTDIR);
157 defaults = new BC_Hash(directory);
160 direction = defaults->get("DIRECTION", direction);
164 int WipeMain::save_defaults()
166 defaults->update("DIRECTION", direction);
171 void WipeMain::save_data(KeyFrame *keyframe)
174 output.set_shared_string(keyframe->data, MESSAGESIZE);
175 output.tag.set_title("WIPE");
176 output.tag.set_property("DIRECTION", direction);
178 output.terminate_string();
181 void WipeMain::read_data(KeyFrame *keyframe)
185 input.set_shared_string(keyframe->data, strlen(keyframe->data));
187 while(!input.read_tag())
189 if(input.tag.title_is("WIPE"))
191 direction = input.tag.get_property("DIRECTION", direction);
196 void WipeMain::load_configuration()
198 read_data(get_prev_keyframe(get_source_position()));
206 #define WIPE(type, components) \
210 for(int j = 0; j < h; j++) \
212 type *in_row = (type*)incoming->get_rows()[j]; \
213 type *out_row = (type*)outgoing->get_rows()[j]; \
214 int x = incoming->get_w() * \
215 PluginClient::get_source_position() / \
216 PluginClient::get_total_len(); \
218 for(int k = 0; k < x; k++) \
220 out_row[k * components + 0] = in_row[k * components + 0]; \
221 out_row[k * components + 1] = in_row[k * components + 1]; \
222 out_row[k * components + 2] = in_row[k * components + 2]; \
223 if(components == 4) out_row[k * components + 3] = in_row[k * components + 3]; \
229 for(int j = 0; j < h; j++) \
231 type *in_row = (type*)incoming->get_rows()[j]; \
232 type *out_row = (type*)outgoing->get_rows()[j]; \
233 int x = incoming->get_w() - incoming->get_w() * \
234 PluginClient::get_source_position() / \
235 PluginClient::get_total_len(); \
237 for(int k = x; k < w; k++) \
239 out_row[k * components + 0] = in_row[k * components + 0]; \
240 out_row[k * components + 1] = in_row[k * components + 1]; \
241 out_row[k * components + 2] = in_row[k * components + 2]; \
242 if(components == 4) out_row[k * components + 3] = in_row[k * components + 3]; \
252 int WipeMain::process_realtime(VFrame *incoming, VFrame *outgoing)
254 load_configuration();
256 int w = incoming->get_w();
257 int h = incoming->get_h();
260 switch(incoming->get_color_model())
267 WIPE(unsigned char, 3)
274 WIPE(unsigned char, 4)
280 case BC_RGBA16161616:
281 case BC_YUVA16161616: