2 Copyright (C) 2010-2013 Paul Davis
3 Author: Robin Gareus <robin@gareus.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifdef PLATFORM_WINDOWS
25 #include <shlobj.h> // CSIDL_*
26 #include "pbd/windows_special_dirs.h"
29 #include "pbd/file_utils.h"
30 #include "video_tool_paths.h"
35 #ifdef PLATFORM_WINDOWS
38 windows_install_dir (const char *regkey, std::string &rv) {
40 DWORD size = PATH_MAX;
43 if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, regkey, 0, KEY_READ, &key))
44 && (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
47 rv = Glib::locale_to_utf8(tmp);
51 if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, regkey, 0, KEY_READ | KEY_WOW64_32KEY, &key))
52 && (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
55 rv = Glib::locale_to_utf8(tmp);
64 ArdourVideoToolPaths::harvid_exe (std::string &harvid_exe)
67 #ifdef PLATFORM_WINDOWS
69 const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
74 std::string icsd_file_path;
75 if (find_file (PBD::Searchpath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) {
76 harvid_exe = icsd_file_path;
78 #ifdef PLATFORM_WINDOWS
79 else if ( windows_install_dir("Software\\RSS\\harvid", reg))
81 harvid_exe = g_build_filename(reg.c_str(), "harvid.exe", NULL);
83 else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "harvid.exe", NULL), Glib::FILE_TEST_EXISTS))
85 harvid_exe = g_build_filename(program_files, "harvid", "harvid.exe", NULL);
87 else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) {
88 harvid_exe = X_("C:\\Program Files\\harvid\\harvid.exe");
99 ArdourVideoToolPaths::xjadeo_exe (std::string &xjadeo_exe)
101 std::string xjadeo_file_path;
102 #ifdef PLATFORM_WINDOWS
104 const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
106 if (getenv("XJREMOTE")) {
107 xjadeo_exe = getenv("XJREMOTE");
108 } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
109 xjadeo_exe = xjadeo_file_path;
110 } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjadeo"), xjadeo_file_path)) {
111 xjadeo_exe = xjadeo_file_path;
114 else if (Glib::file_test(X_("/Applications/Xjadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
115 xjadeo_exe = X_("/Applications/Xjadeo.app/Contents/MacOS/xjremote");
117 else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
118 xjadeo_exe = X_("/Applications/Jadeo.app/Contents/MacOS/xjremote");
121 #ifdef PLATFORM_WINDOWS
122 else if ( windows_install_dir("Software\\RSS\\xjadeo", reg))
124 xjadeo_exe = std::string(g_build_filename(reg.c_str(), "xjadeo.exe", NULL));
126 else if (program_files && Glib::file_test(g_build_filename(program_files, "xjadeo", "xjadeo.exe", NULL), Glib::FILE_TEST_EXISTS))
128 xjadeo_exe = std::string(g_build_filename(program_files, "xjadeo", "xjadeo.exe", NULL));
130 else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjadeo.exe"), Glib::FILE_TEST_EXISTS)) {
131 xjadeo_exe = X_("C:\\Program Files\\xjadeo\\xjadeo.exe");
142 ArdourVideoToolPaths::transcoder_exe (std::string &ffmpeg_exe, std::string &ffprobe_exe)
144 #ifdef PLATFORM_WINDOWS
146 const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
150 ffprobe_exe = X_("");
152 std::string ff_file_path;
153 if (find_file (Searchpath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) {
154 ffmpeg_exe = ff_file_path;
156 #ifdef PLATFORM_WINDOWS
157 else if ( windows_install_dir("Software\\RSS\\harvid", reg))
159 ffmpeg_exe = g_build_filename(reg.c_str(), X_("ffmpeg.exe"), NULL);
160 ffprobe_exe = g_build_filename(reg.c_str(), X_("ffprobe.exe"), NULL);
163 if (Glib::file_test(ffmpeg_exe, Glib::FILE_TEST_EXISTS)) {
166 else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "ffmpeg.exe", NULL), Glib::FILE_TEST_EXISTS)) {
167 ffmpeg_exe = g_build_filename(program_files, "harvid", "ffmpeg.exe", NULL);
169 else if (Glib::file_test(X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
170 ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
176 if (find_file (Searchpath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) {
177 ffprobe_exe = ff_file_path;
179 #ifdef PLATFORM_WINDOWS
180 if (Glib::file_test(ffprobe_exe, Glib::FILE_TEST_EXISTS)) {
183 else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "ffprobe.exe", NULL), Glib::FILE_TEST_EXISTS)) {
184 ffprobe_exe = g_build_filename(program_files, "harvid", "ffprobe.exe", NULL);
186 else if (Glib::file_test(X_("C:\\Program Files\\ffmpeg\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
187 ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe");
189 ffprobe_exe = X_("");
193 if (ffmpeg_exe.empty() || ffprobe_exe.empty()) {