vtl: video-monitor interaction
[ardour.git] / gtk2_ardour / video_monitor.h
1 /*
2     Copyright (C) 2010 Paul Davis
3     Author: Robin Gareus <robin@gareus.org>
4
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.
9
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.
14
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.
18
19 */
20 #ifdef WITH_VIDEOTIMELINE
21
22 #ifndef __ardour_video_monitor_h__
23 #define __ardour_video_monitor_h__
24
25 #include <string>
26
27 #include "ardour/ardour.h"
28 #include "ardour/types.h"
29 #include "ardour/session.h"
30 #include "ardour/session_handle.h"
31 #include "system_exec.h"
32
33 namespace ARDOUR {
34         class Session;
35 }
36 class PublicEditor;
37
38 enum XJSettingOptions {
39         XJ_WINDOW_SIZE = 1,
40         XJ_WINDOW_POS = 2,
41         XJ_WINDOW_ONTOP = 4,
42         XJ_LETTERBOX = 8,
43         XJ_OSD = 16,
44         XJ_OFFSET = 32,
45         XJ_FULLSCREEN = 64,
46 };
47
48 /** @class VideoMonitor
49  *  @brief communication with xjadeo's remote-control interface
50  */
51 class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
52 {
53         public:
54         VideoMonitor (PublicEditor*, std::string);
55         virtual ~VideoMonitor ();
56
57         void set_filename (std::string filename);
58         void set_fps (float f) {fps = f;}
59         bool is_started ();
60         bool start ();
61         void quit ();
62         void open (std::string);
63
64         void set_session (ARDOUR::Session *s);
65         void clear_session_state ();
66         bool set_custom_setting (const std::string, const std::string);
67         const std::string get_custom_setting (const std::string);
68         void restore_settings_mask (int i)  { _restore_settings_mask = i;}
69         int restore_settings_mask () const { return _restore_settings_mask;}
70
71         void set_offset (ARDOUR::frameoffset_t);
72         void manual_seek (ARDOUR::framepos_t, bool, ARDOUR::frameoffset_t);
73         void srsupdate ();
74         void querystate ();
75         bool synced_by_manual_seeks() { return sync_by_manual_seek; }
76
77         sigc::signal<void> Terminated;
78         PBD::Signal1<void,std::string> UiState;
79         void send_cmd (int what, int param);
80
81 #if 1
82         void set_debug (bool onoff) { debug_enable = onoff; }
83 #endif
84
85         protected:
86         PublicEditor *editor;
87         SystemExec *process;
88         float fps;
89         void parse_output (std::string d, size_t s);
90         void terminated ();
91
92         void save_session ();
93         void parameter_changed (std::string const & p);
94
95         typedef std::map<std::string,std::string> XJSettings;
96
97         int _restore_settings_mask;
98         bool skip_setting(std::string);
99         XJSettings xjadeo_settings;
100
101         void xjadeo_sync_setup ();
102         ARDOUR::framepos_t manually_seeked_frame;
103         bool sync_by_manual_seek;
104         sigc::connection clock_connection;
105         sigc::connection state_connection;
106         int state_clk_divide;
107         int starting;
108         int osdmode;
109 #if 1
110         bool debug_enable;
111 #endif
112 };
113
114 #endif /* __ardour_video_monitor_h__ */
115
116 #endif /* WITH_VIDEOTIMELINE */