vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / media / media-add-ons / radeon / Theater.cpp
blob7f6a02655deaa706e08d4342c0e57d04acf218f3
1 /******************************************************************************
3 / File: Theater.cpp
5 / Description: ATI Rage Theater Video Decoder interface.
7 / Copyright 2001, Carlos Hasan
9 *******************************************************************************/
11 #include <Debug.h>
12 #include "Theater.h"
13 #include "VideoIn.h"
14 #include "TheatreReg.h"
15 #include "lendian_bitfield.h"
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)
34 CTheater::~CTheater(){};
36 uint32 CTheater::Capabilities() const
38 uint32 caps = 0;
40 if (fCompositePort)
41 caps |= C_VIDEO_IN_HAS_COMPOSITE;
42 if (fSVideoPort)
43 caps |= C_VIDEO_IN_HAS_SVIDEO;
45 return caps;
48 int CTheater::Register(int index)
50 return fPort.Register(fDevice, index);
53 int CTheater::Register(int index, int mask)
55 return fPort.Register(fDevice, index) & mask;
58 void CTheater::SetRegister(int index, int value)
60 fPort.SetRegister(fDevice, index, value);
63 void CTheater::SetRegister(int index, int mask, int value)
65 if ((value & ~mask) != 0)
66 PRINT(("WARNING: CTheater::SetRegister(0x%04x, 0x%08x, 0x%08x)\n", index, mask, value));
68 fPort.SetRegister(fDevice, index,
69 (fPort.Register(fDevice, index) & ~mask) | (value & mask));