21 #include <sigc++/bind.h>
38 #include <curl/curl.h>
51 , bar_height(initial_height)
142 SessionHandlePtr::set_session (s);
150 if (!node || !node->
property (
X_(
"Filename"))) {
317 double display_vframe_width;
324 unsigned int visible_video_frames;
339 if (apv > samples_per_pixel * display_vframe_width) {
341 vtl_dist = rint(apv);
344 vtl_dist = ceil(display_vframe_width * samples_per_pixel / apv) * apv;
347 assert (vtl_dist > 0);
356 vtl_start -= visible_video_frames * vtl_dist;
357 visible_video_frames *=3;
360 visible_video_frames += ceil((
double)vtl_start/vtl_dist);
366 visible_video_frames = 0;
370 --visible_video_frames;
386 std::list<int> remaining;
396 if (vtl_dist/apv < 3.0) cut =0;
401 for (
unsigned int vfcount=0; vfcount < visible_video_frames; ++vfcount){
402 framepos_t vfpos = vtl_start + vfcount * vtl_dist;
414 outdated_video_frames.remove(frame);
416 remaining.push_back(vfcount);
420 for (VideoFrames::iterator i = outdated_video_frames.begin(); i != outdated_video_frames.end(); ++i ) {
422 if (remaining.empty()) {
425 int vfcount=remaining.front();
426 remaining.pop_front();
427 framepos_t vfpos = vtl_start + vfcount * vtl_dist;
455 if (Glib::path_is_absolute(filename) || !
local_file)
462 long long int _duration;
463 double _start_offset;
468 warning <<
_(
"Parsing video file info failed. Is the Video Server running? Is the file readable by the Video Server? Does the docroot match? Is it a video file?") <<
endmsg;
506 _(
"Failed to set session-framerate: '%1' does not have a corresponding option setting in %2."),
514 _(
"Video file's framerate is not equal to %1 session timecode's framerate: '%2' vs '%3'"),
537 printf(
"the given video file can not be accessed on localhost, video monitoring is not currently supported for this case\n");
551 snprintf(url,
sizeof(url),
"%s%sstatus"
557 if (strstr(res,
"status: ok, online.")) { ok =
true; }
568 std::vector<std::vector<std::string> > lines;
573 snprintf(url,
sizeof(url),
"%s%src?format=csv"
584 || lines.at(0).empty()
587 _(
"Video-server docroot mismatch. %1: '%2', video-server: '%3'. This usually means that the video server was not started by %1 and uses a different document-root."),
600 if (t ==
"videotimeline-update") {
602 }
else if (t ==
"set-xjadeo-active-off") {
604 }
else if (t ==
"set-xjadeo-active-on") {
606 }
else if (t ==
"set-xjadeo-sensitive-on") {
608 }
else if (t ==
"set-xjadeo-sensitive-off") {
612 }
else if (t ==
"xjadeo-window-ontop-on") {
614 }
else if (t ==
"xjadeo-window-ontop-off") {
616 }
else if (t ==
"xjadeo-window-osd-timecode-on") {
618 }
else if (t ==
"xjadeo-window-osd-timecode-off") {
620 }
else if (t ==
"xjadeo-window-osd-frame-on") {
622 }
else if (t ==
"xjadeo-window-osd-frame-off") {
624 }
else if (t ==
"xjadeo-window-osd-box-on") {
626 }
else if (t ==
"xjadeo-window-osd-box-off") {
628 }
else if (t ==
"xjadeo-window-fullscreen-on") {
630 }
else if (t ==
"xjadeo-window-fullscreen-off") {
632 }
else if (t ==
"xjadeo-window-letterbox-on") {
634 }
else if (t ==
"xjadeo-window-letterbox-off") {
636 }
else if (t ==
"video-available") {
638 }
else if (t ==
"video-unavailable") {
669 snprintf(url,
sizeof(url),
"%s%sadmin/flush_cache"
688 if (p ==
"video-server-url") {
690 }
else if (p ==
"video-server-docroot") {
692 }
else if (p ==
"video-advanced-setup") {
696 if (p ==
"use-video-file-fps" || p ==
"videotimeline-pullup" ) {
724 warning <<
_(
"Video-monitor 'xjadeo' was not found. Please install http://xjadeo.sf.net/ "
725 "(a custom path to xjadeo can be specified by setting the XJREMOTE environment variable. "
726 "It should point to an application compatible with xjadeo's remote-control interface 'xjremote').\n"
728 "see also http://manual.ardour.org/video-timeline/setup/")
737 if (version_check.
start(2)) {
739 "Video-monitor 'xjadeo' cannot be launched."
745 version_check.
wait ();
753 if (vo != string::npos) {
754 int v_major, v_minor, v_micro;
755 if(sscanf(
xjadeo_version.substr(vo + 9, string::npos).c_str(),
"%d.%d.%d",
756 &v_major, &v_minor, &v_micro) == 3)
758 if (v_major >= 1) v_ok =
true;
759 else if (v_major == 0 && v_minor >= 8) v_ok =
true;
760 else if (v_major == 0 && v_minor >= 7 && v_micro >= 7) v_ok =
true;
766 "Video-monitor 'xjadeo' is too old. "
767 "Please install xjadeo version 0.7.7 or later. http://xjadeo.sf.net/"
void manual_seek(ARDOUR::framepos_t, bool, ARDOUR::frameoffset_t)
std::string video_get_docroot(ARDOUR::RCConfiguration *config)
double timecode_frames_per_second() const
framecnt_t nominal_frame_rate() const
std::string video_server_url
int atoi(const string &s)
bool video_query_info(std::string video_server_url, std::string filepath, double &video_file_fps, long long int &video_duration, double &video_start_offset, double &video_aspect_ratio)
void gui_update(const std::string &)
const std::string & value() const
void close_video_monitor()
int64_t atoll(const string &s)
char * a3_curl_http_get(const char *u, int *status)
void control_video_monitor(int, int)
PBD::Signal0< void > Terminated
void open_video_monitor()
void set_videoframe(framepos_t, int rightend=-1)
void parameter_changed(std::string const &p)
const std::string video_path() const
static ARDOUR_UI * instance()
void send_cmd(int what, int param)
bool start_video_server(Gtk::Window *float_window, bool popup_msg)
Representation of the interface of the Editor class.
void ParseCSV(const std::string &csv, std::vector< std::vector< std::string > > &lines)
ARDOUR::frameoffset_t video_start_offset
void xjadeo_readversion(std::string d, size_t s)
LIBPBD_API Transmitter warning
void set_offset(ARDOUR::frameoffset_t)
std::ostream & endmsg(std::ostream &ostr)
SessionConfiguration config
void restore_settings_mask(int i)
virtual void set_close_video_sensitive(bool)=0
a single video-frame to be displayed in the video timeline
std::string server_docroot
framecnt_t frame_rate() const
void flush_videotimeline_cache(bool localcacheonly=false)
#define ENSURE_GUI_THREAD(obj, method,...)
PBD::Signal1< void, std::string > UiState
void query_full_state(bool)
std::string video_map_path(std::string server_docroot, std::string filepath)
virtual void set_xjadeo_sensitive(bool onoff)=0
virtual void queue_visual_videotimeline_update()=0
PBD::Signal0< void > VtlUpdate
communication with xjadeo's remote-control interface
bool video_file_info(std::string, bool)
std::string translated_filename()
std::list< VideoImageFrame * > VideoFrames
std::string xjadeo_version
void terminated_video_monitor()
std::string video_filename
virtual void set_video_timeline_height(const int h)=0
void sync_session_state()
bool synced_by_manual_seeks()
XMLProperty * property(const char *)
LIBARDOUR_API RCConfiguration * Config
void set_video_server_url(std::string)
PBD::Signal1< void, std::string > GuiUpdate
virtual framecnt_t get_current_zoom() const =0
framepos_t get_video_frame_number()
void set_session(ARDOUR::Session *s)
VideoTimeLine(PublicEditor *, ArdourCanvas::Container *, int)
bool set_id(const XMLNode &)
PBD::Signal0< void > ImgChanged
void set_session(ARDOUR::Session *s)
common functions used for video-file im/export
void update_video_timeline()
VideoImageFrame * get_video_frame(framepos_t vfn, int cut=0, int rightend=-1)
virtual framecnt_t current_page_samples() const =0
std::string video_get_server_url(ARDOUR::RCConfiguration *config)
PBD::Signal1< void, std::string > ParameterChanged
virtual void toggle_xjadeo_proc(int)=0
XMLProperty * add_property(const char *name, const std::string &value)
ArdourCanvas::Container * videotl_group
int start(int stderr_mode=1)
PBD::Signal0< void > SessionSaveUnderway
void toggle_offset_locked()
bool auto_set_session_fps
PBD::ScopedConnection sessionsave
virtual void toggle_xjadeo_viewoption(int, int)=0
int set_state(const XMLNode &, int version)
XMLNode * extra_xml(const std::string &str, bool add_if_missing=false)
ARDOUR::frameoffset_t video_offset_p
PBD::Signal2< void, std::string, size_t > ReadStdout
virtual int get_videotl_bar_height() const =0
void set_video_server_docroot(std::string)
virtual framepos_t leftmost_sample() const =0
void set_position(framepos_t)
const SessionDirectory & session_directory() const
framepos_t video_duration
sigc::signal< void > Terminated
void add_extra_xml(XMLNode &)
void register_with_memento_command_factory(PBD::ID, PBD::StatefulDestructible *)
ARDOUR::frameoffset_t video_offset
void set_offset_locked(bool v)
double video_aspect_ratio
void manual_seek_video_monitor(framepos_t pos)
ARDOUR::Session * _session
std::string string_compose(const std::string &fmt, const T1 &o1)
bool check_server_docroot()