summaryrefslogtreecommitdiff
path: root/display.h
blob: 7a203e3a5112a85b5064980ed8ac2caf34076e9d (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
/*
 * rpihddevice - VDR HD output device for Raspberry Pi
 * Copyright (C) 2014, 2015, 2016 Thomas Reufer
 *
 * 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 DISPLAY_H
#define DISPLAY_H

#include "tools.h"

class cRpiDisplay
{

public:

	static cRpiDisplay* GetInstance(void);
	static void DropInstance(void);

	static int GetSize(int &width, int &height);
	static int GetSize(int &width, int &height, double &aspect);

	static bool IsProgressive(void);
	static bool IsFixedMode(void);

	static int GetId(void);

	static int Snapshot(unsigned char* frame, int width, int height);

	static int SetVideoFormat(const cVideoFrameFormat *frameFormat);

protected:

	cRpiDisplay(int id, int width, int height, int frameRate, bool interlaced,
			bool fixedMode);
	virtual ~cRpiDisplay();

	int Update(const cVideoFrameFormat *videoFormat);

	virtual int SetMode(int width, int height, int frameRate,
			cScanMode::eMode scanMode) {
		return 0;
	}

	static int SetHvsSyncUpdate(cScanMode::eMode scanMode);

	int m_id;
	int m_width;
	int m_height;
	int m_frameRate;
	bool m_interlaced;
	bool m_fixedMode;

	static cRpiDisplay *s_instance;

private:

	cRpiDisplay(const cRpiDisplay&);
	cRpiDisplay& operator= (const cRpiDisplay&);

};

class cRpiHDMIDisplay : public cRpiDisplay
{

public:

	cRpiHDMIDisplay(int id, int width, int height, int frameRate, bool interlaced,
			int group, int mode);
	virtual ~cRpiHDMIDisplay();

private:

	virtual int SetMode(int width, int height, int frameRate,
			cScanMode::eMode scanMode);
	int SetMode(int group, int mode);

	static void TvServiceCallback(void *data, unsigned int reason,
			unsigned int param1, unsigned int param2);

	class ModeList;
	ModeList *m_modes;

	int m_group;
	int m_mode;

	int m_startGroup;
	int m_startMode;
	bool m_modified;
};

class cRpiDefaultDisplay : public cRpiDisplay
{

public:

	cRpiDefaultDisplay(int id, int width, int height);

};

#endif