ff tooltip, shcmds doc, bld_prepare fix, edl load_xml fix
[goodguy/history.git] / cinelerra-5.1 / cinelerra / edl.C
index 591db25212f9aa2af56243b61849580e7f71891d..9e14b082d9c003af3c534cee3bff931f5718054b 100644 (file)
@@ -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"))
@@ -296,14 +301,19 @@ int EDL::load_xml(FileXML *file,
                                else
                                if(file->tag.title_is("ASSETS"))
                                {
-                                       if(load_flags & LOAD_ASSETS)
+                                       if((load_flags & LOAD_ASSETS) &&
+                                               !parent_edl)
                                                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 +321,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 +330,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"))
@@ -657,6 +671,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 +780,7 @@ double EDL::equivalent_output(EDL *edl)
 }
 
 
-void EDL::set_path(char *path)
+void EDL::set_path(const char *path)
 {
        strcpy(this->path, path);
 }
@@ -989,19 +1023,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()
@@ -1428,7 +1453,7 @@ if(debug) printf("EDL::get_use_vconsole %d\n", __LINE__);
 // Asset and output device must have same resulting de-interlacing method
        if( ilaceautofixmethod2(session->interlace_mode,
            asset->interlace_autofixoption, asset->interlace_mode,
-           asset->interlace_fixmethod) != BC_ILACE_FIXMETHOD_NONE )
+           asset->interlace_fixmethod) != ILACE_FIXMETHOD_NONE )
                return 1;
 
 // If we get here the frame is going to be directly copied.  Whether it is