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 > 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 ();