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 std::string program_files = PBD::get_win_special_folder_path (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\\" PROGRAM_NAME "\\v" PROGRAM_VERSION "\\video", reg))
81 harvid_exe = g_build_filename(reg.c_str(), "harvid", "harvid.exe", NULL);
83 else if ( windows_install_dir("Software\\RSS\\harvid", reg))
85 harvid_exe = g_build_filename(reg.c_str(), "harvid.exe", NULL);
87 else if (!program_files.empty() && Glib::file_test(g_build_filename(program_files.c_str(), "harvid", "harvid.exe", NULL), Glib::FILE_TEST_EXISTS))
89 harvid_exe = g_build_filename(program_files.c_str(), "harvid", "harvid.exe", NULL);
91 else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) {
92 harvid_exe = X_("C:\\Program Files\\harvid\\harvid.exe");
103 ArdourVideoToolPaths::xjadeo_exe (std::string &xjadeo_exe)
105 std::string xjadeo_file_path;
106 #ifdef PLATFORM_WINDOWS
108 std::string program_files = PBD::get_win_special_folder_path (CSIDL_PROGRAM_FILES);
110 if (getenv("XJREMOTE")) {
111 xjadeo_exe = getenv("XJREMOTE");
112 } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
113 xjadeo_exe = xjadeo_file_path;
114 } else if (find_file (Searchpath(Glib::getenv("PATH")), X_("xjadeo"), xjadeo_file_path)) {
115 xjadeo_exe = xjadeo_file_path;
118 else if (Glib::file_test(X_("/Applications/Xjadeo.app/Contents/MacOS/xjadeo"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
119 xjadeo_exe = X_("/Applications/Xjadeo.app/Contents/MacOS/xjadeo");
121 else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/Jadeo-bin"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
122 xjadeo_exe = X_("/Applications/Jadeo.app/Contents/MacOS/Jadeo-bin");
125 #ifdef PLATFORM_WINDOWS
126 else if ( windows_install_dir("Software\\" PROGRAM_NAME "\\v" PROGRAM_VERSION "\\video", reg))
128 xjadeo_exe = std::string(g_build_filename(reg.c_str(), "xjadeo", "xjadeo.exe", NULL));
130 else if ( windows_install_dir("Software\\RSS\\xjadeo", reg))
132 xjadeo_exe = std::string(g_build_filename(reg.c_str(), "xjadeo.exe", NULL));
134 else if (!program_files.empty() && Glib::file_test(g_build_filename(program_files.c_str(), "xjadeo", "xjadeo.exe", NULL), Glib::FILE_TEST_EXISTS))
136 xjadeo_exe = std::string(g_build_filename(program_files.c_str(), "xjadeo", "xjadeo.exe", NULL));
138 else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjadeo.exe"), Glib::FILE_TEST_EXISTS)) {
139 xjadeo_exe = X_("C:\\Program Files\\xjadeo\\xjadeo.exe");
150 ArdourVideoToolPaths::transcoder_exe (std::string &ffmpeg_exe, std::string &ffprobe_exe)
152 #ifdef PLATFORM_WINDOWS
154 std::string program_files = PBD::get_win_special_folder_path (CSIDL_PROGRAM_FILES);
158 ffprobe_exe = X_("");
160 std::string ff_file_path;
161 if (find_file (Searchpath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) {
162 ffmpeg_exe = ff_file_path;
164 #ifdef PLATFORM_WINDOWS
165 else if ( windows_install_dir("Software\\" PROGRAM_NAME "\\v" PROGRAM_VERSION "\\video", reg))
167 ffmpeg_exe = g_build_filename(reg.c_str(), X_("harvid"), X_("ffmpeg.exe"), NULL);
168 ffprobe_exe = g_build_filename(reg.c_str(), X_("harvid"), X_("ffprobe.exe"), NULL);
170 else if ( windows_install_dir("Software\\RSS\\harvid", reg))
172 ffmpeg_exe = g_build_filename(reg.c_str(), X_("ffmpeg.exe"), NULL);
173 ffprobe_exe = g_build_filename(reg.c_str(), X_("ffprobe.exe"), NULL);
176 if (Glib::file_test(ffmpeg_exe, Glib::FILE_TEST_EXISTS)) {
179 else if (!program_files.empty() && Glib::file_test(g_build_filename(program_files.c_str(), "harvid", "ffmpeg.exe", NULL), Glib::FILE_TEST_EXISTS)) {
180 ffmpeg_exe = g_build_filename(program_files.c_str(), "harvid", "ffmpeg.exe", NULL);
182 else if (Glib::file_test(X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
183 ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
189 if (find_file (Searchpath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) {
190 ffprobe_exe = ff_file_path;
192 #ifdef PLATFORM_WINDOWS
193 if (Glib::file_test(ffprobe_exe, Glib::FILE_TEST_EXISTS)) {
196 else if (!program_files.empty() && Glib::file_test(g_build_filename(program_files.c_str(), "harvid", "ffprobe.exe", NULL), Glib::FILE_TEST_EXISTS)) {
197 ffprobe_exe = g_build_filename(program_files.c_str(), "harvid", "ffprobe.exe", NULL);
199 else if (Glib::file_test(X_("C:\\Program Files\\ffmpeg\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
200 ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe");
202 ffprobe_exe = X_("");
206 if (ffmpeg_exe.empty() || ffprobe_exe.empty()) {