update video NO_OFFSET to 64 bit
[ardour.git] / gtk2_ardour / video_monitor.cc
index 238845fb2fd1d4dc1ea445ad8e52cc9e5cefde26..f15013f57eed2957d94d15bbcdaa7894b21ca17d 100644 (file)
 
 using namespace std;
 using namespace PBD;
+using namespace ARDOUR_UI_UTILS;
 
 VideoMonitor::VideoMonitor (PublicEditor *ed, std::string xjadeo_bin_path)
        : editor (ed)
 {
        manually_seeked_frame = 0;
        fps =0.0; // = _session->timecode_frames_per_second();
-       sync_by_manual_seek = false;
+       sync_by_manual_seek = true;
        _restore_settings_mask = 0;
        clock_connection = sigc::connection();
        state_connection = sigc::connection();
@@ -47,7 +48,7 @@ VideoMonitor::VideoMonitor (PublicEditor *ed, std::string xjadeo_bin_path)
        starting = 0;
        osdmode = 10; // 1: frameno, 2: timecode, 8: box
 
-       process = new SystemExec(xjadeo_bin_path, X_("-R"));
+       process = new ARDOUR::SystemExec(xjadeo_bin_path, X_("-R -J"));
        process->ReadStdout.connect_same_thread (*this, boost::bind (&VideoMonitor::parse_output, this, _1 ,_2));
        process->Terminated.connect (*this, invalidator (*this), boost::bind (&VideoMonitor::terminated, this), gui_context());
        XJKeyEvent.connect (*this, invalidator (*this), boost::bind (&VideoMonitor::forward_keyevent, this, _1), gui_context());
@@ -94,7 +95,7 @@ VideoMonitor::query_full_state (bool wait)
        process->write_to_stdin("get osdcfg\n");
        int timeout = 40;
        if (wait && knownstate !=127 && --timeout) {
-               usleep(50000);
+               Glib::usleep(50000);
                sched_yield();
        }
 }
@@ -113,7 +114,7 @@ VideoMonitor::quit ()
         */
        int timeout = 40;
        while (is_started() && --timeout) {
-               usleep(50000);
+               Glib::usleep(50000);
                sched_yield();
        }
        if (timeout <= 0) {
@@ -127,7 +128,6 @@ VideoMonitor::open (std::string filename)
        if (!is_started()) return;
        manually_seeked_frame = 0;
        osdmode = 10; // 1: frameno, 2: timecode, 8: box
-       sync_by_manual_seek = false;
        starting = 15;
        process->write_to_stdin("load " + filename + "\n");
        process->write_to_stdin("set fps -1\n");
@@ -135,15 +135,17 @@ VideoMonitor::open (std::string filename)
        process->write_to_stdin("window ontop on\n");
        process->write_to_stdin("set seekmode 1\n");
        /* override bitwise flags -- see xjadeo.h
-        * 0x01 : ignore 'q', ESC  / quite
-        * 0x02 : ignore "window closed by WM" / quit
-        * 0x04 : (osx only) menu-exit / quit
-        * 0x08 : ignore mouse-button 1 -- resize
-        * 0x10 : no A/V offset
-        * 0x20 : don't use jack-session
-        * 0x40 : no jack-transport control play/pause/rewind
+        * 0x0001 : ignore 'q', ESC  / quit
+        * 0x0002 : ignore "window closed by WM" / quit
+        * 0x0004 : (osx only) menu-exit / quit
+        * 0x0008 : ignore mouse-button 1 -- resize
+        * 0x0010 : no A/V offset control with keyboard
+        * 0x0020 : don't use jack-session
+        * 0x0040 : disable jack transport control
+        * 0x0080 : disallow sync source change (OSX menu)
+        * 0x0100 : disallow file open (OSX menu, X11 DnD)
         */
-       process->write_to_stdin("set override 120\n");
+       process->write_to_stdin("set override 504\n");
        process->write_to_stdin("notify keyboard\n");
        process->write_to_stdin("notify settings\n");
        process->write_to_stdin("window letterbox on\n");
@@ -159,6 +161,8 @@ VideoMonitor::open (std::string filename)
                /* TODO once every two second or so -- state_clk_divide hack below */
                state_connection = ARDOUR_UI::RapidScreenUpdate.connect (sigc::mem_fun (*this, &VideoMonitor::querystate));
        }
+       sync_by_manual_seek = true;
+       clock_connection = ARDOUR_UI::FPSUpdate.connect (sigc::mem_fun (*this, &VideoMonitor::srsupdate));
        xjadeo_sync_setup();
 }
 
@@ -464,7 +468,7 @@ VideoMonitor::get_custom_setting (const std::string k)
        return (xjadeo_settings[k]);
 }
 
-#define NO_OFFSET (1<<31) //< skip setting or modifying offset --  TODO check ARDOUR::frameoffset_t max value.
+#define NO_OFFSET (1<<63) //< skip setting or modifying offset
 void
 VideoMonitor::srsupdate ()
 {
@@ -566,7 +570,7 @@ VideoMonitor::xjadeo_sync_setup ()
                        process->write_to_stdin("jack connect\n");
                } else {
                        process->write_to_stdin("jack disconnect\n");
-                       clock_connection = ARDOUR_UI::SuperRapidScreenUpdate.connect (sigc::mem_fun (*this, &VideoMonitor::srsupdate));
+                       clock_connection = ARDOUR_UI::FPSUpdate.connect (sigc::mem_fun (*this, &VideoMonitor::srsupdate));
                }
                sync_by_manual_seek = my_manual_seek;
        }