X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_video_dialog.cc;h=c1589909b2c0f38ec7591138f90f5be8bed7011e;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=7e01f5b9ad1a132eb4e6e37114bbb0c087262bce;hpb=29abc678dd338a65dd7240176e565678efc56d67;p=ardour.git diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index 7e01f5b9ad..c1589909b2 100644 --- a/gtk2_ardour/export_video_dialog.cc +++ b/gtk2_ardour/export_video_dialog.cc @@ -29,7 +29,7 @@ #include -#include +#include "pbd/gstdio_compat.h" #include "pbd/error.h" #include "pbd/convert.h" @@ -55,11 +55,7 @@ #include "opts.h" #include "export_video_dialog.h" #include "utils_videotl.h" -#include "i18n.h" - -#ifdef COMPILER_MSVC -#define rintf(x) round((x) + 0.5) -#endif +#include "pbd/i18n.h" using namespace Gtk; using namespace std; @@ -116,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); @@ -154,7 +150,6 @@ ExportVideoDialog::ExportVideoDialog () path_hbox->pack_start (*l, false, false, 2); vbox->pack_start (*path_hbox, false, false, 2); - insnd_combo.set_name ("PaddedButton"); insnd_combo.append_text (string_compose (_("from the %1 session's start to the session's end"), PROGRAM_NAME)); outfn_path_entry.set_width_chars(38); @@ -206,7 +201,6 @@ ExportVideoDialog::ExportVideoDialog () t->attach (debug_checkbox, 0, 4, ty, ty+1); ty++; #endif - preset_combo.set_name ("PaddedButton"); preset_combo.append_text("none"); preset_combo.append_text("dvd-mp2"); preset_combo.append_text("dvd-NTSC"); @@ -218,7 +212,6 @@ ExportVideoDialog::ExportVideoDialog () preset_combo.append_text("webm"); preset_combo.append_text("you-tube"); - audio_codec_combo.set_name ("PaddedButton"); audio_codec_combo.append_text(_("(default for format)")); audio_codec_combo.append_text("ac3"); audio_codec_combo.append_text("aac"); @@ -227,7 +220,6 @@ ExportVideoDialog::ExportVideoDialog () audio_codec_combo.append_text("mp2"); audio_codec_combo.append_text("pcm_s16le"); - video_codec_combo.set_name ("PaddedButton"); video_codec_combo.append_text(_("(default for format)")); video_codec_combo.append_text("flv"); video_codec_combo.append_text("libtheora"); @@ -238,7 +230,6 @@ ExportVideoDialog::ExportVideoDialog () video_codec_combo.append_text("vpx (webm)"); video_codec_combo.append_text("copy"); - audio_bitrate_combo.set_name ("PaddedButton"); audio_bitrate_combo.append_text(_("(default)")); audio_bitrate_combo.append_text("64k"); audio_bitrate_combo.append_text("128k"); @@ -246,12 +237,10 @@ ExportVideoDialog::ExportVideoDialog () audio_bitrate_combo.append_text("256k"); audio_bitrate_combo.append_text("320k"); - audio_samplerate_combo.set_name ("PaddedButton"); audio_samplerate_combo.append_text("22050"); audio_samplerate_combo.append_text("44100"); audio_samplerate_combo.append_text("48000"); - video_bitrate_combo.set_name ("PaddedButton"); video_bitrate_combo.append_text(_("(default)")); video_bitrate_combo.append_text(_("(retain)")); video_bitrate_combo.append_text("200k"); @@ -260,7 +249,6 @@ ExportVideoDialog::ExportVideoDialog () video_bitrate_combo.append_text("5000k"); video_bitrate_combo.append_text("8000k"); - fps_combo.set_name ("PaddedButton"); fps_combo.append_text("23.976"); fps_combo.append_text("24"); fps_combo.append_text("24.976"); @@ -270,7 +258,6 @@ ExportVideoDialog::ExportVideoDialog () fps_combo.append_text("59.94"); fps_combo.append_text("60"); - aspect_combo.set_name ("PaddedButton"); aspect_combo.append_text("4:3"); aspect_combo.append_text("16:9"); @@ -379,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; @@ -415,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")); @@ -495,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")); @@ -536,22 +523,6 @@ ExportVideoDialog::on_show () Dialog::on_show (); } -bool -ExportVideoDialog::on_focus_in_event (GdkEventFocus *ev) -{ - Dialog::on_focus_in_event (ev); - Gtkmm2ext::Keyboard::magic_widget_grab_focus (); - return true; -} - -bool -ExportVideoDialog::on_focus_out_event (GdkEventFocus *ev) -{ - Dialog::on_focus_out_event (ev); - Gtkmm2ext::Keyboard::magic_widget_drop_focus (); - return true; -} - void ExportVideoDialog::abort_clicked () { @@ -584,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 = 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; } @@ -639,7 +623,7 @@ ExportVideoDialog::launch_export () _session->add_extra_xml (get_state()); std::string outfn = outfn_path_entry.get_text(); - if (!confirm_video_outfn(outfn)) { return; } + if (!confirm_video_outfn(*this, outfn)) { return; } vbox->hide(); cancel_button->hide(); @@ -771,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 ();