diff options
author | Robin Gareus <robin@gareus.org> | 2013-06-13 00:55:04 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2013-06-13 00:58:19 +0200 |
commit | 27e2b09f632d7a2cb08fe338248800fd97cb3c06 (patch) | |
tree | f135c7848bf2fd4d44311829bb11594f39a49364 /gtk2_ardour | |
parent | 6b480bb2f7d16288b5fa0d35f827ad32f88a6978 (diff) |
vtl: check if server's docroot matches ardour's config
NOTE: this breaks backwards compatibility with icsd and
harvid < 0.3.0 which do not report their settings.
It may also conflict with harvid running on localhost in a chroot.
Ideally this will be a warning only.
That the user can choose to ignore this and should get the option
to stop the video-server and re-start it using a different docroot.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/video_timeline.cc | 33 | ||||
-rw-r--r-- | gtk2_ardour/video_timeline.h | 1 |
3 files changed, 39 insertions, 0 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index a7034a1677..346fcc3c63 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -3439,6 +3439,11 @@ ARDOUR_UI::start_video_server (Gtk::Window* float_window, bool popup_msg) } if (timeout <= 0) { warning << _("Video-server was started but does not respond to requests...") << endmsg; + } else { + if (!ARDOUR_UI::instance()->video_timeline->check_server_docroot()) { + delete video_server_process; + video_server_process = 0; + } } } return true; diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index 72b0900e16..bf527914ba 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -553,6 +553,39 @@ VideoTimeLine::check_server () return ok; } +bool +VideoTimeLine::check_server_docroot () +{ + bool ok = true; + char url[1024]; + std::vector<std::vector<std::string> > lines; + + if (video_server_url.find("/localhost:") == string::npos) { + return true; + } + snprintf(url, sizeof(url), "%s%src?format=csv" + , video_server_url.c_str() + , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/" + ); + char *res=curl_http_get(url, NULL); + if (!res) { + return false; + } + + ParseCSV(std::string(res), lines); + if ( lines.empty() + || lines.at(0).empty() + || lines.at(0).at(0) != video_get_docroot(Config)) { + warning << string_compose( + _("Video-server docroot mismatch. Ardour: '%1', video-server: '%2'. This usually means that the video server was not started by ardour and uses a different document-root."), + video_get_docroot(Config), lines.at(0).at(0)) + << endmsg; + ok = false; // TODO allow to override + } + free(res); + return ok; +} + void VideoTimeLine::gui_update(std::string const & t) { /* this is to be called via GuiUpdate() only. */ diff --git a/gtk2_ardour/video_timeline.h b/gtk2_ardour/video_timeline.h index 3f7b7742d6..fbf563ecf8 100644 --- a/gtk2_ardour/video_timeline.h +++ b/gtk2_ardour/video_timeline.h @@ -86,6 +86,7 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p bool found_xjadeo () { return ((_xjadeo_bin.empty())?false:true); } bool check_server (); + bool check_server_docroot (); void flush_local_cache (); void vmon_update (); void flush_cache (); |