vdr  2.4.7
video.h
Go to the documentation of this file.
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  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24  *
25  */
26 
27 #ifndef _DVBVIDEO_H_
28 #define _DVBVIDEO_H_
29 
30 #include <linux/types.h>
31 #include <time.h>
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 */
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 */
45 
46 typedef struct {
47  int w;
48  int h;
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 */
58 
59 
60 typedef enum {
61  VIDEO_STOPPED, /* Video is stopped */
62  VIDEO_PLAYING, /* Video is currently playing */
63  VIDEO_FREEZED /* Video is freezed */
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 {
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 
146  char *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 
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 /* _DVBVIDEO_H_ */
__u32 cmd
Definition: video.h:89
__u32 flags
Definition: video.h:90
__s32 speed
Definition: video.h:102
struct video_command::@11::@13 stop
struct video_command::@11::@14 play
__u64 pts
Definition: video.h:93
__u32 format
Definition: video.h:103
struct video_command::@11::@15 raw
__u32 data[16]
Definition: video.h:107
union video_event::@16 u
video_size_t size
Definition: video.h:129
long timestamp
Definition: video.h:127
unsigned int frame_rate
Definition: video.h:130
unsigned char vsync_field
Definition: video.h:131
__s32 type
Definition: video.h:121
int h
Definition: video.h:48
int w
Definition: video.h:47
video_format_t aspect_ratio
Definition: video.h:49
video_stream_source_t stream_source
Definition: video.h:139
int video_blank
Definition: video.h:137
video_play_state_t play_state
Definition: video.h:138
video_format_t video_format
Definition: video.h:140
video_displayformat_t display_format
Definition: video.h:141
video_play_state_t
Definition: video.h:60
@ VIDEO_FREEZED
Definition: video.h:63
@ VIDEO_PLAYING
Definition: video.h:62
@ VIDEO_STOPPED
Definition: video.h:61
video_stream_source_t
Definition: video.h:52
@ VIDEO_SOURCE_DEMUX
Definition: video.h:53
@ VIDEO_SOURCE_MEMORY
Definition: video.h:54
video_displayformat_t
Definition: video.h:40
@ VIDEO_PAN_SCAN
Definition: video.h:41
@ VIDEO_CENTER_CUT_OUT
Definition: video.h:43
@ VIDEO_LETTER_BOX
Definition: video.h:42
video_format_t
Definition: video.h:33
@ VIDEO_FORMAT_16_9
Definition: video.h:35
@ VIDEO_FORMAT_4_3
Definition: video.h:34
@ VIDEO_FORMAT_221_1
Definition: video.h:36
__u16 video_attributes_t
Definition: video.h:151