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