X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindowedit.C;h=85b5f7439b1e94918e04d4955f3fb3e23b4c64cd;hb=b75f0c6910f5f1e1094f17874cd404e3f0faee8c;hp=7710d4ada162471c62cb6c0d81b1fae6fd5156ed;hpb=d26ed189093987978190ee07f485a4840746c13c;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 7710d4ad..85b5f743 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -2274,6 +2274,67 @@ void MWindow::remap_audio(int pattern) } } +void MWindow::set_proxy(int use_scaler, int new_scale, + ArrayList *orig_assets, ArrayList *proxy_assets) +{ + int orig_use_scaler = edl->session->proxy_use_scaler; + int orig_scale = edl->session->proxy_scale; +// rescale to full size asset in read_frame + edl->session->proxy_use_scaler = use_scaler; + edl->session->proxy_scale = new_scale; + + if( use_scaler ) { + for( int i=0; isize(); ++i ) { + Asset *proxy_asset = (Asset *)proxy_assets->get(i); + proxy_asset->width = orig_assets->get(i)->get_w(); + proxy_asset->height = orig_assets->get(i)->get_h(); + } + 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); + } + } + +// change original assets to proxy assets + for( int i=0; isize(); i++ ) { + Asset *proxy_asset = edl->assets->update((Asset *)proxy_assets->get(i)); +// replace track contents + for( Track *track = edl->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; + } + } + } + } +} + void MWindow::cut_commercials() { undo->update_undo_before();