#include "clip.h"
#include "clipedit.h"
#include "commercials.h"
+#include "convert.h"
#include "cplayback.h"
#include "ctimebar.h"
#include "cwindow.h"
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
gui->activate_timeline();
-
-// gui->get_scrollbars(0);
-// gui->canvas->draw();
-// gui->patchbay->update();
-// gui->cursor->draw(1);
-// gui->canvas->flash();
-// gui->canvas->activate();
cwindow->refresh_frame(CHANGE_EDL);
}
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
gui->activate_timeline();
-// gui->get_scrollbars(0);
-// gui->canvas->draw();
-// gui->patchbay->update();
-// gui->cursor->draw(1);
-// gui->canvas->flash();
-// gui->canvas->activate();
cwindow->refresh_frame(CHANGE_EDL);
save_backup();
}
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
gui->activate_timeline();
-// gui->get_scrollbars(0);
-// gui->canvas->draw();
-// gui->patchbay->update();
-// gui->cursor->draw(1);
-// gui->canvas->flash();
-// gui->canvas->activate();
cwindow->refresh_frame(CHANGE_EDL);
save_backup();
}
}
}
-
+#ifdef GLx4
if( ((edl->session->output_w % 4) ||
(edl->session->output_h % 4)) &&
edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) {
_("This project's dimensions are not multiples of 4 so\n"
"it can't be rendered by OpenGL."));
}
-
+#endif
// Get aspect ratio
if( defaults->get("AUTOASPECT", 0) ) {
create_aspect_ratio(
h = indexable->get_h();
edl->session->output_w = w;
edl->session->output_h = h;
-
+#ifdef GLx4
if( ((edl->session->output_w % 4) ||
(edl->session->output_h % 4)) &&
edl->session->playback_config->vconfig->driver == PLAYBACK_X11_GL ) {
_("This project's dimensions are not multiples of 4 so\n"
"it can't be rendered by OpenGL."));
}
-
+#endif
// Get aspect ratio
if( defaults->get("AUTOASPECT", 0) ) {
create_aspect_ratio(edl->session->aspect_w,
int MWindow::clear_labels(double start, double end)
{
+ if( start == end ) {
+ start = 0;
+ end = edl->tracks->total_length();
+ }
edl->labels->clear(start, end, 0);
return 0;
}
+void MWindow::clear_hard_edges()
+{
+ undo_before();
+ clear_hard_edges(edl->local_session->get_selectionstart(),
+ edl->local_session->get_selectionend());
+ edl->optimize();
+ save_backup();
+ undo_after(_("clear hard edges"), LOAD_EDITS);
+ restart_brender();
+ gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
+ cwindow->refresh_frame(CHANGE_EDL);
+}
+
+int MWindow::clear_hard_edges(double start, double end)
+{
+ if( start == end ) {
+ start = 0;
+ end = edl->tracks->total_length();
+ }
+ edl->clear_hard_edges(start, end);
+ return 0;
+}
+
+void MWindow::clear_select()
+{
+ edl->tracks->clear_selected_edits();
+ gui->draw_overlays(1);
+}
+
void MWindow::concatenate_tracks()
{
undo_before();
return 0;
}
-
// Uses cropping coordinates in edl session to crop and translate video.
// We modify the projector since camera automation depends on the track size.
-void MWindow::crop_video()
+void MWindow::crop_video(int mode)
{
-
undo_before();
// Clamp EDL crop region
if( edl->session->crop_x1 > edl->session->crop_x2 ) {
edl->session->crop_y2 ^= edl->session->crop_y1;
edl->session->crop_y1 ^= edl->session->crop_y2;
}
-
- float old_projector_x = (float)edl->session->output_w / 2;
- float old_projector_y = (float)edl->session->output_h / 2;
- float new_projector_x = (float)(edl->session->crop_x1 + edl->session->crop_x2) / 2;
- float new_projector_y = (float)(edl->session->crop_y1 + edl->session->crop_y2) / 2;
- float projector_offset_x = -(new_projector_x - old_projector_x);
- float projector_offset_y = -(new_projector_y - old_projector_y);
-
- edl->tracks->translate_projector(projector_offset_x, projector_offset_y);
-
- edl->session->output_w = edl->session->crop_x2 - edl->session->crop_x1;
- edl->session->output_h = edl->session->crop_y2 - edl->session->crop_y1;
- edl->session->crop_x1 = 0;
- edl->session->crop_y1 = 0;
- edl->session->crop_x2 = edl->session->output_w;
- edl->session->crop_y2 = edl->session->output_h;
+ switch( mode ) {
+ case CROP_REFORMAT: {
+ float ctr_x = edl->session->output_w / 2.;
+ float ctr_y = edl->session->output_h / 2.;
+ float new_x = (edl->session->crop_x1 + edl->session->crop_x2) / 2.;
+ float new_y = (edl->session->crop_y1 + edl->session->crop_y2) / 2.;
+ float dx = -(new_x - ctr_x), dy = -(new_y - ctr_y);
+ edl->tracks->translate_projector(dx, dy, 1);
+
+ edl->session->output_w = edl->session->crop_x2 - edl->session->crop_x1;
+ edl->session->output_h = edl->session->crop_y2 - edl->session->crop_y1;
+ edl->session->crop_x1 = edl->session->crop_y1 = 0;
+ edl->session->crop_x2 = edl->session->output_w;
+ edl->session->crop_y2 = edl->session->output_h;
+ break; }
+ case CROP_RESIZE: {
+ float old_w = edl->session->output_w;
+ float old_h = edl->session->output_h;
+ float new_w = edl->session->crop_x2 - edl->session->crop_x1;
+ float new_h = edl->session->crop_y2 - edl->session->crop_y1;
+ if( !new_w ) new_w = 1;
+ if( !new_h ) new_h = 1;
+ float xzoom = old_w / new_w, yzoom = old_h / new_h;
+ float new_z = bmin(xzoom, yzoom);
+ float new_x = (edl->session->crop_x1 + edl->session->crop_x2) / 2.;
+ float new_y = (edl->session->crop_y1 + edl->session->crop_y2) / 2.;
+ edl->tracks->crop_resize(new_x, new_y, new_z);
+
+ edl->session->crop_x1 = 0;
+ edl->session->crop_y1 = 0;
+ edl->session->crop_x2 = edl->session->output_w;
+ edl->session->crop_y2 = edl->session->output_h;
+ break; }
+ case CROP_SHRINK: {
+ float old_w = edl->session->output_w;
+ float old_h = edl->session->output_h;
+ float new_w = edl->session->crop_x2 - edl->session->crop_x1;
+ float new_h = edl->session->crop_y2 - edl->session->crop_y1;
+ if( !new_w ) new_w = 1;
+ if( !new_h ) new_h = 1;
+ float xzoom = old_w / new_w, yzoom = old_h / new_h;
+ float new_z = bmin(xzoom, yzoom);
+
+ float new_x = (edl->session->crop_x1 + edl->session->crop_x2) / 2.;
+ float new_y = (edl->session->crop_y1 + edl->session->crop_y2) / 2.;
+ edl->tracks->crop_shrink(new_x, new_y, new_z);
+ break; }
+ }
// Recalculate aspect ratio
if( defaults->get("AUTOASPECT", 0) ) {
// so we need to clear only when not using both io points
// FIXME: need to write simple overwrite_edl to be used for overwrite function
if( edl->local_session->get_inpoint() < 0 ||
- edl->local_session->get_outpoint() < 0 )
- edl->clear(dst_start, dst_start + overwrite_len, 0, 0, 0);
+ edl->local_session->get_outpoint() < 0 )
+ edl->clear(dst_start, dst_start + overwrite_len,
+ edl->session->labels_follow_edits,
+ edl->session->plugins_follow_edits,
+ edl->session->autos_follow_edits);
- paste(dst_start, dst_start + overwrite_len, &file, 0, 0, 0, 0, 0);
+ paste(dst_start, dst_start + overwrite_len, &file,
+ edl->session->labels_follow_edits,
+ edl->session->plugins_follow_edits,
+ edl->session->autos_follow_edits, 0, 0);
edl->local_session->set_selectionstart(dst_start + overwrite_len);
edl->local_session->set_selectionend(dst_start + overwrite_len);
for( int i=0; i<new_assets->total; ++i ) {
Indexable *indexable = new_assets->get(i);
if( indexable->is_asset ) {
- remove_asset_from_caches((Asset*)indexable);
+ remove_from_caches(indexable);
}
EDL *new_edl = new EDL;
new_edl->create_objects();
else
// Recycle existing tracks of master EDL
if( load_mode == LOADMODE_CONCATENATE ||
- load_mode == LOADMODE_PASTE ||
- load_mode == LOADMODE_NESTED ) {
+ load_mode == LOADMODE_PASTE ) {
Track *current = first_track ? first_track : edl->tracks->first;
for( ; current; current=NEXT ) {
if( current->record ) {
// Add assets and prepare index files
for( Asset *new_asset=new_edl->assets->first;
new_asset; new_asset=new_asset->next ) {
- mainindexes->add_next_asset(0, new_asset);
+ mainindexes->add_indexable(new_asset);
}
// Capture index file status from mainindex test
edl->update_assets(new_edl);
//PRINT_TRACE
// Get starting point of insertion. Need this to paste labels.
switch( load_mode ) {
+ case LOADMODE_NOTHING:
+ continue;
case LOADMODE_REPLACE:
current_position = 0;
break;
break;
case LOADMODE_PASTE:
- case LOADMODE_NESTED:
destination_track = 0;
if( i == 0 ) {
for( int j=0; j<destination_tracks.total; ++j ) {
load_mode != LOADMODE_ASSETSONLY ) {
// Insert labels
if( edit_labels ) {
- if( load_mode == LOADMODE_PASTE || load_mode == LOADMODE_NESTED )
+ if( load_mode == LOADMODE_PASTE )
edl->labels->insert_labels(new_edl->labels,
destination_tracks.total ? paste_position[0] : 0.0,
edl_length, 1);
break;
case LOADMODE_PASTE:
- case LOADMODE_NESTED:
current_position = paste_position[destination_track];
paste_position[destination_track] += new_track->get_length();
break;
}
}
- if( load_mode == LOADMODE_PASTE ||
- load_mode == LOADMODE_NESTED )
+ if( load_mode == LOADMODE_PASTE )
current_position += edl_length;
}
time_t now; time(&now);
struct tm dtm; localtime_r(&now, &dtm);
char *cp = new_edl->local_session->clip_notes;
- int n, sz = sizeof(new_edl->local_session->clip_notes)-1;
- if( txt && *txt ) {
- n = snprintf(cp, sz, "%s", txt);
- cp += n; sz -= n;
- }
- n = snprintf(cp, sz,
+ char *ep = cp + sizeof(new_edl->local_session->clip_notes)-1;
+ if( txt && *txt )
+ cp += snprintf(cp, ep-cp, "%s", txt);
+ cp += snprintf(cp, ep-cp,
"%02d/%02d/%02d %02d:%02d:%02d, +%s\n",
dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
dtm.tm_hour, dtm.tm_min, dtm.tm_sec, duration);
- cp += n; sz -= n;
if( path && *path ) {
FileSystem fs;
char title[BCTEXTLEN];
fs.extract_name(title, path);
- n = snprintf(cp, sz, "%s", title);
- cp += n; sz -= n;
+ cp += snprintf(cp, ep-cp, "%s", title);
}
- cp[n] = 0;
sprintf(new_edl->local_session->clip_icon,
- "clip_%02d%02d%02d-%02d%02d%02d.png",
+ "clip_%02d%02d%02d-%02d%02d%02d-%d.png",
dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday,
- dtm.tm_hour, dtm.tm_min, dtm.tm_sec);
+ dtm.tm_hour, dtm.tm_min, dtm.tm_sec,
+ new_edl->id);
new_edl->folder_no = AW_CLIP_FOLDER;
edl->update_assets(new_edl);
int cur_x, cur_y;
edl->rescale_proxy(orig_scale, new_scale);
}
-void MWindow::add_proxy(int use_scaler,
- ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+void MWindow::add_proxy(ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
{
- edl->add_proxy(use_scaler, orig_assets, proxy_assets);
+ edl->add_proxy(orig_assets, proxy_assets);
+}
+
+void MWindow::start_convert(Asset *format_asset, const char *suffix,
+ float beep, int to_proxy, int remove_originals)
+{
+ if( !convert_render )
+ convert_render = new ConvertRender(this);
+ convert_render->set_format(format_asset, suffix, to_proxy);
+ int found = convert_render->find_convertable_assets(edl);
+ if( convert_render->needed_idxbls.size() > 0 )
+ convert_render->start_convert(beep, remove_originals);
+ else if( found > 0 )
+ finish_convert(remove_originals);
+ else if( found < 0 )
+ eprintf(_("convert assets format error"));
+ else
+ eprintf(_("No convertable assets found"));
+}
+
+void MWindow::finish_convert(int remove_originals)
+{
+ gui->lock_window("MWindow::finish_convert");
+ undo_before();
+ edl->replace_assets(
+ convert_render->orig_idxbls,
+ convert_render->orig_copies);
+ if( remove_originals ) {
+ remove_assets_from_project(0, 0, 0,
+ &convert_render->orig_idxbls, 0);
+ }
+ save_backup();
+ undo_after(_("convert"), LOAD_ALL);
+
+ update_plugin_guis();
+ gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
+ cwindow->update(1, 0, 0, 0, 1);
+ awindow->gui->async_update_assets();
+ cwindow->refresh_frame(CHANGE_EDL);
+ gui->unlock_window();
}
void MWindow::cut_commercials()