]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - Documentation/DocBook/media/dvb/demux.xml
a297f0aadd0a0d9a014fa4882d3b47e60c21c4fb
[mirror_ubuntu-artful-kernel.git] / Documentation / DocBook / media / dvb / demux.xml
1 <title>DVB Demux Device</title>
2
3 <para>The DVB demux device controls the filters of the DVB hardware/software. It can be
4 accessed through <emphasis role="tt">/dev/adapter0/demux0</emphasis>. Data types and and ioctl definitions can be
5 accessed 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>
13 typedef enum
14 {
15 DMX_OUT_DECODER, /&#x22C6; Streaming directly to decoder. &#x22C6;/
16 DMX_OUT_TAP, /&#x22C6; Output going to a memory buffer &#x22C6;/
17 /&#x22C6; (to be retrieved via the read command).&#x22C6;/
18 DMX_OUT_TS_TAP, /&#x22C6; Output multiplexed into a new TS &#x22C6;/
19 /&#x22C6; (to be retrieved by reading from the &#x22C6;/
20 /&#x22C6; logical DVR device). &#x22C6;/
21 DMX_OUT_TSDEMUX_TAP /&#x22C6; Like TS_TAP but retrieved from the DMX device &#x22C6;/
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
25 called.
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>,
28 which delivers a TS multiplexed from all filters for which <emphasis role="tt">DMX_OUT_TS_TAP</emphasis> was
29 specified.
30 </para>
31 </section>
32
33 <section id="dmx-input-t">
34 <title>dmx_input_t</title>
35 <programlisting>
36 typedef enum
37 {
38 DMX_IN_FRONTEND, /&#x22C6; Input from a front-end device. &#x22C6;/
39 DMX_IN_DVR /&#x22C6; Input from the logical DVR device. &#x22C6;/
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>
47 typedef 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>
93 struct 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>
110 struct 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>
139 struct dmx_stc {
140 unsigned int num; /&#x22C6; input : which STC? 0..N &#x22C6;/
141 unsigned int base; /&#x22C6; output: divisor for stc to get 90 kHz clock &#x22C6;/
142 __u64 stc; /&#x22C6; output: stc in 'base'&#x22C6;90 kHz units &#x22C6;/
143 };
144 </programlisting>
145 </section>
146
147 </section>
148
149 <section id="dmx_fcalls">
150 <title>Demux Function Calls</title>
151
152 <section id="dmx_fopen">
153 <title>open()</title>
154 <para>DESCRIPTION
155 </para>
156 <informaltable><tgroup cols="1"><tbody><row><entry
157 align="char">
158 <para>This system call, used with a device name of /dev/dvb/adapter0/demux0,
159 allocates a new filter and returns a handle which can be used for subsequent
160 control of that filter. This call has to be made for each filter to be used, i.e. every
161 returned file descriptor is a reference to a single filter. /dev/dvb/adapter0/dvr0
162 is a logical device to be used for retrieving Transport Streams for digital
163 video recording. When reading from this device a transport stream containing
164 the packets from all PES filters set in the corresponding demux device
165 (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A
166 recorded Transport Stream is replayed by writing to this device. </para>
167 <para>The significance of blocking or non-blocking mode is described in the
168 documentation for functions where there is a difference. It does not affect the
169 semantics of the open() call itself. A device opened in blocking mode can later
170 be put into non-blocking mode (and vice versa) using the F_SETFL command
171 of the fcntl system call.</para>
172 </entry>
173 </row></tbody></tgroup></informaltable>
174 <para>SYNOPSIS
175 </para>
176 <informaltable><tgroup cols="1"><tbody><row><entry
177 align="char">
178 <para>int open(const char &#x22C6;deviceName, int flags);</para>
179 </entry>
180 </row></tbody></tgroup></informaltable>
181 <para>PARAMETERS
182 </para>
183 <informaltable><tgroup cols="2"><tbody><row><entry
184 align="char">
185 <para>const char
186 *deviceName</para>
187 </entry><entry
188 align="char">
189 <para>Name of demux device.</para>
190 </entry>
191 </row><row><entry
192 align="char">
193 <para>int flags</para>
194 </entry><entry
195 align="char">
196 <para>A bit-wise OR of the following flags:</para>
197 </entry>
198 </row><row><entry
199 align="char">
200 </entry><entry
201 align="char">
202 <para>O_RDWR read/write access</para>
203 </entry>
204 </row><row><entry
205 align="char">
206 </entry><entry
207 align="char">
208 <para>O_NONBLOCK open in non-blocking mode</para>
209 </entry>
210 </row><row><entry
211 align="char">
212 </entry><entry
213 align="char">
214 <para>(blocking mode is the default)</para>
215 </entry>
216 </row></tbody></tgroup></informaltable>
217 <para>ERRORS
218 </para>
219 <informaltable><tgroup cols="2"><tbody><row><entry
220 align="char">
221 <para>ENODEV</para>
222 </entry><entry
223 align="char">
224 <para>Device driver not loaded/available.</para>
225 </entry>
226 </row><row><entry
227 align="char">
228 <para>EINVAL</para>
229 </entry><entry
230 align="char">
231 <para>Invalid argument.</para>
232 </entry>
233 </row><row><entry
234 align="char">
235 <para>EMFILE</para>
236 </entry><entry
237 align="char">
238 <para>&#8220;Too many open files&#8221;, i.e. no more filters available.</para>
239 </entry>
240 </row><row><entry
241 align="char">
242 <para>ENOMEM</para>
243 </entry><entry
244 align="char">
245 <para>The driver failed to allocate enough memory.</para>
246 </entry>
247 </row></tbody></tgroup></informaltable>
248 </section>
249
250 <section id="dmx_fclose">
251 <title>close()</title>
252 <para>DESCRIPTION
253 </para>
254 <informaltable><tgroup cols="1"><tbody><row><entry
255 align="char">
256 <para>This system call deactivates and deallocates a filter that was previously
257 allocated via the open() call.</para>
258 </entry>
259 </row></tbody></tgroup></informaltable>
260 <para>SYNOPSIS
261 </para>
262 <informaltable><tgroup cols="1"><tbody><row><entry
263 align="char">
264 <para>int close(int fd);</para>
265 </entry>
266 </row></tbody></tgroup></informaltable>
267 <para>PARAMETERS
268 </para>
269 <informaltable><tgroup cols="2"><tbody><row><entry
270 align="char">
271 <para>int fd</para>
272 </entry><entry
273 align="char">
274 <para>File descriptor returned by a previous call to open().</para>
275 </entry>
276 </row></tbody></tgroup></informaltable>
277 <para>ERRORS
278 </para>
279 <informaltable><tgroup cols="2"><tbody><row><entry
280 align="char">
281 <para>EBADF</para>
282 </entry><entry
283 align="char">
284 <para>fd is not a valid open file descriptor.</para>
285 </entry>
286 </row></tbody></tgroup></informaltable>
287 </section>
288
289 <section id="dmx_fread">
290 <title>read()</title>
291 <para>DESCRIPTION
292 </para>
293 <informaltable><tgroup cols="1"><tbody><row><entry
294 align="char">
295 <para>This system call returns filtered data, which might be section or PES data. The
296 filtered data is transferred from the driver&#8217;s internal circular buffer to buf. The
297 maximum amount of data to be transferred is implied by count.</para>
298 </entry>
299 </row><row><entry
300 align="char">
301 <para>When returning section data the driver always tries to return a complete single
302 section (even though buf would provide buffer space for more data). If the size
303 of the buffer is smaller than the section as much as possible will be returned,
304 and the remaining data will be provided in subsequent calls.</para>
305 </entry>
306 </row><row><entry
307 align="char">
308 <para>The size of the internal buffer is 2 * 4096 bytes (the size of two maximum
309 sized sections) by default. The size of this buffer may be changed by using the
310 DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if
311 the read operations are not performed fast enough, this may result in a buffer
312 overflow error. In this case EOVERFLOW will be returned, and the circular
313 buffer will be emptied. This call is blocking if there is no data to return, i.e. the
314 process will be put to sleep waiting for data, unless the O_NONBLOCK flag
315 is specified.</para>
316 </entry>
317 </row><row><entry
318 align="char">
319 <para>Note that in order to be able to read, the filtering process has to be started
320 by defining either a section or a PES filter by means of the ioctl functions,
321 and then starting the filtering process via the DMX_START ioctl function
322 or by setting the DMX_IMMEDIATE_START flag. If the reading is done
323 from a logical DVR demux device, the data will constitute a Transport Stream
324 including the packets from all PES filters in the corresponding demux device
325 /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP.</para>
326 </entry>
327 </row></tbody></tgroup></informaltable>
328 <para>SYNOPSIS
329 </para>
330 <informaltable><tgroup cols="1"><tbody><row><entry
331 align="char">
332 <para>size_t read(int fd, void &#x22C6;buf, size_t count);</para>
333 </entry>
334 </row></tbody></tgroup></informaltable>
335 <para>PARAMETERS
336 </para>
337 <informaltable><tgroup cols="2"><tbody><row><entry
338 align="char">
339 <para>int fd</para>
340 </entry><entry
341 align="char">
342 <para>File descriptor returned by a previous call to open().</para>
343 </entry>
344 </row><row><entry
345 align="char">
346 <para>void *buf</para>
347 </entry><entry
348 align="char">
349 <para>Pointer to the buffer to be used for returned filtered data.</para>
350 </entry>
351 </row><row><entry
352 align="char">
353 <para>size_t count</para>
354 </entry><entry
355 align="char">
356 <para>Size of buf.</para>
357 </entry>
358 </row></tbody></tgroup></informaltable>
359 <para>ERRORS
360 </para>
361 <informaltable><tgroup cols="2"><tbody><row><entry
362 align="char">
363 <para>EWOULDBLOCK</para>
364 </entry><entry
365 align="char">
366 <para>No data to return and O_NONBLOCK was specified.</para>
367 </entry>
368 </row><row><entry
369 align="char">
370 <para>EBADF</para>
371 </entry><entry
372 align="char">
373 <para>fd is not a valid open file descriptor.</para>
374 </entry>
375 </row><row><entry
376 align="char">
377 <para>ECRC</para>
378 </entry><entry
379 align="char">
380 <para>Last section had a CRC error - no data returned. The
381 buffer is flushed.</para>
382 </entry>
383 </row><row><entry
384 align="char">
385 <para>EOVERFLOW</para>
386 </entry><entry
387 align="char">
388 </entry>
389 </row><row><entry
390 align="char">
391 </entry><entry
392 align="char">
393 <para>The filtered data was not read from the buffer in due
394 time, resulting in non-read data being lost. The buffer is
395 flushed.</para>
396 </entry>
397 </row><row><entry
398 align="char">
399 <para>ETIMEDOUT</para>
400 </entry><entry
401 align="char">
402 <para>The section was not loaded within the stated timeout
403 period. See ioctl DMX_SET_FILTER for how to set a
404 timeout.</para>
405 </entry>
406 </row><row><entry
407 align="char">
408 <para>EFAULT</para>
409 </entry><entry
410 align="char">
411 <para>The driver failed to write to the callers buffer due to an
412 invalid *buf pointer.</para>
413 </entry>
414 </row></tbody></tgroup></informaltable>
415 </section>
416
417 <section id="dmx_fwrite">
418 <title>write()</title>
419 <para>DESCRIPTION
420 </para>
421 <informaltable><tgroup cols="1"><tbody><row><entry
422 align="char">
423 <para>This system call is only provided by the logical device /dev/dvb/adapter0/dvr0,
424 associated with the physical demux device that provides the actual DVR
425 functionality. It is used for replay of a digitally recorded Transport Stream.
426 Matching filters have to be defined in the corresponding physical demux
427 device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is
428 implied by count.</para>
429 </entry>
430 </row></tbody></tgroup></informaltable>
431 <para>SYNOPSIS
432 </para>
433 <informaltable><tgroup cols="1"><tbody><row><entry
434 align="char">
435 <para>ssize_t write(int fd, const void &#x22C6;buf, size_t
436 count);</para>
437 </entry>
438 </row></tbody></tgroup></informaltable>
439 <para>PARAMETERS
440 </para>
441 <informaltable><tgroup cols="2"><tbody><row><entry
442 align="char">
443 <para>int fd</para>
444 </entry><entry
445 align="char">
446 <para>File descriptor returned by a previous call to open().</para>
447 </entry>
448 </row><row><entry
449 align="char">
450 <para>void *buf</para>
451 </entry><entry
452 align="char">
453 <para>Pointer to the buffer containing the Transport Stream.</para>
454 </entry>
455 </row><row><entry
456 align="char">
457 <para>size_t count</para>
458 </entry><entry
459 align="char">
460 <para>Size of buf.</para>
461 </entry>
462 </row></tbody></tgroup></informaltable>
463 <para>ERRORS
464 </para>
465 <informaltable><tgroup cols="2"><tbody><row><entry
466 align="char">
467 <para>EWOULDBLOCK</para>
468 </entry><entry
469 align="char">
470 <para>No data was written. This
471 might happen if O_NONBLOCK was specified and there
472 is no more buffer space available (if O_NONBLOCK is
473 not specified the function will block until buffer space is
474 available).</para>
475 </entry>
476 </row><row><entry
477 align="char">
478 <para>EBUSY</para>
479 </entry><entry
480 align="char">
481 <para>This error code indicates that there are conflicting
482 requests. The corresponding demux device is setup to
483 receive data from the front- end. Make sure that these
484 filters are stopped and that the filters with input set to
485 DMX_IN_DVR are started.</para>
486 </entry>
487 </row><row><entry
488 align="char">
489 <para>EBADF</para>
490 </entry><entry
491 align="char">
492 <para>fd is not a valid open file descriptor.</para>
493 </entry>
494 </row></tbody></tgroup></informaltable>
495 </section>
496
497 <section id="DMX_START">
498 <title>DMX_START</title>
499 <para>DESCRIPTION
500 </para>
501 <informaltable><tgroup cols="1"><tbody><row><entry
502 align="char">
503 <para>This ioctl call is used to start the actual filtering operation defined via the ioctl
504 calls DMX_SET_FILTER or DMX_SET_PES_FILTER.</para>
505 </entry>
506 </row></tbody></tgroup></informaltable>
507 <para>SYNOPSIS
508 </para>
509 <informaltable><tgroup cols="1"><tbody><row><entry
510 align="char">
511 <para>int ioctl( int fd, int request = DMX_START);</para>
512 </entry>
513 </row></tbody></tgroup></informaltable>
514 <para>PARAMETERS
515 </para>
516 <informaltable><tgroup cols="2"><tbody><row><entry
517 align="char">
518 <para>int fd</para>
519 </entry><entry
520 align="char">
521 <para>File descriptor returned by a previous call to open().</para>
522 </entry>
523 </row><row><entry
524 align="char">
525 <para>int request</para>
526 </entry><entry
527 align="char">
528 <para>Equals DMX_START for this command.</para>
529 </entry>
530 </row></tbody></tgroup></informaltable>
531 <para>ERRORS
532 </para>
533 <informaltable><tgroup cols="2"><tbody><row><entry
534 align="char">
535 <para>EBADF</para>
536 </entry><entry
537 align="char">
538 <para>fd is not a valid file descriptor.</para>
539 </entry>
540 </row><row><entry
541 align="char">
542 <para>EINVAL</para>
543 </entry><entry
544 align="char">
545 <para>Invalid argument, i.e. no filtering parameters provided via
546 the DMX_SET_FILTER or DMX_SET_PES_FILTER
547 functions.</para>
548 </entry>
549 </row><row><entry
550 align="char">
551 <para>EBUSY</para>
552 </entry><entry
553 align="char">
554 <para>This error code indicates that there are conflicting
555 requests. There are active filters filtering data from
556 another input source. Make sure that these filters are
557 stopped before starting this filter.</para>
558 </entry>
559 </row></tbody></tgroup></informaltable>
560 </section>
561
562 <section id="DMX_STOP">
563 <title>DMX_STOP</title>
564 <para>DESCRIPTION
565 </para>
566 <informaltable><tgroup cols="1"><tbody><row><entry
567 align="char">
568 <para>This ioctl call is used to stop the actual filtering operation defined via the
569 ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via
570 the DMX_START command.</para>
571 </entry>
572 </row></tbody></tgroup></informaltable>
573 <para>SYNOPSIS
574 </para>
575 <informaltable><tgroup cols="1"><tbody><row><entry
576 align="char">
577 <para>int ioctl( int fd, int request = DMX_STOP);</para>
578 </entry>
579 </row></tbody></tgroup></informaltable>
580 <para>PARAMETERS
581 </para>
582 <informaltable><tgroup cols="2"><tbody><row><entry
583 align="char">
584 <para>int fd</para>
585 </entry><entry
586 align="char">
587 <para>File descriptor returned by a previous call to open().</para>
588 </entry>
589 </row><row><entry
590 align="char">
591 <para>int request</para>
592 </entry><entry
593 align="char">
594 <para>Equals DMX_STOP for this command.</para>
595 </entry>
596 </row></tbody></tgroup></informaltable>
597 <para>ERRORS
598 </para>
599 <informaltable><tgroup cols="2"><tbody><row><entry
600 align="char">
601 <para>EBADF</para>
602 </entry><entry
603 align="char">
604 <para>fd is not a valid file descriptor.</para>
605 </entry>
606 </row></tbody></tgroup></informaltable>
607 </section>
608
609 <section id="DMX_SET_FILTER">
610 <title>DMX_SET_FILTER</title>
611 <para>DESCRIPTION
612 </para>
613 <informaltable><tgroup cols="1"><tbody><row><entry
614 align="char">
615 <para>This ioctl call sets up a filter according to the filter and mask parameters
616 provided. A timeout may be defined stating number of seconds to wait for a
617 section to be loaded. A value of 0 means that no timeout should be applied.
618 Finally there is a flag field where it is possible to state whether a section should
619 be CRC-checked, whether the filter should be a &#8221;one-shot&#8221; filter, i.e. if the
620 filtering operation should be stopped after the first section is received, and
621 whether the filtering operation should be started immediately (without waiting
622 for a DMX_START ioctl call). If a filter was previously set-up, this filter will
623 be canceled, and the receive buffer will be flushed.</para>
624 </entry>
625 </row></tbody></tgroup></informaltable>
626 <para>SYNOPSIS
627 </para>
628 <informaltable><tgroup cols="1"><tbody><row><entry
629 align="char">
630 <para>int ioctl( int fd, int request = DMX_SET_FILTER,
631 struct dmx_sct_filter_params &#x22C6;params);</para>
632 </entry>
633 </row></tbody></tgroup></informaltable>
634 <para>PARAMETERS
635 </para>
636 <informaltable><tgroup cols="2"><tbody><row><entry
637 align="char">
638 <para>int fd</para>
639 </entry><entry
640 align="char">
641 <para>File descriptor returned by a previous call to open().</para>
642 </entry>
643 </row><row><entry
644 align="char">
645 <para>int request</para>
646 </entry><entry
647 align="char">
648 <para>Equals DMX_SET_FILTER for this command.</para>
649 </entry>
650 </row><row><entry
651 align="char">
652 <para>struct
653 dmx_sct_filter_params
654 *params</para>
655 </entry><entry
656 align="char">
657 <para>Pointer to structure containing filter parameters.</para>
658 </entry>
659 </row></tbody></tgroup></informaltable>
660 <para>ERRORS
661 </para>
662 <informaltable><tgroup cols="2"><tbody><row><entry
663 align="char">
664 <para>EBADF</para>
665 </entry><entry
666 align="char">
667 <para>fd is not a valid file descriptor.</para>
668 </entry>
669 </row><row><entry
670 align="char">
671 <para>EINVAL</para>
672 </entry><entry
673 align="char">
674 <para>Invalid argument.</para>
675 </entry>
676 </row></tbody></tgroup></informaltable>
677 </section>
678
679 <section id="DMX_SET_PES_FILTER">
680 <title>DMX_SET_PES_FILTER</title>
681 <para>DESCRIPTION
682 </para>
683 <informaltable><tgroup cols="1"><tbody><row><entry
684 align="char">
685 <para>This ioctl call sets up a PES filter according to the parameters provided. By a
686 PES filter is meant a filter that is based just on the packet identifier (PID), i.e.
687 no PES header or payload filtering capability is supported.</para>
688 </entry>
689 </row><row><entry
690 align="char">
691 <para>The transport stream destination for the filtered output may be set. Also the
692 PES type may be stated in order to be able to e.g. direct a video stream directly
693 to the video decoder. Finally there is a flag field where it is possible to state
694 whether the filtering operation should be started immediately (without waiting
695 for a DMX_START ioctl call). If a filter was previously set-up, this filter will
696 be cancelled, and the receive buffer will be flushed.</para>
697 </entry>
698 </row></tbody></tgroup></informaltable>
699 <para>SYNOPSIS
700 </para>
701 <informaltable><tgroup cols="1"><tbody><row><entry
702 align="char">
703 <para>int ioctl( int fd, int request = DMX_SET_PES_FILTER,
704 struct dmx_pes_filter_params &#x22C6;params);</para>
705 </entry>
706 </row></tbody></tgroup></informaltable>
707 <para>PARAMETERS
708 </para>
709 <informaltable><tgroup cols="2"><tbody><row><entry
710 align="char">
711 <para>int fd</para>
712 </entry><entry
713 align="char">
714 <para>File descriptor returned by a previous call to open().</para>
715 </entry>
716 </row><row><entry
717 align="char">
718 <para>int request</para>
719 </entry><entry
720 align="char">
721 <para>Equals DMX_SET_PES_FILTER for this command.</para>
722 </entry>
723 </row><row><entry
724 align="char">
725 <para>struct
726 dmx_pes_filter_params
727 *params</para>
728 </entry><entry
729 align="char">
730 <para>Pointer to structure containing filter parameters.</para>
731 </entry>
732 </row></tbody></tgroup></informaltable>
733 <para>ERRORS
734 </para>
735 <informaltable><tgroup cols="2"><tbody><row><entry
736 align="char">
737 <para>EBADF</para>
738 </entry><entry
739 align="char">
740 <para>fd is not a valid file descriptor.</para>
741 </entry>
742 </row><row><entry
743 align="char">
744 <para>EINVAL</para>
745 </entry><entry
746 align="char">
747 <para>Invalid argument.</para>
748 </entry>
749 </row><row><entry
750 align="char">
751 <para>EBUSY</para>
752 </entry><entry
753 align="char">
754 <para>This error code indicates that there are conflicting
755 requests. There are active filters filtering data from
756 another input source. Make sure that these filters are
757 stopped before starting this filter.</para>
758 </entry>
759 </row></tbody></tgroup></informaltable>
760 </section>
761
762 <section id="DMX_SET_BUFFER_SIZE">
763 <title>DMX_SET_BUFFER_SIZE</title>
764 <para>DESCRIPTION
765 </para>
766 <informaltable><tgroup cols="1"><tbody><row><entry
767 align="char">
768 <para>This ioctl call is used to set the size of the circular buffer used for filtered data.
769 The default size is two maximum sized sections, i.e. if this function is not called
770 a buffer size of 2 * 4096 bytes will be used.</para>
771 </entry>
772 </row></tbody></tgroup></informaltable>
773 <para>SYNOPSIS
774 </para>
775 <informaltable><tgroup cols="1"><tbody><row><entry
776 align="char">
777 <para>int ioctl( int fd, int request =
778 DMX_SET_BUFFER_SIZE, unsigned long size);</para>
779 </entry>
780 </row></tbody></tgroup></informaltable>
781 <para>PARAMETERS
782 </para>
783 <informaltable><tgroup cols="2"><tbody><row><entry
784 align="char">
785 <para>int fd</para>
786 </entry><entry
787 align="char">
788 <para>File descriptor returned by a previous call to open().</para>
789 </entry>
790 </row><row><entry
791 align="char">
792 <para>int request</para>
793 </entry><entry
794 align="char">
795 <para>Equals DMX_SET_BUFFER_SIZE for this command.</para>
796 </entry>
797 </row><row><entry
798 align="char">
799 <para>unsigned long size</para>
800 </entry><entry
801 align="char">
802 <para>Size of circular buffer.</para>
803 </entry>
804 </row></tbody></tgroup></informaltable>
805 <para>ERRORS
806 </para>
807 <informaltable><tgroup cols="2"><tbody><row><entry
808 align="char">
809 <para>EBADF</para>
810 </entry><entry
811 align="char">
812 <para>fd is not a valid file descriptor.</para>
813 </entry>
814 </row><row><entry
815 align="char">
816 <para>ENOMEM</para>
817 </entry><entry
818 align="char">
819 <para>The driver was not able to allocate a buffer of the
820 requested size.</para>
821 </entry>
822 </row></tbody></tgroup></informaltable>
823 </section>
824
825 <section id="DMX_GET_EVENT">
826 <title>DMX_GET_EVENT</title>
827 <para>DESCRIPTION
828 </para>
829 <informaltable><tgroup cols="1"><tbody><row><entry
830 align="char">
831 <para>This ioctl call returns an event if available. If an event is not available,
832 the behavior depends on whether the device is in blocking or non-blocking
833 mode. In the latter case, the call fails immediately with errno set to
834 EWOULDBLOCK. In the former case, the call blocks until an event becomes
835 available.</para>
836 </entry>
837 </row><row><entry
838 align="char">
839 <para>The standard Linux poll() and/or select() system calls can be used with the
840 device file descriptor to watch for new events. For select(), the file descriptor
841 should be included in the exceptfds argument, and for poll(), POLLPRI should
842 be specified as the wake-up condition. Only the latest event for each filter is
843 saved.</para>
844 </entry>
845 </row></tbody></tgroup></informaltable>
846 <para>SYNOPSIS
847 </para>
848 <informaltable><tgroup cols="1"><tbody><row><entry
849 align="char">
850 <para>int ioctl( int fd, int request = DMX_GET_EVENT,
851 struct dmx_event &#x22C6;ev);</para>
852 </entry>
853 </row></tbody></tgroup></informaltable>
854 <para>PARAMETERS
855 </para>
856 <informaltable><tgroup cols="2"><tbody><row><entry
857 align="char">
858 <para>int fd</para>
859 </entry><entry
860 align="char">
861 <para>File descriptor returned by a previous call to open().</para>
862 </entry>
863 </row><row><entry
864 align="char">
865 <para>int request</para>
866 </entry><entry
867 align="char">
868 <para>Equals DMX_GET_EVENT for this command.</para>
869 </entry>
870 </row><row><entry
871 align="char">
872 <para>struct dmx_event *ev</para>
873 </entry><entry
874 align="char">
875 <para>Pointer to the location where the event is to be stored.</para>
876 </entry>
877 </row></tbody></tgroup></informaltable>
878 <para>ERRORS
879 </para>
880 <informaltable><tgroup cols="2"><tbody><row><entry
881 align="char">
882 <para>EBADF</para>
883 </entry><entry
884 align="char">
885 <para>fd is not a valid file descriptor.</para>
886 </entry>
887 </row><row><entry
888 align="char">
889 <para>EFAULT</para>
890 </entry><entry
891 align="char">
892 <para>ev points to an invalid address.</para>
893 </entry>
894 </row><row><entry
895 align="char">
896 <para>EWOULDBLOCK</para>
897 </entry><entry
898 align="char">
899 <para>There is no event pending, and the device is in
900 non-blocking mode.</para>
901 </entry>
902 </row></tbody></tgroup></informaltable>
903 </section>
904
905 <section id="DMX_GET_STC">
906 <title>DMX_GET_STC</title>
907 <para>DESCRIPTION
908 </para>
909 <informaltable><tgroup cols="1"><tbody><row><entry
910 align="char">
911 <para>This ioctl call returns the current value of the system time counter (which is driven
912 by a PES filter of type DMX_PES_PCR). Some hardware supports more than one
913 STC, so you must specify which one by setting the num field of stc before the ioctl
914 (range 0...n). The result is returned in form of a ratio with a 64 bit numerator
915 and a 32 bit denominator, so the real 90kHz STC value is stc-&#x003E;stc /
916 stc-&#x003E;base
917 .</para>
918 </entry>
919 </row></tbody></tgroup></informaltable>
920 <para>SYNOPSIS
921 </para>
922 <informaltable><tgroup cols="1"><tbody><row><entry
923 align="char">
924 <para>int ioctl( int fd, int request = DMX_GET_STC, struct
925 dmx_stc &#x22C6;stc);</para>
926 </entry>
927 </row></tbody></tgroup></informaltable>
928 <para>PARAMETERS
929 </para>
930 <informaltable><tgroup cols="2"><tbody><row><entry
931 align="char">
932 <para>int fd</para>
933 </entry><entry
934 align="char">
935 <para>File descriptor returned by a previous call to open().</para>
936 </entry>
937 </row><row><entry
938 align="char">
939 <para>int request</para>
940 </entry><entry
941 align="char">
942 <para>Equals DMX_GET_STC for this command.</para>
943 </entry>
944 </row><row><entry
945 align="char">
946 <para>struct dmx_stc *stc</para>
947 </entry><entry
948 align="char">
949 <para>Pointer to the location where the stc is to be stored.</para>
950 </entry>
951 </row></tbody></tgroup></informaltable>
952 <para>ERRORS
953 </para>
954 <informaltable><tgroup cols="2"><tbody><row><entry
955 align="char">
956 <para>EBADF</para>
957 </entry><entry
958 align="char">
959 <para>fd is not a valid file descriptor.</para>
960 </entry>
961 </row><row><entry
962 align="char">
963 <para>EFAULT</para>
964 </entry><entry
965 align="char">
966 <para>stc points to an invalid address.</para>
967 </entry>
968 </row><row><entry
969 align="char">
970 <para>EINVAL</para>
971 </entry><entry
972 align="char">
973 <para>Invalid stc number.</para>
974 </entry>
975 </row></tbody></tgroup></informaltable>
976 </section></section>