vtl: overall export progress bar

This commit is contained in:
Robin Gareus 2013-04-04 23:40:36 +02:00
parent b358a09165
commit 7fe22a7af3
2 changed files with 19 additions and 6 deletions

View file

@ -350,9 +350,16 @@ ExportVideoDialog::update_progress (framecnt_t c, framecnt_t a)
if (a == 0 || c > a) { if (a == 0 || c > a) {
pbar.set_pulse_step(.1); pbar.set_pulse_step(.1);
pbar.pulse(); 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 () ExportVideoDialog::audio_progress_display ()
{ {
std::string status_text; std::string status_text;
float progress = 0.0; double progress = 0.0;
if (status->normalizing) { if (status->normalizing) {
pbar.set_text (_("Normalizing audio")); pbar.set_text (_("Normalizing audio"));
progress = ((float) status->current_normalize_cycle) / status->total_normalize_cycles; progress = ((float) status->current_normalize_cycle) / status->total_normalize_cycles;
progress = progress / (twopass ? 4.0 : 3.0) + (twopass ? .25 : 1.0/3.0);
} else { } else {
pbar.set_text (_("Exporting audio")); pbar.set_text (_("Exporting audio"));
progress = ((float) status->processed_frames_current_timespan) / status->total_frames_current_timespan; 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) { if (progress < previous_progress) {
// Work around gtk bug // Work around gtk bug
@ -386,8 +395,8 @@ ExportVideoDialog::finished ()
unlink (insnd.c_str()); unlink (insnd.c_str());
warning << _("Video Export Failed or Was Aborted") << endmsg; warning << _("Video Export Failed or Was Aborted") << endmsg;
Gtk::Dialog::response(RESPONSE_CANCEL); Gtk::Dialog::response(RESPONSE_CANCEL);
} else if (twopass) { } else if (twopass && firstpass) {
twopass = false; firstpass = false;
if (transcoder) { delete transcoder; transcoder = 0;} if (transcoder) { delete transcoder; transcoder = 0;}
encode_pass(2); encode_pass(2);
} else { } else {
@ -415,6 +424,8 @@ ExportVideoDialog::launch_export ()
progress_box->show(); progress_box->show();
aborted = false; aborted = false;
twopass = twopass_checkbox.get_active(); twopass = twopass_checkbox.get_active();
firstpass = true;
normalize = normalize_checkbox.get_active();
/* export audio track */ /* export audio track */
ExportTimespanPtr tsp = _session->get_export_handler()->add_timespan(); ExportTimespanPtr tsp = _session->get_export_handler()->add_timespan();
@ -423,7 +434,7 @@ ExportVideoDialog::launch_export ()
boost::shared_ptr<AudioGrapher::BroadcastInfo> b; boost::shared_ptr<AudioGrapher::BroadcastInfo> b;
XMLTree tree; XMLTree tree;
std::string vtl_samplerate = audio_samplerate_combo.get_active_text(); 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( tree.read_buffer(std::string(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<ExportFormatSpecification name=\"VTL-WAV-16\" id=\"3094591e-ccb9-4385-a93f-c9955ffeb1f0\">" "<ExportFormatSpecification name=\"VTL-WAV-16\" id=\"3094591e-ccb9-4385-a93f-c9955ffeb1f0\">"

View file

@ -66,6 +66,8 @@ class ExportVideoDialog : public ArdourDialog , public PBD::ScopedConnectionList
bool aborted; bool aborted;
bool twopass; bool twopass;
bool firstpass;
bool normalize;
void finished (); void finished ();
void update_progress (ARDOUR::framecnt_t, ARDOUR::framecnt_t); void update_progress (ARDOUR::framecnt_t, ARDOUR::framecnt_t);