Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * |
Hamad Kadmany | d432f71 | 2013-01-17 17:36:17 +0200 | [diff] [blame] | 8 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Hamad Kadmany | 32cb982 | 2012-05-10 08:47:44 +0300 | [diff] [blame] | 9 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Lesser General Public License |
| 12 | * as published by the Free Software Foundation; either version 2.1 |
| 13 | * of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #ifndef _DVBDMX_H_ |
| 27 | #define _DVBDMX_H_ |
| 28 | |
Jaswinder Singh Rajput | c86629c | 2009-01-30 19:55:32 +0530 | [diff] [blame] | 29 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #ifdef __KERNEL__ |
| 31 | #include <linux/time.h> |
| 32 | #else |
| 33 | #include <time.h> |
| 34 | #endif |
| 35 | |
| 36 | |
| 37 | #define DMX_FILTER_SIZE 16 |
| 38 | |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 39 | /* Min recording chunk upon which event is generated */ |
| 40 | #define DMX_REC_BUFF_CHUNK_MIN_SIZE (100*188) |
| 41 | |
Hamad Kadmany | 168203b | 2013-01-28 15:22:46 +0200 | [diff] [blame] | 42 | #define DMX_MAX_DECODER_BUFFER_NUM (32) |
Gilad Broner | 526e57e | 2012-12-03 15:57:44 +0200 | [diff] [blame] | 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | typedef enum |
| 45 | { |
| 46 | DMX_OUT_DECODER, /* Streaming directly to decoder. */ |
| 47 | DMX_OUT_TAP, /* Output going to a memory buffer */ |
Mauro Carvalho Chehab | 674434c | 2005-12-12 00:37:28 -0800 | [diff] [blame] | 48 | /* (to be retrieved via the read command).*/ |
Peter Hartley | b01cd93 | 2008-04-22 14:45:36 -0300 | [diff] [blame] | 49 | DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */ |
Mauro Carvalho Chehab | 674434c | 2005-12-12 00:37:28 -0800 | [diff] [blame] | 50 | /* (to be retrieved by reading from the */ |
| 51 | /* logical DVR device). */ |
Peter Hartley | b01cd93 | 2008-04-22 14:45:36 -0300 | [diff] [blame] | 52 | DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | } dmx_output_t; |
| 54 | |
| 55 | |
| 56 | typedef enum |
| 57 | { |
| 58 | DMX_IN_FRONTEND, /* Input from a front-end device. */ |
| 59 | DMX_IN_DVR /* Input from the logical DVR device. */ |
| 60 | } dmx_input_t; |
| 61 | |
| 62 | |
| 63 | typedef enum |
| 64 | { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 65 | DMX_PES_AUDIO0, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | DMX_PES_VIDEO0, |
| 67 | DMX_PES_TELETEXT0, |
| 68 | DMX_PES_SUBTITLE0, |
| 69 | DMX_PES_PCR0, |
| 70 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 71 | DMX_PES_AUDIO1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | DMX_PES_VIDEO1, |
| 73 | DMX_PES_TELETEXT1, |
| 74 | DMX_PES_SUBTITLE1, |
| 75 | DMX_PES_PCR1, |
| 76 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 77 | DMX_PES_AUDIO2, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | DMX_PES_VIDEO2, |
| 79 | DMX_PES_TELETEXT2, |
| 80 | DMX_PES_SUBTITLE2, |
| 81 | DMX_PES_PCR2, |
| 82 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 83 | DMX_PES_AUDIO3, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | DMX_PES_VIDEO3, |
| 85 | DMX_PES_TELETEXT3, |
| 86 | DMX_PES_SUBTITLE3, |
| 87 | DMX_PES_PCR3, |
| 88 | |
| 89 | DMX_PES_OTHER |
| 90 | } dmx_pes_type_t; |
| 91 | |
| 92 | #define DMX_PES_AUDIO DMX_PES_AUDIO0 |
| 93 | #define DMX_PES_VIDEO DMX_PES_VIDEO0 |
| 94 | #define DMX_PES_TELETEXT DMX_PES_TELETEXT0 |
| 95 | #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 |
| 96 | #define DMX_PES_PCR DMX_PES_PCR0 |
| 97 | |
| 98 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | typedef struct dmx_filter |
| 100 | { |
| 101 | __u8 filter[DMX_FILTER_SIZE]; |
| 102 | __u8 mask[DMX_FILTER_SIZE]; |
| 103 | __u8 mode[DMX_FILTER_SIZE]; |
| 104 | } dmx_filter_t; |
| 105 | |
| 106 | |
Liron Kuch | d4cc3b0 | 2012-05-17 16:31:58 +0300 | [diff] [blame] | 107 | /* Filter flags */ |
| 108 | #define DMX_CHECK_CRC 0x01 |
| 109 | #define DMX_ONESHOT 0x02 |
| 110 | #define DMX_IMMEDIATE_START 0x04 |
| 111 | #define DMX_ENABLE_INDEXING 0x08 |
| 112 | #define DMX_KERNEL_CLIENT 0x8000 |
| 113 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | struct dmx_sct_filter_params |
| 115 | { |
| 116 | __u16 pid; |
| 117 | dmx_filter_t filter; |
| 118 | __u32 timeout; |
| 119 | __u32 flags; |
Liron Kuch | d4cc3b0 | 2012-05-17 16:31:58 +0300 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | |
| 123 | /* Indexing: supported video standards */ |
| 124 | enum dmx_indexing_video_standard { |
| 125 | DMX_INDEXING_MPEG2, |
| 126 | DMX_INDEXING_H264, |
| 127 | DMX_INDEXING_VC1 |
| 128 | }; |
| 129 | |
| 130 | /* Indexing: Supported video profiles */ |
| 131 | enum dmx_indexing_video_profile { |
| 132 | DMX_INDEXING_MPEG2_ANY, |
| 133 | DMX_INDEXING_H264_ANY, |
| 134 | DMX_INDEXING_VC1_ANY |
| 135 | }; |
| 136 | |
| 137 | /* Indexing: video configuration parameters */ |
| 138 | struct dmx_indexing_video_params { |
| 139 | enum dmx_indexing_video_standard standard; |
| 140 | enum dmx_indexing_video_profile profile; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | }; |
| 142 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | struct dmx_pes_filter_params |
| 144 | { |
| 145 | __u16 pid; |
| 146 | dmx_input_t input; |
| 147 | dmx_output_t output; |
| 148 | dmx_pes_type_t pes_type; |
| 149 | __u32 flags; |
Liron Kuch | d4cc3b0 | 2012-05-17 16:31:58 +0300 | [diff] [blame] | 150 | |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 151 | /* |
| 152 | * The following configures when the event |
| 153 | * DMX_EVENT_NEW_REC_CHUNK will be triggered. |
| 154 | * When new recorded data is received with size |
| 155 | * equal or larger than this value a new event |
| 156 | * will be triggered. This is relevent when |
| 157 | * output is DMX_OUT_TS_TAP or DMX_OUT_TSDEMUX_TAP, |
| 158 | * size must be at least DMX_REC_BUFF_CHUNK_MIN_SIZE |
| 159 | * and smaller than buffer size. |
| 160 | */ |
| 161 | __u32 rec_chunk_size; |
| 162 | |
Liron Kuch | d4cc3b0 | 2012-05-17 16:31:58 +0300 | [diff] [blame] | 163 | struct dmx_indexing_video_params video_params; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | }; |
| 165 | |
Hamad Kadmany | 32cb982 | 2012-05-10 08:47:44 +0300 | [diff] [blame] | 166 | struct dmx_buffer_status { |
| 167 | /* size of buffer in bytes */ |
| 168 | unsigned int size; |
| 169 | |
| 170 | /* fullness of buffer in bytes */ |
| 171 | unsigned int fullness; |
| 172 | |
| 173 | /* |
| 174 | * How many bytes are free |
| 175 | * It's the same as: size-fullness-1 |
| 176 | */ |
| 177 | unsigned int free_bytes; |
| 178 | |
| 179 | /* read pointer offset in bytes */ |
| 180 | unsigned int read_offset; |
| 181 | |
| 182 | /* write pointer offset in bytes */ |
| 183 | unsigned int write_offset; |
| 184 | |
| 185 | /* non-zero if data error occured */ |
| 186 | int error; |
| 187 | }; |
| 188 | |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 189 | /* Events associated with each demux filter */ |
| 190 | enum dmx_event { |
| 191 | /* New PES packet is ready to be consumed */ |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 192 | DMX_EVENT_NEW_PES = 0x00000001, |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 193 | |
| 194 | /* New section is ready to be consumed */ |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 195 | DMX_EVENT_NEW_SECTION = 0x00000002, |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 196 | |
| 197 | /* New recording chunk is ready to be consumed */ |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 198 | DMX_EVENT_NEW_REC_CHUNK = 0x00000004, |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 199 | |
| 200 | /* New PCR value is ready */ |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 201 | DMX_EVENT_NEW_PCR = 0x00000008, |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 202 | |
| 203 | /* Overflow */ |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 204 | DMX_EVENT_BUFFER_OVERFLOW = 0x00000010, |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 205 | |
| 206 | /* Section was dropped due to CRC error */ |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 207 | DMX_EVENT_SECTION_CRC_ERROR = 0x00000020, |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 208 | |
| 209 | /* End-of-stream, no more data from this filter */ |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 210 | DMX_EVENT_EOS = 0x00000040, |
Liron Kuch | 41543b7 | 2012-11-26 13:27:22 +0200 | [diff] [blame] | 211 | |
| 212 | /* New Elementary Stream data is ready */ |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 213 | DMX_EVENT_NEW_ES_DATA = 0x00000080 |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 214 | }; |
| 215 | |
| 216 | /* Flags passed in filter events */ |
| 217 | |
| 218 | /* Continuity counter error was detected */ |
| 219 | #define DMX_FILTER_CC_ERROR 0x01 |
| 220 | |
| 221 | /* Discontinuity indicator was set */ |
Liron Kuch | 41543b7 | 2012-11-26 13:27:22 +0200 | [diff] [blame] | 222 | #define DMX_FILTER_DISCONTINUITY_INDICATOR 0x02 |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 223 | |
| 224 | /* PES legnth in PES header is not correct */ |
| 225 | #define DMX_FILTER_PES_LENGTH_ERROR 0x04 |
| 226 | |
| 227 | |
| 228 | /* PES info associated with DMX_EVENT_NEW_PES event */ |
| 229 | struct dmx_pes_event_info { |
| 230 | /* Offset at which PES information starts */ |
| 231 | __u32 base_offset; |
| 232 | |
| 233 | /* |
| 234 | * Start offset at which PES data |
| 235 | * from the stream starts. |
| 236 | * Equal to base_offset if PES data |
| 237 | * starts from the beginning. |
| 238 | */ |
| 239 | __u32 start_offset; |
| 240 | |
| 241 | /* Total length holding the PES information */ |
| 242 | __u32 total_length; |
| 243 | |
| 244 | /* Actual length holding the PES data */ |
| 245 | __u32 actual_length; |
| 246 | |
| 247 | /* Local receiver timestamp in 27MHz */ |
| 248 | __u64 stc; |
| 249 | |
| 250 | /* Flags passed in filter events */ |
| 251 | __u32 flags; |
Hamad Kadmany | d432f71 | 2013-01-17 17:36:17 +0200 | [diff] [blame] | 252 | |
| 253 | /* |
| 254 | * Number of TS packets with Transport Error Indicator (TEI) |
| 255 | * found while constructing the PES. |
| 256 | */ |
| 257 | __u32 transport_error_indicator_counter; |
| 258 | |
| 259 | /* Number of continuity errors found while constructing the PES */ |
| 260 | __u32 continuity_error_counter; |
| 261 | |
| 262 | /* Total number of TS packets holding the PES */ |
| 263 | __u32 ts_packets_num; |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 264 | }; |
| 265 | |
| 266 | /* Section info associated with DMX_EVENT_NEW_SECTION event */ |
| 267 | struct dmx_section_event_info { |
| 268 | /* Offset at which section information starts */ |
| 269 | __u32 base_offset; |
| 270 | |
| 271 | /* |
| 272 | * Start offset at which section data |
| 273 | * from the stream starts. |
| 274 | * Equal to base_offset if section data |
| 275 | * starts from the beginning. |
| 276 | */ |
| 277 | __u32 start_offset; |
| 278 | |
| 279 | /* Total length holding the section information */ |
| 280 | __u32 total_length; |
| 281 | |
| 282 | /* Actual length holding the section data */ |
| 283 | __u32 actual_length; |
| 284 | |
| 285 | /* Flags passed in filter events */ |
| 286 | __u32 flags; |
| 287 | }; |
| 288 | |
| 289 | /* Recording info associated with DMX_EVENT_NEW_REC_CHUNK event */ |
| 290 | struct dmx_rec_chunk_event_info { |
| 291 | /* Offset at which recording chunk starts */ |
| 292 | __u32 offset; |
| 293 | |
| 294 | /* Size of recording chunk in bytes */ |
| 295 | __u32 size; |
| 296 | }; |
| 297 | |
| 298 | /* PCR info associated with DMX_EVENT_NEW_PCR event */ |
| 299 | struct dmx_pcr_event_info { |
| 300 | /* Local timestamp in 27MHz |
| 301 | * when PCR packet was received |
| 302 | */ |
| 303 | __u64 stc; |
| 304 | |
| 305 | /* PCR value in 27MHz */ |
| 306 | __u64 pcr; |
| 307 | |
| 308 | /* Flags passed in filter events */ |
| 309 | __u32 flags; |
| 310 | }; |
| 311 | |
| 312 | /* |
Liron Kuch | 41543b7 | 2012-11-26 13:27:22 +0200 | [diff] [blame] | 313 | * Elementary stream data information associated |
| 314 | * with DMX_EVENT_NEW_ES_DATA event |
| 315 | */ |
| 316 | struct dmx_es_data_event_info { |
| 317 | /* Buffer user-space handle */ |
| 318 | int buf_handle; |
| 319 | |
| 320 | /* |
| 321 | * Cookie to provide when releasing the buffer |
| 322 | * using the DMX_RELEASE_DECODER_BUFFER ioctl command |
| 323 | */ |
| 324 | int cookie; |
| 325 | |
| 326 | /* Offset of data from the beginning of the buffer */ |
| 327 | __u32 offset; |
| 328 | |
| 329 | /* Length of data in buffer (in bytes) */ |
| 330 | __u32 data_len; |
| 331 | |
| 332 | /* Indication whether PTS value is valid */ |
| 333 | int pts_valid; |
| 334 | |
| 335 | /* PTS value associated with the buffer */ |
| 336 | __u64 pts; |
| 337 | |
| 338 | /* Indication whether DTS value is valid */ |
| 339 | int dts_valid; |
| 340 | |
| 341 | /* DTS value associated with the buffer */ |
| 342 | __u64 dts; |
| 343 | |
| 344 | /* |
| 345 | * Number of TS packets with Transport Error Indicator (TEI) set |
| 346 | * in the TS packet header since last reported event |
| 347 | */ |
| 348 | __u32 transport_error_indicator_counter; |
| 349 | |
| 350 | /* Number of continuity errors since last reported event */ |
| 351 | __u32 continuity_error_counter; |
| 352 | |
| 353 | /* Total number of TS packets processed since last reported event */ |
| 354 | __u32 ts_packets_num; |
| 355 | |
| 356 | /* |
| 357 | * Number of dropped bytes due to insufficient buffer space, |
| 358 | * since last reported event |
| 359 | */ |
| 360 | __u32 ts_dropped_bytes; |
| 361 | }; |
| 362 | |
| 363 | /* |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 364 | * Filter's event returned through DMX_GET_EVENT. |
| 365 | * poll with POLLPRI would block until events are available. |
| 366 | */ |
| 367 | struct dmx_filter_event { |
| 368 | enum dmx_event type; |
| 369 | |
| 370 | union { |
| 371 | struct dmx_pes_event_info pes; |
| 372 | struct dmx_section_event_info section; |
| 373 | struct dmx_rec_chunk_event_info recording_chunk; |
| 374 | struct dmx_pcr_event_info pcr; |
Liron Kuch | 41543b7 | 2012-11-26 13:27:22 +0200 | [diff] [blame] | 375 | struct dmx_es_data_event_info es_data; |
Hamad Kadmany | 4f87794 | 2012-07-15 15:06:01 +0300 | [diff] [blame] | 376 | } params; |
| 377 | }; |
| 378 | |
Hamad Kadmany | ec6202d | 2012-09-20 07:58:57 +0300 | [diff] [blame] | 379 | /* Filter's buffer requirement returned in dmx_caps */ |
| 380 | struct dmx_buffer_requirement { |
| 381 | /* Buffer size alignment, 0 means no special requirement */ |
| 382 | __u32 size_alignment; |
| 383 | |
| 384 | /* Maximum buffer size allowed */ |
| 385 | __u32 max_size; |
Gilad Broner | 526e57e | 2012-12-03 15:57:44 +0200 | [diff] [blame] | 386 | |
| 387 | /* Maximum number of linear buffers handled by demux */ |
| 388 | __u32 max_buffer_num; |
| 389 | |
| 390 | /* Feature support bitmap as detailed below */ |
Hamad Kadmany | ec6202d | 2012-09-20 07:58:57 +0300 | [diff] [blame] | 391 | __u32 flags; |
| 392 | |
Gilad Broner | 526e57e | 2012-12-03 15:57:44 +0200 | [diff] [blame] | 393 | /* Buffer must be allocated as physically contiguous memory */ |
| 394 | #define DMX_BUFFER_CONTIGUOUS_MEM 0x1 |
Hamad Kadmany | ec6202d | 2012-09-20 07:58:57 +0300 | [diff] [blame] | 395 | |
| 396 | /* If the filter's data is decrypted, the buffer should be secured one */ |
| 397 | #define DMX_BUFFER_SECURED_IF_DECRYPTED 0x2 |
Gilad Broner | 526e57e | 2012-12-03 15:57:44 +0200 | [diff] [blame] | 398 | |
| 399 | /* Buffer can be allocated externally */ |
| 400 | #define DMX_BUFFER_EXTERNAL_SUPPORT 0x4 |
| 401 | |
| 402 | /* Buffer can be allocated internally */ |
| 403 | #define DMX_BUFFER_INTERNAL_SUPPORT 0x8 |
| 404 | |
| 405 | /* Filter output can be output to a linear buffer group */ |
| 406 | #define DMX_BUFFER_LINEAR_GROUP_SUPPORT 0x10 |
Hamad Kadmany | ec6202d | 2012-09-20 07:58:57 +0300 | [diff] [blame] | 407 | }; |
| 408 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | typedef struct dmx_caps { |
| 410 | __u32 caps; |
Hamad Kadmany | d2c325e | 2012-05-28 13:52:49 +0300 | [diff] [blame] | 411 | |
| 412 | /* Indicates whether demux support playback from memory in pull mode */ |
| 413 | #define DMX_CAP_PULL_MODE 0x01 |
| 414 | |
| 415 | /* Indicates whether demux support indexing of recorded video stream */ |
| 416 | #define DMX_CAP_VIDEO_INDEXING 0x02 |
| 417 | |
| 418 | /* Indicates whether demux support sending data directly to video decoder */ |
| 419 | #define DMX_CAP_VIDEO_DECODER_DATA 0x04 |
| 420 | |
| 421 | /* Indicates whether demux support sending data directly to audio decoder */ |
| 422 | #define DMX_CAP_AUDIO_DECODER_DATA 0x08 |
| 423 | |
| 424 | /* Indicates whether demux support sending data directly to subtitle decoder */ |
| 425 | #define DMX_CAP_SUBTITLE_DECODER_DATA 0x10 |
| 426 | |
| 427 | /* Number of decoders demux can output data to */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 428 | int num_decoders; |
Hamad Kadmany | d2c325e | 2012-05-28 13:52:49 +0300 | [diff] [blame] | 429 | |
| 430 | /* Number of demux devices */ |
| 431 | int num_demux_devices; |
| 432 | |
| 433 | /* Max number of PID filters */ |
| 434 | int num_pid_filters; |
| 435 | |
| 436 | /* Max number of section filters */ |
| 437 | int num_section_filters; |
| 438 | |
| 439 | /* |
| 440 | * Max number of section filters using same PID, |
| 441 | * 0 if not supported |
| 442 | */ |
| 443 | int num_section_filters_per_pid; |
| 444 | |
| 445 | /* |
| 446 | * Length of section filter, not including section |
| 447 | * length field (2 bytes). |
| 448 | */ |
| 449 | int section_filter_length; |
| 450 | |
| 451 | /* Max number of demod based input */ |
| 452 | int num_demod_inputs; |
| 453 | |
| 454 | /* Max number of memory based input */ |
| 455 | int num_memory_inputs; |
| 456 | |
| 457 | /* Overall bitrate from all inputs concurrently. Mbit/sec */ |
| 458 | int max_bitrate; |
| 459 | |
| 460 | /* Max bitrate from single demod input. Mbit/sec */ |
| 461 | int demod_input_max_bitrate; |
| 462 | |
| 463 | /* Max bitrate from single memory input. Mbit/sec */ |
| 464 | int memory_input_max_bitrate; |
Hamad Kadmany | ec6202d | 2012-09-20 07:58:57 +0300 | [diff] [blame] | 465 | |
| 466 | struct dmx_buffer_requirement section; |
| 467 | |
| 468 | /* For PES not sent to decoder */ |
| 469 | struct dmx_buffer_requirement pes; |
| 470 | |
Gilad Broner | 526e57e | 2012-12-03 15:57:44 +0200 | [diff] [blame] | 471 | /* For PES sent to decoder */ |
| 472 | struct dmx_buffer_requirement decoder; |
| 473 | |
Hamad Kadmany | ec6202d | 2012-09-20 07:58:57 +0300 | [diff] [blame] | 474 | /* Recording buffer for recording of 188 bytes packets */ |
| 475 | struct dmx_buffer_requirement recording_188_tsp; |
| 476 | |
| 477 | /* Recording buffer for recording of 192 bytes packets */ |
| 478 | struct dmx_buffer_requirement recording_192_tsp; |
| 479 | |
| 480 | /* DVR input buffer for playback of 188 bytes packets */ |
| 481 | struct dmx_buffer_requirement playback_188_tsp; |
| 482 | |
| 483 | /* DVR input buffer for playback of 192 bytes packets */ |
| 484 | struct dmx_buffer_requirement playback_192_tsp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | } dmx_caps_t; |
| 486 | |
| 487 | typedef enum { |
| 488 | DMX_SOURCE_FRONT0 = 0, |
| 489 | DMX_SOURCE_FRONT1, |
| 490 | DMX_SOURCE_FRONT2, |
| 491 | DMX_SOURCE_FRONT3, |
| 492 | DMX_SOURCE_DVR0 = 16, |
| 493 | DMX_SOURCE_DVR1, |
| 494 | DMX_SOURCE_DVR2, |
| 495 | DMX_SOURCE_DVR3 |
| 496 | } dmx_source_t; |
| 497 | |
Hamad Kadmany | 32cb982 | 2012-05-10 08:47:44 +0300 | [diff] [blame] | 498 | enum dmx_tsp_format_t { |
| 499 | DMX_TSP_FORMAT_188 = 0, |
| 500 | DMX_TSP_FORMAT_192_TAIL, |
| 501 | DMX_TSP_FORMAT_192_HEAD, |
| 502 | DMX_TSP_FORMAT_204, |
| 503 | }; |
| 504 | |
| 505 | enum dmx_playback_mode_t { |
| 506 | /* |
| 507 | * In push mode, if one of output buffers |
| 508 | * is full, the buffer would overflow |
| 509 | * and demux continue processing incoming stream. |
| 510 | * This is the default mode. When playing from frontend, |
| 511 | * this is the only mode that is allowed. |
| 512 | */ |
| 513 | DMX_PB_MODE_PUSH = 0, |
| 514 | |
| 515 | /* |
| 516 | * In pull mode, if one of output buffers |
| 517 | * is full, demux stalls waiting for free space, |
| 518 | * this would cause DVR input buffer fullness |
| 519 | * to accumulate. |
| 520 | * This mode is possible only when playing |
| 521 | * from DVR. |
| 522 | */ |
| 523 | DMX_PB_MODE_PULL, |
| 524 | }; |
| 525 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | struct dmx_stc { |
Gilad Broner | 526e57e | 2012-12-03 15:57:44 +0200 | [diff] [blame] | 527 | unsigned int num; /* input : which STC? 0..N */ |
| 528 | unsigned int base; /* output: divisor for stc to get 90 kHz clock */ |
| 529 | __u64 stc; /* output: stc in 'base'*90 kHz units */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 530 | }; |
| 531 | |
Hamad Kadmany | ec6202d | 2012-09-20 07:58:57 +0300 | [diff] [blame] | 532 | enum dmx_buffer_mode { |
| 533 | /* |
| 534 | * demux buffers are allocated internally |
| 535 | * by the demux driver. This is the default mode. |
| 536 | * DMX_SET_BUFFER_SIZE can be used to set the size of |
| 537 | * this buffer. |
| 538 | */ |
| 539 | DMX_BUFFER_MODE_INTERNAL, |
| 540 | |
| 541 | /* |
| 542 | * demux buffers are allocated externally and provided |
| 543 | * to demux through DMX_SET_BUFFER. |
| 544 | * When this mode is used DMX_SET_BUFFER_SIZE and |
| 545 | * mmap are prohibited. |
| 546 | */ |
| 547 | DMX_BUFFER_MODE_EXTERNAL, |
| 548 | }; |
| 549 | |
| 550 | struct dmx_buffer { |
| 551 | unsigned int size; |
| 552 | int handle; |
| 553 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | |
Gilad Broner | 526e57e | 2012-12-03 15:57:44 +0200 | [diff] [blame] | 555 | struct dmx_decoder_buffers { |
| 556 | /* |
| 557 | * Specify if linear buffer support is requested. If set, buffers_num |
| 558 | * must be greater than 1 |
| 559 | */ |
| 560 | int is_linear; |
| 561 | |
| 562 | /* |
| 563 | * Specify number of external buffers allocated by user. |
| 564 | * If set to 0 means internal buffer allocation is requested |
| 565 | */ |
| 566 | __u32 buffers_num; |
| 567 | |
| 568 | /* Specify buffer size, either external or internal */ |
| 569 | __u32 buffers_size; |
| 570 | |
| 571 | /* Array of externally allocated buffer handles */ |
| 572 | int handles[DMX_MAX_DECODER_BUFFER_NUM]; |
| 573 | }; |
| 574 | |
Hamad Kadmany | 168203b | 2013-01-28 15:22:46 +0200 | [diff] [blame] | 575 | struct dmx_secure_mode { |
| 576 | /* |
| 577 | * Specifies whether secure mode should be set or not for the filter's |
| 578 | * pid. Note that DMX_OUT_TSDEMUX_TAP filters can have more than 1 pid |
| 579 | */ |
| 580 | int is_secured; |
| 581 | |
| 582 | /* PID to associate with key ladder id */ |
| 583 | __u16 pid; |
| 584 | |
| 585 | /* key ladder information to associate with the specified pid */ |
| 586 | __u32 key_ladder_id; |
| 587 | }; |
| 588 | |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 589 | struct dmx_events_mask { |
| 590 | /* |
| 591 | * Bitmask of events to be disabled (dmx_event). |
| 592 | * Disabled events will not be notified to the user. |
| 593 | * By default all events are enabled except for |
| 594 | * DMX_EVENT_NEW_ES_DATA. |
| 595 | * Overflow event can't be disabled. |
| 596 | */ |
| 597 | __u32 disable_mask; |
| 598 | |
| 599 | /* |
| 600 | * Bitmask of events that will not wake-up the user |
| 601 | * when user calls poll with POLLPRI flag. |
| 602 | * Events that are used as wake-up source should not be |
| 603 | * disabled in disable_mask or they would not be used |
| 604 | * as a wake-up source. |
| 605 | * By default all enabled events are set as wake-up events. |
| 606 | * Overflow event can't be disabled as a wake-up source. |
| 607 | */ |
| 608 | __u32 no_wakeup_mask; |
| 609 | |
| 610 | /* |
| 611 | * Number of ready wake-up events which will trigger |
| 612 | * a wake-up when user calls poll with POLLPRI flag. |
| 613 | * Default is set to 1. |
| 614 | */ |
| 615 | __u32 wakeup_threshold; |
| 616 | }; |
| 617 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | #define DMX_START _IO('o', 41) |
| 619 | #define DMX_STOP _IO('o', 42) |
| 620 | #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) |
| 621 | #define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) |
| 622 | #define DMX_SET_BUFFER_SIZE _IO('o', 45) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) |
| 624 | #define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) |
| 625 | #define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) |
| 626 | #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) |
Andreas Oberritter | 1cb662a | 2009-07-14 20:28:50 -0300 | [diff] [blame] | 627 | #define DMX_ADD_PID _IOW('o', 51, __u16) |
| 628 | #define DMX_REMOVE_PID _IOW('o', 52, __u16) |
Hamad Kadmany | 32cb982 | 2012-05-10 08:47:44 +0300 | [diff] [blame] | 629 | #define DMX_SET_TS_PACKET_FORMAT _IOW('o', 53, enum dmx_tsp_format_t) |
| 630 | #define DMX_SET_TS_OUT_FORMAT _IOW('o', 54, enum dmx_tsp_format_t) |
| 631 | #define DMX_SET_DECODER_BUFFER_SIZE _IO('o', 55) |
| 632 | #define DMX_GET_BUFFER_STATUS _IOR('o', 56, struct dmx_buffer_status) |
| 633 | #define DMX_RELEASE_DATA _IO('o', 57) |
| 634 | #define DMX_FEED_DATA _IO('o', 58) |
| 635 | #define DMX_SET_PLAYBACK_MODE _IOW('o', 59, enum dmx_playback_mode_t) |
Liron Kuch | 41543b7 | 2012-11-26 13:27:22 +0200 | [diff] [blame] | 636 | #define DMX_GET_EVENT _IOR('o', 60, struct dmx_filter_event) |
| 637 | #define DMX_SET_BUFFER_MODE _IOW('o', 61, enum dmx_buffer_mode) |
| 638 | #define DMX_SET_BUFFER _IOW('o', 62, struct dmx_buffer) |
Gilad Broner | 526e57e | 2012-12-03 15:57:44 +0200 | [diff] [blame] | 639 | #define DMX_SET_DECODER_BUFFER _IOW('o', 63, struct dmx_decoder_buffers) |
Liron Kuch | 41543b7 | 2012-11-26 13:27:22 +0200 | [diff] [blame] | 640 | #define DMX_REUSE_DECODER_BUFFER _IO('o', 64) |
Hamad Kadmany | 168203b | 2013-01-28 15:22:46 +0200 | [diff] [blame] | 641 | #define DMX_SET_SECURE_MODE _IOW('o', 65, struct dmx_secure_mode) |
Hamad Kadmany | a0a00f5 | 2013-03-19 10:11:45 +0200 | [diff] [blame] | 642 | #define DMX_SET_EVENTS_MASK _IOW('o', 66, struct dmx_events_mask) |
| 643 | #define DMX_GET_EVENTS_MASK _IOR('o', 67, struct dmx_events_mask) |
Hamad Kadmany | 168203b | 2013-01-28 15:22:46 +0200 | [diff] [blame] | 644 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | |
| 646 | #endif /*_DVBDMX_H_*/ |