xref: /haiku/src/add-ons/media/media-add-ons/radeon/Theater.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /******************************************************************************
2 /
3 /	File:			Theater.h
4 /
5 /	Description:	ATI Rage Theater Video Decoder interface.
6 /
7 /	Copyright 2001, Carlos Hasan
8 /
9 *******************************************************************************/
10 
11 #ifndef __THEATER_H__
12 #define __THEATER_H__
13 
14 #include "Radeon.h"
15 #include "VIPPort.h"
16 
17 enum theater_identifier {
18 	C_THEATER_VIP_VENDOR_ID			= 0x1002,
19 	C_THEATER_VIP_DEVICE_ID			= 0x4d54
20 };
21 
22 
23 enum theater_standard {
24 	// TK: rearranged to match spec order
25 	C_THEATER_NTSC			= 0,
26 	C_THEATER_NTSC_JAPAN	= 1,
27 	C_THEATER_NTSC_443		= 2,
28 	C_THEATER_PAL_M			= 3,
29 	C_THEATER_PAL_N			= 4,
30 	C_THEATER_PAL_NC		= 5,
31 	C_THEATER_PAL_BDGHI		= 6,
32 	C_THEATER_PAL_60		= 7,
33 	C_THEATER_SECAM			= 8
34 };
35 
36 enum theater_source {
37 	C_THEATER_TUNER			= 0,
38 	C_THEATER_COMPOSITE		= 1,
39 	C_THEATER_SVIDEO		= 2
40 };
41 
42 
43 class CTheater {
44 public:
45 	CTheater(CRadeon & radeon);
46 
47 	~CTheater();
48 
49 	status_t InitCheck() const;
50 
51 	void Reset();
52 
53 	void SetEnable(bool enable, bool vbi);
54 
55 	void SetStandard(theater_standard standard, theater_source source);
56 
57 	void SetSize(int hactive, int vactive);
58 
59 	void SetDeinterlace(bool deinterlace);
60 
61 	void SetSharpness(int sharpness);
62 
63 	void SetBrightness(int brightness);
64 
65 	void SetContrast(int contrast);
66 
67 	void SetSaturation(int saturation);
68 
69 	void SetHue(int hue);
70 
71 	int CurrentLine();
72 
73 	void getActiveRange( theater_standard standard, CRadeonRect &rect );
74 
75 	void getVBIRange( theater_standard standard, CRadeonRect &rect );
76 
77 	void PrintToStream();
78 
79 private:
80 	void SetClock(theater_standard standard, radeon_video_clock clock);
81 
82 	void SetADC(theater_standard standard, theater_source source);
83 
84 	void SetHSYNC(theater_standard standard);
85 
86 	void WaitHSYNC();
87 
88 	void SetVSYNC(theater_standard standard);
89 
90 	void WaitVSYNC();
91 
92 	void SetSyncGenerator(theater_standard standard);
93 
94 	void SetCombFilter(theater_standard standard, theater_source source);
95 
96 	void SetLuminanceProcessor(theater_standard standard);
97 
98 	void SetLuminanceLevels(theater_standard standard, int brightness, int contrast);
99 
100 	void SetChromaProcessor(theater_standard standard);
101 
102 	void SetChromaLevels(theater_standard standard, int saturation, int hue);
103 
104 	void SetClipWindow(theater_standard standard, bool vbi);
105 
106 	void SetScaler(theater_standard standard, int hactive, int vactive, bool deinterlace);
107 
108 public:
109 	int Register(int index);
110 
111 	int Register(int index, int mask);
112 
113 	void SetRegister(int index, int value);
114 
115 	void SetRegister(int index, int mask, int value);
116 
117 private:
118 	CVIPPort fPort;
119 	int fDevice;
120 	radeon_video_clock fClock;
121 	int fTunerPort;
122 	int fCompositePort;
123 	int fSVideoPort;
124 	theater_standard fStandard;
125 	theater_source fSource;
126 	int fBrightness;
127 	int fContrast;
128 	int fSaturation;
129 	int fHue;
130 	int fHActive;
131 	int fVActive;
132 	bool fDeinterlace;
133 };
134 
135 #endif
136