NO-OP: whitespace and some guaranteed assertion removal
[ardour.git] / gtk2_ardour / transcode_video_dialog.cc
index ac3d4808fc10348c2e70d6f108d220575e130af6..2087b19cddab7443fc500dd4a96a55b7077ee130 100644 (file)
 
 #include <sigc++/bind.h>
 
-#include <pbd/gstdio_compat.h>
+#include <gtkmm/filechooserdialog.h>
+#include <gtkmm/stock.h>
+
+#include "pbd/gstdio_compat.h"
 
 #include "pbd/error.h"
 #include "pbd/convert.h"
@@ -44,7 +47,7 @@
 #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;
@@ -63,6 +66,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)
@@ -94,7 +98,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);
@@ -110,7 +113,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);
@@ -180,10 +183,8 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile)
        l->set_use_markup ();
        options_box->pack_start (*l, false, true, 4);
 
-       video_combo.set_name ("PaddedButton");
-
        if (ffok) {
-               video_combo.append_text(_("Reference From Current Location (Previously Transcoded Files Only)"));
+               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);
                if (as.size() > 0) {
@@ -219,13 +220,12 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile)
 
        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);
@@ -252,8 +252,8 @@ 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);
+       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);
@@ -264,6 +264,7 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile)
                }
        }
        audio_combo.set_active(0);
+       ltc_detect.set_sensitive (false);
 
 #if 1 /* tentative debug mode */
        options_box->pack_start (debug_checkbox, false, true, 4);
@@ -276,6 +277,7 @@ TranscodeVideoDialog::TranscodeVideoDialog (Session* s, std::string infile)
        get_vbox()->pack_start (*vbox, false, false);
 
        progress_box = manage (new VBox);
+       progress_box->set_spacing(6);
        progress_box->pack_start (progress_label, false, false);
        progress_box->pack_start (pbar, false, false);
        progress_box->pack_start (abort_button, false, false);
@@ -319,7 +321,7 @@ TranscodeVideoDialog::abort_clicked ()
 }
 
 void
-TranscodeVideoDialog::update_progress (framecnt_t c, framecnt_t a)
+TranscodeVideoDialog::update_progress (samplecnt_t c, samplecnt_t a)
 {
        if (a == 0 || c > a) {
                pbar.set_pulse_step(.5);
@@ -375,7 +377,7 @@ TranscodeVideoDialog::launch_extract ()
        audio_stream = audio_combo.get_active_row_number() -1;
        progress_label.set_text (_("Extracting Audio.."));
 
-       if (!transcoder->extract_audio(audiofile, _session->nominal_frame_rate(), audio_stream)) {
+       if (!transcoder->extract_audio(audiofile, _session->nominal_sample_rate(), audio_stream)) {
                ARDOUR_UI::instance()->popup_error(_("Audio Extraction Failed."));
                audiofile="";
                Gtk::Dialog::response(RESPONSE_CANCEL);
@@ -401,7 +403,7 @@ TranscodeVideoDialog::launch_transcode ()
                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 */
@@ -461,6 +463,9 @@ TranscodeVideoDialog::video_combo_changed ()
        }
        if (i == 2 && audio_combo.get_active_row_number() == 0) {
                audio_combo.set_active(1);
+       } else {
+               //update LTC option sensitivity
+               audio_combo_changed ();
        }
 }
 
@@ -471,6 +476,17 @@ TranscodeVideoDialog::audio_combo_changed ()
                        && 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);
        }
 }