summaryrefslogtreecommitdiff
path: root/gtk2_ardour/video_monitor.h
blob: a122e2cacf2556837eceb1d7cfd03ea53042a0f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
 * Copyright (C) 2013-2018 Robin Gareus <robin@gareus.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
#ifndef __ardour_video_monitor_h__
#define __ardour_video_monitor_h__

#include <string>

#include "ardour/ardour.h"
#include "ardour/types.h"
#include "ardour/session.h"
#include "ardour/session_handle.h"
#include "ardour/system_exec.h"

namespace ARDOUR {
	class Session;
}
class PublicEditor;

enum XJSettingOptions {
	XJ_WINDOW_SIZE = 1,
	XJ_WINDOW_POS = 2,
	XJ_WINDOW_ONTOP = 4,
	XJ_LETTERBOX = 8,
	XJ_OSD = 16,
	XJ_OFFSET = 32,
	XJ_FULLSCREEN = 64,
};

/** @class VideoMonitor
 *  @brief communication with xjadeo's remote-control interface
 */
class VideoMonitor : public sigc::trackable , public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
{
	public:
	VideoMonitor (PublicEditor*, std::string);
	virtual ~VideoMonitor ();

	void set_filename (std::string filename);
	void set_fps (float f) {fps = f;}
	bool is_started ();
	bool start ();
	void quit ();
	void open (std::string);

	void set_session (ARDOUR::Session *s);
	void save_session ();
	void query_full_state (bool);
	bool set_custom_setting (const std::string, const std::string);
	const std::string get_custom_setting (const std::string);
	void restore_settings_mask (int i)  { _restore_settings_mask = i;}
	int restore_settings_mask () const { return _restore_settings_mask;}

	void set_offset (ARDOUR::sampleoffset_t);
	void manual_seek (ARDOUR::samplepos_t, bool, ARDOUR::sampleoffset_t);
	void srsupdate ();
	void querystate ();
	bool synced_by_manual_seeks() { return sync_by_manual_seek; }

	sigc::signal<void> Terminated;
	PBD::Signal1<void,std::string> UiState;
	void send_cmd (int what, int param);

#if 1
	void set_debug (bool onoff) { debug_enable = onoff; }
#endif

	protected:
	PublicEditor *editor;
	ARDOUR::SystemExec *process;
	float fps;
	void parse_output (std::string d, size_t s);
	void terminated ();
	void forward_keyevent (unsigned int);

	void parameter_changed (std::string const & p);

	typedef std::map<std::string,std::string> XJSettings;

	int _restore_settings_mask;
	bool skip_setting(std::string);
	XJSettings xjadeo_settings;

	void xjadeo_sync_setup ();
	ARDOUR::samplepos_t manually_seeked_frame;
	ARDOUR::sampleoffset_t video_offset;
	bool sync_by_manual_seek;
	sigc::connection clock_connection;
	sigc::connection state_connection;
	int state_clk_divide;
	int starting;
	int knownstate;
	int osdmode;

	PBD::Signal1<void, unsigned int> XJKeyEvent;
#if 1
	bool debug_enable;
#endif
};

#endif /* __ardour_video_monitor_h__ */