1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
5 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
6 * & Ralph Metzler <ralph@convergence.de>
7 * for convergence integrated media GmbH
10 #ifndef _UAPI_DVBDMX_H_
11 #define _UAPI_DVBDMX_H_
13 #include <linux/types.h>
19 #define DMX_FILTER_SIZE 16
22 * enum dmx_output - Output for the demux.
25 * Streaming directly to decoder.
27 * Output going to a memory buffer (to be retrieved via the read command).
28 * Delivers the stream output to the demux device on which the ioctl
31 * Output multiplexed into a new TS (to be retrieved by reading from the
32 * logical DVR device). Routes output to the logical DVR device
33 * ``/dev/dvb/adapter?/dvr?``, which delivers a TS multiplexed from all
34 * filters for which @DMX_OUT_TS_TAP was specified.
35 * @DMX_OUT_TSDEMUX_TAP:
36 * Like @DMX_OUT_TS_TAP but retrieved from the DMX device.
47 * enum dmx_input - Input from the demux.
49 * @DMX_IN_FRONTEND: Input from a front-end device.
50 * @DMX_IN_DVR: Input from the logical DVR device.
58 * enum dmx_ts_pes - type of the PES filter.
60 * @DMX_PES_AUDIO0: first audio PID. Also referred as @DMX_PES_AUDIO.
61 * @DMX_PES_VIDEO0: first video PID. Also referred as @DMX_PES_VIDEO.
62 * @DMX_PES_TELETEXT0: first teletext PID. Also referred as @DMX_PES_TELETEXT.
63 * @DMX_PES_SUBTITLE0: first subtitle PID. Also referred as @DMX_PES_SUBTITLE.
64 * @DMX_PES_PCR0: first Program Clock Reference PID.
65 * Also referred as @DMX_PES_PCR.
67 * @DMX_PES_AUDIO1: second audio PID.
68 * @DMX_PES_VIDEO1: second video PID.
69 * @DMX_PES_TELETEXT1: second teletext PID.
70 * @DMX_PES_SUBTITLE1: second subtitle PID.
71 * @DMX_PES_PCR1: second Program Clock Reference PID.
73 * @DMX_PES_AUDIO2: third audio PID.
74 * @DMX_PES_VIDEO2: third video PID.
75 * @DMX_PES_TELETEXT2: third teletext PID.
76 * @DMX_PES_SUBTITLE2: third subtitle PID.
77 * @DMX_PES_PCR2: third Program Clock Reference PID.
79 * @DMX_PES_AUDIO3: fourth audio PID.
80 * @DMX_PES_VIDEO3: fourth video PID.
81 * @DMX_PES_TELETEXT3: fourth teletext PID.
82 * @DMX_PES_SUBTITLE3: fourth subtitle PID.
83 * @DMX_PES_PCR3: fourth Program Clock Reference PID.
85 * @DMX_PES_OTHER: any other PID.
116 #define DMX_PES_AUDIO DMX_PES_AUDIO0
117 #define DMX_PES_VIDEO DMX_PES_VIDEO0
118 #define DMX_PES_TELETEXT DMX_PES_TELETEXT0
119 #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
120 #define DMX_PES_PCR DMX_PES_PCR0
125 * struct dmx_filter - Specifies a section header filter.
127 * @filter: bit array with bits to be matched at the section header.
128 * @mask: bits that are valid at the filter bit array.
129 * @mode: mode of match: if bit is zero, it will match if equal (positive
130 * match); if bit is one, it will match if the bit is negated.
132 * Note: All arrays in this struct have a size of DMX_FILTER_SIZE (16 bytes).
135 __u8 filter
[DMX_FILTER_SIZE
];
136 __u8 mask
[DMX_FILTER_SIZE
];
137 __u8 mode
[DMX_FILTER_SIZE
];
141 * struct dmx_sct_filter_params - Specifies a section filter.
143 * @pid: PID to be filtered.
144 * @filter: section header filter, as defined by &struct dmx_filter.
145 * @timeout: maximum time to filter, in milliseconds.
146 * @flags: extra flags for the section filter.
148 * Carries the configuration for a MPEG-TS section filter.
152 * - %DMX_CHECK_CRC - only deliver sections where the CRC check succeeded;
153 * - %DMX_ONESHOT - disable the section filter after one section
154 * has been delivered;
155 * - %DMX_IMMEDIATE_START - Start filter immediately without requiring a
158 struct dmx_sct_filter_params
{
160 struct dmx_filter filter
;
163 #define DMX_CHECK_CRC 1
164 #define DMX_ONESHOT 2
165 #define DMX_IMMEDIATE_START 4
169 * struct dmx_pes_filter_params - Specifies Packetized Elementary Stream (PES)
172 * @pid: PID to be filtered.
173 * @input: Demux input, as specified by &enum dmx_input.
174 * @output: Demux output, as specified by &enum dmx_output.
175 * @pes_type: Type of the pes filter, as specified by &enum dmx_pes_type.
176 * @flags: Demux PES flags.
178 struct dmx_pes_filter_params
{
180 enum dmx_input input
;
181 enum dmx_output output
;
182 enum dmx_ts_pes pes_type
;
187 * struct dmx_stc - Stores System Time Counter (STC) information.
189 * @num: input data: number of the STC, from 0 to N.
190 * @base: output: divisor for STC to get 90 kHz clock.
191 * @stc: output: stc in @base * 90 kHz units.
200 * enum dmx_buffer_flags - DMX memory-mapped buffer flags
202 * @DMX_BUFFER_FLAG_HAD_CRC32_DISCARD:
203 * Indicates that the Kernel discarded one or more frames due to wrong
205 * @DMX_BUFFER_FLAG_TEI:
206 * Indicates that the Kernel has detected a Transport Error indicator
207 * (TEI) on a filtered pid.
208 * @DMX_BUFFER_PKT_COUNTER_MISMATCH:
209 * Indicates that the Kernel has detected a packet counter mismatch
211 * @DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED:
212 * Indicates that the Kernel has detected one or more frame discontinuity.
213 * @DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR:
214 * Received at least one packet with a frame discontinuity indicator.
217 enum dmx_buffer_flags
{
218 DMX_BUFFER_FLAG_HAD_CRC32_DISCARD
= 1 << 0,
219 DMX_BUFFER_FLAG_TEI
= 1 << 1,
220 DMX_BUFFER_PKT_COUNTER_MISMATCH
= 1 << 2,
221 DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED
= 1 << 3,
222 DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR
= 1 << 4,
226 * struct dmx_buffer - dmx buffer info
228 * @index: id number of the buffer
229 * @bytesused: number of bytes occupied by data in the buffer (payload);
230 * @offset: for buffers with memory == DMX_MEMORY_MMAP;
231 * offset from the start of the device memory for this plane,
232 * (or a "cookie" that should be passed to mmap() as offset)
233 * @length: size in bytes of the buffer
234 * @flags: bit array of buffer flags as defined by &enum dmx_buffer_flags.
235 * Filled only at &DMX_DQBUF.
236 * @count: monotonic counter for filled buffers. Helps to identify
237 * data stream loses. Filled only at &DMX_DQBUF.
239 * Contains data exchanged by application and driver using one of the streaming
242 * Please notice that, for &DMX_QBUF, only @index should be filled.
243 * On &DMX_DQBUF calls, all fields will be filled by the Kernel.
255 * struct dmx_requestbuffers - request dmx buffer information
257 * @count: number of requested buffers,
258 * @size: size in bytes of the requested buffer
260 * Contains data used for requesting a dmx buffer.
261 * All reserved fields must be set to zero.
263 struct dmx_requestbuffers
{
269 * struct dmx_exportbuffer - export of dmx buffer as DMABUF file descriptor
271 * @index: id number of the buffer
272 * @flags: flags for newly created file, currently only O_CLOEXEC is
273 * supported, refer to manual of open syscall for more details
274 * @fd: file descriptor associated with DMABUF (set by driver)
276 * Contains data used for exporting a dmx buffer as DMABUF file descriptor.
277 * The buffer is identified by a 'cookie' returned by DMX_QUERYBUF
278 * (identical to the cookie used to mmap() the buffer to userspace). All
279 * reserved fields must be set to zero. The field reserved0 is expected to
280 * become a structure 'type' allowing an alternative layout of the structure
281 * content. Therefore this field should not be used for any other extensions.
283 struct dmx_exportbuffer
{
289 #define DMX_START _IO('o', 41)
290 #define DMX_STOP _IO('o', 42)
291 #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
292 #define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
293 #define DMX_SET_BUFFER_SIZE _IO('o', 45)
294 #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
295 #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
296 #define DMX_ADD_PID _IOW('o', 51, __u16)
297 #define DMX_REMOVE_PID _IOW('o', 52, __u16)
299 #if !defined(__KERNEL__)
301 /* This is needed for legacy userspace support */
302 typedef enum dmx_output dmx_output_t
;
303 typedef enum dmx_input dmx_input_t
;
304 typedef enum dmx_ts_pes dmx_pes_type_t
;
305 typedef struct dmx_filter dmx_filter_t
;
309 #define DMX_REQBUFS _IOWR('o', 60, struct dmx_requestbuffers)
310 #define DMX_QUERYBUF _IOWR('o', 61, struct dmx_buffer)
311 #define DMX_EXPBUF _IOWR('o', 62, struct dmx_exportbuffer)
312 #define DMX_QBUF _IOWR('o', 63, struct dmx_buffer)
313 #define DMX_DQBUF _IOWR('o', 64, struct dmx_buffer)
315 #endif /* _DVBDMX_H_ */