xref: /haiku/src/add-ons/media/media-add-ons/radeon/CC.h (revision ffec4cb14d0b87745137bcb115e949f1fbc895b9)
1 /******************************************************************************
2 /
3 /	File:			CC.h
4 /
5 /	Description:	Closed caption module.
6 /
7 /	Copyright 2001, Carlos Hasan
8 /
9 *******************************************************************************/
10 
11 #ifndef __CC_H__
12 #define __CC_H__
13 
14 #include "Capture.h"
15 
16 enum cc_mode {
17 	C_RADEON_CC1	= 0,
18 	C_RADEON_CC2	= 1,
19 	C_RADEON_CC3	= 2,
20 	C_RADEON_CC4	= 3
21 };
22 
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,
30 
31 	C_RADEON_CC_LINE			= 21,
32 
33 	C_RADEON_CC_CHANNELS		= 4,
34 	C_RADEON_CC_ROWS			= 15,
35 	C_RADEON_CC_COLUMNS			= 32
36 };
37 
38 class CCaption {
39 public:
40 	CCaption(CCapture & capture);
41 
42 	~CCaption();
43 
44 	status_t InitCheck() const;
45 
46 	void SetMode(cc_mode mode);
47 
48 	bool Decode(const unsigned char * buffer0,
49 				const unsigned char * buffer1);
50 
51 private:
52 	bool DecodeBits(const unsigned char * buffer, int & data);
53 
54 	void DisplayCaptions() const;
55 
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];
65 };
66 
67 #endif
68