• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* libv4l1 linux/videodev.h replacement file */
2 #ifndef __LINUX_VIDEODEV_H
3 #define __LINUX_VIDEODEV_H
4 
5 #ifdef linux
6 #include <linux/ioctl.h>
7 #endif
8 
9 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
10 #include <sys/ioctl.h>
11 #endif
12 
13 #include <stdint.h>
14 
15 #define VID_TYPE_CAPTURE	1	/* Can capture */
16 #define VID_TYPE_TUNER		2	/* Can tune */
17 #define VID_TYPE_TELETEXT	4	/* Does teletext */
18 #define VID_TYPE_OVERLAY	8	/* Overlay onto frame buffer */
19 #define VID_TYPE_CHROMAKEY	16	/* Overlay by chromakey */
20 #define VID_TYPE_CLIPPING	32	/* Can clip */
21 #define VID_TYPE_FRAMERAM	64	/* Uses the frame buffer memory */
22 #define VID_TYPE_SCALES		128	/* Scalable */
23 #define VID_TYPE_MONOCHROME	256	/* Monochrome only */
24 #define VID_TYPE_SUBCAPTURE	512	/* Can capture subareas of the image */
25 #define VID_TYPE_MPEG_DECODER	1024	/* Can decode MPEG streams */
26 #define VID_TYPE_MPEG_ENCODER	2048	/* Can encode MPEG streams */
27 #define VID_TYPE_MJPEG_DECODER	4096	/* Can decode MJPEG streams */
28 #define VID_TYPE_MJPEG_ENCODER	8192	/* Can encode MJPEG streams */
29 
30 struct video_capability
31 {
32 	char name[32];
33 	int type;
34 	int channels;	/* Num channels */
35 	int audios;	/* Num audio devices */
36 	int maxwidth;	/* Supported width */
37 	int maxheight;	/* And height */
38 	int minwidth;	/* Supported width */
39 	int minheight;	/* And height */
40 };
41 
42 
43 struct video_channel
44 {
45 	int channel;
46 	char name[32];
47 	int tuners;
48 	uint32_t flags;
49 #define VIDEO_VC_TUNER		1	/* Channel has a tuner */
50 #define VIDEO_VC_AUDIO		2	/* Channel has audio */
51 	uint16_t type;
52 #define VIDEO_TYPE_TV		1
53 #define VIDEO_TYPE_CAMERA	2
54 	uint16_t norm;			/* Norm set by channel */
55 };
56 
57 struct video_tuner
58 {
59 	int tuner;
60 	char name[32];
61 	unsigned long rangelow, rangehigh;	/* Tuner range */
62 	uint32_t flags;
63 #define VIDEO_TUNER_PAL		1
64 #define VIDEO_TUNER_NTSC	2
65 #define VIDEO_TUNER_SECAM	4
66 #define VIDEO_TUNER_LOW		8	/* Uses KHz not MHz */
67 #define VIDEO_TUNER_NORM	16	/* Tuner can set norm */
68 #define VIDEO_TUNER_STEREO_ON	128	/* Tuner is seeing stereo */
69 #define VIDEO_TUNER_RDS_ON      256     /* Tuner is seeing an RDS datastream */
70 #define VIDEO_TUNER_MBS_ON      512     /* Tuner is seeing an MBS datastream */
71 	uint16_t mode;			/* PAL/NTSC/SECAM/OTHER */
72 #define VIDEO_MODE_PAL		0
73 #define VIDEO_MODE_NTSC		1
74 #define VIDEO_MODE_SECAM	2
75 #define VIDEO_MODE_AUTO		3
76 	uint16_t signal;			/* Signal strength 16bit scale */
77 };
78 
79 struct video_picture
80 {
81 	uint16_t	brightness;
82 	uint16_t	hue;
83 	uint16_t	colour;
84 	uint16_t	contrast;
85 	uint16_t	whiteness;	/* Black and white only */
86 	uint16_t	depth;		/* Capture depth */
87 	uint16_t	palette;	/* Palette in use */
88 #define VIDEO_PALETTE_GREY	1	/* Linear greyscale */
89 #define VIDEO_PALETTE_HI240	2	/* High 240 cube (BT848) */
90 #define VIDEO_PALETTE_RGB565	3	/* 565 16 bit RGB */
91 #define VIDEO_PALETTE_RGB24	4	/* 24bit RGB */
92 #define VIDEO_PALETTE_RGB32	5	/* 32bit RGB */
93 #define VIDEO_PALETTE_RGB555	6	/* 555 15bit RGB */
94 #define VIDEO_PALETTE_YUV422	7	/* YUV422 capture */
95 #define VIDEO_PALETTE_YUYV	8
96 #define VIDEO_PALETTE_UYVY	9	/* The great thing about standards is ... */
97 #define VIDEO_PALETTE_YUV420	10
98 #define VIDEO_PALETTE_YUV411	11	/* YUV411 capture */
99 #define VIDEO_PALETTE_RAW	12	/* RAW capture (BT848) */
100 #define VIDEO_PALETTE_YUV422P	13	/* YUV 4:2:2 Planar */
101 #define VIDEO_PALETTE_YUV411P	14	/* YUV 4:1:1 Planar */
102 #define VIDEO_PALETTE_YUV420P	15	/* YUV 4:2:0 Planar */
103 #define VIDEO_PALETTE_YUV410P	16	/* YUV 4:1:0 Planar */
104 #define VIDEO_PALETTE_PLANAR	13	/* start of planar entries */
105 #define VIDEO_PALETTE_COMPONENT 7	/* start of component entries */
106 };
107 
108 struct video_audio
109 {
110 	int		audio;		/* Audio channel */
111 	uint16_t	volume;		/* If settable */
112 	uint16_t	bass, treble;
113 	uint32_t	flags;
114 #define VIDEO_AUDIO_MUTE	1
115 #define VIDEO_AUDIO_MUTABLE	2
116 #define VIDEO_AUDIO_VOLUME	4
117 #define VIDEO_AUDIO_BASS	8
118 #define VIDEO_AUDIO_TREBLE	16
119 #define VIDEO_AUDIO_BALANCE	32
120 	char		name[16];
121 #define VIDEO_SOUND_MONO	1
122 #define VIDEO_SOUND_STEREO	2
123 #define VIDEO_SOUND_LANG1	4
124 #define VIDEO_SOUND_LANG2	8
125 	uint16_t	mode;
126 	uint16_t	balance;	/* Stereo balance */
127 	uint16_t	step;		/* Step actual volume uses */
128 };
129 
130 struct video_clip
131 {
132 	int32_t	x,y;
133 	int32_t	width, height;
134 	struct video_clip *next;	/* For user use/driver use only */
135 };
136 
137 struct video_window
138 {
139 	uint32_t	x,y;			/* Position of window */
140 	uint32_t	width,height;		/* Its size */
141 	uint32_t	chromakey;
142 	uint32_t	flags;
143 	struct		video_clip *clips;	/* Set only */
144 	int		clipcount;
145 #define VIDEO_WINDOW_INTERLACE	1
146 #define VIDEO_WINDOW_CHROMAKEY	16		/* Overlay by chromakey */
147 #define VIDEO_CLIP_BITMAP	-1
148 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
149 #define VIDEO_CLIPMAP_SIZE	(128 * 625)
150 };
151 
152 struct video_buffer
153 {
154 	void	*base;
155 	int	height,width;
156 	int	depth;
157 	int	bytesperline;
158 };
159 
160 struct video_mmap
161 {
162 	unsigned	int frame;	/* Frame (0 - n) for double buffer */
163 	int		height,width;
164 	unsigned	int format;	/* should be VIDEO_PALETTE_* */
165 };
166 
167 struct video_mbuf
168 {
169 	int	size;		/* Total memory to map */
170 	int	frames;		/* Frames */
171 	int	offsets[32];
172 };
173 
174 struct vbi_format {
175 	uint32_t	sampling_rate;	/* in Hz */
176 	uint32_t	samples_per_line;
177 	uint32_t	sample_format;	/* VIDEO_PALETTE_RAW only (1 byte) */
178 	int32_t		start[2];	/* starting line for each frame */
179 	uint32_t	count[2];	/* count of lines for each frame */
180 	uint32_t	flags;
181 #define	VBI_UNSYNC	1	/* can distingues between top/bottom field */
182 #define	VBI_INTERLACED	2	/* lines are interlaced */
183 };
184 
185 #define VIDIOCGCAP		_IOR('v',1,struct video_capability)	/* Get capabilities */
186 #define VIDIOCGCHAN		_IOWR('v',2,struct video_channel)	/* Get channel info (sources) */
187 #define VIDIOCSCHAN		_IOW('v',3,struct video_channel)	/* Set channel 	*/
188 #define VIDIOCGTUNER		_IOWR('v',4,struct video_tuner)		/* Get tuner abilities */
189 #define VIDIOCSTUNER		_IOW('v',5,struct video_tuner)		/* Tune the tuner for the current channel */
190 #define VIDIOCGPICT		_IOR('v',6,struct video_picture)	/* Get picture properties */
191 #define VIDIOCSPICT		_IOW('v',7,struct video_picture)	/* Set picture properties */
192 #define VIDIOCCAPTURE		_IOW('v',8,int)				/* Start, end capture */
193 #define VIDIOCGWIN		_IOR('v',9, struct video_window)	/* Get the video overlay window */
194 #define VIDIOCSWIN		_IOW('v',10, struct video_window)	/* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
195 #define VIDIOCGFBUF		_IOR('v',11, struct video_buffer)	/* Get frame buffer */
196 #define VIDIOCSFBUF		_IOW('v',12, struct video_buffer)	/* Set frame buffer - root only */
197 #define VIDIOCGFREQ		_IOR('v',14, unsigned long)		/* Set tuner */
198 #define VIDIOCSFREQ		_IOW('v',15, unsigned long)		/* Set tuner */
199 #define VIDIOCGAUDIO		_IOR('v',16, struct video_audio)	/* Get audio info */
200 #define VIDIOCSAUDIO		_IOW('v',17, struct video_audio)	/* Audio source, mute etc */
201 #define VIDIOCSYNC		_IOW('v',18, int)			/* Sync with mmap grabbing */
202 #define VIDIOCMCAPTURE		_IOW('v',19, struct video_mmap)		/* Grab frames */
203 #define VIDIOCGMBUF		_IOR('v',20, struct video_mbuf)		/* Memory map buffer info */
204 #define	VIDIOCGVBIFMT		_IOR('v',28, struct vbi_format)		/* Get VBI information */
205 #define	VIDIOCSVBIFMT		_IOW('v',29, struct vbi_format)		/* Set VBI information */
206 
207 #endif
208