X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_video_dialog.cc;h=c1589909b2c0f38ec7591138f90f5be8bed7011e;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=e1d3e22571c7b537b78e75447c0be48847457cb2;hpb=803a2393101195cffb26280543e269a45a7f992c;p=ardour.git diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index e1d3e22571..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; @@ -83,6 +79,7 @@ ExportVideoDialog::ExportVideoDialog () , invid_browse_button (_("Browse")) , transcode_button (_("Export")) , abort_button (_("Abort")) + , progress_box (0) , scale_checkbox (_("Scale Video (W x H):")) , scale_aspect (_("Retain Aspect")) , width_adjustment (768, 128, 1920, 1, 16, 0) @@ -113,14 +110,15 @@ ExportVideoDialog::ExportVideoDialog () HBox* path_hbox; /* check if ffmpeg can be found */ - _transcoder = new TranscodeFfmpeg(""); + _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); add_button (Stock::OK, RESPONSE_CANCEL); show_all_children (); + delete _transcoder; _transcoder = 0; return; } delete _transcoder; _transcoder = 0; @@ -152,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); @@ -204,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"); @@ -216,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"); @@ -225,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"); @@ -236,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"); @@ -244,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"); @@ -258,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"); @@ -268,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"); @@ -377,11 +366,11 @@ 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; if (node) { - bool filenameset = false; if (node->property(X_("OriginalVideoFile"))) { std::string filename = node->property(X_("OriginalVideoFile"))->value(); if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { @@ -406,14 +395,14 @@ ExportVideoDialog::apply_state (TimeSelection &tme, bool range) filenameset = true; } } - if (!filenameset) { - invid_path_entry.set_text (X_("")); - } + } + if (!filenameset) { + invid_path_entry.set_text (X_("")); } 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")); @@ -485,13 +474,15 @@ ExportVideoDialog::apply_state (TimeSelection &tme, bool range) _suspend_dirty = false; show_all_children (); - progress_box->hide(); + if (progress_box) { + progress_box->hide(); + } } 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")); @@ -532,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 () { @@ -580,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; } @@ -635,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(); @@ -767,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 ();