13
0

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.
This commit is contained in:
Robin Gareus 2013-06-13 00:55:04 +02:00
parent 6b480bb2f7
commit 27e2b09f63
3 changed files with 39 additions and 0 deletions

View File

@ -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;

View File

@ -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. */

View File

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