Merge branch 'master' into cairocanvas
[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 save_session ();
66         void clear_session_state ();
67         void query_full_state (bool);
68         bool set_custom_setting (const std::string, const std::string);
69         const std::string get_custom_setting (const std::string);
70         void restore_settings_mask (int i)  { _restore_settings_mask = i;}
71         int restore_settings_mask () const { return _restore_settings_mask;}
72
73         void set_offset (ARDOUR::frameoffset_t);
74         void manual_seek (ARDOUR::framepos_t, bool, ARDOUR::frameoffset_t);
75         void srsupdate ();
76         void querystate ();
77         bool synced_by_manual_seeks() { return sync_by_manual_seek; }
78
79         sigc::signal<void> Terminated;
80         PBD::Signal1<void,std::string> UiState;
81         void send_cmd (int what, int param);
82
83 #if 1
84         void set_debug (bool onoff) { debug_enable = onoff; }
85 #endif
86
87         protected:
88         PublicEditor *editor;
89         SystemExec *process;
90         float fps;
91         void parse_output (std::string d, size_t s);
92         void terminated ();
93
94         void parameter_changed (std::string const & p);
95
96         typedef std::map<std::string,std::string> XJSettings;
97
98         int _restore_settings_mask;
99         bool skip_setting(std::string);
100         XJSettings xjadeo_settings;
101
102         void xjadeo_sync_setup ();
103         ARDOUR::framepos_t manually_seeked_frame;
104         bool sync_by_manual_seek;
105         sigc::connection clock_connection;
106         sigc::connection state_connection;
107         int state_clk_divide;
108         int starting;
109         int knownstate;
110         int osdmode;
111 #if 1
112         bool debug_enable;
113 #endif
114 };
115
116 #endif /* __ardour_video_monitor_h__ */
117
118 #endif /* WITH_VIDEOTIMELINE */