upgrade ffmpeg to 3.4.2, add proxy popup, undo/redo deadlock fix, rework nested edl
[goodguy/history.git] / cinelerra-5.1 / cinelerra / mwindowedit.C
index 2d417dbd79ed939d9202b5c32adaefc17250f4d6..51f1b4214730aabdcd9cd6e6140b897212153f5e 100644 (file)
@@ -1058,12 +1058,14 @@ void MWindow::mute_selection()
 }
 
 
-void MWindow::overwrite(EDL *source)
+void MWindow::overwrite(EDL *source, int all)
 {
        FileXML file;
 
-       double src_start = source->local_session->get_selectionstart();
-       double overwrite_len = source->local_session->get_selectionend() - src_start;
+       double src_start = all ? 0 :
+               source->local_session->get_selectionstart();
+       double overwrite_len = all ? source->tracks->total_length() :
+               source->local_session->get_selectionend() - src_start;
        double dst_start = edl->local_session->get_selectionstart();
        double dst_len = edl->local_session->get_selectionend() - dst_start;
 
@@ -1205,17 +1207,15 @@ if( debug ) printf("MWindow::load_assets %d\n", __LINE__);
                EDL *new_edl = new EDL;
                new_edl->create_objects();
                new_edl->copy_session(edl);
-               new_edls.append(new_edl);
-
                if( !indexable->is_asset ) {
                        EDL *nested_edl = (EDL*)indexable;
-                       new_edl->to_nested(nested_edl);
-                       new_edl->local_session->set_clip_path(nested_edl);
+                       new_edl->create_nested(nested_edl, indexable->path);
                }
                else {
                        Asset *asset = (Asset*)indexable;
                        asset_to_edl(new_edl, asset);
                }
+               new_edls.append(new_edl);
 
                if( labels ) {
                        for( RecordLabel *label=labels->first; label; label=label->next ) {
@@ -1989,13 +1989,15 @@ void MWindow::unset_inoutpoint(int is_mwindow)
        }
 }
 
-void MWindow::splice(EDL *source)
+void MWindow::splice(EDL *source, int all)
 {
        FileXML file;
 
        undo->update_undo_before();
-       double source_start = source->local_session->get_selectionstart();
-       double source_end = source->local_session->get_selectionend();
+       double source_start = all ? 0 :
+               source->local_session->get_selectionstart();
+       double source_end = all ? source->tracks->total_length() :
+               source->local_session->get_selectionend();
        source->copy(source_start, source_end, 1, &file, "", 1);
 //file.dump();
        double start = edl->local_session->get_selectionstart();
@@ -2079,14 +2081,16 @@ void MWindow::save_clip(EDL *new_edl, const char *txt)
        save_backup();
 }
 
-void MWindow::to_clip(EDL *edl, const char *txt)
+void MWindow::to_clip(EDL *edl, const char *txt, int all)
 {
        FileXML file;
        double start, end;
 
        gui->lock_window("MWindow::to_clip 1");
-       start = edl->local_session->get_selectionstart();
-       end = edl->local_session->get_selectionend();
+       start = all ? 0 :
+               edl->local_session->get_selectionstart();
+       end = all ? edl->tracks->total_length() :
+               edl->local_session->get_selectionend();
 
        if( EQUIV(end, start) ) {
                start = 0;
@@ -2374,6 +2378,18 @@ void MWindow::set_proxy(int use_scaler, int new_scale, int auto_scale,
                                }
                        }
                }
+               for( int j=0,m=edl->clips.size(); j<m; ++j ) {
+                       EDL *clip = edl->clips[j];
+                       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) ) {
+                                               edit->asset = proxy_asset;
+                                       }
+                               }
+                       }
+               }
        }
 }