ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / dvb / video.h
1 /* 
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 #ifdef __KERNEL__
28 #include <linux/types.h>
29 #else
30 #include <stdint.h>
31 #include <time.h>
32 #endif
33
34
35 typedef enum {
36         VIDEO_FORMAT_4_3,     /* Select 4:3 format */ 
37         VIDEO_FORMAT_16_9,    /* Select 16:9 format. */
38         VIDEO_FORMAT_221_1    /* 2.21:1 */
39 } video_format_t;
40
41
42 typedef enum {
43          VIDEO_SYSTEM_PAL, 
44          VIDEO_SYSTEM_NTSC, 
45          VIDEO_SYSTEM_PALN, 
46          VIDEO_SYSTEM_PALNc, 
47          VIDEO_SYSTEM_PALM, 
48          VIDEO_SYSTEM_NTSC60, 
49          VIDEO_SYSTEM_PAL60,
50          VIDEO_SYSTEM_PALM60
51 } video_system_t;
52
53
54 typedef enum {   
55         VIDEO_PAN_SCAN,       /* use pan and scan format */
56         VIDEO_LETTER_BOX,     /* use letterbox format */
57         VIDEO_CENTER_CUT_OUT  /* use center cut out format */
58 } video_displayformat_t;
59
60 typedef struct {
61         int w;
62         int h;
63         video_format_t aspect_ratio;
64 } video_size_t;
65
66 typedef enum {
67         VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ 
68         VIDEO_SOURCE_MEMORY /* If this source is selected, the stream 
69                                comes from the user through the write 
70                                system call */ 
71 } video_stream_source_t;
72
73
74 typedef enum {
75         VIDEO_STOPPED, /* Video is stopped */ 
76         VIDEO_PLAYING, /* Video is currently playing */ 
77         VIDEO_FREEZED  /* Video is freezed */ 
78 } video_play_state_t; 
79
80
81 struct video_event { 
82         int32_t type; 
83 #define VIDEO_EVENT_SIZE_CHANGED 1
84 #define VIDEO_EVENT_FRAME_RATE_CHANGED  2
85         time_t timestamp;
86         union { 
87                 video_size_t size;
88                 unsigned int frame_rate;        /* in frames per 1000sec */
89         } u; 
90 };
91
92
93 struct video_status { 
94         int                   video_blank;   /* blank video on freeze? */
95         video_play_state_t    play_state;    /* current state of playback */  
96         video_stream_source_t stream_source; /* current source (demux/memory) */
97         video_format_t        video_format;  /* current aspect ratio of stream*/
98         video_displayformat_t display_format;/* selected cropping mode */
99 };
100
101
102 struct video_still_picture {
103         char *iFrame;        /* pointer to a single iframe in memory */
104         int32_t size; 
105 };
106
107
108 typedef 
109 struct video_highlight {
110         int     active;      /*    1=show highlight, 0=hide highlight */
111         uint8_t contrast1;   /*    7- 4  Pattern pixel contrast */
112                              /*    3- 0  Background pixel contrast */
113         uint8_t contrast2;   /*    7- 4  Emphasis pixel-2 contrast */
114                              /*    3- 0  Emphasis pixel-1 contrast */
115         uint8_t color1;      /*    7- 4  Pattern pixel color */
116                              /*    3- 0  Background pixel color */
117         uint8_t color2;      /*    7- 4  Emphasis pixel-2 color */
118                              /*    3- 0  Emphasis pixel-1 color */
119         uint32_t ypos;       /*   23-22  auto action mode */
120                              /*   21-12  start y */
121                              /*    9- 0  end y */
122         uint32_t xpos;       /*   23-22  button color number */
123                              /*   21-12  start x */
124                              /*    9- 0  end x */
125 } video_highlight_t;
126
127
128 typedef struct video_spu {
129         int active;
130         int stream_id;
131 } video_spu_t;
132
133
134 typedef struct video_spu_palette {      /* SPU Palette information */
135         int length;
136         uint8_t *palette;
137 } video_spu_palette_t;
138
139
140 typedef struct video_navi_pack {
141         int length;          /* 0 ... 1024 */
142         uint8_t data[1024];
143 } video_navi_pack_t;
144
145
146 typedef uint16_t video_attributes_t;
147 /*   bits: descr. */
148 /*   15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
149 /*   13-12 TV system (0=525/60, 1=625/50) */
150 /*   11-10 Aspect ratio (0=4:3, 3=16:9) */
151 /*    9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
152 /*    7    line 21-1 data present in GOP (1=yes, 0=no) */
153 /*    6    line 21-2 data present in GOP (1=yes, 0=no) */
154 /*    5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
155 /*    2    source letterboxed (1=yes, 0=no) */
156 /*    0    film/camera mode (0=camera, 1=film (625/50 only)) */
157
158
159 /* bit definitions for capabilities: */
160 /* can the hardware decode MPEG1 and/or MPEG2? */
161 #define VIDEO_CAP_MPEG1   1 
162 #define VIDEO_CAP_MPEG2   2
163 /* can you send a system and/or program stream to video device?
164    (you still have to open the video and the audio device but only 
165     send the stream to the video device) */
166 #define VIDEO_CAP_SYS     4
167 #define VIDEO_CAP_PROG    8
168 /* can the driver also handle SPU, NAVI and CSS encoded data? 
169    (CSS API is not present yet) */
170 #define VIDEO_CAP_SPU    16
171 #define VIDEO_CAP_NAVI   32
172 #define VIDEO_CAP_CSS    64
173
174
175 #define VIDEO_STOP                 _IO('o', 21) 
176 #define VIDEO_PLAY                 _IO('o', 22)
177 #define VIDEO_FREEZE               _IO('o', 23)
178 #define VIDEO_CONTINUE             _IO('o', 24)
179 #define VIDEO_SELECT_SOURCE        _IO('o', 25)
180 #define VIDEO_SET_BLANK            _IO('o', 26)
181 #define VIDEO_GET_STATUS           _IOR('o', 27, struct video_status)
182 #define VIDEO_GET_EVENT            _IOR('o', 28, struct video_event)
183 #define VIDEO_SET_DISPLAY_FORMAT   _IO('o', 29)
184 #define VIDEO_STILLPICTURE         _IOW('o', 30, struct video_still_picture)
185 #define VIDEO_FAST_FORWARD         _IO('o', 31)
186 #define VIDEO_SLOWMOTION           _IO('o', 32)
187 #define VIDEO_GET_CAPABILITIES     _IOR('o', 33, unsigned int)
188 #define VIDEO_CLEAR_BUFFER         _IO('o',  34)
189 #define VIDEO_SET_ID               _IO('o', 35)
190 #define VIDEO_SET_STREAMTYPE       _IO('o', 36)
191 #define VIDEO_SET_FORMAT           _IO('o', 37)
192 #define VIDEO_SET_SYSTEM           _IO('o', 38)
193 #define VIDEO_SET_HIGHLIGHT        _IOW('o', 39, video_highlight_t)
194 #define VIDEO_SET_SPU              _IOW('o', 50, video_spu_t)
195 #define VIDEO_SET_SPU_PALETTE      _IOW('o', 51, video_spu_palette_t)
196 #define VIDEO_GET_NAVI             _IOR('o', 52, video_navi_pack_t)
197 #define VIDEO_SET_ATTRIBUTES       _IO('o', 53)
198 #define VIDEO_GET_SIZE             _IOR('o', 55, video_size_t)
199 #define VIDEO_GET_FRAME_RATE       _IOR('o', 56, unsigned int)
200
201 #endif /*_DVBVIDEO_H_*/
202