fix conflicts and merge with master
[ardour.git] / gtk2_ardour / transcode_ffmpeg.cc
index 9c6a7d801b807b4bafea95085563a517b48bc463..08060b6a5174e0b7e1e7aab3bc763b84d38ab770 100644 (file)
 
 #include "i18n.h"
 
-#ifdef SearchPath
-#undef SearchPath
-#endif
-
 using namespace PBD;
+using namespace VideoUtils;
 
 TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
        : infile(f)
@@ -54,7 +51,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
 #endif
 
        std::string ff_file_path;
-       if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) { ffmpeg_exe = ff_file_path; }
+       if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) { ffmpeg_exe = ff_file_path; }
        else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
                ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
        }
@@ -62,7 +59,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
                ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
        }
 
-       if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) { ffprobe_exe = ff_file_path; }
+       if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) { ffprobe_exe = ff_file_path; }
        else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
                ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe");
        }
@@ -71,18 +68,19 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
        }
 
        if (ffmpeg_exe.empty() || ffprobe_exe.empty()) {
-               warning << _(
+               warning << string_compose(
+                               _(
                                "No ffprobe or ffmpeg executables could be found on this system.\n"
                                "Video import and export is not possible until you install those tools.\n"
-                               "Ardour requires ffmpeg and ffprobe from ffmpeg.org - version 1.1 or newer.\n"
+                               "%1 requires ffmpeg and ffprobe from ffmpeg.org - version 1.1 or newer.\n"
                                "\n"
-                               "The tools are included with the Ardour releases from ardour.org "
+                               "The tools are included with the %1 releases from ardour.org "
                                "and also available with the video-server at http://x42.github.com/harvid/\n"
                                "\n"
                                "Important: the files need to be installed in $PATH and named ffmpeg_harvid and ffprobe_harvid.\n"
                                "If you already have a suitable ffmpeg installation on your system, we recommend creating "
                                "symbolic links from ffmpeg to ffmpeg_harvid and from ffprobe to ffprobe_harvid.\n"
-                               ) << endmsg;
+                               ), PROGRAM_NAME) << endmsg;
                return;
        }
        ffexecok = true;
@@ -126,7 +124,7 @@ TranscodeFfmpeg::probe ()
         * SystemExec::Terminated is emitted and ffcmd set to NULL */
        int timeout = 300; // 1.5 sec
        while (ffcmd && --timeout > 0) {
-               usleep(5000);
+               Glib::usleep(5000);
        }
        if (timeout == 0 || ffoutput.empty()) {
                return false;
@@ -395,7 +393,7 @@ TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf
 }
 
 bool
-TranscodeFfmpeg::extract_audio (std::string outfile, ARDOUR::framecnt_t samplerate, unsigned int stream)
+TranscodeFfmpeg::extract_audio (std::string outfile, ARDOUR::framecnt_t /*samplerate*/, unsigned int stream)
 {
        if (!probeok) return false;
   if (stream >= m_audio.size()) return false;
@@ -507,7 +505,11 @@ TranscodeFfmpeg::cancel ()
 {
        if (!ffcmd || !ffcmd->is_running()) { return;}
        ffcmd->write_to_stdin("q");
+#ifdef WIN32
+       Sleep(1000);
+#else
        sleep (1);
+#endif
        if (ffcmd) {
          ffcmd->terminate();
        }