Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef WITH_VIDEOTIMELINE
-
#include <cstdio>
#include <string>
#include <sstream>
set_session (s);
set_name ("ExportVideoDialog");
- set_position (Gtk::WIN_POS_MOUSE);
set_modal (true);
set_skip_taskbar_hint (true);
set_resizable (false);
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);
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 (_("<b>Settings:</b>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
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);
+}
+
+
+gint
+ExportVideoDialog::audio_progress_display ()
+{
+ std::string status_text;
+ 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
+ pbar.hide();
+ pbar.show();
+ }
+ previous_progress = progress;
+ pbar.set_fraction (progress);
+ return TRUE;
}
void
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 {
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();
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\">"
/* do sound export */
_session->get_export_handler()->add_export_config (tsp, ccp, fmp, fnp, b);
_session->get_export_handler()->do_export();
- boost::shared_ptr<ARDOUR::ExportStatus> status = _session->get_export_status ();
- //status->running = true;
+ status = _session->get_export_status ();
- float previous_progress = 0.0;
+ audio_progress_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ExportVideoDialog::audio_progress_display), 100);
+ previous_progress = 0.0;
while (status->running) {
if (aborted) { status->abort(); }
-
- float progress = 0.0;
- if (status->normalizing) {
- pbar.set_text (_("Normalizing audio"));
- progress = ((float) status->current_normalize_cycle) / status->total_normalize_cycles;
- } else {
- pbar.set_text (_("Exporting audio"));
- progress = ((float) status->processed_frames_current_timespan) / status->total_frames_current_timespan;
- }
- if (progress < previous_progress) {
- // Work around gtk bug
- pbar.hide();
- pbar.show();
- }
- previous_progress = progress;
- pbar.set_fraction (progress);
if (gtk_events_pending()) {
gtk_main_iteration ();
} else {
usleep (10000);
}
}
+ audio_progress_connection.disconnect();
status->finish ();
if (status->aborted()) {
unlink (insnd.c_str());
Gtk::Dialog::response(RESPONSE_CANCEL);
return;
}
- pbar.set_text (_("Encoding Video.."));
+ pbar.set_text (_("Encoding Video..."));
encode_pass(1);
}
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();
}
}
}
}
-
-#endif /* WITH_VIDEOTIMELINE */