2 Copyright (C) 2010 Paul Davis
3 Author: Robin Gareus <robin@gareus.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <sigc++/bind.h>
22 #include "ardour/tempo.h"
24 #include "pbd/file_utils.h"
25 #include "pbd/convert.h"
26 #include "ardour/session_directory.h"
28 #include "ardour_ui.h"
29 #include "public_editor.h"
30 #include "gui_thread.h"
31 #include "utils_videotl.h"
32 #include "rgb_macros.h"
33 #include "video_timeline.h"
34 #include "video_tool_paths.h"
36 #include <gtkmm2ext/utils.h>
38 #include <curl/curl.h>
43 using namespace ARDOUR;
45 using namespace Timecode;
46 using namespace VideoUtils;
48 VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Container *vbg, int initial_height)
51 , bar_height(initial_height)
53 video_start_offset = 0L;
57 auto_set_session_fps = false;
58 video_offset_lock = false;
59 video_aspect_ratio = 4.0/3.0;
60 Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoTimeLine::parameter_changed, this, _1), gui_context());
61 video_server_url = video_get_server_url(Config);
62 server_docroot = video_get_docroot(Config);
65 video_file_fps = 25.0;
68 reopen_vmonitor=false;
71 VtlUpdate.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
72 GuiUpdate.connect (*this, invalidator (*this), boost::bind (&VideoTimeLine::gui_update, this, _1), gui_context());
75 VideoTimeLine::~VideoTimeLine ()
80 /* close and save settings */
82 VideoTimeLine::save_session ()
88 LocaleGuard lg (X_("C"));
90 XMLNode* node = new XMLNode(X_("Videomonitor"));
92 node->add_property (X_("active"), (vmonitor && vmonitor->is_started())?"yes":"no");
93 _session->add_extra_xml (*node);
96 if (vmonitor->is_started()) {
97 vmonitor->query_full_state(true);
99 vmonitor->save_session();
103 node = _session->extra_xml (X_("Videotimeline"));
105 node->add_property (X_("id"), id().to_s());
106 node->add_property (X_("Height"), editor->get_videotl_bar_height());
107 node->add_property (X_("VideoOffsetLock"), video_offset_lock?X_("1"):X_("0"));
108 node->add_property (X_("VideoOffset"), video_offset);
109 node->add_property (X_("AutoFPS"), auto_set_session_fps?X_("1"):X_("0"));
112 /* close and save settings */
114 VideoTimeLine::close_session ()
116 if (video_duration == 0) {
119 sessionsave.disconnect();
120 close_video_monitor();
125 GuiUpdate("set-xjadeo-sensitive-off");
126 GuiUpdate("video-unavailable");
130 VideoTimeLine::sync_session_state ()
132 if (!_session || !vmonitor || !vmonitor->is_started()) {
138 /** load settings from session */
140 VideoTimeLine::set_session (ARDOUR::Session *s)
142 SessionHandlePtr::set_session (s);
143 if (!_session) { return ; }
145 _session->SessionSaveUnderway.connect_same_thread (sessionsave, boost::bind (&VideoTimeLine::save_session, this));
146 LocaleGuard lg (X_("C"));
148 XMLNode* node = _session->extra_xml (X_("Videotimeline"));
150 if (!node || !node->property (X_("Filename"))) {
154 ARDOUR_UI::instance()->start_video_server((Gtk::Window*)0, false);
158 const XMLProperty* proph = node->property (X_("Height"));
160 editor->set_video_timeline_height(atoi(proph->value()));
162 #if 0 /* TODO THINK: set FPS first time only ?! */
163 const XMLProperty* propasfps = node->property (X_("AutoFPS"));
165 auto_set_session_fps = atoi(propasfps->value())?true:false;
169 const XMLProperty* propoffset = node->property (X_("VideoOffset"));
171 video_offset = atoll(propoffset->value());
172 video_offset_p = video_offset;
175 const XMLProperty* proplock = node->property (X_("VideoOffsetLock"));
177 video_offset_lock = atoi(proplock->value())?true:false;
180 const XMLProperty* localfile = node->property (X_("LocalFile"));
182 local_file = atoi(localfile->value())?true:false;
185 const XMLProperty* propf = node->property (X_("Filename"));
186 video_file_info(propf->value(), local_file);
188 if ((node = _session->extra_xml (X_("Videomonitor")))) {
189 const XMLProperty* prop = node->property (X_("active"));
190 if (prop && prop->value() == "yes" && found_xjadeo() && !video_filename.empty() && local_file) {
191 open_video_monitor();
195 _session->register_with_memento_command_factory(id(), this);
196 _session->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoTimeLine::parameter_changed, this, _1), gui_context());
200 VideoTimeLine::set_offset_locked (bool v) {
201 if (_session && v != video_offset_lock) {
202 _session->set_dirty ();
204 video_offset_lock = v;
208 VideoTimeLine::toggle_offset_locked () {
209 video_offset_lock = !video_offset_lock;
211 _session->set_dirty ();
216 VideoTimeLine::save_undo ()
218 if (_session && video_offset_p != video_offset) {
219 _session->set_dirty ();
221 video_offset_p = video_offset;
225 VideoTimeLine::set_state (const XMLNode& node, int /*version*/)
227 LocaleGuard lg (X_("C"));
228 const XMLProperty* propoffset = node.property (X_("VideoOffset"));
230 video_offset = atoll(propoffset->value());
232 ARDOUR_UI::instance()->flush_videotimeline_cache(true);
237 VideoTimeLine::get_state ()
239 XMLNode* node = new XMLNode (X_("Videotimeline"));
240 LocaleGuard lg (X_("C"));
241 node->add_property (X_("VideoOffset"), video_offset_p);
246 VideoTimeLine::remove_frames ()
248 for (VideoFrames::iterator i = video_frames.begin(); i != video_frames.end(); ++i ) {
249 VideoImageFrame *frame = (*i);
253 video_frames.clear();
257 VideoTimeLine::get_video_frame (framepos_t vfn, int cut, int rightend)
260 for (VideoFrames::iterator i = video_frames.begin(); i != video_frames.end(); ++i) {
261 VideoImageFrame *frame = (*i);
262 if (abs(frame->get_video_frame_number()-vfn)<=cut
263 && frame->get_rightend() == rightend) { return frame; }
269 VideoTimeLine::get_apv()
271 // XXX: dup code - TODO use this fn in update_video_timeline()
272 float apv = -1; /* audio samples per video frame; */
273 if (!_session) return apv;
275 if (_session->config.get_use_video_file_fps()) {
276 if (video_file_fps == 0 ) return apv;
278 if (_session->timecode_frames_per_second() == 0 ) return apv;
281 if (_session->config.get_videotimeline_pullup()) {
282 apv = _session->frame_rate();
284 apv = _session->nominal_frame_rate();
286 if (_session->config.get_use_video_file_fps()) {
287 apv /= video_file_fps;
289 apv /= _session->timecode_frames_per_second();
295 VideoTimeLine::update_video_timeline()
297 if (!_session) return;
299 if (_session->config.get_use_video_file_fps()) {
300 if (video_file_fps == 0 ) return;
302 if (_session->timecode_frames_per_second() == 0 ) return;
305 const double samples_per_pixel = editor->get_current_zoom();
306 const framepos_t leftmost_sample = editor->leftmost_sample();
309 * 1) calculate how many frames there should be in current zoom (plus 1 page on each side)
310 * 2) calculate first frame and distance between video-frames (according to zoom)
311 * 3) destroy/add frames
312 * 4) reposition existing frames
313 * 5) assign framenumber to frames -> request/decode video.
316 /* video-file and session properties */
317 double display_vframe_width; /* unit: pixels ; width of one thumbnail in the timeline */
318 float apv; /* audio samples per video frame; */
319 framepos_t leftmost_video_frame; /* unit: video-frame number ; temporary var -> vtl_start */
321 /* variables needed to render videotimeline -- what needs to computed first */
322 framepos_t vtl_start; /* unit: audio-samples ; first displayed video-frame */
323 framepos_t vtl_dist; /* unit: audio-samples ; distance between displayed video-frames */
324 unsigned int visible_video_frames; /* number of frames that fit on current canvas */
326 if (_session->config.get_videotimeline_pullup()) {
327 apv = _session->frame_rate();
329 apv = _session->nominal_frame_rate();
331 if (_session->config.get_use_video_file_fps()) {
332 apv /= video_file_fps;
334 apv /= _session->timecode_frames_per_second();
337 display_vframe_width = bar_height * video_aspect_ratio;
339 if (apv > samples_per_pixel * display_vframe_width) {
340 /* high-zoom: need space between successive video-frames */
341 vtl_dist = rint(apv);
343 /* continous timeline: skip video-frames */
344 vtl_dist = ceil(display_vframe_width * samples_per_pixel / apv) * apv;
347 assert (vtl_dist > 0);
350 leftmost_video_frame = floor (floor((long double)(leftmost_sample - video_start_offset - video_offset ) / vtl_dist) * vtl_dist / apv);
352 vtl_start = rint (video_offset + video_start_offset + leftmost_video_frame * apv);
353 visible_video_frames = 2 + ceil((double)editor->current_page_samples() / vtl_dist); /* +2 left+right partial frames */
355 /* expand timeline (cache next/prev page images) */
356 vtl_start -= visible_video_frames * vtl_dist;
357 visible_video_frames *=3;
359 /* don't request frames that are too far to the right */
360 if (vtl_start < video_offset) {
361 visible_video_frames = std::max((double)0.0, (double)visible_video_frames + ceil((double)(vtl_start - video_offset)/vtl_dist));
362 vtl_start = video_offset;
365 /* apply video-file constraints
366 * (first frame in video is at video_start_offset) */
367 if (vtl_start > video_start_offset + video_duration + video_offset ) {
368 visible_video_frames = 0;
371 * end = position on timeline (video-offset) minus video-file's first frame position
372 * TODO optimize: compute rather than iterate */
373 while (visible_video_frames > 0 && vtl_start + (visible_video_frames-1) * vtl_dist >= video_start_offset + video_duration + video_offset) {
374 --visible_video_frames;
382 while (video_frames.size() < visible_video_frames) {
383 VideoImageFrame *frame;
384 frame = new VideoImageFrame(*editor, *videotl_group, display_vframe_width, bar_height, video_server_url, translated_filename());
385 frame->ImgChanged.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
386 video_frames.push_back(frame);
389 VideoFrames outdated_video_frames;
390 std::list<int> remaining;
392 outdated_video_frames = video_frames;
395 /* when zoomed out, ignore shifts by +-1 frame
396 * which can occur due to rounding errors when
397 * scrolling to a new leftmost-audio frame.
400 if (vtl_dist/apv < 3.0) cut =0;
405 for (unsigned int vfcount=0; vfcount < visible_video_frames; ++vfcount){
406 framepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-frames */
407 framepos_t vframeno = rint ( (vfpos - video_offset) / apv); /* unit: video-frames */
408 vfpos = (vframeno * apv ) + video_offset; /* audio-frame corresponding to /rounded/ video-frame */
410 int rightend = -1; /* unit: pixels */
411 if (vfpos + vtl_dist > video_start_offset + video_duration + video_offset) {
412 rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
413 //printf("lf(e): %lu\n", vframeno); // XXX
415 VideoImageFrame * frame = get_video_frame(vframeno, cut, rightend);
417 frame->set_position(vfpos);
418 outdated_video_frames.remove(frame);
420 remaining.push_back(vfcount);
424 for (VideoFrames::iterator i = outdated_video_frames.begin(); i != outdated_video_frames.end(); ++i ) {
425 VideoImageFrame *frame = (*i);
426 if (remaining.empty()) {
427 frame->set_position(-2 * vtl_dist + leftmost_sample); /* move off screen */
429 int vfcount=remaining.front();
430 remaining.pop_front();
431 framepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-frames */
432 framepos_t vframeno = rint ((vfpos - video_offset) / apv); /* unit: video-frames */
433 int rightend = -1; /* unit: pixels */
434 if (vfpos + vtl_dist > video_start_offset + video_duration + video_offset) {
435 rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
436 //printf("lf(n): %lu\n", vframeno); // XXX
438 frame->set_position(vfpos);
439 frame->set_videoframe(vframeno, rightend);
445 VideoTimeLine::translated_filename ()
448 return video_filename;
450 return video_map_path(server_docroot, video_filename);
455 VideoTimeLine::video_file_info (std::string filename, bool local)
459 if (Glib::path_is_absolute(filename) || !local_file)
461 video_filename = filename;
463 video_filename = Glib::build_filename (_session->session_directory().video_path(), filename);
466 long long int _duration;
467 double _start_offset;
469 if (!video_query_info(
470 video_server_url, translated_filename(),
471 video_file_fps, _duration, _start_offset, video_aspect_ratio)) {
472 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;
474 GuiUpdate("set-xjadeo-sensitive-off");
475 GuiUpdate("video-unavailable");
478 video_duration = _duration * _session->nominal_frame_rate() / video_file_fps;
479 video_start_offset = _start_offset * _session->nominal_frame_rate();
481 if (auto_set_session_fps && video_file_fps != _session->timecode_frames_per_second()) {
482 switch ((int)floorf(video_file_fps*1000.0)) {
484 _session->config.set_timecode_format(timecode_23976);
487 _session->config.set_timecode_format(timecode_24);
491 _session->config.set_timecode_format(timecode_24976);
494 _session->config.set_timecode_format(timecode_25);
497 _session->config.set_timecode_format(timecode_2997drop);
500 _session->config.set_timecode_format(timecode_30);
503 _session->config.set_timecode_format(timecode_5994);
506 _session->config.set_timecode_format(timecode_60);
509 warning << string_compose (
510 _("Failed to set session-framerate: '%1' does not have a corresponding option setting in %2."),
511 video_file_fps, PROGRAM_NAME ) << endmsg;
514 _session->config.set_video_pullup(0); /* TODO only set if set_timecode_format() was successful ?!*/
516 if (floor(video_file_fps*100) != floor(_session->timecode_frames_per_second()*100)) {
517 warning << string_compose(
518 _("Video file's framerate is not equal to %1 session timecode's framerate: '%2' vs '%3'"),
519 PROGRAM_NAME, video_file_fps, _session->timecode_frames_per_second())
522 flush_local_cache ();
524 if (found_xjadeo() && local_file) {
525 GuiUpdate("set-xjadeo-sensitive-on");
526 if (vmonitor && vmonitor->is_started()) {
528 /* xjadeo <= 0.6.4 has a bug where changing the video-file may segfauls
529 * if the geometry changes to a different line-size alignment
531 reopen_vmonitor = true;
534 vmonitor->set_fps(video_file_fps);
535 vmonitor->open(video_filename);
538 } else if (!local_file) {
539 #if 1 /* temp debug/devel message */
540 // TODO - call xjremote remotely.
541 printf("the given video file can not be accessed on localhost, video monitoring is not currently supported for this case\n");
542 GuiUpdate("set-xjadeo-sensitive-off");
546 GuiUpdate("video-available");
551 VideoTimeLine::check_server ()
555 snprintf(url, sizeof(url), "%s%sstatus"
556 , video_server_url.c_str()
557 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
559 char *res=a3_curl_http_get(url, NULL);
561 if (strstr(res, "status: ok, online.")) { ok = true; }
568 VideoTimeLine::check_server_docroot ()
572 std::vector<std::vector<std::string> > lines;
574 if (video_server_url.find("/localhost:") == string::npos) {
577 snprintf(url, sizeof(url), "%s%src?format=csv"
578 , video_server_url.c_str()
579 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
581 char *res=a3_curl_http_get(url, NULL);
586 ParseCSV(std::string(res), lines);
588 || lines.at(0).empty()
589 || lines.at(0).at(0) != video_get_docroot(Config)) {
590 warning << string_compose(
591 _("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."),
592 PROGRAM_NAME, video_get_docroot(Config), lines.at(0).at(0))
594 ok = false; // TODO allow to override
601 VideoTimeLine::gui_update(std::string const & t) {
602 /* this is to be called via GuiUpdate() only. */
603 ENSURE_GUI_THREAD (*this, &VideoTimeLine::queue_visual_videotimeline_update)
604 if (t == "videotimeline-update") {
605 editor->queue_visual_videotimeline_update();
606 } else if (t == "set-xjadeo-active-off") {
607 editor->toggle_xjadeo_proc(0);
608 } else if (t == "set-xjadeo-active-on") {
609 editor->toggle_xjadeo_proc(1);
610 } else if (t == "set-xjadeo-sensitive-on") {
611 editor->set_xjadeo_sensitive(true);
612 } else if (t == "set-xjadeo-sensitive-off") {
613 editor->toggle_xjadeo_proc(0);
614 //close_video_monitor();
615 editor->set_xjadeo_sensitive(false);
616 } else if (t == "xjadeo-window-ontop-on") {
617 editor->toggle_xjadeo_viewoption(1, 1);
618 } else if (t == "xjadeo-window-ontop-off") {
619 editor->toggle_xjadeo_viewoption(1, 0);
620 } else if (t == "xjadeo-window-osd-timecode-on") {
621 editor->toggle_xjadeo_viewoption(2, 1);
622 } else if (t == "xjadeo-window-osd-timecode-off") {
623 editor->toggle_xjadeo_viewoption(2, 0);
624 } else if (t == "xjadeo-window-osd-frame-on") {
625 editor->toggle_xjadeo_viewoption(3, 1);
626 } else if (t == "xjadeo-window-osd-frame-off") {
627 editor->toggle_xjadeo_viewoption(3, 0);
628 } else if (t == "xjadeo-window-osd-box-on") {
629 editor->toggle_xjadeo_viewoption(4, 1);
630 } else if (t == "xjadeo-window-osd-box-off") {
631 editor->toggle_xjadeo_viewoption(4, 0);
632 } else if (t == "xjadeo-window-fullscreen-on") {
633 editor->toggle_xjadeo_viewoption(5, 1);
634 } else if (t == "xjadeo-window-fullscreen-off") {
635 editor->toggle_xjadeo_viewoption(5, 0);
636 } else if (t == "xjadeo-window-letterbox-on") {
637 editor->toggle_xjadeo_viewoption(6, 1);
638 } else if (t == "xjadeo-window-letterbox-off") {
639 editor->toggle_xjadeo_viewoption(6, 0);
640 } else if (t == "video-available") {
641 editor->set_close_video_sensitive(true);
642 } else if (t == "video-unavailable") {
643 editor->set_close_video_sensitive(false);
648 VideoTimeLine::set_height (int height) {
649 if (_session && bar_height != height) {
650 _session->set_dirty ();
657 VideoTimeLine::vmon_update () {
658 if (vmonitor && vmonitor->is_started()) {
659 vmonitor->set_offset(video_offset); // TODO proper re-init xjadeo w/o restart not just offset.
664 VideoTimeLine::flush_local_cache () {
670 VideoTimeLine::flush_cache () {
673 snprintf(url, sizeof(url), "%s%sadmin/flush_cache"
674 , video_server_url.c_str()
675 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
677 char *res=a3_curl_http_get(url, NULL);
681 if (vmonitor && vmonitor->is_started()) {
682 reopen_vmonitor=true;
685 video_file_info(video_filename, local_file);
690 VideoTimeLine::parameter_changed (std::string const & p)
692 if (p == "video-server-url") {
693 set_video_server_url (video_get_server_url(Config));
694 } else if (p == "video-server-docroot") {
695 set_video_server_docroot (video_get_docroot(Config));
696 } else if (p == "video-advanced-setup") {
697 set_video_server_url (video_get_server_url(Config));
698 set_video_server_docroot (video_get_docroot(Config));
700 if (p == "use-video-file-fps" || p == "videotimeline-pullup" ) { /* session->config parameter */
706 VideoTimeLine::set_video_server_url(std::string vsu) {
707 flush_local_cache ();
708 video_server_url = vsu;
713 VideoTimeLine::set_video_server_docroot(std::string vsr) {
714 flush_local_cache ();
715 server_docroot = vsr;
719 /* video-monitor for this timeline */
721 VideoTimeLine::xjadeo_readversion (std::string d, size_t /* s */) {
726 VideoTimeLine::find_xjadeo () {
727 if (!ArdourVideoToolPaths::xjadeo_exe(_xjadeo_bin)) {
728 warning << _("Video-monitor 'xjadeo' was not found. Please install http://xjadeo.sf.net/ "
729 "(a custom path to xjadeo can be specified by setting the XJREMOTE environment variable. "
730 "It should point to an application compatible with xjadeo's remote-control interface 'xjremote').\n"
732 "see also http://manual.ardour.org/video-timeline/setup/")
736 if (found_xjadeo ()) {
737 ARDOUR::SystemExec version_check(_xjadeo_bin, X_("--version"));
739 version_check.ReadStdout.connect_same_thread (*this, boost::bind (&VideoTimeLine::xjadeo_readversion, this, _1 ,_2));
740 version_check.Terminated.connect_same_thread (*this, boost::bind (&VideoTimeLine::xjadeo_readversion, this, "\n" ,1));
741 if (version_check.start(2)) {
743 "Video-monitor 'xjadeo' cannot be launched."
745 _xjadeo_bin = X_("");
749 version_check.wait ();
751 while (xjadeo_version.empty() && --timeout) {
756 size_t vo = xjadeo_version.find(" version ");
757 if (vo != string::npos) {
758 int v_major, v_minor, v_micro;
759 if(sscanf(xjadeo_version.substr(vo + 9, string::npos).c_str(),"%d.%d.%d",
760 &v_major, &v_minor, &v_micro) == 3)
762 if (v_major >= 1) v_ok = true;
763 else if (v_major == 0 && v_minor >= 8) v_ok = true;
764 else if (v_major == 0 && v_minor >= 7 && v_micro >= 7) v_ok = true;
768 _xjadeo_bin = X_("");
770 "Video-monitor 'xjadeo' is too old. "
771 "Please install xjadeo version 0.7.7 or later. http://xjadeo.sf.net/"
778 VideoTimeLine::open_video_monitor() {
779 if (!found_xjadeo()) return;
781 vmonitor = new VideoMonitor(editor, _xjadeo_bin);
782 vmonitor->set_session(_session);
783 vmonitor->set_offset(video_offset);
784 vmonitor->Terminated.connect (sigc::mem_fun (*this, &VideoTimeLine::terminated_video_monitor));
785 vmonitor->UiState.connect (*this, invalidator (*this), boost::bind (&VideoTimeLine::gui_update, this, _1), gui_context());
786 } else if (vmonitor->is_started()) {
792 * the idea is to selective ignore certain monitor window
793 * states if xjadeo is not running on the same host as ardour.
794 * However with the removal of the video-monitor-startup-dialogue
795 * (git rev 5a4d0fff0) these settings are currently not accessible.
797 int xj_settings_mask = vmonitor->restore_settings_mask();
799 /* load mask from Session */
800 XMLNode* node = _session->extra_xml (X_("XJRestoreSettings"));
802 const XMLProperty* prop = node->property (X_("mask"));
804 xj_settings_mask = atoi(prop->value());
809 vmonitor->restore_settings_mask(xj_settings_mask);
812 if (!vmonitor->start()) {
813 warning << "launching xjadeo failed.." << endmsg;
814 close_video_monitor();
816 GuiUpdate("set-xjadeo-active-on");
817 vmonitor->set_fps(video_file_fps);
818 vmonitor->open(video_filename);
821 XMLNode* node = _session->extra_xml (X_("Videomonitor"));
823 const XMLProperty* prop = node->property (X_("active"));
824 if (prop && prop->value() != "yes") _session->set_dirty ();
826 _session->set_dirty ();
834 VideoTimeLine::close_video_monitor() {
835 if (vmonitor && vmonitor->is_started()) {
841 VideoTimeLine::control_video_monitor(int what, int param) {
842 if (!vmonitor || !vmonitor->is_started()) {
845 vmonitor->send_cmd(what, param);
850 VideoTimeLine::terminated_video_monitor () {
852 vmonitor->save_session();
856 GuiUpdate("set-xjadeo-active-off");
857 if (reopen_vmonitor) {
858 reopen_vmonitor=false;
859 open_video_monitor();
862 _session->set_dirty ();
868 VideoTimeLine::manual_seek_video_monitor (framepos_t pos)
870 if (!vmonitor) { return; }
871 if (!vmonitor->is_started()) { return; }
872 if (!vmonitor->synced_by_manual_seeks()) { return; }
873 vmonitor->manual_seek(pos, false, video_offset); // XXX -> set offset in xjadeo