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/video_timeline.cc | |
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/video_timeline.cc')
-rw-r--r-- | gtk2_ardour/video_timeline.cc | 33 |
1 files changed, 33 insertions, 0 deletions
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. */ |