X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftranscode_video_dialog.cc;h=50e4740cc08276cf25ab558d5216144fab5692c8;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=9f18e85b64880e1002d43ae5cb7edf8cb6479a50;hpb=8c5cff60912c7e0a7256f635641399500d8d00d9;p=ardour.git diff --git a/gtk2_ardour/transcode_video_dialog.cc b/gtk2_ardour/transcode_video_dialog.cc index 9f18e85b64..50e4740cc0 100644 --- a/gtk2_ardour/transcode_video_dialog.cc +++ b/gtk2_ardour/transcode_video_dialog.cc @@ -28,9 +28,8 @@ #include #include -#include -#include +#include "pbd/gstdio_compat.h" #include "pbd/error.h" #include "pbd/convert.h" @@ -42,11 +41,10 @@ #include "ardour_ui.h" #include "gui_thread.h" -#include "utils.h" #include "opts.h" #include "transcode_video_dialog.h" #include "utils_videotl.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace Gtk; using namespace std; @@ -65,6 +63,7 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) , aspect_checkbox (_("Height = ")) , height_adjustment (128, 0, 1920, 1, 16, 0) , height_spinner (height_adjustment) + , ltc_detect (_("Extract LTC from audio and align video")) , bitrate_checkbox (_("Manual Override")) , bitrate_adjustment (2000, 500, 10000, 10, 100, 0) , bitrate_spinner (bitrate_adjustment) @@ -96,7 +95,6 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) path_hbox->pack_start (path_label, false, false, 3); path_hbox->pack_start (path_entry, true, true, 3); path_hbox->pack_start (browse_button, false, false, 3); - browse_button.set_name ("PaddedButton"); path_entry.set_width_chars(38); height_spinner.set_sensitive(false); @@ -112,7 +110,7 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) bool ffok = false; if (!transcoder->ffexec_ok()) { - l = manage (new Label (_("No ffprobe or ffmpeg executables could be found on this system. Video Import 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 Import is not possible. See the Log window for more information."), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false)); l->set_line_wrap(); options_box->pack_start (*l, false, true, 4); aspect_checkbox.set_sensitive(false); @@ -124,12 +122,15 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) aspect_checkbox.set_sensitive(false); bitrate_checkbox.set_sensitive(false); } else { - ffok = true; w = transcoder->get_width(); h = transcoder->get_height(); as = transcoder->get_audio(); m_aspect = transcoder->get_aspect(); + if (w > 0 && h > 0 && transcoder->get_fps() > 0 && transcoder->get_duration() > 0) { + ffok = true; + } + Table* t = manage (new Table (4, 2)); t->set_spacings (4); options_box->pack_start (*t, true, true, 4); @@ -179,27 +180,49 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) l->set_use_markup (); options_box->pack_start (*l, false, true, 4); - video_combo.set_name ("PaddedButton"); - video_combo.append_text(_("Do Not Import Video")); - video_combo.append_text(_("Reference From Current Location")); - if (ffok) { + if (ffok) { + video_combo.append_text(_("Reference from Current Location (Previously Transcoded Files Only)")); video_combo.append_text(_("Import/Transcode Video to Session")); - video_combo.set_active(2); - } else { video_combo.set_active(1); + if (as.size() > 0) { + video_combo.append_text(_("Do Not Import Video (Audio Import Only)")); + audio_combo.set_sensitive(true); + } else { + audio_combo.set_sensitive(false); + } + video_combo.set_sensitive(true); + transcode_button.set_sensitive(true); + path_entry.set_sensitive (true); + browse_button.set_sensitive (true); + } else if (as.size() > 0) { + video_combo.append_text(_("Do Not Import Video (Audio Import Only)")); + video_combo.set_active(0); + path_entry.set_text (""); + + video_combo.set_sensitive(false); + audio_combo.set_sensitive(true); + transcode_button.set_sensitive(true); + path_entry.set_sensitive (false); + browse_button.set_sensitive (false); + } else { + video_combo.append_text(_("Do Not Import Video")); + video_combo.set_active(0); + path_entry.set_text (""); video_combo.set_sensitive(false); audio_combo.set_sensitive(false); + transcode_button.set_sensitive(false); + path_entry.set_sensitive (false); + browse_button.set_sensitive (false); } options_box->pack_start (video_combo, false, false, 4); - Table* t = manage (new Table (4, 3)); + Table* t = manage (new Table (4, 4)); t->set_spacings (4); options_box->pack_start (*t, true, true, 4); l = manage (new Label (_("Scale Video: Width = "), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false)); t->attach (*l, 0, 1, 0, 1); - scale_combo.set_name ("PaddedButton"); t->attach (scale_combo, 1, 2, 0, 1); t->attach (aspect_checkbox, 2, 3, 0, 1); t->attach (height_spinner, 3, 4, 0, 1); @@ -226,15 +249,19 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) l = manage (new Label (_("Extract Audio:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false)); t->attach (*l, 0, 1, 2, 3); - audio_combo.set_name ("PaddedButton"); t->attach (audio_combo, 1, 4, 2, 3); - audio_combo.append_text("No audio"); - if (as.size() > 0) { + t->attach (ltc_detect, 1, 4, 3, 4); + if (as.size() == 0) { + audio_combo.append_text(_("No Audio Track Present")); + audio_combo.set_sensitive(false); + } else { + audio_combo.append_text(_("Do Not Extract Audio")); for (TranscodeFfmpeg::FFAudioStreams::iterator it = as.begin(); it < as.end(); ++it) { audio_combo.append_text((*it).name); } } audio_combo.set_active(0); + ltc_detect.set_sensitive (false); #if 1 /* tentative debug mode */ options_box->pack_start (debug_checkbox, false, true, 4); @@ -367,12 +394,12 @@ TranscodeVideoDialog::dialog_progress_mode () void TranscodeVideoDialog::launch_transcode () { - if (video_combo.get_active_row_number() != 2) { + if (video_combo.get_active_row_number() != 1) { launch_audioonly(); return; } std::string outfn = path_entry.get_text(); - if (!confirm_video_outfn(outfn, video_get_docroot(Config))) return; + if (!confirm_video_outfn(*this, outfn, video_get_docroot(Config))) return; progress_label.set_text (_("Transcoding Video..")); dialog_progress_mode(); #if 1 /* tentative debug mode */ @@ -416,8 +443,8 @@ TranscodeVideoDialog::launch_transcode () void TranscodeVideoDialog::video_combo_changed () { - int i = video_combo.get_active_row_number(); - if (i != 2) { + const int i = video_combo.get_active_row_number(); + if (i != 1) { scale_combo.set_sensitive(false); aspect_checkbox.set_sensitive(false); height_spinner.set_sensitive(false); @@ -430,12 +457,33 @@ TranscodeVideoDialog::video_combo_changed () bitrate_checkbox.set_sensitive(true); bitrate_spinner.set_sensitive(true); } + if (i == 2 && audio_combo.get_active_row_number() == 0) { + audio_combo.set_active(1); + } else { + //update LTC option sensitivity + audio_combo_changed (); + } } void TranscodeVideoDialog::audio_combo_changed () { - ; + if (video_combo.get_active_row_number() == 2 + && audio_combo.get_active_row_number() == 0) + { + audio_combo.set_active(1); + ltc_detect.set_sensitive (false); + ltc_detect.set_active (false); + } + + if (video_combo.get_active_row_number() != 2 + && audio_combo.get_active_row_number() > 0) + { + ltc_detect.set_sensitive (true); + } else { + ltc_detect.set_sensitive (false); + ltc_detect.set_active (false); + } } void