summaryrefslogtreecommitdiff
path: root/display.h
blob: d954a2e55efd58f04cbb96ccf8518ae9c33235f0 (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
/*
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */

#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 cRpiVideoPort::ePort GetVideoPort(void);
	static bool IsProgressive(void);

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

	static int SetVideoFormat(int width, int height, int frameRate,
			bool interlaced);

protected:

	cRpiDisplay(int width, int height, int frameRate,
			cRpiVideoPort::ePort port);
	virtual ~cRpiDisplay();

	int Update(int width, int height, int frameRate, bool interlaced);

	virtual int SetMode(int width, int height, int frameRate, bool interlaced) {
		return -1;
	}

	int m_width;
	int m_height;
	int m_frameRate;
	bool m_interlaced;
	cRpiVideoPort::ePort m_port;

	static cRpiDisplay *s_instance;

private:

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

};

class cRpiHDMIDisplay : public cRpiDisplay
{

public:

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

private:

	virtual int SetMode(int width, int height, int frameRate, bool interlaced);
	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 cRpiCompositeDisplay : public cRpiDisplay
{

public:

	cRpiCompositeDisplay(int width, int height, int frameRate);

private:

	virtual int SetMode(int width, int height, int frameRate, bool interlaced) {
		return 0;
	}
};

#endif