#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,
// 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()
return result;
}
+void MWindow::collect_effects()
+{
+ FileXML file;
+ const char *file_string = "";
+ EDL *group = 0;
+ int ret = edl->collect_effects(group);
+ switch( ret ) {
+ case COLLECT_EFFECTS_RECORD:
+ eprintf(_("Selected edit track not armed."));
+ break;
+ case COLLECT_EFFECTS_MULTIPLE:
+ eprintf(_("More than one edit selected on a track."));
+ break;
+ case COLLECT_EFFECTS_MISSING:
+ eprintf(_("No effects under selected edit."));
+ break;
+ case COLLECT_EFFECTS_EMPTY:
+ eprintf(_("No edits selected."));
+ break;
+ case COLLECT_EFFECTS_MASTER:
+ eprintf(_("Shared effect added without master."));
+ break;
+ case 0:
+ group->save_xml(&file, "");
+ file_string = file.string();
+ group->remove_user();
+ }
+ long file_length = strlen(file_string);
+ gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
+ gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION);
+}
+
+void MWindow::paste_effects()
+{
+ char *string = 0;
+ int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
+ if( len ) {
+ string = new char[len];
+ gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
+ }
+ if( !string || !string[0] ) {
+ eprintf(_("Error clipboard buffer empty."));
+ return;
+ }
+ FileXML file;
+ file.read_from_string(string);
+ EDL *group = new EDL();
+ group->create_objects();
+ if( !group->load_xml(&file, LOAD_ALL) ) {
+ undo_before();
+ int ret = edl->insert_effects(group);
+ switch( ret ) {
+ case INSERT_EFFECTS_RECORD:
+ eprintf(_("Selected edit track not armed."));
+ break;
+ case INSERT_EFFECTS_TYPE:
+ eprintf(_("Track type mismatched."));
+ break;
+ case INSERT_EFFECTS_MULTIPLE:
+ eprintf(_("More than one edit selected on a track."));
+ break;
+ case INSERT_EFFECTS_MISSING:
+ eprintf(_("Too few target edits to add group effects."));
+ break;
+ case INSERT_EFFECTS_EXTRA:
+ eprintf(_("Too many target edits to add group effects."));
+ break;
+ case INSERT_EFFECTS_MASTER:
+ eprintf(_("Shared effect added without master."));
+ break;
+ case 0:
+ break;
+ }
+ save_backup();
+ undo_after(_("paste effects"), LOAD_ALL);
+ restart_brender();
+ cwindow->refresh_frame(CHANGE_EDL);
+ update_plugin_guis();
+ gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
+ }
+ else
+ eprintf(_("Error loading clip from clipboard buffer."));
+ delete [] string;
+ group->remove_user();
+}
+