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"
32 #include "canvas_impl.h"
33 #include "simpleline.h"
34 #include "utils_videotl.h"
35 #include "rgb_macros.h"
36 #include "video_timeline.h"
38 #include <gtkmm2ext/utils.h>
40 #include <curl/curl.h>
45 using namespace ARDOUR;
47 using namespace Timecode;
48 using namespace VideoUtils;
50 VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Group *vbg, int initial_height)
52 , videotl_bar_group(vbg)
53 , bar_height(initial_height)
55 video_start_offset = 0L;
59 auto_set_session_fps = false;
60 video_offset_lock = false;
61 video_aspect_ratio = 4.0/3.0;
62 Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoTimeLine::parameter_changed, this, _1), gui_context());
63 video_server_url = video_get_server_url(Config);
64 server_docroot = video_get_docroot(Config);
67 video_file_fps = 25.0;
70 reopen_vmonitor=false;
73 VtlUpdate.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
74 GuiUpdate.connect (*this, invalidator (*this), boost::bind (&VideoTimeLine::gui_update, this, _1), gui_context());
77 VideoTimeLine::~VideoTimeLine ()
82 /* close and save settings */
84 VideoTimeLine::save_session ()
90 LocaleGuard lg (X_("POSIX"));
92 XMLNode* node = new XMLNode(X_("Videomonitor"));
94 node->add_property (X_("active"), (vmonitor && vmonitor->is_started())?"yes":"no");
95 _session->add_extra_xml (*node);
98 if (vmonitor->is_started()) {
99 vmonitor->query_full_state(true);
101 vmonitor->save_session();
105 node = _session->extra_xml (X_("Videotimeline"));
107 node->add_property (X_("id"), id().to_s());
108 node->add_property (X_("Height"), editor->get_videotl_bar_height());
109 node->add_property (X_("VideoOffsetLock"), video_offset_lock?X_("1"):X_("0"));
110 node->add_property (X_("VideoOffset"), video_offset);
111 node->add_property (X_("AutoFPS"), auto_set_session_fps?X_("1"):X_("0"));
114 /* close and save settings */
116 VideoTimeLine::close_session ()
118 if (video_duration == 0) {
121 sessionsave.disconnect();
122 close_video_monitor();
127 GuiUpdate("set-xjadeo-sensitive-off");
128 GuiUpdate("video-unavailable");
132 VideoTimeLine::sync_session_state ()
134 if (!_session || !vmonitor || !vmonitor->is_started()) {
140 /** load settings from session */
142 VideoTimeLine::set_session (ARDOUR::Session *s)
144 SessionHandlePtr::set_session (s);
145 if (!_session) { return ; }
147 _session->SaveSession.connect_same_thread (sessionsave, boost::bind (&VideoTimeLine::save_session, this));
148 LocaleGuard lg (X_("POSIX"));
150 XMLNode* node = _session->extra_xml (X_("Videotimeline"));
152 if (!node || !node->property (X_("Filename"))) {
156 ARDOUR_UI::instance()->start_video_server((Gtk::Window*)0, false);
160 const XMLProperty* proph = node->property (X_("Height"));
162 editor->set_video_timeline_height(atoi(proph->value()));
164 #if 0 /* TODO THINK: set FPS first time only ?! */
165 const XMLProperty* propasfps = node->property (X_("AutoFPS"));
167 auto_set_session_fps = atoi(propasfps->value())?true:false;
171 const XMLProperty* propoffset = node->property (X_("VideoOffset"));
173 video_offset = atoll(propoffset->value());
174 video_offset_p = video_offset;
177 const XMLProperty* proplock = node->property (X_("VideoOffsetLock"));
179 video_offset_lock = atoi(proplock->value())?true:false;
182 const XMLProperty* localfile = node->property (X_("LocalFile"));
184 local_file = atoi(localfile->value())?true:false;
187 const XMLProperty* propf = node->property (X_("Filename"));
188 video_file_info(propf->value(), local_file);
190 if ((node = _session->extra_xml (X_("Videomonitor")))) {
191 const XMLProperty* prop = node->property (X_("active"));
192 if (prop && prop->value() == "yes" && found_xjadeo() && !video_filename.empty() && local_file) {
193 open_video_monitor();
197 _session->register_with_memento_command_factory(id(), this);
198 _session->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoTimeLine::parameter_changed, this, _1), gui_context());
202 VideoTimeLine::set_offset_locked (bool v) {
203 if (_session && v != video_offset_lock) {
204 _session->set_dirty ();
206 video_offset_lock = v;
210 VideoTimeLine::toggle_offset_locked () {
211 video_offset_lock = !video_offset_lock;
213 _session->set_dirty ();
218 VideoTimeLine::save_undo ()
220 if (_session && video_offset_p != video_offset) {
221 _session->set_dirty ();
223 video_offset_p = video_offset;
227 VideoTimeLine::set_state (const XMLNode& node, int /*version*/)
229 LocaleGuard lg (X_("POSIX"));
230 const XMLProperty* propoffset = node.property (X_("VideoOffset"));
232 video_offset = atoll(propoffset->value());
234 ARDOUR_UI::instance()->flush_videotimeline_cache(true);
239 VideoTimeLine::get_state ()
241 XMLNode* node = new XMLNode (X_("Videotimeline"));
242 LocaleGuard lg (X_("POSIX"));
243 node->add_property (X_("VideoOffset"), video_offset_p);
248 VideoTimeLine::remove_frames ()
250 for (VideoFrames::iterator i = video_frames.begin(); i != video_frames.end(); ++i ) {
251 VideoImageFrame *frame = (*i);
255 video_frames.clear();
259 VideoTimeLine::get_video_frame (framepos_t vfn, int cut, int rightend)
262 for (VideoFrames::iterator i = video_frames.begin(); i != video_frames.end(); ++i) {
263 VideoImageFrame *frame = (*i);
264 if (abs(frame->get_video_frame_number()-vfn)<=cut
265 && frame->get_rightend() == rightend) { return frame; }
271 VideoTimeLine::get_apv()
273 // XXX: dup code - TODO use this fn in update_video_timeline()
274 float apv = -1; /* audio frames per video frame; */
275 if (!_session) return apv;
277 if (_session->config.get_use_video_file_fps()) {
278 if (video_file_fps == 0 ) return apv;
280 if (_session->timecode_frames_per_second() == 0 ) return apv;
283 if (_session->config.get_videotimeline_pullup()) {
284 apv = _session->frame_rate();
286 apv = _session->nominal_frame_rate();
288 if (_session->config.get_use_video_file_fps()) {
289 apv /= video_file_fps;
291 apv /= _session->timecode_frames_per_second();
297 VideoTimeLine::update_video_timeline()
299 if (!_session) return;
301 if (_session->config.get_use_video_file_fps()) {
302 if (video_file_fps == 0 ) return;
304 if (_session->timecode_frames_per_second() == 0 ) return;
307 double frames_per_unit = editor->unit_to_frame(1.0);
308 framepos_t leftmost_frame = editor->leftmost_position();
311 * 1) calculate how many frames there should be in current zoom (plus 1 page on each side)
312 * 2) calculate first frame and distance between video-frames (according to zoom)
313 * 3) destroy/add frames
314 * 4) reposition existing frames
315 * 5) assign framenumber to frames -> request/decode video.
318 /* video-file and session properties */
319 double display_vframe_width; /* unit: pixels ; width of one thumbnail in the timeline */
320 float apv; /* audio frames per video frame; */
321 framepos_t leftmost_video_frame; /* unit: video-frame number ; temporary var -> vtl_start */
323 /* variables needed to render videotimeline -- what needs to computed first */
324 framepos_t vtl_start; /* unit: audio-frames ; first displayed video-frame */
325 framepos_t vtl_dist; /* unit: audio-frames ; distance between displayed video-frames */
326 unsigned int visible_video_frames; /* number of frames that fit on current canvas */
328 if (_session->config.get_videotimeline_pullup()) {
329 apv = _session->frame_rate();
331 apv = _session->nominal_frame_rate();
333 if (_session->config.get_use_video_file_fps()) {
334 apv /= video_file_fps;
336 apv /= _session->timecode_frames_per_second();
339 display_vframe_width = bar_height * video_aspect_ratio;
341 if (apv > frames_per_unit * display_vframe_width) {
342 /* high-zoom: need space between successive video-frames */
343 vtl_dist = rint(apv);
345 /* continous timeline: skip video-frames */
346 vtl_dist = ceil(display_vframe_width * frames_per_unit / apv) * apv;
349 assert (vtl_dist > 0);
352 leftmost_video_frame = floor (floor((leftmost_frame - video_start_offset - video_offset ) / vtl_dist) * vtl_dist / apv);
354 vtl_start = rint (video_offset + video_start_offset + leftmost_video_frame * apv);
355 visible_video_frames = 2 + ceil(editor->current_page_frames() / vtl_dist); /* +2 left+right partial frames */
357 /* expand timeline (cache next/prev page images) */
358 vtl_start -= visible_video_frames * vtl_dist;
359 visible_video_frames *=3;
361 if (vtl_start < video_offset ) {
362 visible_video_frames += ceil(vtl_start/vtl_dist);
363 vtl_start = video_offset;
366 /* apply video-file constraints */
367 if (vtl_start > video_start_offset + video_duration + video_offset ) {
368 visible_video_frames = 0;
370 /* TODO optimize: compute rather than iterate */
371 while (visible_video_frames > 0 && vtl_start + (visible_video_frames-1) * vtl_dist >= video_start_offset + video_duration + video_offset) {
372 --visible_video_frames;
380 while (video_frames.size() < visible_video_frames) {
381 VideoImageFrame *frame;
382 frame = new VideoImageFrame(*editor, *videotl_bar_group, display_vframe_width, bar_height, video_server_url, translated_filename());
383 frame->ImgChanged.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
384 video_frames.push_back(frame);
387 VideoFrames outdated_video_frames;
388 std::list<int> remaining;
390 outdated_video_frames = video_frames;
393 /* when zoomed out, ignore shifts by +-1 frame
394 * which can occur due to rounding errors when
395 * scrolling to a new leftmost-audio frame.
398 if (vtl_dist/apv < 3.0) cut =0;
403 for (unsigned int vfcount=0; vfcount < visible_video_frames; ++vfcount){
404 framepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-frames */
405 framepos_t vframeno = rint ( (vfpos - video_offset) / apv); /* unit: video-frames */
406 vfpos = (vframeno * apv ) + video_offset; /* audio-frame corresponding to /rounded/ video-frame */
408 int rightend = -1; /* unit: pixels */
409 if (vfpos + vtl_dist > video_start_offset + video_duration + video_offset) {
410 rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
411 //printf("lf(e): %lu\n", vframeno); // XXX
413 VideoImageFrame * frame = get_video_frame(vframeno, cut, rightend);
415 frame->set_position(vfpos-leftmost_frame);
416 outdated_video_frames.remove(frame);
418 remaining.push_back(vfcount);
422 for (VideoFrames::iterator i = outdated_video_frames.begin(); i != outdated_video_frames.end(); ++i ) {
423 VideoImageFrame *frame = (*i);
424 if (remaining.empty()) {
425 frame->set_position(-2 * vtl_dist); /* move off screen */
427 int vfcount=remaining.front();
428 remaining.pop_front();
429 framepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-frames */
430 framepos_t vframeno = rint ((vfpos - video_offset) / apv); /* unit: video-frames */
431 int rightend = -1; /* unit: pixels */
432 if (vfpos + vtl_dist > video_start_offset + video_duration + video_offset) {
433 rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
434 //printf("lf(n): %lu\n", vframeno); // XXX
436 frame->set_position(vfpos-leftmost_frame);
437 frame->set_videoframe(vframeno, rightend);
443 VideoTimeLine::translated_filename ()
446 return video_filename;
448 return video_map_path(server_docroot, video_filename);
453 VideoTimeLine::video_file_info (std::string filename, bool local)
457 if (filename.at(0) == G_DIR_SEPARATOR || !local_file) {
458 video_filename = filename;
460 video_filename = Glib::build_filename (_session->session_directory().video_path(), filename);
463 long long int _duration;
464 double _start_offset;
466 if (!video_query_info(
467 video_server_url, translated_filename(),
468 video_file_fps, _duration, _start_offset, video_aspect_ratio)) {
469 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;
471 GuiUpdate("set-xjadeo-sensitive-off");
472 GuiUpdate("video-unavailable");
475 video_duration = _duration * _session->nominal_frame_rate() / video_file_fps;
476 video_start_offset = _start_offset * _session->nominal_frame_rate();
478 if (auto_set_session_fps && video_file_fps != _session->timecode_frames_per_second()) {
479 switch ((int)floorf(video_file_fps*1000.0)) {
481 _session->config.set_timecode_format(timecode_23976);
484 _session->config.set_timecode_format(timecode_24);
488 _session->config.set_timecode_format(timecode_24976);
491 _session->config.set_timecode_format(timecode_25);
494 _session->config.set_timecode_format(timecode_2997drop);
497 _session->config.set_timecode_format(timecode_30);
500 _session->config.set_timecode_format(timecode_5994);
503 _session->config.set_timecode_format(timecode_60);
506 warning << string_compose (
507 _("Failed to set session-framerate: '%1' does not have a corresponding option setting in %2."),
508 video_file_fps, PROGRAM_NAME ) << endmsg;
511 _session->config.set_video_pullup(0); /* TODO only set if set_timecode_format() was successful ?!*/
513 if (floor(video_file_fps*100) != floor(_session->timecode_frames_per_second()*100)) {
514 warning << string_compose(
515 _("Video file's framerate is not equal to %1 session timecode's framerate: '%2' vs '%3'"),
516 PROGRAM_NAME, video_file_fps, _session->timecode_frames_per_second())
519 flush_local_cache ();
521 if (found_xjadeo() && local_file) {
522 GuiUpdate("set-xjadeo-sensitive-on");
523 if (vmonitor && vmonitor->is_started()) {
525 /* xjadeo <= 0.6.4 has a bug where changing the video-file may segfauls
526 * if the geometry changes to a different line-size alignment
528 reopen_vmonitor = true;
531 vmonitor->set_fps(video_file_fps);
532 vmonitor->open(video_filename);
535 } else if (!local_file) {
536 #if 1 /* temp debug/devel message */
537 // TODO - call xjremote remotely.
538 printf("the given video file can not be accessed on localhost, video monitoring is not currently supported for this case\n");
539 GuiUpdate("set-xjadeo-sensitive-off");
543 GuiUpdate("video-available");
548 VideoTimeLine::check_server ()
552 snprintf(url, sizeof(url), "%s%sstatus"
553 , video_server_url.c_str()
554 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
556 char *res=a3_curl_http_get(url, NULL);
558 if (strstr(res, "status: ok, online.")) { ok = true; }
565 VideoTimeLine::check_server_docroot ()
569 std::vector<std::vector<std::string> > lines;
571 if (video_server_url.find("/localhost:") == string::npos) {
574 snprintf(url, sizeof(url), "%s%src?format=csv"
575 , video_server_url.c_str()
576 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
578 char *res=a3_curl_http_get(url, NULL);
583 ParseCSV(std::string(res), lines);
585 || lines.at(0).empty()
586 || lines.at(0).at(0) != video_get_docroot(Config)) {
587 warning << string_compose(
588 _("Video-server docroot mismatch. %1: '%2', video-server: '%3'. This usually means that the video server was not started by ardour and uses a different document-root."),
589 PROGRAM_NAME, video_get_docroot(Config), lines.at(0).at(0))
591 ok = false; // TODO allow to override
598 VideoTimeLine::gui_update(std::string const & t) {
599 /* this is to be called via GuiUpdate() only. */
600 ENSURE_GUI_THREAD (*this, &VideoTimeLine::queue_visual_videotimeline_update)
601 if (t == "videotimeline-update") {
602 editor->queue_visual_videotimeline_update();
603 } else if (t == "set-xjadeo-active-off") {
604 editor->toggle_xjadeo_proc(0);
605 } else if (t == "set-xjadeo-active-on") {
606 editor->toggle_xjadeo_proc(1);
607 } else if (t == "set-xjadeo-sensitive-on") {
608 editor->set_xjadeo_sensitive(true);
609 } else if (t == "set-xjadeo-sensitive-off") {
610 editor->toggle_xjadeo_proc(0);
611 //close_video_monitor();
612 editor->set_xjadeo_sensitive(false);
613 } else if (t == "xjadeo-window-ontop-on") {
614 editor->toggle_xjadeo_viewoption(1, 1);
615 } else if (t == "xjadeo-window-ontop-off") {
616 editor->toggle_xjadeo_viewoption(1, 0);
617 } else if (t == "xjadeo-window-osd-timecode-on") {
618 editor->toggle_xjadeo_viewoption(2, 1);
619 } else if (t == "xjadeo-window-osd-timecode-off") {
620 editor->toggle_xjadeo_viewoption(2, 0);
621 } else if (t == "xjadeo-window-osd-frame-on") {
622 editor->toggle_xjadeo_viewoption(3, 1);
623 } else if (t == "xjadeo-window-osd-frame-off") {
624 editor->toggle_xjadeo_viewoption(3, 0);
625 } else if (t == "xjadeo-window-osd-box-on") {
626 editor->toggle_xjadeo_viewoption(4, 1);
627 } else if (t == "xjadeo-window-osd-box-off") {
628 editor->toggle_xjadeo_viewoption(4, 0);
629 } else if (t == "xjadeo-window-fullscreen-on") {
630 editor->toggle_xjadeo_viewoption(5, 1);
631 } else if (t == "xjadeo-window-fullscreen-off") {
632 editor->toggle_xjadeo_viewoption(5, 0);
633 } else if (t == "xjadeo-window-letterbox-on") {
634 editor->toggle_xjadeo_viewoption(6, 1);
635 } else if (t == "xjadeo-window-letterbox-off") {
636 editor->toggle_xjadeo_viewoption(6, 0);
637 } else if (t == "video-available") {
638 editor->set_close_video_sensitive(true);
639 } else if (t == "video-unavailable") {
640 editor->set_close_video_sensitive(false);
645 VideoTimeLine::set_height (int height) {
646 if (_session && bar_height != height) {
647 _session->set_dirty ();
654 VideoTimeLine::vmon_update () {
655 if (vmonitor && vmonitor->is_started()) {
656 vmonitor->set_offset(video_offset); // TODO proper re-init xjadeo w/o restart not just offset.
661 VideoTimeLine::flush_local_cache () {
667 VideoTimeLine::flush_cache () {
670 snprintf(url, sizeof(url), "%s%sadmin/flush_cache"
671 , video_server_url.c_str()
672 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
674 char *res=a3_curl_http_get(url, NULL);
678 if (vmonitor && vmonitor->is_started()) {
679 reopen_vmonitor=true;
682 video_file_info(video_filename, local_file);
687 VideoTimeLine::parameter_changed (std::string const & p)
689 if (p == "video-server-url") {
690 set_video_server_url (video_get_server_url(Config));
691 } else if (p == "video-server-docroot") {
692 set_video_server_docroot (video_get_docroot(Config));
693 } else if (p == "video-advanced-setup") {
694 set_video_server_url (video_get_server_url(Config));
695 set_video_server_docroot (video_get_docroot(Config));
697 if (p == "use-video-file-fps" || p == "videotimeline-pullup" ) { /* session->config parameter */
703 VideoTimeLine::set_video_server_url(std::string vsu) {
704 flush_local_cache ();
705 video_server_url = vsu;
710 VideoTimeLine::set_video_server_docroot(std::string vsr) {
711 flush_local_cache ();
712 server_docroot = vsr;
716 /* video-monitor for this timeline */
718 VideoTimeLine::find_xjadeo () {
719 std::string xjadeo_file_path;
720 if (getenv("XJREMOTE")) {
721 _xjadeo_bin = strdup(getenv("XJREMOTE")); // XXX TODO: free it?!
722 } else if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
723 _xjadeo_bin = xjadeo_file_path;
725 else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
726 _xjadeo_bin = X_("/Applications/Jadeo.app/Contents/MacOS/xjremote");
728 /* TODO: win32: allow to configure PATH to xjremote */
729 else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjremote.exe"), Glib::FILE_TEST_EXISTS)) {
730 _xjadeo_bin = X_("C:\\Program Files\\xjadeo\\xjremote.exe");
732 else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjremote.bat"), Glib::FILE_TEST_EXISTS)) {
733 _xjadeo_bin = X_("C:\\Program Files\\xjadeo\\xjremote.bat");
736 _xjadeo_bin = X_("");
737 warning << _("Video-monitor 'xjadeo' was not found. Please install http://xjadeo.sf.net/ "
738 "(a custom path to xjadeo can be specified by setting the XJREMOTE environment variable. "
739 "It should point to an application compatible with xjadeo's remote-control interface 'xjremote').\n"
741 "see also http://manual.ardour.org/video-timeline/setup/")
747 VideoTimeLine::open_video_monitor() {
748 if (!found_xjadeo()) return;
750 vmonitor = new VideoMonitor(editor, _xjadeo_bin);
751 vmonitor->set_session(_session);
752 vmonitor->set_offset(video_offset);
753 vmonitor->Terminated.connect (sigc::mem_fun (*this, &VideoTimeLine::terminated_video_monitor));
754 vmonitor->UiState.connect (*this, invalidator (*this), boost::bind (&VideoTimeLine::gui_update, this, _1), gui_context());
755 } else if (vmonitor->is_started()) {
761 * the idea is to selective ignore certain monitor window
762 * states if xjadeo is not running on the same host as ardour.
763 * However with the removal of the video-monitor-startup-dialogue
764 * (git rev 5a4d0fff0) these settings are currently not accessible.
766 int xj_settings_mask = vmonitor->restore_settings_mask();
768 /* load mask from Session */
769 XMLNode* node = _session->extra_xml (X_("XJRestoreSettings"));
771 const XMLProperty* prop = node->property (X_("mask"));
773 xj_settings_mask = atoi(prop->value());
778 vmonitor->restore_settings_mask(xj_settings_mask);
781 if (!vmonitor->start()) {
782 warning << "launching xjadeo failed.." << endmsg;
783 close_video_monitor();
785 GuiUpdate("set-xjadeo-active-on");
786 vmonitor->set_fps(video_file_fps);
787 vmonitor->open(video_filename);
790 XMLNode* node = _session->extra_xml (X_("Videomonitor"));
792 const XMLProperty* prop = node->property (X_("active"));
793 if (prop && prop->value() != "yes") _session->set_dirty ();
795 _session->set_dirty ();
803 VideoTimeLine::close_video_monitor() {
804 if (vmonitor && vmonitor->is_started()) {
810 VideoTimeLine::control_video_monitor(int what, int param) {
811 if (!vmonitor || !vmonitor->is_started()) {
814 vmonitor->send_cmd(what, param);
819 VideoTimeLine::terminated_video_monitor () {
821 vmonitor->save_session();
825 GuiUpdate("set-xjadeo-active-off");
826 if (reopen_vmonitor) {
827 reopen_vmonitor=false;
828 open_video_monitor();
831 _session->set_dirty ();
837 VideoTimeLine::manual_seek_video_monitor (framepos_t pos)
839 if (!vmonitor) { return; }
840 if (!vmonitor->is_started()) { return; }
841 if (!vmonitor->synced_by_manual_seeks()) { return; }
842 vmonitor->manual_seek(pos, false, video_offset); // XXX -> set offset in xjadeo