ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / dvb / dmx.h
1 /* 
2  * dmx.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 _DVBDMX_H_
25 #define _DVBDMX_H_
26
27 #include <asm/types.h>
28 #ifdef __KERNEL__
29 #include <linux/time.h>
30 #else
31 #include <time.h>
32 #endif
33
34 #define DMX_FILTER_SIZE 16
35
36 typedef enum
37 {
38         DMX_OUT_DECODER, /* Streaming directly to decoder. */
39         DMX_OUT_TAP,     /* Output going to a memory buffer */
40                          /* (to be retrieved via the read command).*/
41         DMX_OUT_TS_TAP   /* Output multiplexed into a new TS  */
42                          /* (to be retrieved by reading from the */
43                          /* logical DVR device).                 */
44 } dmx_output_t;
45
46
47 typedef enum
48 {
49         DMX_IN_FRONTEND, /* Input from a front-end device.  */
50         DMX_IN_DVR       /* Input from the logical DVR device.  */
51 } dmx_input_t;
52
53
54 typedef enum
55 {
56         DMX_PES_AUDIO0,
57         DMX_PES_VIDEO0,
58         DMX_PES_TELETEXT0,
59         DMX_PES_SUBTITLE0,
60         DMX_PES_PCR0,
61
62         DMX_PES_AUDIO1,
63         DMX_PES_VIDEO1,
64         DMX_PES_TELETEXT1,
65         DMX_PES_SUBTITLE1,
66         DMX_PES_PCR1,
67
68         DMX_PES_AUDIO2,
69         DMX_PES_VIDEO2,
70         DMX_PES_TELETEXT2,
71         DMX_PES_SUBTITLE2,
72         DMX_PES_PCR2,
73
74         DMX_PES_AUDIO3,
75         DMX_PES_VIDEO3,
76         DMX_PES_TELETEXT3,
77         DMX_PES_SUBTITLE3,
78         DMX_PES_PCR3,
79
80         DMX_PES_OTHER
81 } dmx_pes_type_t;
82
83 #define DMX_PES_AUDIO    DMX_PES_AUDIO0
84 #define DMX_PES_VIDEO    DMX_PES_VIDEO0
85 #define DMX_PES_TELETEXT DMX_PES_TELETEXT0
86 #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
87 #define DMX_PES_PCR      DMX_PES_PCR0
88
89
90 typedef enum
91 {
92         DMX_SCRAMBLING_EV,
93         DMX_FRONTEND_EV
94 } dmx_event_t;
95
96
97 typedef enum
98 {
99         DMX_SCRAMBLING_OFF,
100         DMX_SCRAMBLING_ON
101 } dmx_scrambling_status_t;
102
103
104 typedef struct dmx_filter
105 {
106         __u8  filter[DMX_FILTER_SIZE];
107         __u8  mask[DMX_FILTER_SIZE];
108         __u8  mode[DMX_FILTER_SIZE];
109 } dmx_filter_t;
110
111
112 struct dmx_sct_filter_params
113 {
114         __u16            pid;
115         dmx_filter_t        filter;
116         __u32            timeout;
117         __u32            flags;
118 #define DMX_CHECK_CRC       1
119 #define DMX_ONESHOT         2
120 #define DMX_IMMEDIATE_START 4
121 #define DMX_KERNEL_CLIENT   0x8000
122 };
123
124
125 struct dmx_pes_filter_params
126 {
127         __u16            pid;
128         dmx_input_t         input;
129         dmx_output_t        output;
130         dmx_pes_type_t      pes_type;
131         __u32            flags;
132 };
133
134
135 struct dmx_event
136 {
137         dmx_event_t         event;
138         time_t              timeStamp;
139         union
140         {
141                 dmx_scrambling_status_t scrambling;
142         } u;
143 };
144
145 typedef struct dmx_caps {
146         __u32 caps;
147         int num_decoders; 
148 } dmx_caps_t;
149
150 typedef enum {
151         DMX_SOURCE_FRONT0 = 0,
152         DMX_SOURCE_FRONT1,
153         DMX_SOURCE_FRONT2,
154         DMX_SOURCE_FRONT3,
155         DMX_SOURCE_DVR0   = 16,
156         DMX_SOURCE_DVR1,
157         DMX_SOURCE_DVR2,
158         DMX_SOURCE_DVR3
159 } dmx_source_t;
160
161 struct dmx_stc {
162         unsigned int num;       /* input : which STC? 0..N */
163         unsigned int base;      /* output: divisor for stc to get 90 kHz clock */
164         __u64 stc;              /* output: stc in 'base'*90 kHz units */
165 };
166
167
168 #define DMX_START                _IO('o',41) 
169 #define DMX_STOP                 _IO('o',42)
170 #define DMX_SET_FILTER           _IOW('o',43,struct dmx_sct_filter_params)
171 #define DMX_SET_PES_FILTER       _IOW('o',44,struct dmx_pes_filter_params)
172 #define DMX_SET_BUFFER_SIZE      _IO('o',45)
173 #define DMX_GET_EVENT            _IOR('o',46,struct dmx_event)
174 #define DMX_GET_PES_PIDS         _IOR('o', 47, __u16[5])
175 #define DMX_GET_CAPS             _IOR('o',48,dmx_caps_t)
176 #define DMX_SET_SOURCE           _IOW('o',49,dmx_source_t)
177 #define DMX_GET_STC              _IOWR('o',50,struct dmx_stc)
178
179 #endif /*_DVBDMX_H_*/
180