X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fedl.C;h=cd20a7b0d56e570d3a36de7b47bd6315fcff947e;hb=38cb4182e11e57fc426bede3825e825e9d61433b;hp=3082788c2a85d5d647982ef2eb4b892adcf8cd01;hpb=49f85559268fc040fe7ba5611cc0520793cf728b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 3082788c..cd20a7b0 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -38,6 +38,7 @@ #include "interlacemodes.h" #include "labels.h" #include "localsession.h" +#include "maskautos.h" #include "mutex.h" #include "nestededls.h" #include "panauto.h" @@ -278,6 +279,8 @@ int EDL::load_xml(FileXML *file, if((load_flags & LOAD_VCONFIG) && (load_flags & LOAD_SESSION)) session->load_video_config(file, 0, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("AUDIO")) @@ -285,6 +288,8 @@ int EDL::load_xml(FileXML *file, if((load_flags & LOAD_ACONFIG) && (load_flags & LOAD_SESSION)) session->load_audio_config(file, 0, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("FOLDER")) @@ -298,12 +303,16 @@ int EDL::load_xml(FileXML *file, { if(load_flags & LOAD_ASSETS) assets->load(file, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is(labels->xml_tag)) { if(load_flags & LOAD_TIMEBAR) labels->load(file, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("LOCALSESSION")) @@ -311,6 +320,8 @@ int EDL::load_xml(FileXML *file, if((load_flags & LOAD_SESSION) || (load_flags & LOAD_TIMEBAR)) local_session->load_xml(file, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("SESSION")) @@ -318,6 +329,8 @@ int EDL::load_xml(FileXML *file, if((load_flags & LOAD_SESSION) && !parent_edl) session->load_xml(file, 0, load_flags); + else + result = file->skip_tag(); } else if(file->tag.title_is("TRACK")) @@ -596,14 +609,9 @@ int EDL::copy(double start, // Media // Don't replicate all assets for every clip. -// The assets for the clips are probably in the mane EDL. - if(!is_clip) - copy_assets(start, - end, - file, - all, - output_path); - +// The assets for the clips are probably in the main EDL. + if( !is_clip ) + copy_assets(start, end, file, all, output_path); // Clips // Don't want this if using clipboard if(all) @@ -636,10 +644,9 @@ int EDL::copy(double start, //printf("EDL::copy 2\n"); // terminate file - if(is_clip) + if( is_clip ) file->tag.set_title("/CLIP_EDL"); - else - if(is_vwindow) + else if( is_vwindow ) file->tag.set_title("/VWINDOW_EDL"); else file->tag.set_title("/EDL"); @@ -657,6 +664,26 @@ int EDL::copy(double start, return 0; } +void EDL::retrack() +{ + int min_w = session->output_w, min_h = session->output_h; + for( Track *track=tracks->first; track!=0; track=track->next ) { + if( track->data_type != TRACK_VIDEO ) continue; + int w = min_w, h = min_h; + for( Edit *current=track->edits->first; current!=0; current=NEXT ) { + Indexable* indexable = current->get_source(); + if( !indexable ) continue; + int edit_w = indexable->get_w(), edit_h = indexable->get_h(); + if( w < edit_w ) w = edit_w; + if( h < edit_h ) h = edit_h; + } + if( track->track_w == w && track->track_h == h ) continue; + ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])-> + translate_masks( (w - track->track_w) / 2, (h - track->track_h) / 2); + track->track_w = w; track->track_h = h; + } +} + void EDL::rechannel() { for(Track *current = tracks->first; current; current = NEXT) @@ -746,7 +773,7 @@ double EDL::equivalent_output(EDL *edl) } -void EDL::set_path(char *path) +void EDL::set_path(const char *path) { strcpy(this->path, path); } @@ -781,12 +808,23 @@ void EDL::set_outpoint(double position) } } +void EDL::deglitch(double position) +{ + if( !session->cursor_on_frames ) return; + Track *current_track = tracks->first; + for( ; current_track; current_track=current_track->next ) { + if( !current_track->record ) continue; + if( current_track->data_type != TRACK_AUDIO ) continue; + ATrack *atrack = (ATrack*)current_track; + atrack->deglitch(position, + session->labels_follow_edits, + session->plugins_follow_edits, + session->autos_follow_edits); + } +} -int EDL::clear(double start, - double end, - int clear_labels, - int clear_plugins, - int edit_autos) +int EDL::clear(double start, double end, + int clear_labels, int clear_plugins, int edit_autos) { if(start == end) { @@ -989,19 +1027,10 @@ int64_t EDL::get_tracks_width() // Get the total output size scaled to aspect ratio void EDL::calculate_conformed_dimensions(int single_channel, float &w, float &h) { - w = session->output_w; - h = session->output_h; - if((float)session->output_w / session->output_h > get_aspect_ratio()) - { - h = (float)h * - (session->output_w / get_aspect_ratio() / session->output_h); - } + h = (w = session->output_w) / get_aspect_ratio(); else - { - w = (float)w * - (h * get_aspect_ratio() / session->output_w); - } + w = (h = session->output_h) * get_aspect_ratio(); } float EDL::get_aspect_ratio() @@ -1531,3 +1560,51 @@ void EDL::append_vwindow_edl(EDL *edl, int increase_counter) } +double EDL::next_edit(double position) +{ + Units::fix_double(&position); + double new_position = tracks->total_length(); + + double max_rate = get_frame_rate(); + int sample_rate = get_sample_rate(); + if( sample_rate > max_rate ) max_rate = sample_rate; + double min_movement = max_rate > 0 ? 1. / max_rate : 1e-6; + +// Test for edit handles after position + for( Track *track=tracks->first; track; track=track->next ) { + if( !track->record ) continue; + for( Edit *edit=track->edits->first; edit; edit=edit->next ) { + double edit_end = track->from_units(edit->startproject + edit->length); + Units::fix_double(&edit_end); + if( fabs(edit_end-position) < min_movement ) continue; + if( edit_end > position && edit_end < new_position ) + new_position = edit_end; + } + } + return new_position; +} + +double EDL::prev_edit(double position) +{ + Units::fix_double(&position); + double new_position = -1; + + double max_rate = get_frame_rate(); + int sample_rate = get_sample_rate(); + if( sample_rate > max_rate ) max_rate = sample_rate; + double min_movement = max_rate > 0 ? 1. / max_rate : 1e-6; + +// Test for edit handles before cursor position + for( Track *track=tracks->first; track; track=track->next ) { + if( !track->record ) continue; + for( Edit *edit=track->edits->first; edit; edit=edit->next ) { + double edit_end = track->from_units(edit->startproject); + Units::fix_double(&edit_end); + if( fabs(edit_end-position) < min_movement ) continue; + if( edit_end < position && edit_end > new_position ) + new_position = edit_end; + } + } + return new_position; +} +