Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
0002 /*
0003  * video.h - DEPRECATED MPEG-TS video decoder API
0004  *
0005  * NOTE: should not be used on future drivers
0006  *
0007  * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
0008  *                  & Ralph  Metzler <ralph@convergence.de>
0009  *                    for convergence integrated media GmbH
0010  *
0011  * This program is free software; you can redistribute it and/or
0012  * modify it under the terms of the GNU Lesser General Public License
0013  * as published by the Free Software Foundation; either version 2.1
0014  * of the License, or (at your option) any later version.
0015  *
0016  * This program is distributed in the hope that it will be useful,
0017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0019  * GNU General Public License for more details.
0020  *
0021  * You should have received a copy of the GNU Lesser General Public License
0022  * along with this program; if not, write to the Free Software
0023  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
0024  *
0025  */
0026 
0027 #ifndef _UAPI_DVBVIDEO_H_
0028 #define _UAPI_DVBVIDEO_H_
0029 
0030 #include <linux/types.h>
0031 #ifndef __KERNEL__
0032 #include <time.h>
0033 #endif
0034 
0035 typedef enum {
0036     VIDEO_FORMAT_4_3,     /* Select 4:3 format */
0037     VIDEO_FORMAT_16_9,    /* Select 16:9 format. */
0038     VIDEO_FORMAT_221_1    /* 2.21:1 */
0039 } video_format_t;
0040 
0041 
0042 typedef enum {
0043     VIDEO_PAN_SCAN,       /* use pan and scan format */
0044     VIDEO_LETTER_BOX,     /* use letterbox format */
0045     VIDEO_CENTER_CUT_OUT  /* use center cut out format */
0046 } video_displayformat_t;
0047 
0048 typedef struct {
0049     int w;
0050     int h;
0051     video_format_t aspect_ratio;
0052 } video_size_t;
0053 
0054 typedef enum {
0055     VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
0056     VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
0057                    comes from the user through the write
0058                    system call */
0059 } video_stream_source_t;
0060 
0061 
0062 typedef enum {
0063     VIDEO_STOPPED, /* Video is stopped */
0064     VIDEO_PLAYING, /* Video is currently playing */
0065     VIDEO_FREEZED  /* Video is freezed */
0066 } video_play_state_t;
0067 
0068 
0069 /* Decoder commands */
0070 #define VIDEO_CMD_PLAY        (0)
0071 #define VIDEO_CMD_STOP        (1)
0072 #define VIDEO_CMD_FREEZE      (2)
0073 #define VIDEO_CMD_CONTINUE    (3)
0074 
0075 /* Flags for VIDEO_CMD_FREEZE */
0076 #define VIDEO_CMD_FREEZE_TO_BLACK   (1 << 0)
0077 
0078 /* Flags for VIDEO_CMD_STOP */
0079 #define VIDEO_CMD_STOP_TO_BLACK     (1 << 0)
0080 #define VIDEO_CMD_STOP_IMMEDIATELY  (1 << 1)
0081 
0082 /* Play input formats: */
0083 /* The decoder has no special format requirements */
0084 #define VIDEO_PLAY_FMT_NONE         (0)
0085 /* The decoder requires full GOPs */
0086 #define VIDEO_PLAY_FMT_GOP          (1)
0087 
0088 /* The structure must be zeroed before use by the application
0089    This ensures it can be extended safely in the future. */
0090 struct video_command {
0091     __u32 cmd;
0092     __u32 flags;
0093     union {
0094         struct {
0095             __u64 pts;
0096         } stop;
0097 
0098         struct {
0099             /* 0 or 1000 specifies normal speed,
0100                1 specifies forward single stepping,
0101                -1 specifies backward single stepping,
0102                >1: playback at speed/1000 of the normal speed,
0103                <-1: reverse playback at (-speed/1000) of the normal speed. */
0104             __s32 speed;
0105             __u32 format;
0106         } play;
0107 
0108         struct {
0109             __u32 data[16];
0110         } raw;
0111     };
0112 };
0113 
0114 /* FIELD_UNKNOWN can be used if the hardware does not know whether
0115    the Vsync is for an odd, even or progressive (i.e. non-interlaced)
0116    field. */
0117 #define VIDEO_VSYNC_FIELD_UNKNOWN   (0)
0118 #define VIDEO_VSYNC_FIELD_ODD       (1)
0119 #define VIDEO_VSYNC_FIELD_EVEN      (2)
0120 #define VIDEO_VSYNC_FIELD_PROGRESSIVE   (3)
0121 
0122 struct video_event {
0123     __s32 type;
0124 #define VIDEO_EVENT_SIZE_CHANGED    1
0125 #define VIDEO_EVENT_FRAME_RATE_CHANGED  2
0126 #define VIDEO_EVENT_DECODER_STOPPED 3
0127 #define VIDEO_EVENT_VSYNC       4
0128     /* unused, make sure to use atomic time for y2038 if it ever gets used */
0129     long timestamp;
0130     union {
0131         video_size_t size;
0132         unsigned int frame_rate;    /* in frames per 1000sec */
0133         unsigned char vsync_field;  /* unknown/odd/even/progressive */
0134     } u;
0135 };
0136 
0137 
0138 struct video_status {
0139     int                   video_blank;   /* blank video on freeze? */
0140     video_play_state_t    play_state;    /* current state of playback */
0141     video_stream_source_t stream_source; /* current source (demux/memory) */
0142     video_format_t        video_format;  /* current aspect ratio of stream*/
0143     video_displayformat_t display_format;/* selected cropping mode */
0144 };
0145 
0146 
0147 struct video_still_picture {
0148     char __user *iFrame;        /* pointer to a single iframe in memory */
0149     __s32 size;
0150 };
0151 
0152 
0153 typedef __u16 video_attributes_t;
0154 /*   bits: descr. */
0155 /*   15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
0156 /*   13-12 TV system (0=525/60, 1=625/50) */
0157 /*   11-10 Aspect ratio (0=4:3, 3=16:9) */
0158 /*    9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
0159 /*    7    line 21-1 data present in GOP (1=yes, 0=no) */
0160 /*    6    line 21-2 data present in GOP (1=yes, 0=no) */
0161 /*    5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
0162 /*    2    source letterboxed (1=yes, 0=no) */
0163 /*    0    film/camera mode (0=
0164  *camera, 1=film (625/50 only)) */
0165 
0166 
0167 /* bit definitions for capabilities: */
0168 /* can the hardware decode MPEG1 and/or MPEG2? */
0169 #define VIDEO_CAP_MPEG1   1
0170 #define VIDEO_CAP_MPEG2   2
0171 /* can you send a system and/or program stream to video device?
0172    (you still have to open the video and the audio device but only
0173     send the stream to the video device) */
0174 #define VIDEO_CAP_SYS     4
0175 #define VIDEO_CAP_PROG    8
0176 /* can the driver also handle SPU, NAVI and CSS encoded data?
0177    (CSS API is not present yet) */
0178 #define VIDEO_CAP_SPU    16
0179 #define VIDEO_CAP_NAVI   32
0180 #define VIDEO_CAP_CSS    64
0181 
0182 
0183 #define VIDEO_STOP                 _IO('o', 21)
0184 #define VIDEO_PLAY                 _IO('o', 22)
0185 #define VIDEO_FREEZE               _IO('o', 23)
0186 #define VIDEO_CONTINUE             _IO('o', 24)
0187 #define VIDEO_SELECT_SOURCE        _IO('o', 25)
0188 #define VIDEO_SET_BLANK            _IO('o', 26)
0189 #define VIDEO_GET_STATUS           _IOR('o', 27, struct video_status)
0190 #define VIDEO_GET_EVENT            _IOR('o', 28, struct video_event)
0191 #define VIDEO_SET_DISPLAY_FORMAT   _IO('o', 29)
0192 #define VIDEO_STILLPICTURE         _IOW('o', 30, struct video_still_picture)
0193 #define VIDEO_FAST_FORWARD         _IO('o', 31)
0194 #define VIDEO_SLOWMOTION           _IO('o', 32)
0195 #define VIDEO_GET_CAPABILITIES     _IOR('o', 33, unsigned int)
0196 #define VIDEO_CLEAR_BUFFER         _IO('o',  34)
0197 #define VIDEO_SET_STREAMTYPE       _IO('o', 36)
0198 #define VIDEO_SET_FORMAT           _IO('o', 37)
0199 #define VIDEO_GET_SIZE             _IOR('o', 55, video_size_t)
0200 
0201 /**
0202  * VIDEO_GET_PTS
0203  *
0204  * Read the 33 bit presentation time stamp as defined
0205  * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
0206  *
0207  * The PTS should belong to the currently played
0208  * frame if possible, but may also be a value close to it
0209  * like the PTS of the last decoded frame or the last PTS
0210  * extracted by the PES parser.
0211  */
0212 #define VIDEO_GET_PTS              _IOR('o', 57, __u64)
0213 
0214 /* Read the number of displayed frames since the decoder was started */
0215 #define VIDEO_GET_FRAME_COUNT      _IOR('o', 58, __u64)
0216 
0217 #define VIDEO_COMMAND          _IOWR('o', 59, struct video_command)
0218 #define VIDEO_TRY_COMMAND      _IOWR('o', 60, struct video_command)
0219 
0220 #endif /* _UAPI_DVBVIDEO_H_ */