/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
*/
#include <math.h>
shape == that.shape &&
rate == that.rate &&
EQUIV(center_x, that.center_x) &&
- EQUIV(center_y, that.center_y) &&
+ EQUIV(center_y, that.center_y) &&
invert == that.invert &&
show_grayscale == that.show_grayscale);
}
show_grayscale = that.show_grayscale;
}
-void TimeFrontConfig::interpolate(TimeFrontConfig &prev,
- TimeFrontConfig &next,
- long prev_frame,
- long next_frame,
+void TimeFrontConfig::interpolate(TimeFrontConfig &prev,
+ TimeFrontConfig &next,
+ long prev_frame,
+ long next_frame,
long current_frame)
{
double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
TimeFrontWindow::TimeFrontWindow(TimeFrontMain *plugin)
: PluginClientWindow(plugin,
- 350,
- 290,
- 350,
- 290,
+ 350,
+ 290,
+ 350,
+ 290,
0)
{
this->plugin = plugin;
out_radius = 0;
track_usage_title = 0;
track_usage = 0;
-
+
}
TimeFrontWindow::~TimeFrontWindow()
BC_Title *title;
add_subwindow(title = new BC_Title(x, y, _("Type:")));
- add_subwindow(shape = new TimeFrontShape(plugin,
- this,
- x + title->get_w() + 10,
+ add_subwindow(shape = new TimeFrontShape(plugin,
+ this,
+ x + title->get_w() + 10,
y));
shape->create_objects();
y += 40;
frame_range_y = y;
y += 35;
update_shape();
-
+
add_subwindow(invert = new TimeFrontInvert(plugin, x, y));
add_subwindow(show_grayscale = new TimeFrontShowGrayscale(plugin, x+ 100, y));
}
if(!rate){
y = shape_y + 40;
-
+
add_subwindow(rate_title = new BC_Title(x, y, _("Rate:")));
add_subwindow(rate = new TimeFrontRate(plugin,
x + rate_title->get_w() + 10,
x + center_y_title->get_w() + 10,
y));
}
-
-
+
+
if(!rate)
{
y = shape_y + 40;
-TimeFrontShape::TimeFrontShape(TimeFrontMain *plugin,
- TimeFrontWindow *gui,
- int x,
+TimeFrontShape::TimeFrontShape(TimeFrontMain *plugin,
+ TimeFrontWindow *gui,
+ int x,
int y)
- : BC_PopupMenu(x, y, 190, to_text(plugin->config.shape), 1)
+ : BC_PopupMenu(x, y, 230, to_text(plugin->config.shape), 1)
{
this->plugin = plugin;
this->gui = gui;
}
int TimeFrontShape::from_text(char *text)
{
- if(!strcmp(text, to_text(TimeFrontConfig::LINEAR)))
+ if(!strcmp(text, to_text(TimeFrontConfig::LINEAR)))
return TimeFrontConfig::LINEAR;
- if(!strcmp(text, to_text(TimeFrontConfig::OTHERTRACK)))
+ if(!strcmp(text, to_text(TimeFrontConfig::OTHERTRACK)))
return TimeFrontConfig::OTHERTRACK;
- if(!strcmp(text, to_text(TimeFrontConfig::ALPHA)))
+ if(!strcmp(text, to_text(TimeFrontConfig::ALPHA)))
return TimeFrontConfig::ALPHA;
return TimeFrontConfig::RADIAL;
}
{
plugin->config.shape = from_text(get_text());
gui->update_shape();
+ gui->show_window();
plugin->send_configure_change();
return 1;
}
-TimeFrontTrackUsage::TimeFrontTrackUsage(TimeFrontMain *plugin,
+TimeFrontTrackUsage::TimeFrontTrackUsage(TimeFrontMain *plugin,
TimeFrontWindow *gui, int x, int y)
: BC_PopupMenu(x, y, 140, to_text(plugin->config.track_usage), 1)
{
}
int TimeFrontTrackUsage::from_text(char *text)
{
- if(!strcmp(text, to_text(TimeFrontConfig::OTHERTRACK_INTENSITY)))
+ if(!strcmp(text, to_text(TimeFrontConfig::OTHERTRACK_INTENSITY)))
return TimeFrontConfig::OTHERTRACK_INTENSITY;
- if(!strcmp(text, to_text(TimeFrontConfig::OTHERTRACK_ALPHA)))
+ if(!strcmp(text, to_text(TimeFrontConfig::OTHERTRACK_ALPHA)))
return TimeFrontConfig::OTHERTRACK_ALPHA;
return TimeFrontConfig::OTHERTRACK_INTENSITY;
{
plugin->config.track_usage = from_text(get_text());
gui->update_shape();
+ gui->show_window();
plugin->send_configure_change();
return 1;
}
TimeFrontRate::TimeFrontRate(TimeFrontMain *plugin, int x, int y)
: BC_PopupMenu(x,
y,
- 100,
+ 155,
to_text(plugin->config.rate),
1)
{
case TimeFrontConfig::LOG:
return _("Log");
default:
- return _("Square");
+ return C_("Square");
}
}
int TimeFrontRate::from_text(char *text)
{
- if(!strcmp(text, to_text(TimeFrontConfig::LINEAR)))
+ if(!strcmp(text, to_text(TimeFrontConfig::LINEAR)))
return TimeFrontConfig::LINEAR;
if(!strcmp(text, to_text(TimeFrontConfig::LOG)))
return TimeFrontConfig::LOG;
TimeFrontInvert::TimeFrontInvert(TimeFrontMain *client, int x, int y)
- : BC_CheckBox(x,
- y,
- client->config.invert,
+ : BC_CheckBox(x,
+ y,
+ client->config.invert,
_("Inversion"))
{
this->plugin = client;
}
TimeFrontShowGrayscale::TimeFrontShowGrayscale(TimeFrontMain *client, int x, int y)
- : BC_CheckBox(x,
- y,
- client->config.show_grayscale,
+ : BC_CheckBox(x,
+ y,
+ client->config.show_grayscale,
_("Show grayscale (for tuning"))
{
this->plugin = client;
TimeFrontMain::TimeFrontMain(PluginServer *server)
: PluginVClient(server)
{
-
+
need_reconfigure = 1;
gradient = 0;
engine = 0;
TimeFrontMain::~TimeFrontMain()
{
-
+
if(gradient) delete gradient;
if(engine) delete engine;
grad_row[j] = (unsigned char) (CLIP((float)config.frame_range * tmp * in_row[j * components + 3] / maxval / maxval / 3, 0.0F, config.frame_range)); \
} \
}
-
+
#define GRADIENTFROMCHANNEL(type, components, max, channel) \
for(int i = 0; i < tfframe->get_h(); i++) \
{ \
grad_row ++; \
} \
}
-
+
#define GRADIENTTOYUVPICTURE(type, inttype, components, max, invertion) \
for(int i = 0; i < height; i++) \
{ \
{
VFrame **outframes = frame;
VFrame *(framelist[1024]);
- framelist[0] = new VFrame (
- outframes[0]->get_w(),
- outframes[0]->get_h(),
- outframes[0]->get_color_model());
+ framelist[0] = new VFrame (outframes[0]->get_w(), outframes[0]->get_h(),
+ outframes[0]->get_color_model(), 0);
read_frame(framelist[0],
0,
start_position,
if (config.shape == TimeFrontConfig::OTHERTRACK)
{
// this->output = frame[1];
- if (get_total_buffers() != 2)
+ if (get_total_buffers() != 2)
{
// FIXME, maybe this should go to some other notification area?
printf(_("ERROR: TimeFront plugin - If you are using another track for timefront, you have to have it under shared effects\n"));
{
need_reconfigure = 0;
- if(!gradient) gradient = new VFrame(
- outframes[0]->get_w(),
- outframes[0]->get_h(),
- BC_A8);
+ if(!gradient)
+ gradient = new VFrame( outframes[0]->get_w(), outframes[0]->get_h(), BC_A8, 0);
-
if (config.shape != TimeFrontConfig::OTHERTRACK &&
config.shape != TimeFrontConfig::ALPHA)
{
get_project_smp() + 1);
engine->process_packages();
}
-
+
}
if (config.shape == TimeFrontConfig::ALPHA)
{
- if(!gradient) gradient = new VFrame(
- outframes[0]->get_w(),
- outframes[0]->get_h(),
- BC_A8);
+ if(!gradient)
+ gradient = new VFrame(outframes[0]->get_w(), outframes[0]->get_h(), BC_A8, 0);
VFrame *tfframe = framelist[0];
switch (tfframe->get_color_model())
{
case BC_RGBA_FLOAT:
GRADIENTFROMCHANNEL(float, 4, 1.0f, 3);
break;
-
+
default:
{
printf(_("TimeFront plugin error: ALPHA used, but project color model does not have alpha\n"));
} else
if (config.shape == TimeFrontConfig::OTHERTRACK)
{
- if(!gradient) gradient = new VFrame(
- outframes[0]->get_w(),
- outframes[0]->get_h(),
- BC_A8);
+ if(!gradient)
+ gradient = new VFrame(outframes[0]->get_w(), outframes[0]->get_h(), BC_A8, 0);
VFrame *tfframe = outframes[1];
read_frame(tfframe,
1,
case BC_RGBA_FLOAT:
GRADIENTFROMCHANNEL(float, 4, 1.0f, 3);
break;
-
+
default:
{
printf(_("TimeFront plugin error: ALPHA track used, but project color model does not have alpha\n"));
printf(_("TimeFront plugin error: unsupported track_usage parameter\n"));
return 1;
}
- }
+ }
if (!config.show_grayscale)
{
- for (int i = 1; i <= config.frame_range; i++)
+ for (int i = 1; i <= config.frame_range; i++)
{
- framelist[i] = new VFrame (
- outframes[0]->get_w(),
- outframes[0]->get_h(),
- outframes[0]->get_color_model());
+ framelist[i] = new VFrame (outframes[0]->get_w(), outframes[0]->get_h(),
+ outframes[0]->get_color_model(), 0);
read_frame(framelist[i],
0,
0);
}
}
-
+
int width = outframes[0]->get_w();
int height = outframes[0]->get_h();
break;
}
}
- } else
+ } else
if (!config.invert)
{
switch (outframes[0]->get_color_model())
case BC_RGBA_FLOAT:
SETALPHA(float, 1.0f);
break;
-
+
default:
break;
}
delete framelist[0];
if (!config.show_grayscale)
{
- for (int i = 1; i <= config.frame_range; i++)
+ for (int i = 1; i <= config.frame_range; i++)
delete framelist[i];
}
return 0;
((TimeFrontWindow*)thread->window)->center_x->update(config.center_x);
if(((TimeFrontWindow*)thread->window)->center_y)
((TimeFrontWindow*)thread->window)->center_y->update(config.center_y);
-
+
((TimeFrontWindow*)thread->window)->update_shape();
thread->window->unlock_window();
}
-TimeFrontServer::TimeFrontServer(TimeFrontMain *plugin,
- int total_clients,
+TimeFrontServer::TimeFrontServer(TimeFrontMain *plugin,
+ int total_clients,
int total_packages)
: LoadServer(total_clients, total_packages)
{
for(int i = 0; i < get_total_packages(); i++)
{
TimeFrontPackage *package = (TimeFrontPackage*)get_package(i);
- package->y1 = plugin->input->get_h() *
- i /
+ package->y1 = plugin->input->get_h() *
+ i /
get_total_packages();
- package->y2 = plugin->input->get_h() *
+ package->y2 = plugin->input->get_h() *
(i + 1) /
get_total_packages();
}