xref: /haiku/src/add-ons/media/media-add-ons/radeon/Capture.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 /******************************************************************************
2 /
3 /	File:			Capture.h
4 /
5 /	Description:	ATI Radeon Capture Unit interface.
6 /
7 /	Copyright 2001, Carlos Hasan
8 /
9 *******************************************************************************/
10 
11 #ifndef __CAPTURE_H__
12 #define __CAPTURE_H__
13 
14 #include "Radeon.h"
15 
16 enum capture_buffer_mode {
17 	C_RADEON_CAPTURE_FIELD_SINGLE	= 0,
18 	C_RADEON_CAPTURE_FIELD_DOUBLE	= 1,
19 	C_RADEON_CAPTURE_BOB_SINGLE		= 2,
20 	C_RADEON_CAPTURE_BOB_DOUBLE		= 3,
21 	C_RADEON_CAPTURE_WEAVE_SINGLE	= 4,
22 	C_RADEON_CAPTURE_WEAVE_DOUBLE	= 5
23 };
24 
25 enum capture_stream_format {
26 	C_RADEON_CAPTURE_BROOKTREE		= 0,
27 	C_RADEON_CAPTURE_CCIR656		= 1,
28 	C_RADEON_CAPTURE_ZOOMVIDEO		= 2,
29 	C_RADEON_CAPTURE_VIP			= 3
30 };
31 
32 enum capture_interrupt_mask {
33 	C_RADEON_CAPTURE_BUF0_INT		= 1 << 0,
34 	C_RADEON_CAPTURE_BUF0_EVEN_INT	= 1 << 1,
35 	C_RADEON_CAPTURE_BUF1_INT		= 1 << 2,
36 	C_RADEON_CAPTURE_BUF1_EVEN_INT	= 1 << 3,
37 	C_RADEON_CAPTURE_VBI0_INT		= 1 << 4,
38 	C_RADEON_CAPTURE_VBI1_INT		= 1 << 5
39 };
40 
41 class CCapture {
42 public:
43 	CCapture(CRadeon & radeon);
44 
45 	~CCapture();
46 
47 	status_t InitCheck() const;
48 
49 	void SetBuffer(capture_stream_format format, capture_buffer_mode mode,
50 				   int offset0, int offset1, int size, int pitch);
51 
52 	void SetClip(int left, int top, int right, int bottom);
53 
54 	void SetVBIBuffer(int offset0, int offset1, int size);
55 
56 	void SetVBIClip(int left, int top, int right, int bottom);
57 
58 	void Start(bool vbi = false);
59 
60 	void Stop();
61 
62 public:
63 	void SetInterrupts(bool enable);
64 
65 	int WaitInterrupts(int * sequence, bigtime_t * when, bigtime_t timeout);
66 
67 private:
68 	int Register(radeon_register index, int mask);
69 
70 	void SetRegister(radeon_register index, int value);
71 
72 	void SetRegister(radeon_register index, int mask, int value);
73 
74 private:
75 	CRadeon & fRadeon;
76 	capture_buffer_mode fMode;
77 	capture_stream_format fFormat;
78 	int fOffset0;
79 	int fOffset1;
80 	int fVBIOffset0;
81 	int fVBIOffset1;
82 	int fSize;
83 	int fVBISize;
84 	int fPitch;
85 	CRadeonRect fClip;
86 	CRadeonRect fVBIClip;
87 };
88 
89 #endif
90