fix crash when copy'ing latent plugins
[ardour.git] / gtk2_ardour / export_video_dialog.cc
index 41b78723954163a87c6d4000023b54b8bb8d8732..fba09e92704c7f0ee4d84163ea966f625aad3e65 100644 (file)
@@ -55,7 +55,7 @@
 #include "opts.h"
 #include "export_video_dialog.h"
 #include "utils_videotl.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace Gtk;
 using namespace std;
@@ -112,7 +112,7 @@ ExportVideoDialog::ExportVideoDialog ()
        /* check if ffmpeg can be found */
        _transcoder = new TranscodeFfmpeg(X_(""));
        if (!_transcoder->ffexec_ok()) {
-               l = manage (new Label (_("No ffprobe or ffmpeg executables could be found on this system. Video Export is not possible until you install those tools. See the Log window for more information."), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
+               l = manage (new Label (_("ffmpeg installation was not found. Video Export is not possible. See the Log window for more information."), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
                l->set_line_wrap();
                vbox->pack_start (*l, false, false, 8);
                get_vbox()->pack_start (*vbox, false, false);
@@ -366,7 +366,7 @@ ExportVideoDialog::apply_state (TimeSelection &tme, bool range)
 
        float tcfps = _session->timecode_frames_per_second();
 
-       LocaleGuard lg (X_("C"));
+       LocaleGuard lg;
 
        XMLNode* node = _session->extra_xml (X_("Videotimeline"));
        bool filenameset = false;
@@ -402,7 +402,7 @@ ExportVideoDialog::apply_state (TimeSelection &tme, bool range)
 
        node = _session->extra_xml (X_("Videoexport"));
        if (node) {
-               const XMLProperty* prop;
+               XMLProperty const * prop;
                prop = node->property (X_("ChangeGeometry"));
                if (prop) { scale_checkbox.set_active(atoi(prop->value())?true:false); }
                prop = node->property (X_("KeepAspect"));
@@ -482,7 +482,7 @@ ExportVideoDialog::apply_state (TimeSelection &tme, bool range)
 XMLNode&
 ExportVideoDialog::get_state ()
 {
-       LocaleGuard lg (X_("C"));
+       LocaleGuard lg;
        XMLNode* node = new XMLNode (X_("Videoexport"));
        node->add_property (X_("ChangeGeometry"), scale_checkbox.get_active() ? X_("1") : X_("0"));
        node->add_property (X_("KeepAspect"), scale_aspect.get_active() ? X_("1") : X_("0"));
@@ -555,23 +555,36 @@ gint
 ExportVideoDialog::audio_progress_display ()
 {
        std::string status_text;
-       double progress = 0.0;
-               if (status->normalizing) {
+       double progress = -1.0;
+       switch (status->active_job) {
+               case ExportStatus::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 {
+                       progress = ((float) status->current_postprocessing_cycle) / status->total_postprocessing_cycles;
+                       progress = progress / (_twopass ? 4.0 : 3.0) + (_twopass ? .25 : 1.0 / 3.0);
+                       break;
+               case ExportStatus::Exporting:
                        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
-                       pbar.hide();
-                       pbar.show();
-               }
-               _previous_progress = progress;
+                       break;
+               default:
+                       pbar.set_text (_("Exporting audio"));
+                       break;
+       }
+
+       if (progress < _previous_progress) {
+               // Work around gtk bug
+               pbar.hide();
+               pbar.show();
+       }
+       _previous_progress = progress;
+
+       if (progress >= 0) {
                pbar.set_fraction (progress);
+       } else {
+               pbar.set_pulse_step(.1);
+               pbar.pulse();
+       }
        return TRUE;
 }
 
@@ -742,7 +755,7 @@ ExportVideoDialog::launch_export ()
 
        audio_progress_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ExportVideoDialog::audio_progress_display), 100);
        _previous_progress = 0.0;
-       while (status->running) {
+       while (status->running ()) {
                if (_aborted) { status->abort(); }
                if (gtk_events_pending()) {
                        gtk_main_iteration ();