3 #include "overlayframe.h"
9 #define _(String) gettext(String)
10 #define gettext_noop(String) String
11 #define N_(String) gettext_noop (String)
13 PluginClient* new_plugin(PluginServer *server)
15 return new FlashMain(server);
22 FlashMain::FlashMain(PluginServer *server)
23 : PluginVClient(server)
27 FlashMain::~FlashMain()
31 char* FlashMain::plugin_title() { return _("Flash"); }
32 int FlashMain::is_video() { return 1; }
33 int FlashMain::is_transition() { return 1; }
34 int FlashMain::uses_gui() { return 0; }
36 NEW_PICON_MACRO(FlashMain)
39 #define FLASH(type, components, max, chroma_offset) \
41 int foreground = (int)(fraction * max + 0.5); \
42 int chroma_foreground = foreground; \
43 if(chroma_offset) chroma_foreground = foreground * chroma_offset / max; \
44 int transparency = max - foreground; \
45 /* printf("FLASH %d %d %d\n", foreground, transparency, is_before); */\
46 for(int i = 0; i < h; i++) \
48 type *in_row = (type*)incoming->get_rows()[i]; \
49 type *out_row = (type*)outgoing->get_rows()[i]; \
52 for(int j = 0; j < w; j++) \
54 *out_row = foreground + transparency * *out_row / max; \
56 *out_row = chroma_foreground + transparency * *out_row / max; \
58 *out_row = chroma_foreground + transparency * *out_row / max; \
62 *out_row = foreground + transparency * *out_row / max; \
69 for(int j = 0; j < w; j++) \
71 *out_row = foreground + transparency * *in_row / max; \
74 *out_row = chroma_foreground + transparency * *in_row / max; \
77 *out_row = chroma_foreground + transparency * *in_row / max; \
82 *out_row = foreground + transparency * *in_row / max; \
91 int FlashMain::process_realtime(VFrame *incoming, VFrame *outgoing)
93 int half = PluginClient::get_total_len() / 2;
94 int position = half - labs(PluginClient::get_source_position() - half);
95 float fraction = (float)position / half;
96 int is_before = PluginClient::get_source_position() < half;
97 int w = incoming->get_w();
98 int h = incoming->get_h();
100 switch(incoming->get_color_model())
103 FLASH(unsigned char, 3, 0xff, 0x0);
106 FLASH(unsigned char, 4, 0xff, 0x0);
109 FLASH(unsigned char, 3, 0xff, 0x80);
112 FLASH(unsigned char, 4, 0xff, 0x80);
115 FLASH(uint16_t, 3, 0xffff, 0x0);
117 case BC_RGBA16161616:
118 FLASH(uint16_t, 4, 0xffff, 0x0);
121 FLASH(uint16_t, 3, 0xffff, 0x8000);
123 case BC_YUVA16161616:
124 FLASH(uint16_t, 4, 0xffff, 0x8000);