consolidate video-tool filepaths - step one
authorRobin Gareus <robin@gareus.org>
Tue, 23 Dec 2014 17:28:45 +0000 (18:28 +0100)
committerRobin Gareus <robin@gareus.org>
Tue, 23 Dec 2014 22:43:24 +0000 (23:43 +0100)
1:1 cut/paste

gtk2_ardour/transcode_ffmpeg.cc
gtk2_ardour/video_server_dialog.cc
gtk2_ardour/video_timeline.cc
gtk2_ardour/video_tool_paths.cc [new file with mode: 0644]
gtk2_ardour/video_tool_paths.h [new file with mode: 0644]
gtk2_ardour/wscript

index 6b826e577569d71475e36747d1e026ffbf9bdea2..b9da8948fa390dfc8120e0bb2c8a05d8b8bab5a4 100644 (file)
 
 #include "transcode_ffmpeg.h"
 #include "utils_videotl.h"
-
-#ifdef PLATFORM_WINDOWS
-#include <windows.h>
-#include <shlobj.h> // CSIDL_*
-#include "pbd/windows_special_dirs.h"
-#endif
+#include "video_tool_paths.h"
 
 #include "i18n.h"
 
@@ -46,8 +41,6 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
 {
        probeok = false;
        ffexecok = false;
-       ffmpeg_exe = "";
-       ffprobe_exe = "";
        m_duration = 0;
        m_avoffset = m_lead_in = m_lead_out = 0;
        m_width = m_height = 0;
@@ -57,77 +50,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
        debug_enable = false;
 #endif
 
-#ifdef PLATFORM_WINDOWS
-       HKEY key;
-       DWORD size = PATH_MAX;
-       char tmp[PATH_MAX+1];
-       const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
-#endif
-
-       std::string ff_file_path;
-       if (find_file (Searchpath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) {
-               ffmpeg_exe = ff_file_path;
-       }
-#ifdef PLATFORM_WINDOWS
-       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ, &key))
-                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
-                       )
-       {
-               ffmpeg_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), X_("ffmpeg.exe"), NULL);
-               ffprobe_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), X_("ffprobe.exe"), NULL);
-       }
-       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ | KEY_WOW64_32KEY, &key))
-                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
-                       )
-       {
-               ffmpeg_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), X_("ffmpeg.exe"), NULL);
-               ffprobe_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), X_("ffprobe.exe"), NULL);
-       }
-       if (Glib::file_test(ffmpeg_exe, Glib::FILE_TEST_EXISTS)) {
-               ;
-       }
-       else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "ffmpeg.exe", NULL), Glib::FILE_TEST_EXISTS)) {
-               ffmpeg_exe = g_build_filename(program_files, "harvid", "ffmpeg.exe", NULL);
-       }
-       else if (program_files && Glib::file_test(g_build_filename(program_files, "ffmpeg", "ffmpeg.exe", NULL), Glib::FILE_TEST_EXISTS)) {
-               ffmpeg_exe = g_build_filename(program_files, "harvid", "ffmpeg.exe", NULL);
-       }
-       /* generic fallbacks to try */
-       else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
-               ffmpeg_exe = X_("C:\\Program Files\\harvid\\ffmpeg.exe");
-       }
-       else if (Glib::file_test(X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
-               ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
-       } else {
-               ffmpeg_exe = X_("");
-       }
-#endif
-
-       if (find_file (Searchpath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) {
-               ffprobe_exe = ff_file_path;
-       }
-#ifdef PLATFORM_WINDOWS
-       if (Glib::file_test(ffprobe_exe, Glib::FILE_TEST_EXISTS)) {
-               ;
-       }
-       else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "ffprobe.exe", NULL), Glib::FILE_TEST_EXISTS)) {
-               ffmpeg_exe = g_build_filename(program_files, "harvid", "ffprobe.exe", NULL);
-       }
-       else if (program_files && Glib::file_test(g_build_filename(program_files, "ffmpeg", "ffprobe.exe", NULL), Glib::FILE_TEST_EXISTS)) {
-               ffmpeg_exe = g_build_filename(program_files, "harvid", "ffprobe.exe", NULL);
-       }
-       /* generic fallbacks to try */
-       else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
-               ffprobe_exe = X_("C:\\Program Files\\harvid\\ffprobe.exe");
-       }
-       else if (Glib::file_test(X_("C:\\Program Files\\ffmpeg\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
-               ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe");
-       } else {
-               ffprobe_exe = X_("");
-       }
-#endif
-
-       if (ffmpeg_exe.empty() || ffprobe_exe.empty()) {
+       if (!ArdourVideoToolPaths::transcoder_exe(ffmpeg_exe, ffprobe_exe)) {
                warning << string_compose(
                                _(
                                        "No ffprobe or ffmpeg executables could be found on this system.\n"
index 4b3bf206e4dcc7e980b66c056e1b36bccca996c2..af2ff9efde406e6240f9cc4597350b5e207cb096 100644 (file)
 #include "ardour/template_utils.h"
 #include "ardour/session.h"
 
-#ifdef PLATFORM_WINDOWS
-#include <windows.h>
-#include <shlobj.h> // CSIDL_*
-#include "pbd/windows_special_dirs.h"
-#endif
-
 #ifdef interface
 #undef interface
 #endif
 
 #include "video_server_dialog.h"
 #include "utils_videotl.h"
+#include "video_tool_paths.h"
 #include "i18n.h"
 
 #ifdef PLATFORM_WINDOWS
@@ -93,40 +88,10 @@ VideoServerDialog::VideoServerDialog (Session* s)
        listenaddr_combo.append_text("0.0.0.0");
        listenaddr_combo.set_active(0);
 
-#ifdef PLATFORM_WINDOWS
-       HKEY key;
-       DWORD size = PATH_MAX;
-       char tmp[PATH_MAX+1];
-       const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
-#endif
-
-       std::string icsd_file_path;
-       if (find_file (PBD::Searchpath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) {
-               path_entry.set_text(icsd_file_path);
-       }
-#ifdef PLATFORM_WINDOWS
-       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ, &key))
-                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
-                       )
-       {
-               path_entry.set_text(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "harvid.exe", NULL));
-       }
-       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ | KEY_WOW64_32KEY, &key))
-                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
-                       )
-       {
-               path_entry.set_text(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "harvid.exe", NULL));
-       }
-       else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "harvid.exe", NULL), Glib::FILE_TEST_EXISTS))
-       {
-               path_entry.set_text(g_build_filename(program_files, "harvid", "harvid.exe", NULL));
-       }
-#endif
-       /* generic fallbacks to try */
-       else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) {
-               path_entry.set_text(X_("C:\\Program Files\\harvid\\harvid.exe"));
-       }
-       else {
+       std::string harvid_exe;
+       if (ArdourVideoToolPaths::harvid_exe(harvid_exe)) {
+               path_entry.set_text(harvid_exe);
+       } else {
                PBD::warning <<
                        string_compose(
                                        _("The external video server 'harvid' can not be found.\n"
@@ -139,7 +104,6 @@ VideoServerDialog::VideoServerDialog (Session* s)
                        << endmsg;
        }
 
-
        if (docroot_entry.get_text().empty()) {
          std::string docroot =  Glib::path_get_dirname(_session->session_directory().root_path());
          if ((docroot.empty() || docroot.at(docroot.length()-1) != '/')) { docroot += "/"; }
index f87883377faaf8daabf20366334c55538cd614f7..8093ecdb1f658f3a875d5d82d094fbde42613488 100644 (file)
 #include "pbd/convert.h"
 #include "ardour/session_directory.h"
 
-#ifdef PLATFORM_WINDOWS
-#include <windows.h>
-#include <shlobj.h> // CSIDL_*
-#include "pbd/windows_special_dirs.h"
-#endif
-
 #include "ardour_ui.h"
 #include "public_editor.h"
 #include "gui_thread.h"
 #include "utils_videotl.h"
 #include "rgb_macros.h"
 #include "video_timeline.h"
+#include "video_tool_paths.h"
 
 #include <gtkmm2ext/utils.h>
 #include <pthread.h>
@@ -725,52 +720,7 @@ VideoTimeLine::xjadeo_readversion (std::string d, size_t /* s */) {
 
 void
 VideoTimeLine::find_xjadeo () {
-       std::string xjadeo_file_path;
-#ifdef PLATFORM_WINDOWS
-       HKEY key;
-       DWORD size = PATH_MAX;
-       char tmp[PATH_MAX+1];
-       const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
-#endif
-       if (getenv("XJREMOTE")) {
-               _xjadeo_bin = getenv("XJREMOTE");
-       } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
-               _xjadeo_bin = xjadeo_file_path;
-       } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjadeo"), xjadeo_file_path)) {
-               _xjadeo_bin = xjadeo_file_path;
-       }
-#ifdef __APPLE__
-       else if (Glib::file_test(X_("/Applications/Xjadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
-               _xjadeo_bin = X_("/Applications/Xjadeo.app/Contents/MacOS/xjremote");
-       }
-       else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
-               _xjadeo_bin = X_("/Applications/Jadeo.app/Contents/MacOS/xjremote");
-       }
-#endif
-#ifdef PLATFORM_WINDOWS
-       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\xjadeo", 0, KEY_READ, &key))
-                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
-                       )
-       {
-               _xjadeo_bin = std::string(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "xjadeo.exe", NULL));
-       }
-       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\xjadeo", 0, KEY_READ | KEY_WOW64_32KEY, &key))
-                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
-                       )
-       {
-               _xjadeo_bin = std::string(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "xjadeo.exe", NULL));
-       }
-       else if (program_files && Glib::file_test(g_build_filename(program_files, "xjadeo", "xjadeo.exe", NULL), Glib::FILE_TEST_EXISTS))
-       {
-               _xjadeo_bin = std::string(g_build_filename(program_files, "xjadeo", "xjadeo.exe", NULL));
-       }
-       /* generic fallback to try */
-       else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjadeo.exe"), Glib::FILE_TEST_EXISTS)) {
-               _xjadeo_bin = X_("C:\\Program Files\\xjadeo\\xjadeo.exe");
-       }
-#endif
-       else  {
-               _xjadeo_bin = X_("");
+       if (!ArdourVideoToolPaths::xjadeo_exe(_xjadeo_bin)) {
                warning << _("Video-monitor 'xjadeo' was not found. Please install http://xjadeo.sf.net/ "
                                "(a custom path to xjadeo can be specified by setting the XJREMOTE environment variable. "
                                "It should point to an application compatible with xjadeo's remote-control interface 'xjremote').\n"
@@ -778,6 +728,7 @@ VideoTimeLine::find_xjadeo () {
                                "see also http://manual.ardour.org/video-timeline/setup/")
                        << endmsg;
        }
+
        if (found_xjadeo ()) {
                ARDOUR::SystemExec version_check(_xjadeo_bin, X_("--version"));
                xjadeo_version = "";
diff --git a/gtk2_ardour/video_tool_paths.cc b/gtk2_ardour/video_tool_paths.cc
new file mode 100644 (file)
index 0000000..d14f347
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+    Copyright (C) 2010-2013 Paul Davis
+    Author: Robin Gareus <robin@gareus.org>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+#include <string>
+#include <gtkmm.h>
+
+#ifdef PLATFORM_WINDOWS
+#include <windows.h>
+#include <shlobj.h> // CSIDL_*
+#include "pbd/windows_special_dirs.h"
+#endif
+
+#include "pbd/file_utils.h"
+#include "video_tool_paths.h"
+#include "i18n.h"
+
+using namespace PBD;
+
+bool
+ArdourVideoToolPaths::harvid_exe (std::string &harvid_exe)
+{
+
+#ifdef PLATFORM_WINDOWS
+       HKEY key;
+       DWORD size = PATH_MAX;
+       char tmp[PATH_MAX+1];
+       const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
+#endif
+
+       harvid_exe = "";
+
+       std::string icsd_file_path;
+       if (find_file (PBD::Searchpath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) {
+               harvid_exe = icsd_file_path;
+       }
+#ifdef PLATFORM_WINDOWS
+       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ, &key))
+                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
+                       )
+       {
+               harvid_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "harvid.exe", NULL);
+       }
+       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ | KEY_WOW64_32KEY, &key))
+                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
+                       )
+       {
+               harvid_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "harvid.exe", NULL);
+       }
+       else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "harvid.exe", NULL), Glib::FILE_TEST_EXISTS))
+       {
+               harvid_exe = g_build_filename(program_files, "harvid", "harvid.exe", NULL);
+       }
+#endif
+       /* generic fallbacks to try */
+       else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) {
+               harvid_exe = X_("C:\\Program Files\\harvid\\harvid.exe");
+       }
+       else {
+               return false;
+       }
+       return true;
+}
+
+bool
+ArdourVideoToolPaths::xjadeo_exe (std::string &xjadeo_exe)
+{
+       std::string xjadeo_file_path;
+#ifdef PLATFORM_WINDOWS
+       HKEY key;
+       DWORD size = PATH_MAX;
+       char tmp[PATH_MAX+1];
+       const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
+#endif
+       if (getenv("XJREMOTE")) {
+               xjadeo_exe = getenv("XJREMOTE");
+       } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
+               xjadeo_exe = xjadeo_file_path;
+       } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjadeo"), xjadeo_file_path)) {
+               xjadeo_exe = xjadeo_file_path;
+       }
+#ifdef __APPLE__
+       else if (Glib::file_test(X_("/Applications/Xjadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
+               xjadeo_exe = X_("/Applications/Xjadeo.app/Contents/MacOS/xjremote");
+       }
+       else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
+               xjadeo_exe = X_("/Applications/Jadeo.app/Contents/MacOS/xjremote");
+       }
+#endif
+#ifdef PLATFORM_WINDOWS
+       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\xjadeo", 0, KEY_READ, &key))
+                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
+                       )
+       {
+               xjadeo_exe = std::string(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "xjadeo.exe", NULL));
+       }
+       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\xjadeo", 0, KEY_READ | KEY_WOW64_32KEY, &key))
+                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
+                       )
+       {
+               xjadeo_exe = std::string(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "xjadeo.exe", NULL));
+       }
+       else if (program_files && Glib::file_test(g_build_filename(program_files, "xjadeo", "xjadeo.exe", NULL), Glib::FILE_TEST_EXISTS))
+       {
+               xjadeo_exe = std::string(g_build_filename(program_files, "xjadeo", "xjadeo.exe", NULL));
+       }
+       /* generic fallback to try */
+       else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjadeo.exe"), Glib::FILE_TEST_EXISTS)) {
+               xjadeo_exe = X_("C:\\Program Files\\xjadeo\\xjadeo.exe");
+       }
+#endif
+       else  {
+               xjadeo_exe = X_("");
+               return false;
+       }
+       return true;
+}
+
+bool
+ArdourVideoToolPaths::transcoder_exe (std::string &ffmpeg_exe, std::string &ffprobe_exe)
+{
+#ifdef PLATFORM_WINDOWS
+       HKEY key;
+       DWORD size = PATH_MAX;
+       char tmp[PATH_MAX+1];
+       const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
+#endif
+
+       ffmpeg_exe = X_("");
+       ffprobe_exe = X_("");
+
+       std::string ff_file_path;
+       if (find_file (Searchpath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) {
+               ffmpeg_exe = ff_file_path;
+       }
+#ifdef PLATFORM_WINDOWS
+       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ, &key))
+                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
+                       )
+       {
+               ffmpeg_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), X_("ffmpeg.exe"), NULL);
+               ffprobe_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), X_("ffprobe.exe"), NULL);
+       }
+       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ | KEY_WOW64_32KEY, &key))
+                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
+                       )
+       {
+               ffmpeg_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), X_("ffmpeg.exe"), NULL);
+               ffprobe_exe = g_build_filename(Glib::locale_to_utf8(tmp).c_str(), X_("ffprobe.exe"), NULL);
+       }
+       if (Glib::file_test(ffmpeg_exe, Glib::FILE_TEST_EXISTS)) {
+               ;
+       }
+       else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "ffmpeg.exe", NULL), Glib::FILE_TEST_EXISTS)) {
+               ffmpeg_exe = g_build_filename(program_files, "harvid", "ffmpeg.exe", NULL);
+       }
+       else if (program_files && Glib::file_test(g_build_filename(program_files, "ffmpeg", "ffmpeg.exe", NULL), Glib::FILE_TEST_EXISTS)) {
+               ffmpeg_exe = g_build_filename(program_files, "harvid", "ffmpeg.exe", NULL);
+       }
+       /* generic fallbacks to try */
+       else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
+               ffmpeg_exe = X_("C:\\Program Files\\harvid\\ffmpeg.exe");
+       }
+       else if (Glib::file_test(X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
+               ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
+       } else {
+               ffmpeg_exe = X_("");
+       }
+#endif
+
+       if (find_file (Searchpath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) {
+               ffprobe_exe = ff_file_path;
+       }
+#ifdef PLATFORM_WINDOWS
+       if (Glib::file_test(ffprobe_exe, Glib::FILE_TEST_EXISTS)) {
+               ;
+       }
+       else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "ffprobe.exe", NULL), Glib::FILE_TEST_EXISTS)) {
+               ffmpeg_exe = g_build_filename(program_files, "harvid", "ffprobe.exe", NULL);
+       }
+       else if (program_files && Glib::file_test(g_build_filename(program_files, "ffmpeg", "ffprobe.exe", NULL), Glib::FILE_TEST_EXISTS)) {
+               ffmpeg_exe = g_build_filename(program_files, "harvid", "ffprobe.exe", NULL);
+       }
+       /* generic fallbacks to try */
+       else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
+               ffprobe_exe = X_("C:\\Program Files\\harvid\\ffprobe.exe");
+       }
+       else if (Glib::file_test(X_("C:\\Program Files\\ffmpeg\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
+               ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe");
+       } else {
+               ffprobe_exe = X_("");
+       }
+#endif
+
+       if (ffmpeg_exe.empty() || ffprobe_exe.empty()) {
+               return false;
+       }
+       return true;
+}
diff --git a/gtk2_ardour/video_tool_paths.h b/gtk2_ardour/video_tool_paths.h
new file mode 100644 (file)
index 0000000..60abcc8
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+    Copyright (C) 2010-2013 Paul Davis
+    Author: Robin Gareus <robin@gareus.org>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __gtk_ardour_video_tool_paths_h__
+#define __gtk_ardour_video_tool_paths_h__
+
+namespace ArdourVideoToolPaths {
+
+       bool harvid_exe (std::string &harvid_exe);
+       bool xjadeo_exe (std::string &xjadeo_exe);
+       bool transcoder_exe (std::string &ffmpeg_exe, std::string &ffprobe_exe);
+
+};
+
+#endif /* __gtk_ardour_video_tool_paths_h__ */
index 4cfcde79ef3e55d5b24fe8844ac3325d9f121edd..ef3fff9531325d438078ce4e541e4465630084e7 100644 (file)
@@ -251,7 +251,8 @@ gtk2_ardour_sources = [
         'video_server_dialog.cc',
         'utils_videotl.cc',
         'export_video_dialog.cc',
-        'export_video_infobox.cc'
+        'export_video_infobox.cc',
+        'video_tool_paths.cc'
 ]
 
 def options(opt):