xref: /haiku/src/add-ons/media/media-add-ons/radeon/Theater.cpp (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /******************************************************************************
2 /
3 /	File:			Theater.cpp
4 /
5 /	Description:	ATI Rage Theater Video Decoder interface.
6 /
7 /	Copyright 2001, Carlos Hasan
8 /
9 *******************************************************************************/
10 
11 #include <Debug.h>
12 #include "Theater.h"
13 #include "VideoIn.h"
14 #include "TheatreReg.h"
15 #include "lendian_bitfield.h"
16 
17 CTheater::CTheater(CRadeon & radeon, int device)
18 	:	fPort(radeon),
19 		fDevice(device),
20 		fClock(C_RADEON_NO_VIDEO_CLOCK),
21 		fTunerPort(0),
22 		fCompositePort(0),
23 		fSVideoPort(0),
24 		fStandard(C_THEATER_NTSC),
25 		fSource(C_THEATER_TUNER),
26 		fBrightness(0),
27 		fContrast(0),
28 		fSaturation(0),
29 		fHue(0),
30 		fDeinterlace(true)
31 {
32 }
33 
34 CTheater::~CTheater(){};
35 
36 uint32 CTheater::Capabilities() const
37 {
38 	uint32 caps = 0;
39 
40 	if (fCompositePort)
41 		caps |= C_VIDEO_IN_HAS_COMPOSITE;
42 	if (fSVideoPort)
43 		caps |= C_VIDEO_IN_HAS_SVIDEO;
44 
45 	return caps;
46 }
47 
48 int CTheater::Register(int index)
49 {
50 	return fPort.Register(fDevice, index);
51 }
52 
53 int CTheater::Register(int index, int mask)
54 {
55 	return fPort.Register(fDevice, index) & mask;
56 }
57 
58 void CTheater::SetRegister(int index, int value)
59 {
60 	fPort.SetRegister(fDevice, index, value);
61 }
62 
63 void CTheater::SetRegister(int index, int mask, int value)
64 {
65 	if ((value & ~mask) != 0)
66 		PRINT(("WARNING: CTheater::SetRegister(0x%04x, 0x%08x, 0x%08x)\n", index, mask, value));
67 
68 	fPort.SetRegister(fDevice, index,
69 		(fPort.Register(fDevice, index) & ~mask) | (value & mask));
70 }
71