1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ 2 /* 3 * video.h 4 * 5 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> 6 * & Ralph Metzler <ralph@convergence.de> 7 * for convergence integrated media GmbH 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public License 11 * as published by the Free Software Foundation; either version 2.1 12 * of the License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 * 23 */ 24 25 #ifndef _UAPI_DVBVIDEO_H_ 26 #define _UAPI_DVBVIDEO_H_ 27 28 #include <linux/types.h> 29 #ifndef __KERNEL__ 30 #include <time.h> 31 #endif 32 33 typedef enum { 34 VIDEO_FORMAT_4_3, /* Select 4:3 format */ 35 VIDEO_FORMAT_16_9, /* Select 16:9 format. */ 36 VIDEO_FORMAT_221_1 /* 2.21:1 */ 37 } video_format_t; 38 39 40 typedef enum { 41 VIDEO_PAN_SCAN, /* use pan and scan format */ 42 VIDEO_LETTER_BOX, /* use letterbox format */ 43 VIDEO_CENTER_CUT_OUT /* use center cut out format */ 44 } video_displayformat_t; 45 46 typedef struct { 47 int w; 48 int h; 49 video_format_t aspect_ratio; 50 } video_size_t; 51 52 typedef enum { 53 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ 54 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream 55 comes from the user through the write 56 system call */ 57 } video_stream_source_t; 58 59 60 typedef enum { 61 VIDEO_STOPPED, /* Video is stopped */ 62 VIDEO_PLAYING, /* Video is currently playing */ 63 VIDEO_FREEZED /* Video is freezed */ 64 } video_play_state_t; 65 66 67 /* Decoder commands */ 68 #define VIDEO_CMD_PLAY (0) 69 #define VIDEO_CMD_STOP (1) 70 #define VIDEO_CMD_FREEZE (2) 71 #define VIDEO_CMD_CONTINUE (3) 72 73 /* Flags for VIDEO_CMD_FREEZE */ 74 #define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0) 75 76 /* Flags for VIDEO_CMD_STOP */ 77 #define VIDEO_CMD_STOP_TO_BLACK (1 << 0) 78 #define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1) 79 80 /* Play input formats: */ 81 /* The decoder has no special format requirements */ 82 #define VIDEO_PLAY_FMT_NONE (0) 83 /* The decoder requires full GOPs */ 84 #define VIDEO_PLAY_FMT_GOP (1) 85 86 /* The structure must be zeroed before use by the application 87 This ensures it can be extended safely in the future. */ 88 struct video_command { 89 __u32 cmd; 90 __u32 flags; 91 union { 92 struct { 93 __u64 pts; 94 } stop; 95 96 struct { 97 /* 0 or 1000 specifies normal speed, 98 1 specifies forward single stepping, 99 -1 specifies backward single stepping, 100 >1: playback at speed/1000 of the normal speed, 101 <-1: reverse playback at (-speed/1000) of the normal speed. */ 102 __s32 speed; 103 __u32 format; 104 } play; 105 106 struct { 107 __u32 data[16]; 108 } raw; 109 }; 110 }; 111 112 /* FIELD_UNKNOWN can be used if the hardware does not know whether 113 the Vsync is for an odd, even or progressive (i.e. non-interlaced) 114 field. */ 115 #define VIDEO_VSYNC_FIELD_UNKNOWN (0) 116 #define VIDEO_VSYNC_FIELD_ODD (1) 117 #define VIDEO_VSYNC_FIELD_EVEN (2) 118 #define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) 119 120 struct video_event { 121 __s32 type; 122 #define VIDEO_EVENT_SIZE_CHANGED 1 123 #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 124 #define VIDEO_EVENT_DECODER_STOPPED 3 125 #define VIDEO_EVENT_VSYNC 4 126 /* unused, make sure to use atomic time for y2038 if it ever gets used */ 127 long timestamp; 128 union { 129 video_size_t size; 130 unsigned int frame_rate; /* in frames per 1000sec */ 131 unsigned char vsync_field; /* unknown/odd/even/progressive */ 132 } u; 133 }; 134 135 136 struct video_status { 137 int video_blank; /* blank video on freeze? */ 138 video_play_state_t play_state; /* current state of playback */ 139 video_stream_source_t stream_source; /* current source (demux/memory) */ 140 video_format_t video_format; /* current aspect ratio of stream*/ 141 video_displayformat_t display_format;/* selected cropping mode */ 142 }; 143 144 145 struct video_still_picture { 146 char __user *iFrame; /* pointer to a single iframe in memory */ 147 __s32 size; 148 }; 149 150 151 typedef __u16 video_attributes_t; 152 /* bits: descr. */ 153 /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ 154 /* 13-12 TV system (0=525/60, 1=625/50) */ 155 /* 11-10 Aspect ratio (0=4:3, 3=16:9) */ 156 /* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */ 157 /* 7 line 21-1 data present in GOP (1=yes, 0=no) */ 158 /* 6 line 21-2 data present in GOP (1=yes, 0=no) */ 159 /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ 160 /* 2 source letterboxed (1=yes, 0=no) */ 161 /* 0 film/camera mode (0= 162 *camera, 1=film (625/50 only)) */ 163 164 165 /* bit definitions for capabilities: */ 166 /* can the hardware decode MPEG1 and/or MPEG2? */ 167 #define VIDEO_CAP_MPEG1 1 168 #define VIDEO_CAP_MPEG2 2 169 /* can you send a system and/or program stream to video device? 170 (you still have to open the video and the audio device but only 171 send the stream to the video device) */ 172 #define VIDEO_CAP_SYS 4 173 #define VIDEO_CAP_PROG 8 174 /* can the driver also handle SPU, NAVI and CSS encoded data? 175 (CSS API is not present yet) */ 176 #define VIDEO_CAP_SPU 16 177 #define VIDEO_CAP_NAVI 32 178 #define VIDEO_CAP_CSS 64 179 180 181 #define VIDEO_STOP _IO('o', 21) 182 #define VIDEO_PLAY _IO('o', 22) 183 #define VIDEO_FREEZE _IO('o', 23) 184 #define VIDEO_CONTINUE _IO('o', 24) 185 #define VIDEO_SELECT_SOURCE _IO('o', 25) 186 #define VIDEO_SET_BLANK _IO('o', 26) 187 #define VIDEO_GET_STATUS _IOR('o', 27, struct video_status) 188 #define VIDEO_GET_EVENT _IOR('o', 28, struct video_event) 189 #define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29) 190 #define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture) 191 #define VIDEO_FAST_FORWARD _IO('o', 31) 192 #define VIDEO_SLOWMOTION _IO('o', 32) 193 #define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int) 194 #define VIDEO_CLEAR_BUFFER _IO('o', 34) 195 #define VIDEO_SET_STREAMTYPE _IO('o', 36) 196 #define VIDEO_SET_FORMAT _IO('o', 37) 197 #define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) 198 199 /** 200 * VIDEO_GET_PTS 201 * 202 * Read the 33 bit presentation time stamp as defined 203 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1. 204 * 205 * The PTS should belong to the currently played 206 * frame if possible, but may also be a value close to it 207 * like the PTS of the last decoded frame or the last PTS 208 * extracted by the PES parser. 209 */ 210 #define VIDEO_GET_PTS _IOR('o', 57, __u64) 211 212 /* Read the number of displayed frames since the decoder was started */ 213 #define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64) 214 215 #define VIDEO_COMMAND _IOWR('o', 59, struct video_command) 216 #define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command) 217 218 #endif /* _UAPI_DVBVIDEO_H_ */ 219