From 95545630e5f987e539346c70d4926ec186a0a086 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 10 Jul 2015 23:46:35 +0200 Subject: [PATCH] tweak video import dialog (handle non video files) --- gtk2_ardour/transcode_video_dialog.cc | 40 ++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/transcode_video_dialog.cc b/gtk2_ardour/transcode_video_dialog.cc index 16bfc36995..04c21b6140 100644 --- a/gtk2_ardour/transcode_video_dialog.cc +++ b/gtk2_ardour/transcode_video_dialog.cc @@ -122,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); @@ -178,17 +181,40 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile) options_box->pack_start (*l, false, true, 4); video_combo.set_name ("PaddedButton"); - video_combo.append_text(_("Reference From Current Location (Previously Transcoded Files Only)")); - 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(1); - } else { + 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); - } - if (as.size() > 0) { - video_combo.append_text(_("Do Not Import Video (Audio Import Only)")); + transcode_button.set_sensitive(false); + path_entry.set_sensitive (false); + browse_button.set_sensitive (false); } options_box->pack_start (video_combo, false, false, 4);