X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=gtk2_ardour%2Fexport_video_dialog.cc;h=ce85fad81ef5c6129cb861c7bc00092239703740;hb=cb7bcb6d9f3a9f67b23066e3fd0c36db394c00fe;hp=6190f388512c36fd3d0328c26cb4bc2b9eafff39;hpb=b4e5eb3c8bc1547157526fcb3de3f77188641658;p=ardour.git diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index 6190f38851..ce85fad81e 100644 --- a/gtk2_ardour/export_video_dialog.cc +++ b/gtk2_ardour/export_video_dialog.cc @@ -17,8 +17,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifdef WITH_VIDEOTIMELINE - #include #include #include @@ -93,7 +91,6 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s) set_session (s); set_name ("ExportVideoDialog"); - set_position (Gtk::WIN_POS_MOUSE); set_modal (true); set_skip_taskbar_hint (true); set_resizable (false); @@ -144,13 +141,13 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s) vbox->pack_start (*path_hbox, false, false, 2); insnd_combo.set_name ("PaddedButton"); - insnd_combo.append_text("from ardour session-start to session-end"); + insnd_combo.append_text (string_compose (_("from the %1 session's start to the session's end"), PROGRAM_NAME)); frameoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset(); if (av_offset < 0 ) { - insnd_combo.append_text("from 00:00:00:00 to video-end"); + insnd_combo.append_text (_("from 00:00:00:00 to the video's end")); } else { - insnd_combo.append_text("from video-start to video-end"); + insnd_combo.append_text (_("from the video's start to the video's end")); } insnd_combo.set_active(0); @@ -158,12 +155,29 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s) outfn_path_entry.set_text (_session->session_directory().export_path() + G_DIR_SEPARATOR +"export.avi"); XMLNode* node = _session->extra_xml (X_("Videotimeline")); - if (node && node->property(X_("Filename"))) { - std::string filename = node->property(X_("Filename"))->value(); - if (filename.at(0) != G_DIR_SEPARATOR) { - filename = Glib::build_filename (_session->session_directory().video_path(), filename); + 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)) { + invid_path_entry.set_text (filename); + filenameset = true; + } + } + else if (!filenameset + && node->property(X_("Filename")) + && node->property(X_("LocalFile")) + && node->property(X_("LocalFile"))->value() == X_("1") + ) { + std::string filename = node->property(X_("Filename"))->value(); + if (filename.at(0) != G_DIR_SEPARATOR) { + filename = Glib::build_filename (_session->session_directory().video_path(), filename); + } + if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { + invid_path_entry.set_text (filename); + filenameset = true; + } } - invid_path_entry.set_text (filename); } l = manage (new Label (_("Settings:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false)); @@ -350,9 +364,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 +381,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 @@ -384,10 +407,9 @@ ExportVideoDialog::finished () if (aborted) { unlink(outfn_path_entry.get_text().c_str()); 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 { @@ -411,10 +433,12 @@ ExportVideoDialog::launch_export () cancel_button->hide(); transcode_button.hide(); pbar.set_size_request(300,-1); - pbar.set_text(_("Exporting Audio..")); + pbar.set_text(_("Exporting Audio...")); 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 +447,7 @@ ExportVideoDialog::launch_export () boost::shared_ptr 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( "" "" @@ -534,7 +558,7 @@ ExportVideoDialog::launch_export () Gtk::Dialog::response(RESPONSE_CANCEL); return; } - pbar.set_text (_("Encoding Video..")); + pbar.set_text (_("Encoding Video...")); encode_pass(1); } @@ -574,7 +598,7 @@ ExportVideoDialog::encode_pass (int pass) ffs["-acodec"] = audio_codec_combo.get_active_text(); if (video_bitrate_combo.get_active_text() == "retain" ) { - ffs["-sameq"] = "-y"; // we use '-y' as dummy parameter for non key/value options + ffs["-qscale"] = "0"; } else { ffs["-b:v"] = video_bitrate_combo.get_active_text(); } @@ -956,5 +980,3 @@ ExportVideoDialog::open_invid_dialog () } } } - -#endif /* WITH_VIDEOTIMELINE */