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