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 "utils_videotl.h"
33 #include "rgb_macros.h"
34 #include "video_timeline.h"
36 #include <gtkmm2ext/utils.h>
38 #include <curl/curl.h>
43 using namespace ARDOUR;
45 using namespace Timecode;
47 VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Group *vbg, int initial_height)
50 , bar_height(initial_height)
52 video_start_offset = 0L;
56 auto_set_session_fps = false;
57 video_offset_lock = false;
58 video_aspect_ratio = 4.0/3.0;
59 Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoTimeLine::parameter_changed, this, _1), gui_context());
60 video_server_url = video_get_server_url(Config);
61 server_docroot = video_get_docroot(Config);
64 video_file_fps = 25.0;
67 reopen_vmonitor=false;
70 VtlUpdate.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
71 GuiUpdate.connect (*this, invalidator (*this), boost::bind (&VideoTimeLine::gui_update, this, _1), gui_context());
74 VideoTimeLine::~VideoTimeLine ()
79 /* close and save settings */
81 VideoTimeLine::save_session ()
87 LocaleGuard lg (X_("POSIX"));
89 XMLNode* node = new XMLNode(X_("Videomonitor"));
91 node->add_property (X_("active"), (vmonitor && vmonitor->is_started())?"yes":"no");
92 _session->add_extra_xml (*node);
95 if (vmonitor->is_started()) {
96 vmonitor->query_full_state(true);
98 vmonitor->save_session();
102 node = _session->extra_xml (X_("Videotimeline"));
104 node->add_property (X_("id"), id().to_s());
105 node->add_property (X_("Height"), editor->get_videotl_bar_height());
106 node->add_property (X_("VideoOffsetLock"), video_offset_lock?X_("1"):X_("0"));
107 node->add_property (X_("VideoOffset"), video_offset);
108 node->add_property (X_("AutoFPS"), auto_set_session_fps?X_("1"):X_("0"));
111 /* close and save settings */
113 VideoTimeLine::close_session ()
115 if (video_duration == 0) {
118 sessionsave.disconnect();
119 close_video_monitor();
124 GuiUpdate("set-xjadeo-sensitive-off");
125 GuiUpdate("video-unavailable");
129 VideoTimeLine::sync_session_state ()
131 if (!_session || !vmonitor || !vmonitor->is_started()) {
137 /** load settings from session */
139 VideoTimeLine::set_session (ARDOUR::Session *s)
141 SessionHandlePtr::set_session (s);
142 if (!_session) { return ; }
144 _session->SaveSession.connect_same_thread (sessionsave, boost::bind (&VideoTimeLine::save_session, this));
145 LocaleGuard lg (X_("POSIX"));
147 XMLNode* node = _session->extra_xml (X_("Videotimeline"));
149 if (!node || !node->property (X_("Filename"))) {
153 ARDOUR_UI::instance()->start_video_server((Gtk::Window*)0, false);
157 const XMLProperty* proph = node->property (X_("Height"));
159 editor->set_video_timeline_height(atoi(proph->value()));
161 #if 0 /* TODO THINK: set FPS first time only ?! */
162 const XMLProperty* propasfps = node->property (X_("AutoFPS"));
164 auto_set_session_fps = atoi(propasfps->value())?true:false;
168 const XMLProperty* propoffset = node->property (X_("VideoOffset"));
170 video_offset = atoll(propoffset->value());
171 video_offset_p = video_offset;
174 const XMLProperty* proplock = node->property (X_("VideoOffsetLock"));
176 video_offset_lock = atoi(proplock->value())?true:false;
179 const XMLProperty* localfile = node->property (X_("LocalFile"));
181 local_file = atoi(localfile->value())?true:false;
184 const XMLProperty* propf = node->property (X_("Filename"));
185 video_file_info(propf->value(), local_file);
187 if ((node = _session->extra_xml (X_("Videomonitor")))) {
188 const XMLProperty* prop = node->property (X_("active"));
189 if (prop && prop->value() == "yes" && found_xjadeo() && !video_filename.empty() && local_file) {
190 open_video_monitor();
194 _session->register_with_memento_command_factory(id(), this);
195 _session->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&VideoTimeLine::parameter_changed, this, _1), gui_context());
199 VideoTimeLine::set_offset_locked (bool v) {
200 if (_session && v != video_offset_lock) {
201 _session->set_dirty ();
203 video_offset_lock = v;
207 VideoTimeLine::toggle_offset_locked () {
208 video_offset_lock = !video_offset_lock;
210 _session->set_dirty ();
215 VideoTimeLine::save_undo ()
217 if (_session && video_offset_p != video_offset) {
218 _session->set_dirty ();
220 video_offset_p = video_offset;
224 VideoTimeLine::set_state (const XMLNode& node, int /*version*/)
226 LocaleGuard lg (X_("POSIX"));
227 const XMLProperty* propoffset = node.property (X_("VideoOffset"));
229 video_offset = atoll(propoffset->value());
231 ARDOUR_UI::instance()->flush_videotimeline_cache(true);
236 VideoTimeLine::get_state ()
238 XMLNode* node = new XMLNode (X_("Videotimeline"));
239 LocaleGuard lg (X_("POSIX"));
240 node->add_property (X_("VideoOffset"), video_offset_p);
245 VideoTimeLine::remove_frames ()
247 for (VideoFrames::iterator i = video_frames.begin(); i != video_frames.end(); ++i ) {
248 VideoImageFrame *frame = (*i);
252 video_frames.clear();
256 VideoTimeLine::get_video_frame (framepos_t vfn, int cut, int rightend)
259 for (VideoFrames::iterator i = video_frames.begin(); i != video_frames.end(); ++i) {
260 VideoImageFrame *frame = (*i);
261 if (abs(frame->get_video_frame_number()-vfn)<=cut
262 && frame->get_rightend() == rightend) { return frame; }
268 VideoTimeLine::get_apv()
270 // XXX: dup code - TODO use this fn in update_video_timeline()
271 float apv = -1; /* audio samples per video frame; */
272 if (!_session) return apv;
274 if (_session->config.get_use_video_file_fps()) {
275 if (video_file_fps == 0 ) return apv;
277 if (_session->timecode_frames_per_second() == 0 ) return apv;
280 if (_session->config.get_videotimeline_pullup()) {
281 apv = _session->frame_rate();
283 apv = _session->nominal_frame_rate();
285 if (_session->config.get_use_video_file_fps()) {
286 apv /= video_file_fps;
288 apv /= _session->timecode_frames_per_second();
294 VideoTimeLine::update_video_timeline()
296 if (!_session) return;
298 if (_session->config.get_use_video_file_fps()) {
299 if (video_file_fps == 0 ) return;
301 if (_session->timecode_frames_per_second() == 0 ) return;
304 const double samples_per_pixel = editor->get_current_zoom();
305 const framepos_t leftmost_sample = editor->leftmost_sample();
308 * 1) calculate how many frames there should be in current zoom (plus 1 page on each side)
309 * 2) calculate first frame and distance between video-frames (according to zoom)
310 * 3) destroy/add frames
311 * 4) reposition existing frames
312 * 5) assign framenumber to frames -> request/decode video.
315 /* video-file and session properties */
316 double display_vframe_width; /* unit: pixels ; width of one thumbnail in the timeline */
317 float apv; /* audio samples per video frame; */
318 framepos_t leftmost_video_frame; /* unit: video-frame number ; temporary var -> vtl_start */
320 /* variables needed to render videotimeline -- what needs to computed first */
321 framepos_t vtl_start; /* unit: audio-samples ; first displayed video-frame */
322 framepos_t vtl_dist; /* unit: audio-samples ; distance between displayed video-frames */
323 unsigned int visible_video_frames; /* number of frames that fit on current canvas */
325 if (_session->config.get_videotimeline_pullup()) {
326 apv = _session->frame_rate();
328 apv = _session->nominal_frame_rate();
330 if (_session->config.get_use_video_file_fps()) {
331 apv /= video_file_fps;
333 apv /= _session->timecode_frames_per_second();
336 display_vframe_width = bar_height * video_aspect_ratio;
338 if (apv > samples_per_pixel * display_vframe_width) {
339 /* high-zoom: need space between successive video-frames */
340 vtl_dist = rint(apv);
342 /* continous timeline: skip video-frames */
343 vtl_dist = ceil(display_vframe_width * samples_per_pixel / apv) * apv;
346 assert (vtl_dist > 0);
349 leftmost_video_frame = floor (floor((leftmost_sample - video_start_offset - video_offset ) / vtl_dist) * vtl_dist / apv);
351 vtl_start = rint (video_offset + video_start_offset + leftmost_video_frame * apv);
352 visible_video_frames = 2 + ceil(editor->current_page_samples() / vtl_dist); /* +2 left+right partial frames */
354 /* expand timeline (cache next/prev page images) */
355 vtl_start -= visible_video_frames * vtl_dist;
356 visible_video_frames *=3;
358 if (vtl_start < video_offset ) {
359 visible_video_frames += ceil(vtl_start/vtl_dist);
360 vtl_start = video_offset;
363 /* apply video-file constraints */
364 if (vtl_start > video_start_offset + video_duration + video_offset ) {
365 visible_video_frames = 0;
367 /* TODO optimize: compute rather than iterate */
368 while (visible_video_frames > 0 && vtl_start + (visible_video_frames-1) * vtl_dist >= video_start_offset + video_duration + video_offset) {
369 --visible_video_frames;
377 while (video_frames.size() < visible_video_frames) {
378 VideoImageFrame *frame;
379 frame = new VideoImageFrame(*editor, *videotl_group, display_vframe_width, bar_height, video_server_url, translated_filename());
380 frame->ImgChanged.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
381 video_frames.push_back(frame);
384 VideoFrames outdated_video_frames;
385 std::list<int> remaining;
387 outdated_video_frames = video_frames;
390 /* when zoomed out, ignore shifts by +-1 frame
391 * which can occur due to rounding errors when
392 * scrolling to a new leftmost-audio frame.
395 if (vtl_dist/apv < 3.0) cut =0;
400 for (unsigned int vfcount=0; vfcount < visible_video_frames; ++vfcount){
401 framepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-frames */
402 framepos_t vframeno = rint ( (vfpos - video_offset) / apv); /* unit: video-frames */
403 vfpos = (vframeno * apv ) + video_offset; /* audio-frame corresponding to /rounded/ video-frame */
405 int rightend = -1; /* unit: pixels */
406 if (vfpos + vtl_dist > video_start_offset + video_duration + video_offset) {
407 rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
408 //printf("lf(e): %lu\n", vframeno); // XXX
410 VideoImageFrame * frame = get_video_frame(vframeno, cut, rightend);
412 frame->set_position(vfpos);
413 outdated_video_frames.remove(frame);
415 remaining.push_back(vfcount);
419 for (VideoFrames::iterator i = outdated_video_frames.begin(); i != outdated_video_frames.end(); ++i ) {
420 VideoImageFrame *frame = (*i);
421 if (remaining.empty()) {
422 frame->set_position(-2 * vtl_dist + leftmost_sample); /* move off screen */
424 int vfcount=remaining.front();
425 remaining.pop_front();
426 framepos_t vfpos = vtl_start + vfcount * vtl_dist; /* unit: audio-frames */
427 framepos_t vframeno = rint ((vfpos - video_offset) / apv); /* unit: video-frames */
428 int rightend = -1; /* unit: pixels */
429 if (vfpos + vtl_dist > video_start_offset + video_duration + video_offset) {
430 rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
431 //printf("lf(n): %lu\n", vframeno); // XXX
433 frame->set_position(vfpos);
434 frame->set_videoframe(vframeno, rightend);
440 VideoTimeLine::translated_filename ()
443 return video_filename;
445 return video_map_path(server_docroot, video_filename);
450 VideoTimeLine::video_file_info (std::string filename, bool local)
454 if (filename.at(0) == G_DIR_SEPARATOR || !local_file) {
455 video_filename = filename;
457 video_filename = Glib::build_filename (_session->session_directory().video_path(), filename);
460 long long int _duration;
461 double _start_offset;
463 if (!video_query_info(
464 video_server_url, translated_filename(),
465 video_file_fps, _duration, _start_offset, video_aspect_ratio)) {
466 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;
468 GuiUpdate("set-xjadeo-sensitive-off");
469 GuiUpdate("video-unavailable");
472 video_duration = _duration * _session->nominal_frame_rate() / video_file_fps;
473 video_start_offset = _start_offset * _session->nominal_frame_rate();
475 if (auto_set_session_fps && video_file_fps != _session->timecode_frames_per_second()) {
476 switch ((int)floorf(video_file_fps*1000.0)) {
478 _session->config.set_timecode_format(timecode_23976);
481 _session->config.set_timecode_format(timecode_24);
485 _session->config.set_timecode_format(timecode_24976);
488 _session->config.set_timecode_format(timecode_25);
491 _session->config.set_timecode_format(timecode_2997drop);
494 _session->config.set_timecode_format(timecode_30);
497 _session->config.set_timecode_format(timecode_5994);
500 _session->config.set_timecode_format(timecode_60);
503 warning << _("Failed to set session-fps: ") << video_file_fps << _(" does not have a corresponding option setting in Ardour.") << endmsg; /* TODO: gettext arg */
506 _session->config.set_video_pullup(0); /* TODO only set if set_timecode_format() was successful ?!*/
508 if (floor(video_file_fps*100) != floor(_session->timecode_frames_per_second()*100)) {
509 warning << _("Video file's framerate is not equal to Ardour session timecode's framerate: ")
510 << video_file_fps << _(" vs ") << _session->timecode_frames_per_second() << endmsg;
512 flush_local_cache ();
514 if (found_xjadeo() && local_file) {
515 GuiUpdate("set-xjadeo-sensitive-on");
516 if (vmonitor && vmonitor->is_started()) {
518 /* xjadeo <= 0.6.4 has a bug where changing the video-file may segfauls
519 * if the geometry changes to a different line-size alignment
521 reopen_vmonitor = true;
524 vmonitor->set_fps(video_file_fps);
525 vmonitor->open(video_filename);
528 } else if (!local_file) {
529 #if 1 /* temp debug/devel message */
530 // TODO - call xjremote remotely.
531 printf("the given video file can not be accessed on localhost, video monitoring is not currently supported for this case\n");
532 GuiUpdate("set-xjadeo-sensitive-off");
536 GuiUpdate("video-available");
541 VideoTimeLine::check_server ()
545 snprintf(url, sizeof(url), "%s%sstatus"
546 , video_server_url.c_str()
547 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
549 char *res=curl_http_get(url, NULL);
551 if (strstr(res, "status: ok, online.")) { ok = true; }
558 VideoTimeLine::check_server_docroot ()
562 std::vector<std::vector<std::string> > lines;
564 if (video_server_url.find("/localhost:") == string::npos) {
567 snprintf(url, sizeof(url), "%s%src?format=csv"
568 , video_server_url.c_str()
569 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
571 char *res=curl_http_get(url, NULL);
576 ParseCSV(std::string(res), lines);
578 || lines.at(0).empty()
579 || lines.at(0).at(0) != video_get_docroot(Config)) {
580 warning << string_compose(
581 _("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."),
582 video_get_docroot(Config), lines.at(0).at(0))
584 ok = false; // TODO allow to override
591 VideoTimeLine::gui_update(std::string const & t) {
592 /* this is to be called via GuiUpdate() only. */
593 ENSURE_GUI_THREAD (*this, &VideoTimeLine::queue_visual_videotimeline_update)
594 if (t == "videotimeline-update") {
595 editor->queue_visual_videotimeline_update();
596 } else if (t == "set-xjadeo-active-off") {
597 editor->toggle_xjadeo_proc(0);
598 } else if (t == "set-xjadeo-active-on") {
599 editor->toggle_xjadeo_proc(1);
600 } else if (t == "set-xjadeo-sensitive-on") {
601 editor->set_xjadeo_sensitive(true);
602 } else if (t == "set-xjadeo-sensitive-off") {
603 editor->toggle_xjadeo_proc(0);
604 //close_video_monitor();
605 editor->set_xjadeo_sensitive(false);
606 } else if (t == "xjadeo-window-ontop-on") {
607 editor->toggle_xjadeo_viewoption(1, 1);
608 } else if (t == "xjadeo-window-ontop-off") {
609 editor->toggle_xjadeo_viewoption(1, 0);
610 } else if (t == "xjadeo-window-osd-timecode-on") {
611 editor->toggle_xjadeo_viewoption(2, 1);
612 } else if (t == "xjadeo-window-osd-timecode-off") {
613 editor->toggle_xjadeo_viewoption(2, 0);
614 } else if (t == "xjadeo-window-osd-frame-on") {
615 editor->toggle_xjadeo_viewoption(3, 1);
616 } else if (t == "xjadeo-window-osd-frame-off") {
617 editor->toggle_xjadeo_viewoption(3, 0);
618 } else if (t == "xjadeo-window-osd-box-on") {
619 editor->toggle_xjadeo_viewoption(4, 1);
620 } else if (t == "xjadeo-window-osd-box-off") {
621 editor->toggle_xjadeo_viewoption(4, 0);
622 } else if (t == "xjadeo-window-fullscreen-on") {
623 editor->toggle_xjadeo_viewoption(5, 1);
624 } else if (t == "xjadeo-window-fullscreen-off") {
625 editor->toggle_xjadeo_viewoption(5, 0);
626 } else if (t == "xjadeo-window-letterbox-on") {
627 editor->toggle_xjadeo_viewoption(6, 1);
628 } else if (t == "xjadeo-window-letterbox-off") {
629 editor->toggle_xjadeo_viewoption(6, 0);
630 } else if (t == "video-available") {
631 editor->set_close_video_sensitive(true);
632 } else if (t == "video-unavailable") {
633 editor->set_close_video_sensitive(false);
638 VideoTimeLine::set_height (int height) {
639 if (_session && bar_height != height) {
640 _session->set_dirty ();
647 VideoTimeLine::vmon_update () {
648 if (vmonitor && vmonitor->is_started()) {
649 vmonitor->set_offset(video_offset); // TODO proper re-init xjadeo w/o restart not just offset.
654 VideoTimeLine::flush_local_cache () {
660 VideoTimeLine::flush_cache () {
663 snprintf(url, sizeof(url), "%s%sadmin/flush_cache"
664 , video_server_url.c_str()
665 , (video_server_url.length()>0 && video_server_url.at(video_server_url.length()-1) == '/')?"":"/"
667 char *res=curl_http_get(url, NULL);
671 if (vmonitor && vmonitor->is_started()) {
672 reopen_vmonitor=true;
675 video_file_info(video_filename, local_file);
680 VideoTimeLine::parameter_changed (std::string const & p)
682 if (p == "video-server-url") {
683 set_video_server_url (video_get_server_url(Config));
684 } else if (p == "video-server-docroot") {
685 set_video_server_docroot (video_get_docroot(Config));
686 } else if (p == "video-advanced-setup") {
687 set_video_server_url (video_get_server_url(Config));
688 set_video_server_docroot (video_get_docroot(Config));
690 if (p == "use-video-file-fps" || p == "videotimeline-pullup" ) { /* session->config parameter */
696 VideoTimeLine::set_video_server_url(std::string vsu) {
697 flush_local_cache ();
698 video_server_url = vsu;
703 VideoTimeLine::set_video_server_docroot(std::string vsr) {
704 flush_local_cache ();
705 server_docroot = vsr;
709 /* video-monitor for this timeline */
711 VideoTimeLine::find_xjadeo () {
712 std::string xjadeo_file_path;
713 if (getenv("XJREMOTE")) {
714 _xjadeo_bin = strdup(getenv("XJREMOTE")); // XXX TODO: free it?!
715 } else if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
716 _xjadeo_bin = xjadeo_file_path;
718 else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
719 _xjadeo_bin = X_("/Applications/Jadeo.app/Contents/MacOS/xjremote");
721 /* TODO: win32: allow to configure PATH to xjremote */
722 else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjremote.exe"), Glib::FILE_TEST_EXISTS)) {
723 _xjadeo_bin = X_("C:\\Program Files\\xjadeo\\xjremote.exe");
725 else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjremote.bat"), Glib::FILE_TEST_EXISTS)) {
726 _xjadeo_bin = X_("C:\\Program Files\\xjadeo\\xjremote.bat");
729 _xjadeo_bin = X_("");
730 warning << _("Video-monitor 'xjadeo' was not found. Please install http://xjadeo.sf.net/ "
731 "(a custom path to xjadeo can be specified by setting the XJREMOTE environment variable. "
732 "It should point to an application compatible with xjadeo's remote-control interface 'xjremote').")
738 VideoTimeLine::open_video_monitor() {
739 if (!found_xjadeo()) return;
741 vmonitor = new VideoMonitor(editor, _xjadeo_bin);
742 vmonitor->set_session(_session);
743 vmonitor->set_offset(video_offset);
744 vmonitor->Terminated.connect (sigc::mem_fun (*this, &VideoTimeLine::terminated_video_monitor));
745 vmonitor->UiState.connect (*this, invalidator (*this), boost::bind (&VideoTimeLine::gui_update, this, _1), gui_context());
746 } else if (vmonitor->is_started()) {
752 * the idea is to selective ignore certain monitor window
753 * states if xjadeo is not running on the same host as ardour.
754 * However with the removal of the video-monitor-startup-dialogue
755 * (git rev 5a4d0fff0) these settings are currently not accessible.
757 int xj_settings_mask = vmonitor->restore_settings_mask();
759 /* load mask from Session */
760 XMLNode* node = _session->extra_xml (X_("XJRestoreSettings"));
762 const XMLProperty* prop = node->property (X_("mask"));
764 xj_settings_mask = atoi(prop->value());
769 vmonitor->restore_settings_mask(xj_settings_mask);
772 if (!vmonitor->start()) {
773 warning << "launching xjadeo failed.." << endmsg;
774 close_video_monitor();
776 GuiUpdate("set-xjadeo-active-on");
777 vmonitor->set_fps(video_file_fps);
778 vmonitor->open(video_filename);
781 XMLNode* node = _session->extra_xml (X_("Videomonitor"));
783 const XMLProperty* prop = node->property (X_("active"));
784 if (prop && prop->value() != "yes") _session->set_dirty ();
786 _session->set_dirty ();
794 VideoTimeLine::close_video_monitor() {
795 if (vmonitor && vmonitor->is_started()) {
801 VideoTimeLine::control_video_monitor(int what, int param) {
802 if (!vmonitor || !vmonitor->is_started()) {
805 vmonitor->send_cmd(what, param);
810 VideoTimeLine::terminated_video_monitor () {
812 vmonitor->save_session();
815 GuiUpdate("set-xjadeo-active-off");
817 if (reopen_vmonitor) {
818 reopen_vmonitor=false;
819 open_video_monitor();
822 _session->set_dirty ();
828 VideoTimeLine::manual_seek_video_monitor (framepos_t pos)
830 if (!vmonitor) { return; }
831 if (!vmonitor->is_started()) { return; }
832 if (!vmonitor->synced_by_manual_seeks()) { return; }
833 vmonitor->manual_seek(pos, false, video_offset); // XXX -> set offset in xjadeo