blob: a96da40c50f51834f269f11fc9bebc64ef2585c1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * video.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23
24#ifndef _DVBVIDEO_H_
25#define _DVBVIDEO_H_
26
27#include <linux/compiler.h>
28
29#ifdef __KERNEL__
30#include <linux/types.h>
31#else
32#include <stdint.h>
33#include <time.h>
34#endif
35
36
37typedef enum {
38 VIDEO_FORMAT_4_3, /* Select 4:3 format */
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080039 VIDEO_FORMAT_16_9, /* Select 16:9 format. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 VIDEO_FORMAT_221_1 /* 2.21:1 */
41} video_format_t;
42
43
44typedef enum {
45 VIDEO_SYSTEM_PAL,
46 VIDEO_SYSTEM_NTSC,
47 VIDEO_SYSTEM_PALN,
48 VIDEO_SYSTEM_PALNc,
49 VIDEO_SYSTEM_PALM,
50 VIDEO_SYSTEM_NTSC60,
51 VIDEO_SYSTEM_PAL60,
52 VIDEO_SYSTEM_PALM60
53} video_system_t;
54
55
56typedef enum {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080057 VIDEO_PAN_SCAN, /* use pan and scan format */
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 VIDEO_LETTER_BOX, /* use letterbox format */
59 VIDEO_CENTER_CUT_OUT /* use center cut out format */
60} video_displayformat_t;
61
62typedef struct {
63 int w;
64 int h;
65 video_format_t aspect_ratio;
66} video_size_t;
67
68typedef enum {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080069 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
71 comes from the user through the write
72 system call */
73} video_stream_source_t;
74
75
76typedef enum {
77 VIDEO_STOPPED, /* Video is stopped */
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080078 VIDEO_PLAYING, /* Video is currently playing */
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 VIDEO_FREEZED /* Video is freezed */
80} video_play_state_t;
81
82
Hans Verkuil2435be12007-04-27 12:31:09 -030083/* Decoder commands */
84#define VIDEO_CMD_PLAY (0)
85#define VIDEO_CMD_STOP (1)
86#define VIDEO_CMD_FREEZE (2)
87#define VIDEO_CMD_CONTINUE (3)
88
89/* Flags for VIDEO_CMD_FREEZE */
90#define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
91
92/* Flags for VIDEO_CMD_STOP */
93#define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
94#define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
95
96/* Play input formats: */
97/* The decoder has no special format requirements */
98#define VIDEO_PLAY_FMT_NONE (0)
99/* The decoder requires full GOPs */
100#define VIDEO_PLAY_FMT_GOP (1)
101
102/* The structure must be zeroed before use by the application
103 This ensures it can be extended safely in the future. */
104struct video_command {
105 __u32 cmd;
106 __u32 flags;
107 union {
108 struct {
109 __u64 pts;
110 } stop;
111
112 struct {
113 __u32 speed;
114 __u32 format;
115 } play;
116
117 struct {
118 __u32 data[16];
119 } raw;
120 };
121};
122
123
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124struct video_event {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800125 int32_t type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126#define VIDEO_EVENT_SIZE_CHANGED 1
127#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
Hans Verkuil2435be12007-04-27 12:31:09 -0300128#define VIDEO_EVENT_DECODER_STOPPED 3
129#define VIDEO_EVENT_VSYNC 4
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800130 time_t timestamp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 union {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800132 video_size_t size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 unsigned int frame_rate; /* in frames per 1000sec */
134 } u;
135};
136
137
138struct video_status {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800139 int video_blank; /* blank video on freeze? */
140 video_play_state_t play_state; /* current state of playback */
141 video_stream_source_t stream_source; /* current source (demux/memory) */
142 video_format_t video_format; /* current aspect ratio of stream*/
143 video_displayformat_t display_format;/* selected cropping mode */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144};
145
146
147struct video_still_picture {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800148 char __user *iFrame; /* pointer to a single iframe in memory */
149 int32_t size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150};
151
152
153typedef
154struct video_highlight {
155 int active; /* 1=show highlight, 0=hide highlight */
156 uint8_t contrast1; /* 7- 4 Pattern pixel contrast */
Mauro Carvalho Chehab674434c2005-12-12 00:37:28 -0800157 /* 3- 0 Background pixel contrast */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 uint8_t contrast2; /* 7- 4 Emphasis pixel-2 contrast */
Mauro Carvalho Chehab674434c2005-12-12 00:37:28 -0800159 /* 3- 0 Emphasis pixel-1 contrast */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 uint8_t color1; /* 7- 4 Pattern pixel color */
Mauro Carvalho Chehab674434c2005-12-12 00:37:28 -0800161 /* 3- 0 Background pixel color */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 uint8_t color2; /* 7- 4 Emphasis pixel-2 color */
Mauro Carvalho Chehab674434c2005-12-12 00:37:28 -0800163 /* 3- 0 Emphasis pixel-1 color */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 uint32_t ypos; /* 23-22 auto action mode */
Mauro Carvalho Chehab674434c2005-12-12 00:37:28 -0800165 /* 21-12 start y */
166 /* 9- 0 end y */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 uint32_t xpos; /* 23-22 button color number */
Mauro Carvalho Chehab674434c2005-12-12 00:37:28 -0800168 /* 21-12 start x */
169 /* 9- 0 end x */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170} video_highlight_t;
171
172
173typedef struct video_spu {
174 int active;
175 int stream_id;
176} video_spu_t;
177
178
179typedef struct video_spu_palette { /* SPU Palette information */
180 int length;
Al Virobee14e12006-02-01 07:33:44 -0500181 uint8_t __user *palette;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182} video_spu_palette_t;
183
184
185typedef struct video_navi_pack {
186 int length; /* 0 ... 1024 */
187 uint8_t data[1024];
188} video_navi_pack_t;
189
190
191typedef uint16_t video_attributes_t;
192/* bits: descr. */
193/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
194/* 13-12 TV system (0=525/60, 1=625/50) */
195/* 11-10 Aspect ratio (0=4:3, 3=16:9) */
196/* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
197/* 7 line 21-1 data present in GOP (1=yes, 0=no) */
198/* 6 line 21-2 data present in GOP (1=yes, 0=no) */
199/* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
200/* 2 source letterboxed (1=yes, 0=no) */
201/* 0 film/camera mode (0=camera, 1=film (625/50 only)) */
202
203
204/* bit definitions for capabilities: */
205/* can the hardware decode MPEG1 and/or MPEG2? */
206#define VIDEO_CAP_MPEG1 1
207#define VIDEO_CAP_MPEG2 2
208/* can you send a system and/or program stream to video device?
209 (you still have to open the video and the audio device but only
210 send the stream to the video device) */
211#define VIDEO_CAP_SYS 4
212#define VIDEO_CAP_PROG 8
213/* can the driver also handle SPU, NAVI and CSS encoded data?
214 (CSS API is not present yet) */
215#define VIDEO_CAP_SPU 16
216#define VIDEO_CAP_NAVI 32
217#define VIDEO_CAP_CSS 64
218
219
220#define VIDEO_STOP _IO('o', 21)
221#define VIDEO_PLAY _IO('o', 22)
222#define VIDEO_FREEZE _IO('o', 23)
223#define VIDEO_CONTINUE _IO('o', 24)
224#define VIDEO_SELECT_SOURCE _IO('o', 25)
225#define VIDEO_SET_BLANK _IO('o', 26)
226#define VIDEO_GET_STATUS _IOR('o', 27, struct video_status)
227#define VIDEO_GET_EVENT _IOR('o', 28, struct video_event)
228#define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29)
229#define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture)
230#define VIDEO_FAST_FORWARD _IO('o', 31)
231#define VIDEO_SLOWMOTION _IO('o', 32)
232#define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int)
233#define VIDEO_CLEAR_BUFFER _IO('o', 34)
234#define VIDEO_SET_ID _IO('o', 35)
235#define VIDEO_SET_STREAMTYPE _IO('o', 36)
236#define VIDEO_SET_FORMAT _IO('o', 37)
237#define VIDEO_SET_SYSTEM _IO('o', 38)
238#define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t)
239#define VIDEO_SET_SPU _IOW('o', 50, video_spu_t)
240#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t)
241#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
242#define VIDEO_SET_ATTRIBUTES _IO('o', 53)
243#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
244#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
245
Andreas Oberritterf05cce82006-02-27 00:09:00 -0300246/**
247 * VIDEO_GET_PTS
248 *
249 * Read the 33 bit presentation time stamp as defined
250 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
251 *
252 * The PTS should belong to the currently played
253 * frame if possible, but may also be a value close to it
254 * like the PTS of the last decoded frame or the last PTS
255 * extracted by the PES parser.
256 */
257#define VIDEO_GET_PTS _IOR('o', 57, __u64)
258
Hans Verkuil2435be12007-04-27 12:31:09 -0300259/* Read the number of displayed frames since the decoder was started */
260#define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
261
262#define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
263#define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
264
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265#endif /*_DVBVIDEO_H_*/