{
AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0);
if( !asset_picon ) return 0;
+ Indexable *picon_idxbl = asset_picon->indexable;
+ EDL *picon_edl = asset_picon->edl;
+ int proxy = 0;
+ VWindow *vwindow = 0;
switch( mwindow->edl->session->awindow_folder ) {
case AW_AEFFECT_FOLDER:
case AW_VEFFECT_FOLDER:
case AW_ATRANSITION_FOLDER:
case AW_VTRANSITION_FOLDER: return 1;
+ case AW_PROXY_FOLDER:
+ proxy = 1; // fall thru
+ default:
+ if( mwindow->vwindows.size() > DEFAULT_VWINDOW )
+ vwindow = mwindow->vwindows.get(DEFAULT_VWINDOW);
+ break;
}
- VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
- mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
if( !vwindow || !vwindow->is_running() ) return 1;
+ if( proxy && picon_idxbl ) {
+ picon_edl = gui->collect_proxy(picon_idxbl);
+ picon_idxbl = 0;
+ }
- if( asset_picon->indexable )
- vwindow->change_source(asset_picon->indexable);
- else if( asset_picon->edl )
- vwindow->change_source(asset_picon->edl);
+ if( picon_idxbl ) vwindow->change_source(picon_idxbl);
+ else if( picon_edl ) vwindow->change_source(picon_edl);
return 1;
}
#include "edit.h"
#include "edits.h"
#include "edl.h"
+#include "edlsession.h"
#include "filexml.h"
#include "language.h"
#include "localsession.h"
{
MWindowGUI *gui = mwindow->gui;
gui->lock_window("ClipPopupNest::handle_event 1");
- if( mwindow->session->drag_clips->total > 0 ) {
+ if( mwindow->edl->session->proxy_scale != 1 ) {
+ eprintf("Nesting not allowed when proxy scale != 1");
+ }
+ else if( mwindow->session->drag_clips->total > 0 ) {
EDL *edl = mwindow->edl;
time_t dt; time(&dt);
struct tm dtm; localtime_r(&dt, &dtm);
Track *track;
-// Asset is 0 if silence, otherwise points an object in edl->assets
+// points to an object in edl->assets if set
Asset *asset;
-
-// points to an object in edl->clips if a nested clip
+// points to an object in edl->nested_edls if set
EDL *nested_edl;
+// Asset and nested_edl are 0 if silence
// Parent EDL of this edit
EDL *edl;
#include "autoconf.h"
#include "automation.h"
#include "awindowgui.inc"
+#include "bccmodels.h"
+#include "bchash.h"
#include "bcsignals.h"
#include "clip.h"
#include "cstrdup.h"
-#include "bccmodels.h"
-#include "bchash.h"
#include "clipedls.h"
#include "edits.h"
#include "edl.h"
#include "edlsession.h"
#include "filexml.h"
+#include "floatauto.h"
+#include "floatautos.h"
#include "guicast.h"
#include "indexstate.h"
#include "interlacemodes.h"
void EDL::set_path(const char *path)
{
+ if( &this->path[0] == path ) return;
strcpy(this->path, path);
}
return new_position;
}
+void EDL::rescale_proxy(int orig_scale, int new_scale)
+{
+ if( orig_scale == new_scale ) return;
+// project size
+ float orig_w = (float)session->output_w * orig_scale;
+ float orig_h = (float)session->output_h * orig_scale;
+ if( !parent_edl ) {
+ session->output_w = Units::round(orig_w / new_scale);
+ session->output_h = Units::round(orig_h / new_scale);
+ }
+
+// track sizes
+ for( Track *track=tracks->first; track; track=track->next ) {
+ if( track->data_type != TRACK_VIDEO ) continue;
+ orig_w = (float)track->track_w * orig_scale;
+ orig_h = (float)track->track_h * orig_scale;
+ track->track_w = Units::round(orig_w / new_scale);
+ track->track_h = Units::round(orig_h / new_scale);
+ ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->
+ set_proxy(orig_scale, new_scale);
+ ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_X])->
+ set_proxy(orig_scale, new_scale);
+ ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_Y])->
+ set_proxy(orig_scale, new_scale);
+ ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_X])->
+ set_proxy(orig_scale, new_scale);
+ ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_Y])->
+ set_proxy(orig_scale, new_scale);
+ }
+}
+
+void EDL::set_proxy(int use_scaler, int new_scale, int auto_scale,
+ ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+{
+ int orig_use_scaler = session->proxy_use_scaler;
+ int orig_scale = session->proxy_scale;
+// rescale to full size asset in read_frame
+ session->proxy_use_scaler = use_scaler;
+ session->proxy_scale = new_scale;
+ session->proxy_auto_scale = auto_scale;
+
+ if( use_scaler ) {
+ for( int i=0; i<proxy_assets->size(); ++i ) {
+ Asset *proxy_asset = (Asset *)proxy_assets->get(i);
+ proxy_asset->width = orig_assets->get(i)->get_w();
+ proxy_asset->height = orig_assets->get(i)->get_h();
+ }
+ new_scale = 1;
+ }
+
+ if( !orig_use_scaler )
+ rescale_proxy(orig_scale, new_scale);
+
+// change original assets to proxy assets
+ int awindow_folder = use_scaler || new_scale != 1 ? AW_PROXY_FOLDER : AW_MEDIA_FOLDER;
+ for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
+ const char *orig_path = orig_assets->get(i)->path;
+ Indexable *proxy_idxbl = proxy_assets->get(i);
+ proxy_idxbl->awindow_folder = awindow_folder;
+ Asset *proxy_asset = proxy_idxbl->is_asset ? assets->update((Asset *)proxy_idxbl) : 0;
+ EDL *proxy_edl = !proxy_idxbl->is_asset ? (EDL *)proxy_idxbl : 0;
+// replace track contents
+ for( Track *track=tracks->first; track; track=track->next ) {
+ if( track->data_type != TRACK_VIDEO ) continue;
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ Indexable *idxbl = (Indexable *)edit->asset;
+ if( !idxbl ) idxbl = (Indexable *)edit->nested_edl;
+ if( !idxbl ) continue;
+ if( strcmp(idxbl->path, orig_path) ) continue;
+ edit->asset = proxy_asset;
+ edit->nested_edl = proxy_edl;
+ }
+ }
+ for( int j=0,m=clips.size(); j<m; ++j ) {
+ EDL *clip = clips[j];
+ int has_proxy = 0;
+ for( Track *track=clip->tracks->first; track; track=track->next ) {
+ if( track->data_type != TRACK_VIDEO ) continue;
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ Indexable *idxbl = (Indexable *)edit->asset;
+ if( !idxbl ) idxbl = (Indexable *)edit->nested_edl;
+ if( !idxbl ) continue;
+ if( strcmp(idxbl->path, orig_path) ) continue;
+ edit->asset = proxy_asset;
+ edit->nested_edl = proxy_edl;
+ has_proxy = 1;
+ }
+ }
+ if( has_proxy && !orig_use_scaler )
+ clip->rescale_proxy(orig_scale, new_scale);
+ }
+ }
+}
+
+void EDL::add_proxy(int use_scaler,
+ ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+{
+ if( use_scaler ) {
+ for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
+ Asset *proxy_asset = (Asset *)proxy_assets->get(i);
+ proxy_asset->width = orig_assets->get(i)->get_w();
+ proxy_asset->height = orig_assets->get(i)->get_h();
+ }
+ }
+
+// change original assets to proxy assets
+ for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
+ Asset *proxy_asset = assets->update((Asset *)proxy_assets->get(i));
+ proxy_asset->awindow_folder = AW_PROXY_FOLDER;
+// replace track contents
+ for( Track *track=tracks->first; track; track=track->next ) {
+ if( track->data_type != TRACK_VIDEO ) continue;
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ if( !edit->asset ) continue;
+ if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) {
+ edit->asset = proxy_asset;
+ }
+ }
+ }
+ }
+}
+
// Adds to list of EDLs & increase garbage collection counter
// Does nothing if EDL already exists
void append_vwindow_edl(EDL *edl, int increase_counter);
+ void rescale_proxy(int orig_scale, int new_scale);
+ void set_proxy(int use_scaler, int new_scale, int auto_scale,
+ ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets);
+ void add_proxy(int use_scaler,
+ ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets);
// Titles of all subfolders
ArrayList<char*> folders;
cwindow_xscroll = cwindow_yscroll = 0;
cwindow_zoom = 1.0;
cwindow_click2play = 0;
- strcpy(default_atransition, "");
- strcpy(default_vtransition, "");
+ strcpy(default_atransition, INIT_ATRANSITION);
+ strcpy(default_vtransition, INIT_VTRANSITION);
default_transition_length = 1.0;
edit_handle_mode[0] = MOVE_ALL_EDITS;
edit_handle_mode[1] = MOVE_ONE_EDIT;
cwindow_yscroll = defaults->get("CWINDOW_YSCROLL", 0);
cwindow_zoom = defaults->get("CWINDOW_ZOOM", (float)1);
cwindow_click2play = defaults->get("CWINDOW_CLICK2PLAY", 0);
- sprintf(default_atransition, _("Crossfade"));
+ sprintf(default_atransition, INIT_ATRANSITION);
defaults->get("DEFAULT_ATRANSITION", default_atransition);
- sprintf(default_vtransition, _("Dissolve"));
+ sprintf(default_vtransition, INIT_VTRANSITION);
defaults->get("DEFAULT_VTRANSITION", default_vtransition);
default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1);
edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_ALL_EDITS);
#ifndef EDLSESSION_INC
#define EDLSESSION_INC
+#define INIT_ATRANSITION "Crossfade"
+#define INIT_VTRANSITION "Dissolve"
+
class EDLSession;
#endif
PluginServer *server = session->drag_pluginservers->values[0];
undo->update_undo_before();
- if( server->audio )
- strcpy(edl->session->default_atransition, server->title);
- else
- strcpy(edl->session->default_vtransition, server->title);
-
edl->tracks->paste_transition(server, session->edit_highlighted);
save_backup();
undo->update_undo_after(_("transition"), LOAD_EDITS);
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->paste_transitions(start, end, track_type, title);
-
- switch( track_type ) {
- case TRACK_AUDIO:
- strcpy(edl->session->default_atransition, title);
- break;
- case TRACK_VIDEO:
- strcpy(edl->session->default_vtransition, title);
- break;
- }
-
save_backup();
undo->update_undo_after(_("attach transitions"), LOAD_EDITS);
void MWindow::rescale_proxy(EDL *clip, int orig_scale, int new_scale)
{
- if( orig_scale == new_scale ) return;
-// project size
- float orig_w = (float)clip->session->output_w * orig_scale;
- float orig_h = (float)clip->session->output_h * orig_scale;
- if( !clip->parent_edl ) {
- clip->session->output_w = Units::round(orig_w / new_scale);
- clip->session->output_h = Units::round(orig_h / new_scale);
- }
-
-// track sizes
- for( Track *track=clip->tracks->first; track; track=track->next ) {
- if( track->data_type != TRACK_VIDEO ) continue;
- orig_w = (float)track->track_w * orig_scale;
- orig_h = (float)track->track_h * orig_scale;
- track->track_w = Units::round(orig_w / new_scale);
- track->track_h = Units::round(orig_h / new_scale);
- ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->
- set_proxy(orig_scale, new_scale);
- ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_X])->
- set_proxy(orig_scale, new_scale);
- ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_Y])->
- set_proxy(orig_scale, new_scale);
- ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_X])->
- set_proxy(orig_scale, new_scale);
- ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_Y])->
- set_proxy(orig_scale, new_scale);
- }
+ edl->rescale_proxy(orig_scale, new_scale);
}
void MWindow::set_proxy(int use_scaler, int new_scale, int auto_scale,
- ArrayList<Indexable*> *orig_assets,
- ArrayList<Indexable*> *proxy_assets)
-{
- int orig_use_scaler = edl->session->proxy_use_scaler;
- int orig_scale = edl->session->proxy_scale;
-// rescale to full size asset in read_frame
- edl->session->proxy_use_scaler = use_scaler;
- edl->session->proxy_scale = new_scale;
- edl->session->proxy_auto_scale = auto_scale;
-
- if( use_scaler ) {
- for( int i=0; i<proxy_assets->size(); ++i ) {
- Asset *proxy_asset = (Asset *)proxy_assets->get(i);
- proxy_asset->width = orig_assets->get(i)->get_w();
- proxy_asset->height = orig_assets->get(i)->get_h();
- }
- new_scale = 1;
- }
-
- if( !orig_use_scaler )
- rescale_proxy(edl, orig_scale, new_scale);
-
-// change original assets to proxy assets
- int awindow_folder = use_scaler || new_scale != 1 ? AW_PROXY_FOLDER : AW_MEDIA_FOLDER;
- for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
- Asset *proxy_asset = edl->assets->update((Asset *)proxy_assets->get(i));
- proxy_asset->awindow_folder = awindow_folder;
-// replace track contents
- for( Track *track=edl->tracks->first; track; track=track->next ) {
- if( track->data_type != TRACK_VIDEO ) continue;
- for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
- if( !edit->asset ) continue;
- if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) {
- edit->asset = proxy_asset;
- }
- }
- }
- for( int j=0,m=edl->clips.size(); j<m; ++j ) {
- EDL *clip = edl->clips[j];
- int has_proxy = 0;
- for( Track *track=clip->tracks->first; track; track=track->next ) {
- if( track->data_type != TRACK_VIDEO ) continue;
- for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
- if( !edit->asset ) continue;
- if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) {
- has_proxy = 1;
- edit->asset = proxy_asset;
- }
- }
- }
- if( has_proxy && !orig_use_scaler )
- rescale_proxy(clip, orig_scale, new_scale);
- }
- }
+ ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+{
+ edl->set_proxy(use_scaler, new_scale, auto_scale, orig_assets, proxy_assets);
}
void MWindow::add_proxy(int use_scaler,
- ArrayList<Indexable*> *orig_assets,
- ArrayList<Indexable*> *proxy_assets)
-{
- if( use_scaler ) {
- for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
- Asset *proxy_asset = (Asset *)proxy_assets->get(i);
- proxy_asset->width = orig_assets->get(i)->get_w();
- proxy_asset->height = orig_assets->get(i)->get_h();
- }
- }
-
-// change original assets to proxy assets
- for( int i=0,n=proxy_assets->size(); i<n; ++i ) {
- Asset *proxy_asset = edl->assets->update((Asset *)proxy_assets->get(i));
- proxy_asset->awindow_folder = AW_PROXY_FOLDER;
-// replace track contents
- for( Track *track=edl->tracks->first; track; track=track->next ) {
- if( track->data_type != TRACK_VIDEO ) continue;
- for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
- if( !edit->asset ) continue;
- if( !strcmp(edit->asset->path, orig_assets->get(i)->path) ) {
- edit->asset = proxy_asset;
- }
- }
- }
- }
+ ArrayList<Indexable*> *orig_assets, ArrayList<Indexable*> *proxy_assets)
+{
+ edl->add_proxy(use_scaler, orig_assets, proxy_assets);
}
void MWindow::cut_commercials()
// y += canvas_h_text->get_h() + 5;
x1 = x;
- add_subwindow(new BC_Title(x1, y, _("Track size:")));
+ add_subwindow(new BC_Title(x1, y, new_thread->load_mode == LOADMODE_REPLACE ?
+ _("Canvas size:") : _("Track size:")));
x1 += 115;
add_subwindow(output_w_text = new NewOutputW(this, x1, y));
x1 += output_w_text->get_w() + 2;
int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz)
{
reset_lv2();
+ double bps = 2. * sample_rate / bfrsz;
+ if( bps > refreshrate ) refreshrate = bps;
lv2_AudioPort = lilv_new_uri(world, LV2_CORE__AudioPort);
lv2_ControlPort = lilv_new_uri(world, LV2_CORE__ControlPort);
orig_idxbls.append(orig_asset);
orig_asset->add_user();
}
+ for( int i=0,n=edl->nested_edls.size(); i<n; ++i ) {
+ EDL *orig_nested = edl->nested_edls[i];
+ char new_path[BCTEXTLEN];
+ if( !ProxyRender::from_proxy_path(new_path, orig_nested, proxy_scale) )
+ continue;
+ proxy_render.to_proxy_path(new_path, orig_nested, proxy_scale);
+// test if proxy asset was already added to proxy_assets
+ int got_it = 0;
+ for( int i = 0; !got_it && i<proxy_assets.size(); ++i )
+ got_it = !strcmp(proxy_assets[i]->path, new_path);
+ if( got_it ) continue;
+ Asset *proxy_nested = edl->assets->get_asset(new_path);
+ if( !proxy_nested ) continue;
+// add pointer to existing EDL asset if it exists
+// EDL won't delete it unless it's the same pointer.
+ proxy_assets.append(proxy_nested);
+ proxy_nested->add_user();
+ orig_idxbls.append(orig_nested);
+ orig_nested->add_user();
+ }
// convert from the proxy assets to the original assets
int proxy_auto_scale = edl->session->proxy_auto_scale;
proxy_render.add_needed(orig, proxy);
}
}
+ for( int i=0,n=edl->nested_edls.size(); i<n; ++i ) {
+ EDL *orig_nested = edl->nested_edls[i];
+ Asset *proxy = proxy_render.add_original(orig_nested, new_scale);
+ if( !proxy ) continue;
+ int exists = fs.get_size(proxy->path) > 0 ? 1 : 0;
+ int got_it = exists && // if proxy exists, and is newer than orig_nested
+ fs.get_date(proxy->path) > fs.get_date(orig_nested->path) ? 1 : 0;
+ if( !got_it ) {
+ if( exists ) // prompt user to overwrite
+ confirm_paths.append(cstrdup(proxy->path));
+ proxy_render.add_needed(orig_nested, proxy);
+ }
+ }
}
int result = 0;
//printf("ProxyRender::to_proxy_path %d %s %s\n", __LINE__, new_path), asset->path);
}
-void ProxyRender::from_proxy_path(char *new_path, Asset *asset, int scale)
+int ProxyRender::from_proxy_path(char *new_path, Indexable *indexable, int scale)
{
char prxy[BCTEXTLEN];
int n = sprintf(prxy, ".proxy%d", scale);
- strcpy(new_path, asset->path);
+ strcpy(new_path, indexable->path);
char *ptr = strstr(new_path, prxy);
- if( !ptr || (ptr[n] != '-' && ptr[n] != '.') ) return;
+ if( !ptr || (ptr[n] != '-' && ptr[n] != '.') ) return 1;
// remove proxy, path.proxy#-sfx.ext => path.sfx
char *ext = strrchr(ptr, '.');
if( !ext ) ext = ptr + strlen(ptr);
char *cp = ptr + n;
for( *cp='.'; cp<ext; ++cp ) *ptr++ = *cp;
*ptr = 0;
+ return 0;
}
ProxyRender::ProxyRender(MWindow *mwindow, Asset *format_asset)
ProxyRender(MWindow *mwindow, Asset *format_asset);
~ProxyRender();
void to_proxy_path(char *new_path, Indexable *indexable, int scale);
- static void from_proxy_path(char *new_path, Asset *asset, int scale);
+ static int from_proxy_path(char *new_path, Indexable *indexable, int scale);
ArrayList<Indexable *> orig_idxbls; // originals which match the proxy assets
ArrayList<Indexable *> orig_proxies; // proxy assets
{
filter_list.append(new BC_ListBoxItem("*"));
filter_list.append(new BC_ListBoxItem("[*.mkv][*.webm]"));
- filter_list.append(new BC_ListBoxItem("[*.mp4]"));
+ filter_list.append(new BC_ListBoxItem("[*.mp4][*.MP4]"));
filter_list.append(new BC_ListBoxItem("[*.mp2][*.mp3][*.wav]"));
filter_list.append(new BC_ListBoxItem("[*.avi][*.mpg][*.m2v][*.m1v][*.mov]"));
- filter_list.append(new BC_ListBoxItem("[*.jpg][*.png][*.gif][*.tiff]"));
+ filter_list.append(new BC_ListBoxItem("[*.jpg][*.JPG][*.png][*.gif][*.tiff]"));
filter_list.append(new BC_ListBoxItem("*.xml"));
fs->set_filter(get_resources()->filebox_filter);
}