diff options
author | Robin Gareus <robin@gareus.org> | 2018-11-19 03:20:11 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-11-19 03:20:11 +0100 |
commit | a5b38fd6dc9ce9d1fb450da493adbc02b787c5e8 (patch) | |
tree | d9d617f5db4fa61c9801578ceab4381132479569 | |
parent | 4c6ff5f7e7ba8509259021e4ac9176224edd6036 (diff) |
Use libardour video-tool path (2/2)
-rw-r--r-- | gtk2_ardour/rc_option_editor.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/transcode_ffmpeg.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/ui_config_vars.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/video_server_dialog.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/video_timeline.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/video_tool_paths.cc | 218 | ||||
-rw-r--r-- | gtk2_ardour/video_tool_paths.h | 32 | ||||
-rw-r--r-- | gtk2_ardour/wscript | 3 |
8 files changed, 10 insertions, 265 deletions
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 93d7c76fb3..c1a9b87527 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1594,9 +1594,6 @@ class VideoTimelineOptions : public OptionEditorMiniPage _video_server_docroot_entry.signal_activate().connect (sigc::mem_fun(*this, &VideoTimelineOptions::server_docroot_changed)); _custom_xjadeo_path.signal_changed().connect (sigc::mem_fun (*this, &VideoTimelineOptions::custom_xjadeo_path_changed)); _xjadeo_browse_button.signal_clicked ().connect (sigc::mem_fun (*this, &VideoTimelineOptions::xjadeo_browse_clicked)); - - // xjadeo-path is a UIConfig parameter - UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &VideoTimelineOptions::parameter_changed)); } void server_url_changed () @@ -1629,13 +1626,13 @@ class VideoTimelineOptions : public OptionEditorMiniPage void custom_xjadeo_path_changed () { - UIConfiguration::instance().set_xjadeo_binary (_custom_xjadeo_path.get_text()); + _rc_config->set_xjadeo_binary (_custom_xjadeo_path.get_text()); } void xjadeo_browse_clicked () { Gtk::FileChooserDialog dialog(_("Set Video Monitor Executable"), Gtk::FILE_CHOOSER_ACTION_OPEN); - dialog.set_filename (UIConfiguration::instance().get_xjadeo_binary()); + dialog.set_filename (_rc_config->get_xjadeo_binary()); dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); if (dialog.run () == Gtk::RESPONSE_OK) { @@ -1646,7 +1643,7 @@ class VideoTimelineOptions : public OptionEditorMiniPage #endif Glib::file_test (filename, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE) )) { - UIConfiguration::instance().set_xjadeo_binary (filename); + _rc_config->set_xjadeo_binary (filename); } } } @@ -1669,7 +1666,7 @@ class VideoTimelineOptions : public OptionEditorMiniPage _video_server_docroot_entry.set_sensitive(x); _video_server_url_entry.set_sensitive(x); } else if (p == "xjadeo-binary") { - _custom_xjadeo_path.set_text (UIConfiguration::instance().get_xjadeo_binary()); + _custom_xjadeo_path.set_text (_rc_config->get_xjadeo_binary()); } } diff --git a/gtk2_ardour/transcode_ffmpeg.cc b/gtk2_ardour/transcode_ffmpeg.cc index bf8fe5fff9..3b3239c2ef 100644 --- a/gtk2_ardour/transcode_ffmpeg.cc +++ b/gtk2_ardour/transcode_ffmpeg.cc @@ -27,9 +27,10 @@ #include "pbd/file_utils.h" #include "gui_thread.h" +#include "ardour/filesystem_paths.h" + #include "transcode_ffmpeg.h" #include "utils_videotl.h" -#include "video_tool_paths.h" #include "pbd/i18n.h" @@ -50,7 +51,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f) debug_enable = false; #endif - if (!ArdourVideoToolPaths::transcoder_exe(ffmpeg_exe, ffprobe_exe)) { + if (!ARDOUR::ArdourVideoToolPaths::transcoder_exe(ffmpeg_exe, ffprobe_exe)) { warning << string_compose( _( "ffmpeg installation was not found on this system.\n" @@ -598,7 +599,6 @@ TranscodeFfmpeg::ffmpegparse_v (std::string d, size_t /* s */) printf("ffmpeg: '%s'\n", d.c_str()); } #endif - Progress(0, 0); /* EMIT SIGNAL */ return; } ARDOUR::samplecnt_t f = atol(d.substr(6)); diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 1713bbd5e4..ede770b8be 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -92,7 +92,6 @@ UI_CONFIG_VARIABLE (bool, cairo_image_surface, "cairo-image-surface", false) UI_CONFIG_VARIABLE (uint64_t, waveform_cache_size, "waveform-cache-size", 100) /* units of megagbytes */ UI_CONFIG_VARIABLE (int32_t, recent_session_sort, "recent-session-sort", 0) UI_CONFIG_VARIABLE (bool, save_export_analysis_image, "save-export-analysis-image", false) -UI_CONFIG_VARIABLE (std::string, xjadeo_binary, "xjadeo-binary", "") UI_CONFIG_VARIABLE (bool, open_gui_after_adding_plugin, "open-gui-after-adding-plugin", true) UI_CONFIG_VARIABLE (bool, show_inline_display_by_default, "show-inline-display-by-default", true) UI_CONFIG_VARIABLE (bool, prefer_inline_over_gui, "prefer-inline-over-gui", true) diff --git a/gtk2_ardour/video_server_dialog.cc b/gtk2_ardour/video_server_dialog.cc index beefb53696..9422a53971 100644 --- a/gtk2_ardour/video_server_dialog.cc +++ b/gtk2_ardour/video_server_dialog.cc @@ -29,6 +29,7 @@ #include "pbd/error.h" #include "pbd/file_utils.h" +#include "ardour/filesystem_paths.h" #include "ardour/session_directory.h" #include "gtkmm2ext/utils.h" #include "ardour/template_utils.h" @@ -40,7 +41,6 @@ #include "video_server_dialog.h" #include "utils_videotl.h" -#include "video_tool_paths.h" #include "pbd/i18n.h" #ifdef PLATFORM_WINDOWS diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index f16aea8dfa..d8bec5e23b 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -23,6 +23,7 @@ #include "pbd/file_utils.h" #include "pbd/types_convert.h" +#include "ardour/filesystem_paths.h" #include "ardour/session_directory.h" #include "ardour_ui.h" @@ -32,7 +33,6 @@ #include "utils_videotl.h" #include "rgb_macros.h" #include "video_timeline.h" -#include "video_tool_paths.h" #include <gtkmm2ext/utils.h> #include <pthread.h> diff --git a/gtk2_ardour/video_tool_paths.cc b/gtk2_ardour/video_tool_paths.cc deleted file mode 100644 index 012690205a..0000000000 --- a/gtk2_ardour/video_tool_paths.cc +++ /dev/null @@ -1,218 +0,0 @@ -/* - 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 "ui_config.h" -#include "video_tool_paths.h" -#include "pbd/i18n.h" - -using namespace PBD; - -#ifdef PLATFORM_WINDOWS - -static bool -windows_install_dir (const char *regkey, std::string &rv) { - HKEY key; - DWORD size = PATH_MAX; - char tmp[PATH_MAX+1]; - - if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, regkey, 0, KEY_READ, &key)) - && (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size)) - ) - { - rv = Glib::locale_to_utf8(tmp); - return true; - } - - if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, regkey, 0, KEY_READ | KEY_WOW64_32KEY, &key)) - && (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size)) - ) - { - rv = Glib::locale_to_utf8(tmp); - return true; - } - - return false; -} -#endif - -bool -ArdourVideoToolPaths::harvid_exe (std::string &harvid_exe) -{ - -#ifdef PLATFORM_WINDOWS - std::string reg; - std::string program_files = PBD::get_win_special_folder_path (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 ( windows_install_dir("Software\\" PROGRAM_NAME "\\v" PROGRAM_VERSION "\\video", reg)) - { - harvid_exe = g_build_filename(reg.c_str(), "harvid", "harvid.exe", NULL); - } - else if ( windows_install_dir("Software\\RSS\\harvid", reg)) - { - harvid_exe = g_build_filename(reg.c_str(), "harvid.exe", NULL); - } - else if (!program_files.empty() && Glib::file_test(g_build_filename(program_files.c_str(), "harvid", "harvid.exe", NULL), Glib::FILE_TEST_EXISTS)) - { - harvid_exe = g_build_filename(program_files.c_str(), "harvid", "harvid.exe", NULL); - } - 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"); - } -#endif - else - { - return false; - } - return true; -} - -bool -ArdourVideoToolPaths::xjadeo_exe (std::string &xjadeo_exe) -{ - std::string xjadeo_file_path; -#ifdef PLATFORM_WINDOWS - std::string reg; - std::string program_files = PBD::get_win_special_folder_path (CSIDL_PROGRAM_FILES); -#endif - xjadeo_exe = X_(""); - - if (getenv("XJREMOTE")) { - xjadeo_exe = getenv("XJREMOTE"); -#ifdef __APPLE__ - } else if (!UIConfiguration::instance().get_xjadeo_binary().empty() - && Glib::file_test (UIConfiguration::instance().get_xjadeo_binary() + "/Contents/MacOS/xjadeo", Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) { - xjadeo_exe = UIConfiguration::instance().get_xjadeo_binary() + "/Contents/MacOS/xjadeo"; -#endif - } else if (!UIConfiguration::instance().get_xjadeo_binary().empty() - && Glib::file_test (UIConfiguration::instance().get_xjadeo_binary(), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) { - xjadeo_exe = UIConfiguration::instance().get_xjadeo_binary(); - } 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/xjadeo"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) { - xjadeo_exe = X_("/Applications/Xjadeo.app/Contents/MacOS/xjadeo"); - } - else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/Jadeo-bin"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) { - xjadeo_exe = X_("/Applications/Jadeo.app/Contents/MacOS/Jadeo-bin"); - } -#endif -#ifdef PLATFORM_WINDOWS - else if ( windows_install_dir("Software\\" PROGRAM_NAME "\\v" PROGRAM_VERSION "\\video", reg)) - { - xjadeo_exe = std::string(g_build_filename(reg.c_str(), "xjadeo", "xjadeo.exe", NULL)); - } - else if ( windows_install_dir("Software\\RSS\\xjadeo", reg)) - { - xjadeo_exe = std::string(g_build_filename(reg.c_str(), "xjadeo.exe", NULL)); - } - else if (!program_files.empty() && Glib::file_test(g_build_filename(program_files.c_str(), "xjadeo", "xjadeo.exe", NULL), Glib::FILE_TEST_EXISTS)) - { - xjadeo_exe = std::string(g_build_filename(program_files.c_str(), "xjadeo", "xjadeo.exe", NULL)); - } - 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 - - return (!xjadeo_exe.empty() && Glib::file_test(xjadeo_exe, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)); -} - -bool -ArdourVideoToolPaths::transcoder_exe (std::string &ffmpeg_exe, std::string &ffprobe_exe) -{ -#ifdef PLATFORM_WINDOWS - std::string reg; - std::string program_files = PBD::get_win_special_folder_path (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 ( windows_install_dir("Software\\" PROGRAM_NAME "\\v" PROGRAM_VERSION "\\video", reg)) - { - ffmpeg_exe = g_build_filename(reg.c_str(), X_("harvid"), X_("ffmpeg.exe"), NULL); - ffprobe_exe = g_build_filename(reg.c_str(), X_("harvid"), X_("ffprobe.exe"), NULL); - } - else if ( windows_install_dir("Software\\RSS\\harvid", reg)) - { - ffmpeg_exe = g_build_filename(reg.c_str(), X_("ffmpeg.exe"), NULL); - ffprobe_exe = g_build_filename(reg.c_str(), X_("ffprobe.exe"), NULL); - } - - if (Glib::file_test(ffmpeg_exe, Glib::FILE_TEST_EXISTS)) { - ; - } - else if (!program_files.empty() && Glib::file_test(g_build_filename(program_files.c_str(), "harvid", "ffmpeg.exe", NULL), Glib::FILE_TEST_EXISTS)) { - ffmpeg_exe = g_build_filename(program_files.c_str(), "harvid", "ffmpeg.exe", NULL); - } - 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.empty() && Glib::file_test(g_build_filename(program_files.c_str(), "harvid", "ffprobe.exe", NULL), Glib::FILE_TEST_EXISTS)) { - ffprobe_exe = g_build_filename(program_files.c_str(), "harvid", "ffprobe.exe", NULL); - } - 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 deleted file mode 100644 index 60abcc84f1..0000000000 --- a/gtk2_ardour/video_tool_paths.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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__ */ diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 72dca6e5d5..9ef81a268c 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -285,8 +285,7 @@ gtk2_ardour_sources = [ 'video_server_dialog.cc', 'utils_videotl.cc', 'export_video_dialog.cc', - 'export_video_infobox.cc', - 'video_tool_paths.cc' + 'export_video_infobox.cc' ] def enoify (major, minor): |