vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / media / media-add-ons / radeon / CC.h
blobb011b69ec4310beea5c3206923b0e3862ad21e52
1 /******************************************************************************
3 / File: CC.h
5 / Description: Closed caption module.
7 / Copyright 2001, Carlos Hasan
9 *******************************************************************************/
11 #ifndef __CC_H__
12 #define __CC_H__
14 #include "Capture.h"
16 enum cc_mode {
17 C_RADEON_CC1 = 0,
18 C_RADEON_CC2 = 1,
19 C_RADEON_CC3 = 2,
20 C_RADEON_CC4 = 3
23 enum cc_window {
24 C_RADEON_CC_VBI_LINE_WIDTH = 2048,
25 C_RADEON_CC_BLANK_START = 4*112,
26 C_RADEON_CC_VBI_LINE_NUMBER = 19,
27 C_RADEON_CC_BIT_DURATION = 56,
28 C_RADEON_CC_BITS_PER_FIELD = 16,
29 C_RADEON_CC_LEVEL_THRESHOLD = 32,
31 C_RADEON_CC_LINE = 21,
33 C_RADEON_CC_CHANNELS = 4,
34 C_RADEON_CC_ROWS = 15,
35 C_RADEON_CC_COLUMNS = 32
38 class CCaption {
39 public:
40 CCaption(CCapture & capture);
42 ~CCaption();
44 status_t InitCheck() const;
46 void SetMode(cc_mode mode);
48 bool Decode(const unsigned char * buffer0,
49 const unsigned char * buffer1);
51 private:
52 bool DecodeBits(const unsigned char * buffer, int & data);
54 void DisplayCaptions() const;
56 private:
57 CCapture & fCapture;
58 cc_mode fChannel;
59 int fRow;
60 int fColumn;
61 int fColor;
62 int fLastControlCode;
63 short fText[C_RADEON_CC_ROWS][C_RADEON_CC_COLUMNS];
64 short fDisplayText[C_RADEON_CC_ROWS][C_RADEON_CC_COLUMNS];
67 #endif