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