#include "edits.h"
#include "edl.h"
#include "edlsession.h"
+#include "file.h"
#include "filexml.h"
#include "floatauto.h"
#include "floatautos.h"
file->tag.title_is("/CLIP_EDL") ||
file->tag.title_is("/NESTED_EDL") ||
file->tag.title_is("/VWINDOW_EDL") ) {
- result = 1;
+ break;
}
else
if( file->tag.title_is("CLIPBOARD") ) {
}
}
-EDL *EDL::new_nested(EDL *edl, const char *path)
+EDL *EDL::new_nested_edl(EDL *edl, const char *path)
{
EDL *nested = new EDL; // no parent for nested edl
nested->create_objects();
return nested;
}
+EDL *EDL::get_nested_edl()
+{
+ Track *track = tracks->first;
+ Edit *edit = track ? track->edits->first : 0;
+ EDL *nested = edit && !edit->next && !edit->asset ? edit->nested_edl : 0;
+ while( nested && (track=track->next)!=0 ) {
+ Edit *edit = track->edits->first;
+ if( !edit || edit->next ||
+ ( edit->nested_edl != nested &&
+ strcmp(edit->nested_edl->path, nested->path) ) )
+ nested = 0;
+ }
+ return nested;
+}
+
+
EDL *EDL::create_nested_clip(EDL *nested)
{
EDL *new_edl = new EDL(this); // parent for clip edl
void EDL::create_nested(EDL *nested)
{
+ int video_tracks = 0, audio_tracks = 0;
+ for( Track *track=nested->tracks->first; track!=0; track=track->next ) {
+ if( track->data_type == TRACK_VIDEO && track->record ) ++video_tracks;
+ if( track->data_type == TRACK_AUDIO && track->record ) ++audio_tracks;
+ }
+// renderengine properties
+ if( video_tracks > 0 )
+ video_tracks = 1;
+ if( audio_tracks > 0 )
+ audio_tracks = nested->session->audio_channels;
+
// Keep frame rate, sample rate, and output size unchanged.
// Nest all video & audio outputs
+ session->video_channels = video_tracks;
+ session->audio_channels = audio_tracks;
session->video_tracks = 1;
- session->audio_tracks = nested->session->audio_channels;
+ session->audio_tracks = audio_tracks;
create_default_tracks();
insert_asset(0, nested, 0, 0, 0);
}
+void EDL::overwrite_clip(EDL *clip)
+{
+ int folder = folder_no;
+ char clip_title[BCTEXTLEN], clip_notes[BCTEXTLEN], clip_icon[BCSTRLEN];
+ if( parent_edl ) {
+ strcpy(clip_title, local_session->clip_title);
+ strcpy(clip_notes, local_session->clip_notes);
+ strcpy(clip_icon, local_session->clip_icon);
+ }
+ copy_all(clip);
+ folder_no = folder;
+ if( parent_edl ) {
+ strcpy(local_session->clip_title, clip_title);
+ strcpy(local_session->clip_notes, clip_notes);
+ strcpy(local_session->clip_icon, clip_icon);
+ }
+ if( !clip_icon[0] ) return;
+// discard old clip icon to reconstruct
+ char clip_icon_path[BCTEXTLEN];
+ snprintf(clip_icon_path, sizeof(clip_icon_path),
+ "%s/%s", File::get_config_path(), clip_icon);
+ remove(clip_icon_path);
+}
+
void EDL::retrack()
{
int min_w = session->output_w, min_h = session->output_h;
if( new_nested_edl ) {
length = new_nested_edl->tracks->total_length();
- layers = 1;
+ layers = new_nested_edl->session->video_channels;
channels = new_nested_edl->session->audio_channels;
}
}
int64_t clip_start_pos = startproject;
Edit *clip_edit = new Edit(new_edl, new_track);
- clip_edit->copy_from(edit);
+ clip_edit->clone_from(edit);
clip_edit->startproject = startproject;
startproject += clip_edit->length;
new_track->edits->append(clip_edit);
if( overwrite )
track->edits->clear(start, end);
Edit *dst = track->edits->insert_new_edit(start);
- dst->copy_from(edit);
+ dst->clone_from(edit);
dst->startproject = start;
dst->is_selected = 1;
while( (dst=dst->next) != 0 )
Plugin *new_plugin = dst_plugin_set->insert_plugin(plugin->title,
start, end-start, plugin->plugin_type, &plugin->shared_location,
(KeyFrame*)plugin->keyframes->default_auto, 0);
+ new_plugin->on = plugin->on;
KeyFrame *keyframe = (KeyFrame*)plugin->keyframes->first;
for( ; keyframe; keyframe=(KeyFrame*)keyframe->next ) {
int64_t keyframe_pos = pos + keyframe->position;
int i = orig_idxbls.size();
while( --i>=0 && strcmp(orig_idxbls[i]->path, idxbl->path) );
if( i < 0 ) continue;
- edit->asset = assets->update((Asset*)new_assets[i]);
+ Asset *new_asset = new_assets[i];
+ if( track->data_type == TRACK_VIDEO && !new_asset->video_data ) continue;
+ if( track->data_type == TRACK_AUDIO && !new_asset->audio_data ) continue;
+ edit->asset = assets->update(new_assets[i]);
}
}
if( !parent_edl ) {