From 7fe22a7af3531f5c11e842c2a47db8a6ee5b33bc Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 4 Apr 2013 23:40:36 +0200 Subject: vtl: overall export progress bar --- gtk2_ardour/export_video_dialog.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'gtk2_ardour/export_video_dialog.cc') diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index 6190f38851..dc99a9d831 100644 --- a/gtk2_ardour/export_video_dialog.cc +++ b/gtk2_ardour/export_video_dialog.cc @@ -350,9 +350,16 @@ ExportVideoDialog::update_progress (framecnt_t c, framecnt_t a) if (a == 0 || c > a) { pbar.set_pulse_step(.1); pbar.pulse(); - return; + } else { + double progress = (double)c / (double) a; + progress = progress / ((twopass ? 2.0 : 1.0) + (normalize ? 2.0 : 1.0)); + if (normalize && twopass) progress += (firstpass ? .5 : .75); + else if (normalize) progress += 2.0/3.0; + else if (twopass) progress += (firstpass ? 1.0/3.0 : 2.0/3.0); + else progress += .5; + + pbar.set_fraction (progress); } - pbar.set_fraction ((double)c / (double) a); } @@ -360,13 +367,15 @@ gint ExportVideoDialog::audio_progress_display () { std::string status_text; - float progress = 0.0; + double progress = 0.0; if (status->normalizing) { pbar.set_text (_("Normalizing audio")); progress = ((float) status->current_normalize_cycle) / status->total_normalize_cycles; + progress = progress / (twopass ? 4.0 : 3.0) + (twopass ? .25 : 1.0/3.0); } else { pbar.set_text (_("Exporting audio")); progress = ((float) status->processed_frames_current_timespan) / status->total_frames_current_timespan; + progress = progress / ((twopass ? 2.0 : 1.0) + (normalize ? 2.0 : 1.0)); } if (progress < previous_progress) { // Work around gtk bug @@ -386,8 +395,8 @@ ExportVideoDialog::finished () unlink (insnd.c_str()); warning << _("Video Export Failed or Was Aborted") << endmsg; Gtk::Dialog::response(RESPONSE_CANCEL); - } else if (twopass) { - twopass = false; + } else if (twopass && firstpass) { + firstpass = false; if (transcoder) { delete transcoder; transcoder = 0;} encode_pass(2); } else { @@ -415,6 +424,8 @@ ExportVideoDialog::launch_export () progress_box->show(); aborted = false; twopass = twopass_checkbox.get_active(); + firstpass = true; + normalize = normalize_checkbox.get_active(); /* export audio track */ ExportTimespanPtr tsp = _session->get_export_handler()->add_timespan(); @@ -423,7 +434,7 @@ ExportVideoDialog::launch_export () boost::shared_ptr b; XMLTree tree; std::string vtl_samplerate = audio_samplerate_combo.get_active_text(); - std::string vtl_normalize = normalize_checkbox.get_active()?"true":"false"; + std::string vtl_normalize = normalize ? "true" : "false"; tree.read_buffer(std::string( "" "" -- cgit v1.2.3