Greg Kroah-Hartman | e2be04c | 2017-11-01 15:09:13 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 2 | /* |
| 3 | * dmx.h |
| 4 | * |
| 5 | * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> |
| 6 | * & Ralph Metzler <ralph@convergence.de> |
| 7 | * for convergence integrated media GmbH |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Lesser General Public License |
| 11 | * as published by the Free Software Foundation; either version 2.1 |
| 12 | * of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Lesser General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef _UAPI_DVBDMX_H_ |
| 26 | #define _UAPI_DVBDMX_H_ |
| 27 | |
| 28 | #include <linux/types.h> |
| 29 | #ifndef __KERNEL__ |
| 30 | #include <time.h> |
| 31 | #endif |
| 32 | |
| 33 | |
| 34 | #define DMX_FILTER_SIZE 16 |
| 35 | |
Mauro Carvalho Chehab | bb98e6d | 2017-08-31 12:28:52 -0400 | [diff] [blame] | 36 | /** |
| 37 | * enum dmx_output - Output for the demux. |
| 38 | * |
| 39 | * @DMX_OUT_DECODER: |
| 40 | * Streaming directly to decoder. |
| 41 | * @DMX_OUT_TAP: |
| 42 | * Output going to a memory buffer (to be retrieved via the read command). |
| 43 | * Delivers the stream output to the demux device on which the ioctl |
| 44 | * is called. |
| 45 | * @DMX_OUT_TS_TAP: |
| 46 | * Output multiplexed into a new TS (to be retrieved by reading from the |
| 47 | * logical DVR device). Routes output to the logical DVR device |
| 48 | * ``/dev/dvb/adapter?/dvr?``, which delivers a TS multiplexed from all |
| 49 | * filters for which @DMX_OUT_TS_TAP was specified. |
| 50 | * @DMX_OUT_TSDEMUX_TAP: |
| 51 | * Like @DMX_OUT_TS_TAP but retrieved from the DMX device. |
| 52 | */ |
| 53 | enum dmx_output { |
| 54 | DMX_OUT_DECODER, |
| 55 | DMX_OUT_TAP, |
| 56 | DMX_OUT_TS_TAP, |
| 57 | DMX_OUT_TSDEMUX_TAP |
Mauro Carvalho Chehab | 3256b36 | 2017-09-01 06:09:14 -0400 | [diff] [blame] | 58 | }; |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 59 | |
| 60 | |
Mauro Carvalho Chehab | bb98e6d | 2017-08-31 12:28:52 -0400 | [diff] [blame] | 61 | /** |
| 62 | * enum dmx_input - Input from the demux. |
| 63 | * |
| 64 | * @DMX_IN_FRONTEND: Input from a front-end device. |
| 65 | * @DMX_IN_DVR: Input from the logical DVR device. |
| 66 | */ |
| 67 | enum dmx_input { |
| 68 | DMX_IN_FRONTEND, |
| 69 | DMX_IN_DVR |
| 70 | }; |
| 71 | |
| 72 | /** |
| 73 | * enum dmx_ts_pes - type of the PES filter. |
| 74 | * |
| 75 | * @DMX_PES_AUDIO0: first audio PID. Also referred as @DMX_PES_AUDIO. |
| 76 | * @DMX_PES_VIDEO0: first video PID. Also referred as @DMX_PES_VIDEO. |
| 77 | * @DMX_PES_TELETEXT0: first teletext PID. Also referred as @DMX_PES_TELETEXT. |
| 78 | * @DMX_PES_SUBTITLE0: first subtitle PID. Also referred as @DMX_PES_SUBTITLE. |
| 79 | * @DMX_PES_PCR0: first Program Clock Reference PID. |
| 80 | * Also referred as @DMX_PES_PCR. |
| 81 | * |
| 82 | * @DMX_PES_AUDIO1: second audio PID. |
| 83 | * @DMX_PES_VIDEO1: second video PID. |
| 84 | * @DMX_PES_TELETEXT1: second teletext PID. |
| 85 | * @DMX_PES_SUBTITLE1: second subtitle PID. |
| 86 | * @DMX_PES_PCR1: second Program Clock Reference PID. |
| 87 | * |
| 88 | * @DMX_PES_AUDIO2: third audio PID. |
| 89 | * @DMX_PES_VIDEO2: third video PID. |
| 90 | * @DMX_PES_TELETEXT2: third teletext PID. |
| 91 | * @DMX_PES_SUBTITLE2: third subtitle PID. |
| 92 | * @DMX_PES_PCR2: third Program Clock Reference PID. |
| 93 | * |
| 94 | * @DMX_PES_AUDIO3: fourth audio PID. |
| 95 | * @DMX_PES_VIDEO3: fourth video PID. |
| 96 | * @DMX_PES_TELETEXT3: fourth teletext PID. |
| 97 | * @DMX_PES_SUBTITLE3: fourth subtitle PID. |
| 98 | * @DMX_PES_PCR3: fourth Program Clock Reference PID. |
| 99 | * |
| 100 | * @DMX_PES_OTHER: any other PID. |
| 101 | */ |
| 102 | |
| 103 | enum dmx_ts_pes { |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 104 | DMX_PES_AUDIO0, |
| 105 | DMX_PES_VIDEO0, |
| 106 | DMX_PES_TELETEXT0, |
| 107 | DMX_PES_SUBTITLE0, |
| 108 | DMX_PES_PCR0, |
| 109 | |
| 110 | DMX_PES_AUDIO1, |
| 111 | DMX_PES_VIDEO1, |
| 112 | DMX_PES_TELETEXT1, |
| 113 | DMX_PES_SUBTITLE1, |
| 114 | DMX_PES_PCR1, |
| 115 | |
| 116 | DMX_PES_AUDIO2, |
| 117 | DMX_PES_VIDEO2, |
| 118 | DMX_PES_TELETEXT2, |
| 119 | DMX_PES_SUBTITLE2, |
| 120 | DMX_PES_PCR2, |
| 121 | |
| 122 | DMX_PES_AUDIO3, |
| 123 | DMX_PES_VIDEO3, |
| 124 | DMX_PES_TELETEXT3, |
| 125 | DMX_PES_SUBTITLE3, |
| 126 | DMX_PES_PCR3, |
| 127 | |
| 128 | DMX_PES_OTHER |
Mauro Carvalho Chehab | 3256b36 | 2017-09-01 06:09:14 -0400 | [diff] [blame] | 129 | }; |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 130 | |
| 131 | #define DMX_PES_AUDIO DMX_PES_AUDIO0 |
| 132 | #define DMX_PES_VIDEO DMX_PES_VIDEO0 |
| 133 | #define DMX_PES_TELETEXT DMX_PES_TELETEXT0 |
| 134 | #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 |
| 135 | #define DMX_PES_PCR DMX_PES_PCR0 |
| 136 | |
| 137 | |
Mauro Carvalho Chehab | bb98e6d | 2017-08-31 12:28:52 -0400 | [diff] [blame] | 138 | |
| 139 | /** |
| 140 | * struct dmx_filter - Specifies a section header filter. |
| 141 | * |
| 142 | * @filter: bit array with bits to be matched at the section header. |
| 143 | * @mask: bits that are valid at the filter bit array. |
| 144 | * @mode: mode of match: if bit is zero, it will match if equal (positive |
| 145 | * match); if bit is one, it will match if the bit is negated. |
| 146 | * |
| 147 | * Note: All arrays in this struct have a size of DMX_FILTER_SIZE (16 bytes). |
| 148 | */ |
| 149 | struct dmx_filter { |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 150 | __u8 filter[DMX_FILTER_SIZE]; |
| 151 | __u8 mask[DMX_FILTER_SIZE]; |
| 152 | __u8 mode[DMX_FILTER_SIZE]; |
Mauro Carvalho Chehab | 3256b36 | 2017-09-01 06:09:14 -0400 | [diff] [blame] | 153 | }; |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 154 | |
Mauro Carvalho Chehab | bb98e6d | 2017-08-31 12:28:52 -0400 | [diff] [blame] | 155 | /** |
| 156 | * struct dmx_sct_filter_params - Specifies a section filter. |
| 157 | * |
| 158 | * @pid: PID to be filtered. |
| 159 | * @filter: section header filter, as defined by &struct dmx_filter. |
| 160 | * @timeout: maximum time to filter, in milliseconds. |
| 161 | * @flags: extra flags for the section filter. |
| 162 | * |
| 163 | * Carries the configuration for a MPEG-TS section filter. |
| 164 | * |
| 165 | * The @flags can be: |
| 166 | * |
| 167 | * - %DMX_CHECK_CRC - only deliver sections where the CRC check succeeded; |
| 168 | * - %DMX_ONESHOT - disable the section filter after one section |
| 169 | * has been delivered; |
| 170 | * - %DMX_IMMEDIATE_START - Start filter immediately without requiring a |
| 171 | * :ref:`DMX_START`. |
| 172 | */ |
| 173 | struct dmx_sct_filter_params { |
Mauro Carvalho Chehab | 3256b36 | 2017-09-01 06:09:14 -0400 | [diff] [blame] | 174 | __u16 pid; |
| 175 | struct dmx_filter filter; |
| 176 | __u32 timeout; |
| 177 | __u32 flags; |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 178 | #define DMX_CHECK_CRC 1 |
| 179 | #define DMX_ONESHOT 2 |
| 180 | #define DMX_IMMEDIATE_START 4 |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 181 | }; |
| 182 | |
Mauro Carvalho Chehab | bb98e6d | 2017-08-31 12:28:52 -0400 | [diff] [blame] | 183 | /** |
| 184 | * struct dmx_pes_filter_params - Specifies Packetized Elementary Stream (PES) |
| 185 | * filter parameters. |
| 186 | * |
| 187 | * @pid: PID to be filtered. |
| 188 | * @input: Demux input, as specified by &enum dmx_input. |
| 189 | * @output: Demux output, as specified by &enum dmx_output. |
| 190 | * @pes_type: Type of the pes filter, as specified by &enum dmx_pes_type. |
| 191 | * @flags: Demux PES flags. |
| 192 | */ |
Mauro Carvalho Chehab | e4faa09 | 2017-09-05 07:02:44 -0400 | [diff] [blame] | 193 | struct dmx_pes_filter_params { |
Mauro Carvalho Chehab | 3256b36 | 2017-09-01 06:09:14 -0400 | [diff] [blame] | 194 | __u16 pid; |
| 195 | enum dmx_input input; |
| 196 | enum dmx_output output; |
| 197 | enum dmx_ts_pes pes_type; |
| 198 | __u32 flags; |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 199 | }; |
| 200 | |
Mauro Carvalho Chehab | bb98e6d | 2017-08-31 12:28:52 -0400 | [diff] [blame] | 201 | /** |
| 202 | * struct dmx_stc - Stores System Time Counter (STC) information. |
| 203 | * |
| 204 | * @num: input data: number of the STC, from 0 to N. |
| 205 | * @base: output: divisor for STC to get 90 kHz clock. |
| 206 | * @stc: output: stc in @base * 90 kHz units. |
| 207 | */ |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 208 | struct dmx_stc { |
Mauro Carvalho Chehab | bb98e6d | 2017-08-31 12:28:52 -0400 | [diff] [blame] | 209 | unsigned int num; |
| 210 | unsigned int base; |
| 211 | __u64 stc; |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 212 | }; |
| 213 | |
Satendra Singh Thakur | 57868ac | 2017-12-18 22:35:53 -0500 | [diff] [blame] | 214 | /** |
| 215 | * struct dmx_buffer - dmx buffer info |
| 216 | * |
| 217 | * @index: id number of the buffer |
| 218 | * @bytesused: number of bytes occupied by data in the buffer (payload); |
| 219 | * @offset: for buffers with memory == DMX_MEMORY_MMAP; |
| 220 | * offset from the start of the device memory for this plane, |
| 221 | * (or a "cookie" that should be passed to mmap() as offset) |
| 222 | * @length: size in bytes of the buffer |
| 223 | * |
| 224 | * Contains data exchanged by application and driver using one of the streaming |
| 225 | * I/O methods. |
| 226 | */ |
| 227 | struct dmx_buffer { |
| 228 | __u32 index; |
| 229 | __u32 bytesused; |
| 230 | __u32 offset; |
| 231 | __u32 length; |
Satendra Singh Thakur | 57868ac | 2017-12-18 22:35:53 -0500 | [diff] [blame] | 232 | }; |
| 233 | |
| 234 | /** |
| 235 | * struct dmx_requestbuffers - request dmx buffer information |
| 236 | * |
| 237 | * @count: number of requested buffers, |
| 238 | * @size: size in bytes of the requested buffer |
| 239 | * |
| 240 | * Contains data used for requesting a dmx buffer. |
| 241 | * All reserved fields must be set to zero. |
| 242 | */ |
| 243 | struct dmx_requestbuffers { |
| 244 | __u32 count; |
| 245 | __u32 size; |
Satendra Singh Thakur | 57868ac | 2017-12-18 22:35:53 -0500 | [diff] [blame] | 246 | }; |
| 247 | |
| 248 | /** |
| 249 | * struct dmx_exportbuffer - export of dmx buffer as DMABUF file descriptor |
| 250 | * |
| 251 | * @index: id number of the buffer |
| 252 | * @flags: flags for newly created file, currently only O_CLOEXEC is |
| 253 | * supported, refer to manual of open syscall for more details |
| 254 | * @fd: file descriptor associated with DMABUF (set by driver) |
| 255 | * |
| 256 | * Contains data used for exporting a dmx buffer as DMABUF file descriptor. |
| 257 | * The buffer is identified by a 'cookie' returned by DMX_QUERYBUF |
| 258 | * (identical to the cookie used to mmap() the buffer to userspace). All |
| 259 | * reserved fields must be set to zero. The field reserved0 is expected to |
| 260 | * become a structure 'type' allowing an alternative layout of the structure |
| 261 | * content. Therefore this field should not be used for any other extensions. |
| 262 | */ |
| 263 | struct dmx_exportbuffer { |
| 264 | __u32 index; |
| 265 | __u32 flags; |
| 266 | __s32 fd; |
Satendra Singh Thakur | 57868ac | 2017-12-18 22:35:53 -0500 | [diff] [blame] | 267 | }; |
| 268 | |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 269 | #define DMX_START _IO('o', 41) |
| 270 | #define DMX_STOP _IO('o', 42) |
| 271 | #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) |
| 272 | #define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) |
| 273 | #define DMX_SET_BUFFER_SIZE _IO('o', 45) |
| 274 | #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) |
David Howells | c57fd02 | 2012-10-09 09:48:42 +0100 | [diff] [blame] | 275 | #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) |
| 276 | #define DMX_ADD_PID _IOW('o', 51, __u16) |
| 277 | #define DMX_REMOVE_PID _IOW('o', 52, __u16) |
| 278 | |
Mauro Carvalho Chehab | e4faa09 | 2017-09-05 07:02:44 -0400 | [diff] [blame] | 279 | #if !defined(__KERNEL__) |
Mauro Carvalho Chehab | 3256b36 | 2017-09-01 06:09:14 -0400 | [diff] [blame] | 280 | |
| 281 | /* This is needed for legacy userspace support */ |
| 282 | typedef enum dmx_output dmx_output_t; |
| 283 | typedef enum dmx_input dmx_input_t; |
| 284 | typedef enum dmx_ts_pes dmx_pes_type_t; |
| 285 | typedef struct dmx_filter dmx_filter_t; |
Mauro Carvalho Chehab | 3256b36 | 2017-09-01 06:09:14 -0400 | [diff] [blame] | 286 | |
| 287 | #endif |
| 288 | |
Satendra Singh Thakur | 57868ac | 2017-12-18 22:35:53 -0500 | [diff] [blame] | 289 | #define DMX_REQBUFS _IOWR('o', 60, struct dmx_requestbuffers) |
| 290 | #define DMX_QUERYBUF _IOWR('o', 61, struct dmx_buffer) |
| 291 | #define DMX_EXPBUF _IOWR('o', 62, struct dmx_exportbuffer) |
| 292 | #define DMX_QBUF _IOWR('o', 63, struct dmx_buffer) |
| 293 | #define DMX_DQBUF _IOWR('o', 64, struct dmx_buffer) |
| 294 | |
| 295 | #endif /* _DVBDMX_H_ */ |