vtl: overall export progress bar
authorRobin Gareus <robin@gareus.org>
Thu, 4 Apr 2013 21:40:36 +0000 (23:40 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 4 Apr 2013 21:40:36 +0000 (23:40 +0200)
gtk2_ardour/export_video_dialog.cc
gtk2_ardour/export_video_dialog.h

index 6190f388512c36fd3d0328c26cb4bc2b9eafff39..dc99a9d831e2a1f7e2cf73c53b2b7a4aa3fd20a6 100644 (file)
@@ -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<AudioGrapher::BroadcastInfo> 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(
 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
 "<ExportFormatSpecification name=\"VTL-WAV-16\" id=\"3094591e-ccb9-4385-a93f-c9955ffeb1f0\">"
index f1c996de3038d713619da64e23bb5180d15e99de..72376512d12dd332238ed2578e96e7239a95a373 100644 (file)
@@ -66,6 +66,8 @@ class ExportVideoDialog : public ArdourDialog , public PBD::ScopedConnectionList
 
        bool aborted;
        bool twopass;
+       bool firstpass;
+       bool normalize;
 
        void finished ();
        void update_progress (ARDOUR::framecnt_t, ARDOUR::framecnt_t);