- if( use_scale ) {
- sprintf(data,"<SCALE TYPE=%d X_FACTOR=%f Y_FACTOR=%f "
- "WIDTH=%d HEIGHT=%d CONSTRAIN=0>",
- max_w >= dvd_width || max_h >= dvd_height ? 1 : 0,
- max_w > 0 ? (double)dvd_width/max_w : 1,
- max_h > 0 ? (double)dvd_height/max_h : 1,
- dvd_width, dvd_height);
- keyframe.set_data(data);
- insert_video_plugin("Scale", &keyframe);
+ if( use_scale != Rescale::none ) {
+ double dvd_aspect = dvd_aspect_height > 0 ? dvd_aspect_width/dvd_aspect_height : 1;
+
+ Tracks *tracks = mwindow->edl->tracks;
+ for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
+ if( vtrk->data_type != TRACK_VIDEO ) continue;
+ if( !vtrk->record ) continue;
+ vtrk->expand_view = 1;
+ PluginSet *plugin_set = new PluginSet(mwindow->edl, vtrk);
+ vtrk->plugin_set.append(plugin_set);
+ Edits *edits = vtrk->edits;
+ for( Edit *edit=edits->first; edit; edit=edit->next ) {
+ Indexable *indexable = edit->get_source();
+ if( !indexable ) continue;
+ Rescale in(indexable);
+ Rescale out(dvd_width, dvd_height, dvd_aspect);
+ float src_w, src_h, dst_w, dst_h;
+ in.rescale(out,use_scale, src_w,src_h, dst_w,dst_h);
+ sprintf(data,"<SCALERATIO TYPE=%d"
+ " IN_W=%d IN_H=%d IN_ASPECT_RATIO=%f"
+ " OUT_W=%d OUT_H=%d OUT_ASPECT_RATIO=%f"
+ " SRC_X=%f SRC_Y=%f SRC_W=%f SRC_H=%f"
+ " DST_X=%f DST_Y=%f DST_W=%f DST_H=%f>", use_scale,
+ in.w, in.h, in.aspect, out.w, out.h, out.aspect,
+ 0., 0., src_w, src_h, 0., 0., dst_w, dst_h);
+ keyframe.set_data(data);
+ plugin_set->insert_plugin(_("Scale Ratio"),
+ edit->startproject, edit->length,
+ PLUGIN_STANDALONE, 0, &keyframe, 0);
+ }
+ vtrk->optimize();
+ }