1<title>DVB Demux Device</title> 2 3<para>The DVB demux device controls the filters of the DVB hardware/software. It can be 4accessed through <emphasis role="tt">/dev/adapter0/demux0</emphasis>. Data types and and ioctl definitions can be 5accessed by including <emphasis role="tt">linux/dvb/dmx.h</emphasis> in your application. 6</para> 7<section id="dmx_types"> 8<title>Demux Data Types</title> 9 10<section id="dmx-output-t"> 11<title>dmx_output_t</title> 12<programlisting> 13typedef enum 14{ 15 DMX_OUT_DECODER, /⋆ Streaming directly to decoder. ⋆/ 16 DMX_OUT_TAP, /⋆ Output going to a memory buffer ⋆/ 17 /⋆ (to be retrieved via the read command).⋆/ 18 DMX_OUT_TS_TAP, /⋆ Output multiplexed into a new TS ⋆/ 19 /⋆ (to be retrieved by reading from the ⋆/ 20 /⋆ logical DVR device). ⋆/ 21 DMX_OUT_TSDEMUX_TAP /⋆ Like TS_TAP but retrieved from the DMX device ⋆/ 22} dmx_output_t; 23</programlisting> 24<para><emphasis role="tt">DMX_OUT_TAP</emphasis> delivers the stream output to the demux device on which the ioctl is 25called. 26</para> 27<para><emphasis role="tt">DMX_OUT_TS_TAP</emphasis> routes output to the logical DVR device <emphasis role="tt">/dev/dvb/adapter0/dvr0</emphasis>, 28which delivers a TS multiplexed from all filters for which <emphasis role="tt">DMX_OUT_TS_TAP</emphasis> was 29specified. 30</para> 31</section> 32 33<section id="dmx-input-t"> 34<title>dmx_input_t</title> 35<programlisting> 36typedef enum 37{ 38 DMX_IN_FRONTEND, /⋆ Input from a front-end device. ⋆/ 39 DMX_IN_DVR /⋆ Input from the logical DVR device. ⋆/ 40} dmx_input_t; 41</programlisting> 42</section> 43 44<section id="dmx-pes-type-t"> 45<title>dmx_pes_type_t</title> 46<programlisting> 47typedef enum 48{ 49 DMX_PES_AUDIO0, 50 DMX_PES_VIDEO0, 51 DMX_PES_TELETEXT0, 52 DMX_PES_SUBTITLE0, 53 DMX_PES_PCR0, 54 55 DMX_PES_AUDIO1, 56 DMX_PES_VIDEO1, 57 DMX_PES_TELETEXT1, 58 DMX_PES_SUBTITLE1, 59 DMX_PES_PCR1, 60 61 DMX_PES_AUDIO2, 62 DMX_PES_VIDEO2, 63 DMX_PES_TELETEXT2, 64 DMX_PES_SUBTITLE2, 65 DMX_PES_PCR2, 66 67 DMX_PES_AUDIO3, 68 DMX_PES_VIDEO3, 69 DMX_PES_TELETEXT3, 70 DMX_PES_SUBTITLE3, 71 DMX_PES_PCR3, 72 73 DMX_PES_OTHER 74} dmx_pes_type_t; 75</programlisting> 76</section> 77 78<section id="dmx-filter"> 79<title>struct dmx_filter</title> 80 <programlisting> 81 typedef struct dmx_filter 82{ 83 __u8 filter[DMX_FILTER_SIZE]; 84 __u8 mask[DMX_FILTER_SIZE]; 85 __u8 mode[DMX_FILTER_SIZE]; 86} dmx_filter_t; 87</programlisting> 88</section> 89 90<section id="dmx-sct-filter-params"> 91<title>struct dmx_sct_filter_params</title> 92<programlisting> 93struct dmx_sct_filter_params 94{ 95 __u16 pid; 96 dmx_filter_t filter; 97 __u32 timeout; 98 __u32 flags; 99#define DMX_CHECK_CRC 1 100#define DMX_ONESHOT 2 101#define DMX_IMMEDIATE_START 4 102#define DMX_KERNEL_CLIENT 0x8000 103}; 104</programlisting> 105</section> 106 107<section id="dmx-pes-filter-params"> 108<title>struct dmx_pes_filter_params</title> 109<programlisting> 110struct dmx_pes_filter_params 111{ 112 __u16 pid; 113 dmx_input_t input; 114 dmx_output_t output; 115 dmx_pes_type_t pes_type; 116 __u32 flags; 117}; 118</programlisting> 119</section> 120 121<section id="dmx-event"> 122<title>struct dmx_event</title> 123 <programlisting> 124 struct dmx_event 125 { 126 dmx_event_t event; 127 time_t timeStamp; 128 union 129 { 130 dmx_scrambling_status_t scrambling; 131 } u; 132 }; 133</programlisting> 134</section> 135 136<section id="dmx-stc"> 137<title>struct dmx_stc</title> 138<programlisting> 139struct dmx_stc { 140 unsigned int num; /⋆ input : which STC? 0..N ⋆/ 141 unsigned int base; /⋆ output: divisor for stc to get 90 kHz clock ⋆/ 142 __u64 stc; /⋆ output: stc in 'base'⋆90 kHz units ⋆/ 143}; 144</programlisting> 145</section> 146 147<section id="dmx-caps"> 148<title>struct dmx_caps</title> 149<programlisting> 150 typedef struct dmx_caps { 151 __u32 caps; 152 int num_decoders; 153} dmx_caps_t; 154</programlisting> 155</section> 156 157<section id="dmx-source-t"> 158<title>enum dmx_source_t</title> 159<programlisting> 160typedef enum { 161 DMX_SOURCE_FRONT0 = 0, 162 DMX_SOURCE_FRONT1, 163 DMX_SOURCE_FRONT2, 164 DMX_SOURCE_FRONT3, 165 DMX_SOURCE_DVR0 = 16, 166 DMX_SOURCE_DVR1, 167 DMX_SOURCE_DVR2, 168 DMX_SOURCE_DVR3 169} dmx_source_t; 170</programlisting> 171</section> 172 173</section> 174<section id="dmx_fcalls"> 175<title>Demux Function Calls</title> 176 177<section id="dmx_fopen"> 178<title>open()</title> 179<para>DESCRIPTION 180</para> 181<informaltable><tgroup cols="1"><tbody><row><entry 182 align="char"> 183<para>This system call, used with a device name of /dev/dvb/adapter0/demux0, 184 allocates a new filter and returns a handle which can be used for subsequent 185 control of that filter. This call has to be made for each filter to be used, i.e. every 186 returned file descriptor is a reference to a single filter. /dev/dvb/adapter0/dvr0 187 is a logical device to be used for retrieving Transport Streams for digital 188 video recording. When reading from this device a transport stream containing 189 the packets from all PES filters set in the corresponding demux device 190 (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A 191 recorded Transport Stream is replayed by writing to this device. </para> 192<para>The significance of blocking or non-blocking mode is described in the 193 documentation for functions where there is a difference. It does not affect the 194 semantics of the open() call itself. A device opened in blocking mode can later 195 be put into non-blocking mode (and vice versa) using the F_SETFL command 196 of the fcntl system call.</para> 197</entry> 198 </row></tbody></tgroup></informaltable> 199<para>SYNOPSIS 200</para> 201<informaltable><tgroup cols="1"><tbody><row><entry 202 align="char"> 203<para>int open(const char ⋆deviceName, int flags);</para> 204</entry> 205 </row></tbody></tgroup></informaltable> 206<para>PARAMETERS 207</para> 208<informaltable><tgroup cols="2"><tbody><row><entry 209 align="char"> 210<para>const char 211 *deviceName</para> 212</entry><entry 213 align="char"> 214<para>Name of demux device.</para> 215</entry> 216 </row><row><entry 217 align="char"> 218<para>int flags</para> 219</entry><entry 220 align="char"> 221<para>A bit-wise OR of the following flags:</para> 222</entry> 223 </row><row><entry 224 align="char"> 225</entry><entry 226 align="char"> 227<para>O_RDWR read/write access</para> 228</entry> 229 </row><row><entry 230 align="char"> 231</entry><entry 232 align="char"> 233<para>O_NONBLOCK open in non-blocking mode</para> 234</entry> 235 </row><row><entry 236 align="char"> 237</entry><entry 238 align="char"> 239<para>(blocking mode is the default)</para> 240</entry> 241 </row></tbody></tgroup></informaltable> 242<para>RETURN VALUE</para> 243<informaltable><tgroup cols="2"><tbody><row><entry 244 align="char"> 245<para>ENODEV</para> 246</entry><entry 247 align="char"> 248<para>Device driver not loaded/available.</para> 249</entry> 250 </row><row><entry 251 align="char"> 252<para>EINVAL</para> 253</entry><entry 254 align="char"> 255<para>Invalid argument.</para> 256</entry> 257 </row><row><entry 258 align="char"> 259<para>EMFILE</para> 260</entry><entry 261 align="char"> 262<para>“Too many open files”, i.e. no more filters available.</para> 263</entry> 264 </row><row><entry 265 align="char"> 266<para>ENOMEM</para> 267</entry><entry 268 align="char"> 269<para>The driver failed to allocate enough memory.</para> 270</entry> 271 </row></tbody></tgroup></informaltable> 272</section> 273 274<section id="dmx_fclose"> 275<title>close()</title> 276<para>DESCRIPTION 277</para> 278<informaltable><tgroup cols="1"><tbody><row><entry 279 align="char"> 280<para>This system call deactivates and deallocates a filter that was previously 281 allocated via the open() call.</para> 282</entry> 283 </row></tbody></tgroup></informaltable> 284<para>SYNOPSIS 285</para> 286<informaltable><tgroup cols="1"><tbody><row><entry 287 align="char"> 288<para>int close(int fd);</para> 289</entry> 290 </row></tbody></tgroup></informaltable> 291<para>PARAMETERS 292</para> 293<informaltable><tgroup cols="2"><tbody><row><entry 294 align="char"> 295<para>int fd</para> 296</entry><entry 297 align="char"> 298<para>File descriptor returned by a previous call to open().</para> 299</entry> 300 </row></tbody></tgroup></informaltable> 301<para>RETURN VALUE</para> 302<informaltable><tgroup cols="2"><tbody><row><entry 303 align="char"> 304<para>EBADF</para> 305</entry><entry 306 align="char"> 307<para>fd is not a valid open file descriptor.</para> 308</entry> 309 </row></tbody></tgroup></informaltable> 310</section> 311 312<section id="dmx_fread"> 313<title>read()</title> 314<para>DESCRIPTION 315</para> 316<informaltable><tgroup cols="1"><tbody><row><entry 317 align="char"> 318<para>This system call returns filtered data, which might be section or PES data. The 319 filtered data is transferred from the driver’s internal circular buffer to buf. The 320 maximum amount of data to be transferred is implied by count.</para> 321</entry> 322 </row><row><entry 323 align="char"> 324<para>When returning section data the driver always tries to return a complete single 325 section (even though buf would provide buffer space for more data). If the size 326 of the buffer is smaller than the section as much as possible will be returned, 327 and the remaining data will be provided in subsequent calls.</para> 328</entry> 329 </row><row><entry 330 align="char"> 331<para>The size of the internal buffer is 2 * 4096 bytes (the size of two maximum 332 sized sections) by default. The size of this buffer may be changed by using the 333 DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if 334 the read operations are not performed fast enough, this may result in a buffer 335 overflow error. In this case EOVERFLOW will be returned, and the circular 336 buffer will be emptied. This call is blocking if there is no data to return, i.e. the 337 process will be put to sleep waiting for data, unless the O_NONBLOCK flag 338 is specified.</para> 339</entry> 340 </row><row><entry 341 align="char"> 342<para>Note that in order to be able to read, the filtering process has to be started 343 by defining either a section or a PES filter by means of the ioctl functions, 344 and then starting the filtering process via the DMX_START ioctl function 345 or by setting the DMX_IMMEDIATE_START flag. If the reading is done 346 from a logical DVR demux device, the data will constitute a Transport Stream 347 including the packets from all PES filters in the corresponding demux device 348 /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP.</para> 349</entry> 350 </row></tbody></tgroup></informaltable> 351<para>SYNOPSIS 352</para> 353<informaltable><tgroup cols="1"><tbody><row><entry 354 align="char"> 355<para>size_t read(int fd, void ⋆buf, size_t count);</para> 356</entry> 357 </row></tbody></tgroup></informaltable> 358<para>PARAMETERS 359</para> 360<informaltable><tgroup cols="2"><tbody><row><entry 361 align="char"> 362<para>int fd</para> 363</entry><entry 364 align="char"> 365<para>File descriptor returned by a previous call to open().</para> 366</entry> 367 </row><row><entry 368 align="char"> 369<para>void *buf</para> 370</entry><entry 371 align="char"> 372<para>Pointer to the buffer to be used for returned filtered data.</para> 373</entry> 374 </row><row><entry 375 align="char"> 376<para>size_t count</para> 377</entry><entry 378 align="char"> 379<para>Size of buf.</para> 380</entry> 381 </row></tbody></tgroup></informaltable> 382<para>RETURN VALUE</para> 383<informaltable><tgroup cols="2"><tbody><row><entry 384 align="char"> 385<para>EWOULDBLOCK</para> 386</entry><entry 387 align="char"> 388<para>No data to return and O_NONBLOCK was specified.</para> 389</entry> 390 </row><row><entry 391 align="char"> 392<para>EBADF</para> 393</entry><entry 394 align="char"> 395<para>fd is not a valid open file descriptor.</para> 396</entry> 397 </row><row><entry 398 align="char"> 399<para>ECRC</para> 400</entry><entry 401 align="char"> 402<para>Last section had a CRC error - no data returned. The 403 buffer is flushed.</para> 404</entry> 405 </row><row><entry 406 align="char"> 407<para>EOVERFLOW</para> 408</entry><entry 409 align="char"> 410</entry> 411 </row><row><entry 412 align="char"> 413</entry><entry 414 align="char"> 415<para>The filtered data was not read from the buffer in due 416 time, resulting in non-read data being lost. The buffer is 417 flushed.</para> 418</entry> 419 </row><row><entry 420 align="char"> 421<para>ETIMEDOUT</para> 422</entry><entry 423 align="char"> 424<para>The section was not loaded within the stated timeout 425 period. See ioctl DMX_SET_FILTER for how to set a 426 timeout.</para> 427</entry> 428 </row><row><entry 429 align="char"> 430<para>EFAULT</para> 431</entry><entry 432 align="char"> 433<para>The driver failed to write to the callers buffer due to an 434 invalid *buf pointer.</para> 435</entry> 436 </row></tbody></tgroup></informaltable> 437</section> 438 439<section id="dmx_fwrite"> 440<title>write()</title> 441<para>DESCRIPTION 442</para> 443<informaltable><tgroup cols="1"><tbody><row><entry 444 align="char"> 445<para>This system call is only provided by the logical device /dev/dvb/adapter0/dvr0, 446 associated with the physical demux device that provides the actual DVR 447 functionality. It is used for replay of a digitally recorded Transport Stream. 448 Matching filters have to be defined in the corresponding physical demux 449 device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is 450 implied by count.</para> 451</entry> 452 </row></tbody></tgroup></informaltable> 453<para>SYNOPSIS 454</para> 455<informaltable><tgroup cols="1"><tbody><row><entry 456 align="char"> 457<para>ssize_t write(int fd, const void ⋆buf, size_t 458 count);</para> 459</entry> 460 </row></tbody></tgroup></informaltable> 461<para>PARAMETERS 462</para> 463<informaltable><tgroup cols="2"><tbody><row><entry 464 align="char"> 465<para>int fd</para> 466</entry><entry 467 align="char"> 468<para>File descriptor returned by a previous call to open().</para> 469</entry> 470 </row><row><entry 471 align="char"> 472<para>void *buf</para> 473</entry><entry 474 align="char"> 475<para>Pointer to the buffer containing the Transport Stream.</para> 476</entry> 477 </row><row><entry 478 align="char"> 479<para>size_t count</para> 480</entry><entry 481 align="char"> 482<para>Size of buf.</para> 483</entry> 484 </row></tbody></tgroup></informaltable> 485<para>RETURN VALUE</para> 486<informaltable><tgroup cols="2"><tbody><row><entry 487 align="char"> 488<para>EWOULDBLOCK</para> 489</entry><entry 490 align="char"> 491<para>No data was written. This 492 might happen if O_NONBLOCK was specified and there 493 is no more buffer space available (if O_NONBLOCK is 494 not specified the function will block until buffer space is 495 available).</para> 496</entry> 497 </row><row><entry 498 align="char"> 499<para>EBUSY</para> 500</entry><entry 501 align="char"> 502<para>This error code indicates that there are conflicting 503 requests. The corresponding demux device is setup to 504 receive data from the front- end. Make sure that these 505 filters are stopped and that the filters with input set to 506 DMX_IN_DVR are started.</para> 507</entry> 508 </row><row><entry 509 align="char"> 510<para>EBADF</para> 511</entry><entry 512 align="char"> 513<para>fd is not a valid open file descriptor.</para> 514</entry> 515 </row></tbody></tgroup></informaltable> 516</section> 517 518<section id="DMX_START"> 519<title>DMX_START</title> 520<para>DESCRIPTION 521</para> 522<informaltable><tgroup cols="1"><tbody><row><entry 523 align="char"> 524<para>This ioctl call is used to start the actual filtering operation defined via the ioctl 525 calls DMX_SET_FILTER or DMX_SET_PES_FILTER.</para> 526</entry> 527 </row></tbody></tgroup></informaltable> 528<para>SYNOPSIS 529</para> 530<informaltable><tgroup cols="1"><tbody><row><entry 531 align="char"> 532<para>int ioctl( int fd, int request = DMX_START);</para> 533</entry> 534 </row></tbody></tgroup></informaltable> 535<para>PARAMETERS 536</para> 537<informaltable><tgroup cols="2"><tbody><row><entry 538 align="char"> 539<para>int fd</para> 540</entry><entry 541 align="char"> 542<para>File descriptor returned by a previous call to open().</para> 543</entry> 544 </row><row><entry 545 align="char"> 546<para>int request</para> 547</entry><entry 548 align="char"> 549<para>Equals DMX_START for this command.</para> 550</entry> 551 </row></tbody></tgroup></informaltable> 552&return-value-dvb; 553<informaltable><tgroup cols="2"><tbody><row><entry 554 align="char"> 555<para>EINVAL</para> 556</entry><entry 557 align="char"> 558<para>Invalid argument, i.e. no filtering parameters provided via 559 the DMX_SET_FILTER or DMX_SET_PES_FILTER 560 functions.</para> 561</entry> 562 </row><row><entry 563 align="char"> 564<para>EBUSY</para> 565</entry><entry 566 align="char"> 567<para>This error code indicates that there are conflicting 568 requests. There are active filters filtering data from 569 another input source. Make sure that these filters are 570 stopped before starting this filter.</para> 571</entry> 572 </row></tbody></tgroup></informaltable> 573</section> 574 575<section id="DMX_STOP"> 576<title>DMX_STOP</title> 577<para>DESCRIPTION 578</para> 579<informaltable><tgroup cols="1"><tbody><row><entry 580 align="char"> 581<para>This ioctl call is used to stop the actual filtering operation defined via the 582 ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via 583 the DMX_START command.</para> 584</entry> 585 </row></tbody></tgroup></informaltable> 586<para>SYNOPSIS 587</para> 588<informaltable><tgroup cols="1"><tbody><row><entry 589 align="char"> 590<para>int ioctl( int fd, int request = DMX_STOP);</para> 591</entry> 592 </row></tbody></tgroup></informaltable> 593<para>PARAMETERS 594</para> 595<informaltable><tgroup cols="2"><tbody><row><entry 596 align="char"> 597<para>int fd</para> 598</entry><entry 599 align="char"> 600<para>File descriptor returned by a previous call to open().</para> 601</entry> 602 </row><row><entry 603 align="char"> 604<para>int request</para> 605</entry><entry 606 align="char"> 607<para>Equals DMX_STOP for this command.</para> 608</entry> 609 </row></tbody></tgroup></informaltable> 610&return-value-dvb; 611</section> 612 613<section id="DMX_SET_FILTER"> 614<title>DMX_SET_FILTER</title> 615<para>DESCRIPTION 616</para> 617<informaltable><tgroup cols="1"><tbody><row><entry 618 align="char"> 619<para>This ioctl call sets up a filter according to the filter and mask parameters 620 provided. A timeout may be defined stating number of seconds to wait for a 621 section to be loaded. A value of 0 means that no timeout should be applied. 622 Finally there is a flag field where it is possible to state whether a section should 623 be CRC-checked, whether the filter should be a ”one-shot” filter, i.e. if the 624 filtering operation should be stopped after the first section is received, and 625 whether the filtering operation should be started immediately (without waiting 626 for a DMX_START ioctl call). If a filter was previously set-up, this filter will 627 be canceled, and the receive buffer will be flushed.</para> 628</entry> 629 </row></tbody></tgroup></informaltable> 630<para>SYNOPSIS 631</para> 632<informaltable><tgroup cols="1"><tbody><row><entry 633 align="char"> 634<para>int ioctl( int fd, int request = DMX_SET_FILTER, 635 struct dmx_sct_filter_params ⋆params);</para> 636</entry> 637 </row></tbody></tgroup></informaltable> 638<para>PARAMETERS 639</para> 640<informaltable><tgroup cols="2"><tbody><row><entry 641 align="char"> 642<para>int fd</para> 643</entry><entry 644 align="char"> 645<para>File descriptor returned by a previous call to open().</para> 646</entry> 647 </row><row><entry 648 align="char"> 649<para>int request</para> 650</entry><entry 651 align="char"> 652<para>Equals DMX_SET_FILTER for this command.</para> 653</entry> 654 </row><row><entry 655 align="char"> 656<para>struct 657 dmx_sct_filter_params 658 *params</para> 659</entry><entry 660 align="char"> 661<para>Pointer to structure containing filter parameters.</para> 662</entry> 663 </row></tbody></tgroup></informaltable> 664&return-value-dvb; 665</section> 666 667<section id="DMX_SET_PES_FILTER"> 668<title>DMX_SET_PES_FILTER</title> 669<para>DESCRIPTION 670</para> 671<informaltable><tgroup cols="1"><tbody><row><entry 672 align="char"> 673<para>This ioctl call sets up a PES filter according to the parameters provided. By a 674 PES filter is meant a filter that is based just on the packet identifier (PID), i.e. 675 no PES header or payload filtering capability is supported.</para> 676</entry> 677 </row><row><entry 678 align="char"> 679<para>The transport stream destination for the filtered output may be set. Also the 680 PES type may be stated in order to be able to e.g. direct a video stream directly 681 to the video decoder. Finally there is a flag field where it is possible to state 682 whether the filtering operation should be started immediately (without waiting 683 for a DMX_START ioctl call). If a filter was previously set-up, this filter will 684 be cancelled, and the receive buffer will be flushed.</para> 685</entry> 686 </row></tbody></tgroup></informaltable> 687<para>SYNOPSIS 688</para> 689<informaltable><tgroup cols="1"><tbody><row><entry 690 align="char"> 691<para>int ioctl( int fd, int request = DMX_SET_PES_FILTER, 692 struct dmx_pes_filter_params ⋆params);</para> 693</entry> 694 </row></tbody></tgroup></informaltable> 695<para>PARAMETERS 696</para> 697<informaltable><tgroup cols="2"><tbody><row><entry 698 align="char"> 699<para>int fd</para> 700</entry><entry 701 align="char"> 702<para>File descriptor returned by a previous call to open().</para> 703</entry> 704 </row><row><entry 705 align="char"> 706<para>int request</para> 707</entry><entry 708 align="char"> 709<para>Equals DMX_SET_PES_FILTER for this command.</para> 710</entry> 711 </row><row><entry 712 align="char"> 713<para>struct 714 dmx_pes_filter_params 715 *params</para> 716</entry><entry 717 align="char"> 718<para>Pointer to structure containing filter parameters.</para> 719</entry> 720 </row></tbody></tgroup></informaltable> 721&return-value-dvb; 722<informaltable><tgroup cols="2"><tbody><row><entry 723 align="char"> 724<para>EBUSY</para> 725</entry><entry 726 align="char"> 727<para>This error code indicates that there are conflicting 728 requests. There are active filters filtering data from 729 another input source. Make sure that these filters are 730 stopped before starting this filter.</para> 731</entry> 732 </row></tbody></tgroup></informaltable> 733</section> 734 735<section id="DMX_SET_BUFFER_SIZE"> 736<title>DMX_SET_BUFFER_SIZE</title> 737<para>DESCRIPTION 738</para> 739<informaltable><tgroup cols="1"><tbody><row><entry 740 align="char"> 741<para>This ioctl call is used to set the size of the circular buffer used for filtered data. 742 The default size is two maximum sized sections, i.e. if this function is not called 743 a buffer size of 2 * 4096 bytes will be used.</para> 744</entry> 745 </row></tbody></tgroup></informaltable> 746<para>SYNOPSIS 747</para> 748<informaltable><tgroup cols="1"><tbody><row><entry 749 align="char"> 750<para>int ioctl( int fd, int request = 751 DMX_SET_BUFFER_SIZE, unsigned long size);</para> 752</entry> 753 </row></tbody></tgroup></informaltable> 754<para>PARAMETERS 755</para> 756<informaltable><tgroup cols="2"><tbody><row><entry 757 align="char"> 758<para>int fd</para> 759</entry><entry 760 align="char"> 761<para>File descriptor returned by a previous call to open().</para> 762</entry> 763 </row><row><entry 764 align="char"> 765<para>int request</para> 766</entry><entry 767 align="char"> 768<para>Equals DMX_SET_BUFFER_SIZE for this command.</para> 769</entry> 770 </row><row><entry 771 align="char"> 772<para>unsigned long size</para> 773</entry><entry 774 align="char"> 775<para>Size of circular buffer.</para> 776</entry> 777 </row></tbody></tgroup></informaltable> 778&return-value-dvb; 779</section> 780 781<section id="DMX_GET_EVENT"> 782<title>DMX_GET_EVENT</title> 783<para>DESCRIPTION 784</para> 785<informaltable><tgroup cols="1"><tbody><row><entry 786 align="char"> 787<para>This ioctl call returns an event if available. If an event is not available, 788 the behavior depends on whether the device is in blocking or non-blocking 789 mode. In the latter case, the call fails immediately with errno set to 790 EWOULDBLOCK. In the former case, the call blocks until an event becomes 791 available.</para> 792</entry> 793 </row><row><entry 794 align="char"> 795<para>The standard Linux poll() and/or select() system calls can be used with the 796 device file descriptor to watch for new events. For select(), the file descriptor 797 should be included in the exceptfds argument, and for poll(), POLLPRI should 798 be specified as the wake-up condition. Only the latest event for each filter is 799 saved.</para> 800</entry> 801 </row></tbody></tgroup></informaltable> 802<para>SYNOPSIS 803</para> 804<informaltable><tgroup cols="1"><tbody><row><entry 805 align="char"> 806<para>int ioctl( int fd, int request = DMX_GET_EVENT, 807 struct dmx_event ⋆ev);</para> 808</entry> 809 </row></tbody></tgroup></informaltable> 810<para>PARAMETERS 811</para> 812<informaltable><tgroup cols="2"><tbody><row><entry 813 align="char"> 814<para>int fd</para> 815</entry><entry 816 align="char"> 817<para>File descriptor returned by a previous call to open().</para> 818</entry> 819 </row><row><entry 820 align="char"> 821<para>int request</para> 822</entry><entry 823 align="char"> 824<para>Equals DMX_GET_EVENT for this command.</para> 825</entry> 826 </row><row><entry 827 align="char"> 828<para>struct dmx_event *ev</para> 829</entry><entry 830 align="char"> 831<para>Pointer to the location where the event is to be stored.</para> 832</entry> 833 </row></tbody></tgroup></informaltable> 834&return-value-dvb; 835<informaltable><tgroup cols="2"><tbody><row><entry 836 align="char"> 837<para>EWOULDBLOCK</para> 838</entry><entry 839 align="char"> 840<para>There is no event pending, and the device is in 841 non-blocking mode.</para> 842</entry> 843 </row></tbody></tgroup></informaltable> 844</section> 845 846<section id="DMX_GET_STC"> 847<title>DMX_GET_STC</title> 848<para>DESCRIPTION 849</para> 850<informaltable><tgroup cols="1"><tbody><row><entry 851 align="char"> 852<para>This ioctl call returns the current value of the system time counter (which is driven 853 by a PES filter of type DMX_PES_PCR). Some hardware supports more than one 854 STC, so you must specify which one by setting the num field of stc before the ioctl 855 (range 0...n). The result is returned in form of a ratio with a 64 bit numerator 856 and a 32 bit denominator, so the real 90kHz STC value is stc->stc / 857 stc->base 858 .</para> 859</entry> 860 </row></tbody></tgroup></informaltable> 861<para>SYNOPSIS 862</para> 863<informaltable><tgroup cols="1"><tbody><row><entry 864 align="char"> 865<para>int ioctl( int fd, int request = DMX_GET_STC, struct 866 dmx_stc ⋆stc);</para> 867</entry> 868 </row></tbody></tgroup></informaltable> 869<para>PARAMETERS 870</para> 871<informaltable><tgroup cols="2"><tbody><row><entry 872 align="char"> 873<para>int fd</para> 874</entry><entry 875 align="char"> 876<para>File descriptor returned by a previous call to open().</para> 877</entry> 878 </row><row><entry 879 align="char"> 880<para>int request</para> 881</entry><entry 882 align="char"> 883<para>Equals DMX_GET_STC for this command.</para> 884</entry> 885 </row><row><entry 886 align="char"> 887<para>struct dmx_stc *stc</para> 888</entry><entry 889 align="char"> 890<para>Pointer to the location where the stc is to be stored.</para> 891</entry> 892 </row></tbody></tgroup></informaltable> 893&return-value-dvb; 894<informaltable><tgroup cols="2"><tbody><row><entry 895 align="char"> 896<para>EINVAL</para> 897</entry><entry 898 align="char"> 899<para>Invalid stc number.</para> 900</entry> 901 </row></tbody></tgroup></informaltable> 902 </section> 903 904<section id="DMX_GET_PES_PIDS" 905role="subsection"><title>DMX_GET_PES_PIDS</title> 906<para>DESCRIPTION 907</para> 908<informaltable><tgroup cols="1"><tbody><row><entry 909 align="char"> 910<para>This ioctl is undocumented. Documentation is welcome.</para> 911</entry> 912 </row></tbody></tgroup></informaltable> 913<para>SYNOPSIS 914</para> 915<informaltable><tgroup cols="1"><tbody><row><entry 916 align="char"> 917<para>int ioctl(fd, int request = DMX_GET_PES_PIDS, 918 __u16[5]);</para> 919</entry> 920 </row></tbody></tgroup></informaltable> 921<para>PARAMETERS 922</para> 923<informaltable><tgroup cols="2"><tbody><row><entry 924 align="char"> 925<para>int fd</para> 926</entry><entry 927 align="char"> 928<para>File descriptor returned by a previous call to open().</para> 929</entry> 930 </row><row><entry 931 align="char"> 932<para>int request</para> 933</entry><entry 934 align="char"> 935<para>Equals DMX_GET_PES_PIDS for this command.</para> 936</entry> 937 </row><row><entry 938 align="char"> 939<para>__u16[5] 940</para> 941</entry><entry 942 align="char"> 943<para>Undocumented.</para> 944</entry> 945 </row></tbody></tgroup></informaltable> 946&return-value-dvb; 947</section> 948 949<section id="DMX_GET_CAPS" 950role="subsection"><title>DMX_GET_CAPS</title> 951<para>DESCRIPTION 952</para> 953<informaltable><tgroup cols="1"><tbody><row><entry 954 align="char"> 955<para>This ioctl is undocumented. Documentation is welcome.</para> 956</entry> 957 </row></tbody></tgroup></informaltable> 958<para>SYNOPSIS 959</para> 960<informaltable><tgroup cols="1"><tbody><row><entry 961 align="char"> 962<para>int ioctl(fd, int request = DMX_GET_CAPS, 963 dmx_caps_t *);</para> 964</entry> 965 </row></tbody></tgroup></informaltable> 966<para>PARAMETERS 967</para> 968<informaltable><tgroup cols="2"><tbody><row><entry 969 align="char"> 970<para>int fd</para> 971</entry><entry 972 align="char"> 973<para>File descriptor returned by a previous call to open().</para> 974</entry> 975 </row><row><entry 976 align="char"> 977<para>int request</para> 978</entry><entry 979 align="char"> 980<para>Equals DMX_GET_CAPS for this command.</para> 981</entry> 982 </row><row><entry 983 align="char"> 984<para>dmx_caps_t * 985</para> 986</entry><entry 987 align="char"> 988<para>Undocumented.</para> 989</entry> 990 </row></tbody></tgroup></informaltable> 991&return-value-dvb; 992</section> 993 994<section id="DMX_SET_SOURCE" 995role="subsection"><title>DMX_SET_SOURCE</title> 996<para>DESCRIPTION 997</para> 998<informaltable><tgroup cols="1"><tbody><row><entry 999 align="char"> 1000<para>This ioctl is undocumented. Documentation is welcome.</para> 1001</entry> 1002 </row></tbody></tgroup></informaltable> 1003<para>SYNOPSIS 1004</para> 1005<informaltable><tgroup cols="1"><tbody><row><entry 1006 align="char"> 1007<para>int ioctl(fd, int request = DMX_SET_SOURCE, 1008 dmx_source_t *);</para> 1009</entry> 1010 </row></tbody></tgroup></informaltable> 1011<para>PARAMETERS 1012</para> 1013<informaltable><tgroup cols="2"><tbody><row><entry 1014 align="char"> 1015<para>int fd</para> 1016</entry><entry 1017 align="char"> 1018<para>File descriptor returned by a previous call to open().</para> 1019</entry> 1020 </row><row><entry 1021 align="char"> 1022<para>int request</para> 1023</entry><entry 1024 align="char"> 1025<para>Equals DMX_SET_SOURCE for this command.</para> 1026</entry> 1027 </row><row><entry 1028 align="char"> 1029<para>dmx_source_t * 1030</para> 1031</entry><entry 1032 align="char"> 1033<para>Undocumented.</para> 1034</entry> 1035 </row></tbody></tgroup></informaltable> 1036&return-value-dvb; 1037</section> 1038 1039<section id="DMX_ADD_PID" 1040role="subsection"><title>DMX_ADD_PID</title> 1041<para>DESCRIPTION 1042</para> 1043<informaltable><tgroup cols="1"><tbody><row><entry 1044 align="char"> 1045<para>This ioctl call allows to add multiple PIDs to a transport stream filter 1046previously set up with DMX_SET_PES_FILTER and output equal to DMX_OUT_TSDEMUX_TAP. 1047</para></entry></row><row><entry align="char"><para> 1048It is used by readers of /dev/dvb/adapterX/demuxY. 1049</para></entry></row><row><entry align="char"><para> 1050It may be called at any time, i.e. before or after the first filter on the 1051shared file descriptor was started. It makes it possible to record multiple 1052services without the need to de-multiplex or re-multiplex TS packets.</para> 1053</entry> 1054 </row></tbody></tgroup></informaltable> 1055<para>SYNOPSIS 1056</para> 1057<informaltable><tgroup cols="1"><tbody><row><entry 1058 align="char"> 1059<para>int ioctl(fd, int request = DMX_ADD_PID, 1060 __u16 *);</para> 1061</entry> 1062 </row></tbody></tgroup></informaltable> 1063<para>PARAMETERS 1064</para> 1065<informaltable><tgroup cols="2"><tbody><row><entry 1066 align="char"> 1067<para>int fd</para> 1068</entry><entry 1069 align="char"> 1070<para>File descriptor returned by a previous call to open().</para> 1071</entry> 1072 </row><row><entry 1073 align="char"> 1074<para>int request</para> 1075</entry><entry 1076 align="char"> 1077<para>Equals DMX_ADD_PID for this command.</para> 1078</entry> 1079 </row><row><entry 1080 align="char"> 1081<para>__u16 * 1082</para> 1083</entry><entry 1084 align="char"> 1085<para>PID number to be filtered.</para> 1086</entry> 1087 </row></tbody></tgroup></informaltable> 1088&return-value-dvb; 1089</section> 1090 1091<section id="DMX_REMOVE_PID" 1092role="subsection"><title>DMX_REMOVE_PID</title> 1093<para>DESCRIPTION 1094</para> 1095<informaltable><tgroup cols="1"><tbody><row><entry 1096 align="char"> 1097<para>This ioctl call allows to remove a PID when multiple PIDs are set on a 1098transport stream filter, e. g. a filter previously set up with output equal to 1099DMX_OUT_TSDEMUX_TAP, created via either DMX_SET_PES_FILTER or DMX_ADD_PID. 1100</para></entry></row><row><entry align="char"><para> 1101It is used by readers of /dev/dvb/adapterX/demuxY. 1102</para></entry></row><row><entry align="char"><para> 1103It may be called at any time, i.e. before or after the first filter on the 1104shared file descriptor was started. It makes it possible to record multiple 1105services without the need to de-multiplex or re-multiplex TS packets.</para> 1106</entry> 1107 </row></tbody></tgroup></informaltable> 1108<para>SYNOPSIS 1109</para> 1110<informaltable><tgroup cols="1"><tbody><row><entry 1111 align="char"> 1112<para>int ioctl(fd, int request = DMX_REMOVE_PID, 1113 __u16 *);</para> 1114</entry> 1115 </row></tbody></tgroup></informaltable> 1116<para>PARAMETERS 1117</para> 1118<informaltable><tgroup cols="2"><tbody><row><entry 1119 align="char"> 1120<para>int fd</para> 1121</entry><entry 1122 align="char"> 1123<para>File descriptor returned by a previous call to open().</para> 1124</entry> 1125 </row><row><entry 1126 align="char"> 1127<para>int request</para> 1128</entry><entry 1129 align="char"> 1130<para>Equals DMX_REMOVE_PID for this command.</para> 1131</entry> 1132 </row><row><entry 1133 align="char"> 1134<para>__u16 * 1135</para> 1136</entry><entry 1137 align="char"> 1138<para>PID of the PES filter to be removed.</para> 1139</entry> 1140 </row></tbody></tgroup></informaltable> 1141&return-value-dvb; 1142</section> 1143 1144 1145</section> 1146