update openjpeg + x265, unproxy clip fix, config mods for lv2/opus/x265-10bit
[goodguy/history.git] / cinelerra-5.1 / cinelerra / mwindowedit.C
index 065c1f9f08d475fe994aec06fb3a1f39de87cd04..cfabc9bb1c73820aad08cb905bad3bcdfcd57fa8 100644 (file)
@@ -2319,6 +2319,38 @@ void MWindow::remap_audio(int pattern)
        }
 }
 
+
+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);
+       }
+}
+
 void MWindow::set_proxy(int use_scaler, int new_scale, int auto_scale,
                ArrayList<Indexable*> *orig_assets,
                ArrayList<Indexable*> *proxy_assets)
@@ -2339,32 +2371,8 @@ void MWindow::set_proxy(int use_scaler, int new_scale, int auto_scale,
                new_scale = 1;
        }
 
-       if( !orig_use_scaler && new_scale != orig_scale ) {
-// project size
-               float orig_w = (float)edl->session->output_w * orig_scale;
-               float orig_h = (float)edl->session->output_h * orig_scale;
-               edl->session->output_w = Units::round(orig_w / new_scale);
-               edl->session->output_h = Units::round(orig_h / new_scale);
-
-// track sizes
-               for( Track *track=edl->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);
-               }
-       }
+       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;
@@ -2383,15 +2391,19 @@ 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];
+                       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);
                }
        }
 }