doc-rst: linux_tv: Error codes should be const
[deliverable/linux.git] / Documentation / linux_tv / video.h.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 file: video.h
4 =============
5
6 .. code-block:: c
7
8 /*
9 * video.h
10 *
11 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
12 * & Ralph Metzler <ralph@convergence.de>
13 * for convergence integrated media GmbH
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public License
17 * as published by the Free Software Foundation; either version 2.1
18 * of the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 *
29 */
30
31 #ifndef _UAPI_DVBVIDEO_H_
32 #define _UAPI_DVBVIDEO_H_
33
34 #include <linux/types.h>
35 #ifndef __KERNEL__
36 #include <time.h>
37 #endif
38
39 typedef enum {
40 VIDEO_FORMAT_4_3, /* Select 4:3 format */
41 VIDEO_FORMAT_16_9, /* Select 16:9 format. */
42 VIDEO_FORMAT_221_1 /* 2.21:1 */
43 } video_format_t;
44
45
46 typedef enum {
47 VIDEO_SYSTEM_PAL,
48 VIDEO_SYSTEM_NTSC,
49 VIDEO_SYSTEM_PALN,
50 VIDEO_SYSTEM_PALNc,
51 VIDEO_SYSTEM_PALM,
52 VIDEO_SYSTEM_NTSC60,
53 VIDEO_SYSTEM_PAL60,
54 VIDEO_SYSTEM_PALM60
55 } video_system_t;
56
57
58 typedef enum {
59 VIDEO_PAN_SCAN, /* use pan and scan format */
60 VIDEO_LETTER_BOX, /* use letterbox format */
61 VIDEO_CENTER_CUT_OUT /* use center cut out format */
62 } video_displayformat_t;
63
64 typedef struct {
65 int w;
66 int h;
67 video_format_t aspect_ratio;
68 } video_size_t;
69
70 typedef enum {
71 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
72 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
73 comes from the user through the write
74 system call */
75 } video_stream_source_t;
76
77
78 typedef enum {
79 VIDEO_STOPPED, /* Video is stopped */
80 VIDEO_PLAYING, /* Video is currently playing */
81 VIDEO_FREEZED /* Video is freezed */
82 } video_play_state_t;
83
84
85 /* Decoder commands */
86 #define VIDEO_CMD_PLAY (0)
87 #define VIDEO_CMD_STOP (1)
88 #define VIDEO_CMD_FREEZE (2)
89 #define VIDEO_CMD_CONTINUE (3)
90
91 /* Flags for VIDEO_CMD_FREEZE */
92 #define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
93
94 /* Flags for VIDEO_CMD_STOP */
95 #define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
96 #define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
97
98 /* Play input formats: */
99 /* The decoder has no special format requirements */
100 #define VIDEO_PLAY_FMT_NONE (0)
101 /* The decoder requires full GOPs */
102 #define VIDEO_PLAY_FMT_GOP (1)
103
104 /* The structure must be zeroed before use by the application
105 This ensures it can be extended safely in the future. */
106 struct video_command {
107 __u32 cmd;
108 __u32 flags;
109 union {
110 struct {
111 __u64 pts;
112 } stop;
113
114 struct {
115 /* 0 or 1000 specifies normal speed,
116 1 specifies forward single stepping,
117 -1 specifies backward single stepping,
118 >1: playback at speed/1000 of the normal speed,
119 <-1: reverse playback at (-speed/1000) of the normal speed. */
120 __s32 speed;
121 __u32 format;
122 } play;
123
124 struct {
125 __u32 data[16];
126 } raw;
127 };
128 };
129
130 /* FIELD_UNKNOWN can be used if the hardware does not know whether
131 the Vsync is for an odd, even or progressive (i.e.ie; non-interlaced)
132 field. */
133 #define VIDEO_VSYNC_FIELD_UNKNOWN (0)
134 #define VIDEO_VSYNC_FIELD_ODD (1)
135 #define VIDEO_VSYNC_FIELD_EVEN (2)
136 #define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
137
138 struct video_event {
139 __s32 type;
140 #define VIDEO_EVENT_SIZE_CHANGED 1
141 #define VIDEO_EVENT_FRAME_RATE_CHANGED 2
142 #define VIDEO_EVENT_DECODER_STOPPED 3
143 #define VIDEO_EVENT_VSYNC 4
144 __kernel_time_t timestamp;
145 union {
146 video_size_t size;
147 unsigned int frame_rate; /* in frames per 1000sec */
148 unsigned char vsync_field; /* unknown/odd/even/progressive */
149 } u;
150 };
151
152
153 struct video_status {
154 int video_blank; /* blank video on freeze? */
155 video_play_state_t play_state; /* current state of playback */
156 video_stream_source_t stream_source; /* current source (demux/memory) */
157 video_format_t video_format; /* current aspect ratio of stream*/
158 video_displayformat_t display_format;/* selected cropping mode */
159 };
160
161
162 struct video_still_picture {
163 char __user *iFrame; /* pointer to a single iframe in memory */
164 __s32 size;
165 };
166
167
168 typedef
169 struct video_highlight {
170 int active; /* 1=show highlight, 0=hide highlight */
171 __u8 contrast1; /* 7- 4 Pattern pixel contrast */
172 /* 3- 0 Background pixel contrast */
173 __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */
174 /* 3- 0 Emphasis pixel-1 contrast */
175 __u8 color1; /* 7- 4 Pattern pixel color */
176 /* 3- 0 Background pixel color */
177 __u8 color2; /* 7- 4 Emphasis pixel-2 color */
178 /* 3- 0 Emphasis pixel-1 color */
179 __u32 ypos; /* 23-22 auto action mode */
180 /* 21-12 start y */
181 /* 9- 0 end y */
182 __u32 xpos; /* 23-22 button color number */
183 /* 21-12 start x */
184 /* 9- 0 end x */
185 } video_highlight_t;
186
187
188 typedef struct video_spu {
189 int active;
190 int stream_id;
191 } video_spu_t;
192
193
194 typedef struct video_spu_palette { /* SPU Palette information */
195 int length;
196 __u8 __user *palette;
197 } video_spu_palette_t;
198
199
200 typedef struct video_navi_pack {
201 int length; /* 0 ... 1024 */
202 __u8 data[1024];
203 } video_navi_pack_t;
204
205
206 typedef __u16 video_attributes_t;
207 /* bits: descr. */
208 /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
209 /* 13-12 TV system (0=525/60, 1=625/50) */
210 /* 11-10 Aspect ratio (0=4:3, 3=16:9) */
211 /* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
212 /* 7 line 21-1 data present in GOP (1=yes, 0=no) */
213 /* 6 line 21-2 data present in GOP (1=yes, 0=no) */
214 /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
215 /* 2 source letterboxed (1=yes, 0=no) */
216 /* 0 film/camera mode (0=camera, 1=film (625/50 only)) */
217
218
219 /* bit definitions for capabilities: */
220 /* can the hardware decode MPEG1 and/or MPEG2? */
221 #define VIDEO_CAP_MPEG1 1
222 #define VIDEO_CAP_MPEG2 2
223 /* can you send a system and/or program stream to video device?
224 (you still have to open the video and the audio device but only
225 send the stream to the video device) */
226 #define VIDEO_CAP_SYS 4
227 #define VIDEO_CAP_PROG 8
228 /* can the driver also handle SPU, NAVI and CSS encoded data?
229 (CSS API is not present yet) */
230 #define VIDEO_CAP_SPU 16
231 #define VIDEO_CAP_NAVI 32
232 #define VIDEO_CAP_CSS 64
233
234
235 #define VIDEO_STOP _IO('o', 21)
236 #define VIDEO_PLAY _IO('o', 22)
237 #define VIDEO_FREEZE _IO('o', 23)
238 #define VIDEO_CONTINUE _IO('o', 24)
239 #define VIDEO_SELECT_SOURCE _IO('o', 25)
240 #define VIDEO_SET_BLANK _IO('o', 26)
241 #define VIDEO_GET_STATUS _IOR('o', 27, struct video_status)
242 #define VIDEO_GET_EVENT _IOR('o', 28, struct video_event)
243 #define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29)
244 #define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture)
245 #define VIDEO_FAST_FORWARD _IO('o', 31)
246 #define VIDEO_SLOWMOTION _IO('o', 32)
247 #define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int)
248 #define VIDEO_CLEAR_BUFFER _IO('o', 34)
249 #define VIDEO_SET_ID _IO('o', 35)
250 #define VIDEO_SET_STREAMTYPE _IO('o', 36)
251 #define VIDEO_SET_FORMAT _IO('o', 37)
252 #define VIDEO_SET_SYSTEM _IO('o', 38)
253 #define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t)
254 #define VIDEO_SET_SPU _IOW('o', 50, video_spu_t)
255 #define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t)
256 #define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
257 #define VIDEO_SET_ATTRIBUTES _IO('o', 53)
258 #define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
259 #define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
260
261 /**
262 * VIDEO_GET_PTS
263 *
264 * Read the 33 bit presentation time stamp as defined
265 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
266 *
267 * The PTS should belong to the currently played
268 * frame if possible, but may also be a value close to it
269 * like the PTS of the last decoded frame or the last PTS
270 * extracted by the PES parser.
271 */
272 #define VIDEO_GET_PTS _IOR('o', 57, __u64)
273
274 /* Read the number of displayed frames since the decoder was started */
275 #define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
276
277 #define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
278 #define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
279
280 #endif /* _UAPI_DVBVIDEO_H_ */
281
282
283
284
285 .. ------------------------------------------------------------------------------
286 .. This file was automatically converted from DocBook-XML with the dbxml
287 .. library (https://github.com/return42/sphkerneldoc). The origin XML comes
288 .. from the linux kernel, refer to:
289 ..
290 .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
291 .. ------------------------------------------------------------------------------
This page took 0.074923 seconds and 5 git commands to generate.