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