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