[media] DVB: Point to the generic error chapter
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / Documentation / DocBook / media / dvb / demux.xml
blobe5058d7d9213245e92f688740c791fa2dd2ddc9a
1 <title>DVB Demux Device</title>
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>
10 <section id="dmx-output-t">
11 <title>dmx_output_t</title>
12 <programlisting>
13 typedef enum
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>
33 <section id="dmx-input-t">
34 <title>dmx_input_t</title>
35 <programlisting>
36 typedef enum
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>
44 <section id="dmx-pes-type-t">
45 <title>dmx_pes_type_t</title>
46 <programlisting>
47 typedef enum
49         DMX_PES_AUDIO0,
50         DMX_PES_VIDEO0,
51         DMX_PES_TELETEXT0,
52         DMX_PES_SUBTITLE0,
53         DMX_PES_PCR0,
55         DMX_PES_AUDIO1,
56         DMX_PES_VIDEO1,
57         DMX_PES_TELETEXT1,
58         DMX_PES_SUBTITLE1,
59         DMX_PES_PCR1,
61         DMX_PES_AUDIO2,
62         DMX_PES_VIDEO2,
63         DMX_PES_TELETEXT2,
64         DMX_PES_SUBTITLE2,
65         DMX_PES_PCR2,
67         DMX_PES_AUDIO3,
68         DMX_PES_VIDEO3,
69         DMX_PES_TELETEXT3,
70         DMX_PES_SUBTITLE3,
71         DMX_PES_PCR3,
73         DMX_PES_OTHER
74 } dmx_pes_type_t;
75 </programlisting>
76 </section>
78 <section id="dmx-filter">
79 <title>struct dmx_filter</title>
80  <programlisting>
81  typedef struct dmx_filter
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>
90 <section id="dmx-sct-filter-params">
91 <title>struct dmx_sct_filter_params</title>
92 <programlisting>
93 struct dmx_sct_filter_params
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
104 </programlisting>
105 </section>
107 <section id="dmx-pes-filter-params">
108 <title>struct dmx_pes_filter_params</title>
109 <programlisting>
110 struct dmx_pes_filter_params
112         __u16          pid;
113         dmx_input_t    input;
114         dmx_output_t   output;
115         dmx_pes_type_t pes_type;
116         __u32          flags;
118 </programlisting>
119 </section>
121 <section id="dmx-event">
122 <title>struct dmx_event</title>
123  <programlisting>
124  struct dmx_event
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>
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;/
144 </programlisting>
145 </section>
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>
157 <section id="dmx-source-t">
158 <title>enum dmx_source_t</title>
159 <programlisting>
160 typedef 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>
173 </section>
174 <section id="dmx_fcalls">
175 <title>Demux Function Calls</title>
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 &#x22C6;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>&#8220;Too many open files&#8221;, 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>
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>
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&#8217;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 &#x22C6;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>
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 &#x22C6;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>
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>EBADF</para>
556 </entry><entry
557  align="char">
558 <para>fd is not a valid file descriptor.</para>
559 </entry>
560  </row><row><entry
561  align="char">
562 <para>EINVAL</para>
563 </entry><entry
564  align="char">
565 <para>Invalid argument, i.e. no filtering parameters provided via
566  the DMX_SET_FILTER or DMX_SET_PES_FILTER
567  functions.</para>
568 </entry>
569  </row><row><entry
570  align="char">
571 <para>EBUSY</para>
572 </entry><entry
573  align="char">
574 <para>This error code indicates that there are conflicting
575  requests. There are active filters filtering data from
576  another input source. Make sure that these filters are
577  stopped before starting this filter.</para>
578 </entry>
579  </row></tbody></tgroup></informaltable>
580 </section>
582 <section id="DMX_STOP">
583 <title>DMX_STOP</title>
584 <para>DESCRIPTION
585 </para>
586 <informaltable><tgroup cols="1"><tbody><row><entry
587  align="char">
588 <para>This ioctl call is used to stop the actual filtering operation defined via the
589  ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via
590  the DMX_START command.</para>
591 </entry>
592  </row></tbody></tgroup></informaltable>
593 <para>SYNOPSIS
594 </para>
595 <informaltable><tgroup cols="1"><tbody><row><entry
596  align="char">
597 <para>int ioctl( int fd, int request = DMX_STOP);</para>
598 </entry>
599  </row></tbody></tgroup></informaltable>
600 <para>PARAMETERS
601 </para>
602 <informaltable><tgroup cols="2"><tbody><row><entry
603  align="char">
604 <para>int fd</para>
605 </entry><entry
606  align="char">
607 <para>File descriptor returned by a previous call to open().</para>
608 </entry>
609  </row><row><entry
610  align="char">
611 <para>int request</para>
612 </entry><entry
613  align="char">
614 <para>Equals DMX_STOP for this command.</para>
615 </entry>
616  </row></tbody></tgroup></informaltable>
617 &return-value-dvb;
618 <informaltable><tgroup cols="2"><tbody><row><entry
619  align="char">
620 <para>EBADF</para>
621 </entry><entry
622  align="char">
623 <para>fd is not a valid file descriptor.</para>
624 </entry>
625  </row></tbody></tgroup></informaltable>
626 </section>
628 <section id="DMX_SET_FILTER">
629 <title>DMX_SET_FILTER</title>
630 <para>DESCRIPTION
631 </para>
632 <informaltable><tgroup cols="1"><tbody><row><entry
633  align="char">
634 <para>This ioctl call sets up a filter according to the filter and mask parameters
635  provided. A timeout may be defined stating number of seconds to wait for a
636  section to be loaded. A value of 0 means that no timeout should be applied.
637  Finally there is a flag field where it is possible to state whether a section should
638  be CRC-checked, whether the filter should be a &#8221;one-shot&#8221; filter, i.e. if the
639  filtering operation should be stopped after the first section is received, and
640  whether the filtering operation should be started immediately (without waiting
641  for a DMX_START ioctl call). If a filter was previously set-up, this filter will
642  be canceled, and the receive buffer will be flushed.</para>
643 </entry>
644  </row></tbody></tgroup></informaltable>
645 <para>SYNOPSIS
646 </para>
647 <informaltable><tgroup cols="1"><tbody><row><entry
648  align="char">
649 <para>int ioctl( int fd, int request = DMX_SET_FILTER,
650  struct dmx_sct_filter_params &#x22C6;params);</para>
651 </entry>
652  </row></tbody></tgroup></informaltable>
653 <para>PARAMETERS
654 </para>
655 <informaltable><tgroup cols="2"><tbody><row><entry
656  align="char">
657 <para>int fd</para>
658 </entry><entry
659  align="char">
660 <para>File descriptor returned by a previous call to open().</para>
661 </entry>
662  </row><row><entry
663  align="char">
664 <para>int request</para>
665 </entry><entry
666  align="char">
667 <para>Equals DMX_SET_FILTER for this command.</para>
668 </entry>
669  </row><row><entry
670  align="char">
671 <para>struct
672  dmx_sct_filter_params
673  *params</para>
674 </entry><entry
675  align="char">
676 <para>Pointer to structure containing filter parameters.</para>
677 </entry>
678  </row></tbody></tgroup></informaltable>
679 &return-value-dvb;
680 <informaltable><tgroup cols="2"><tbody><row><entry
681  align="char">
682 <para>EBADF</para>
683 </entry><entry
684  align="char">
685 <para>fd is not a valid file descriptor.</para>
686 </entry>
687  </row><row><entry
688  align="char">
689 <para>EINVAL</para>
690 </entry><entry
691  align="char">
692 <para>Invalid argument.</para>
693 </entry>
694  </row></tbody></tgroup></informaltable>
695 </section>
697 <section id="DMX_SET_PES_FILTER">
698 <title>DMX_SET_PES_FILTER</title>
699 <para>DESCRIPTION
700 </para>
701 <informaltable><tgroup cols="1"><tbody><row><entry
702  align="char">
703 <para>This ioctl call sets up a PES filter according to the parameters provided. By a
704  PES filter is meant a filter that is based just on the packet identifier (PID), i.e.
705  no PES header or payload filtering capability is supported.</para>
706 </entry>
707  </row><row><entry
708  align="char">
709 <para>The transport stream destination for the filtered output may be set. Also the
710  PES type may be stated in order to be able to e.g. direct a video stream directly
711  to the video decoder. Finally there is a flag field where it is possible to state
712  whether the filtering operation should be started immediately (without waiting
713  for a DMX_START ioctl call). If a filter was previously set-up, this filter will
714  be cancelled, and the receive buffer will be flushed.</para>
715 </entry>
716  </row></tbody></tgroup></informaltable>
717 <para>SYNOPSIS
718 </para>
719 <informaltable><tgroup cols="1"><tbody><row><entry
720  align="char">
721 <para>int ioctl( int fd, int request = DMX_SET_PES_FILTER,
722  struct dmx_pes_filter_params &#x22C6;params);</para>
723 </entry>
724  </row></tbody></tgroup></informaltable>
725 <para>PARAMETERS
726 </para>
727 <informaltable><tgroup cols="2"><tbody><row><entry
728  align="char">
729 <para>int fd</para>
730 </entry><entry
731  align="char">
732 <para>File descriptor returned by a previous call to open().</para>
733 </entry>
734  </row><row><entry
735  align="char">
736 <para>int request</para>
737 </entry><entry
738  align="char">
739 <para>Equals DMX_SET_PES_FILTER for this command.</para>
740 </entry>
741  </row><row><entry
742  align="char">
743 <para>struct
744  dmx_pes_filter_params
745  *params</para>
746 </entry><entry
747  align="char">
748 <para>Pointer to structure containing filter parameters.</para>
749 </entry>
750  </row></tbody></tgroup></informaltable>
751 &return-value-dvb;
752 <informaltable><tgroup cols="2"><tbody><row><entry
753  align="char">
754 <para>EBADF</para>
755 </entry><entry
756  align="char">
757 <para>fd is not a valid file descriptor.</para>
758 </entry>
759  </row><row><entry
760  align="char">
761 <para>EINVAL</para>
762 </entry><entry
763  align="char">
764 <para>Invalid argument.</para>
765 </entry>
766  </row><row><entry
767  align="char">
768 <para>EBUSY</para>
769 </entry><entry
770  align="char">
771 <para>This error code indicates that there are conflicting
772  requests. There are active filters filtering data from
773  another input source. Make sure that these filters are
774  stopped before starting this filter.</para>
775 </entry>
776  </row></tbody></tgroup></informaltable>
777 </section>
779 <section id="DMX_SET_BUFFER_SIZE">
780 <title>DMX_SET_BUFFER_SIZE</title>
781 <para>DESCRIPTION
782 </para>
783 <informaltable><tgroup cols="1"><tbody><row><entry
784  align="char">
785 <para>This ioctl call is used to set the size of the circular buffer used for filtered data.
786  The default size is two maximum sized sections, i.e. if this function is not called
787  a buffer size of 2 * 4096 bytes will be used.</para>
788 </entry>
789  </row></tbody></tgroup></informaltable>
790 <para>SYNOPSIS
791 </para>
792 <informaltable><tgroup cols="1"><tbody><row><entry
793  align="char">
794 <para>int ioctl( int fd, int request =
795  DMX_SET_BUFFER_SIZE, unsigned long size);</para>
796 </entry>
797  </row></tbody></tgroup></informaltable>
798 <para>PARAMETERS
799 </para>
800 <informaltable><tgroup cols="2"><tbody><row><entry
801  align="char">
802 <para>int fd</para>
803 </entry><entry
804  align="char">
805 <para>File descriptor returned by a previous call to open().</para>
806 </entry>
807  </row><row><entry
808  align="char">
809 <para>int request</para>
810 </entry><entry
811  align="char">
812 <para>Equals DMX_SET_BUFFER_SIZE for this command.</para>
813 </entry>
814  </row><row><entry
815  align="char">
816 <para>unsigned long size</para>
817 </entry><entry
818  align="char">
819 <para>Size of circular buffer.</para>
820 </entry>
821  </row></tbody></tgroup></informaltable>
822 &return-value-dvb;
823 <informaltable><tgroup cols="2"><tbody><row><entry
824  align="char">
825 <para>EBADF</para>
826 </entry><entry
827  align="char">
828 <para>fd is not a valid file descriptor.</para>
829 </entry>
830  </row><row><entry
831  align="char">
832 <para>ENOMEM</para>
833 </entry><entry
834  align="char">
835 <para>The driver was not able to allocate a buffer of the
836  requested size.</para>
837 </entry>
838  </row></tbody></tgroup></informaltable>
839 </section>
841 <section id="DMX_GET_EVENT">
842 <title>DMX_GET_EVENT</title>
843 <para>DESCRIPTION
844 </para>
845 <informaltable><tgroup cols="1"><tbody><row><entry
846  align="char">
847 <para>This ioctl call returns an event if available. If an event is not available,
848  the behavior depends on whether the device is in blocking or non-blocking
849  mode. In the latter case, the call fails immediately with errno set to
850  EWOULDBLOCK. In the former case, the call blocks until an event becomes
851  available.</para>
852 </entry>
853  </row><row><entry
854  align="char">
855 <para>The standard Linux poll() and/or select() system calls can be used with the
856  device file descriptor to watch for new events. For select(), the file descriptor
857  should be included in the exceptfds argument, and for poll(), POLLPRI should
858  be specified as the wake-up condition. Only the latest event for each filter is
859  saved.</para>
860 </entry>
861  </row></tbody></tgroup></informaltable>
862 <para>SYNOPSIS
863 </para>
864 <informaltable><tgroup cols="1"><tbody><row><entry
865  align="char">
866 <para>int ioctl( int fd, int request = DMX_GET_EVENT,
867  struct dmx_event &#x22C6;ev);</para>
868 </entry>
869  </row></tbody></tgroup></informaltable>
870 <para>PARAMETERS
871 </para>
872 <informaltable><tgroup cols="2"><tbody><row><entry
873  align="char">
874 <para>int fd</para>
875 </entry><entry
876  align="char">
877 <para>File descriptor returned by a previous call to open().</para>
878 </entry>
879  </row><row><entry
880  align="char">
881 <para>int request</para>
882 </entry><entry
883  align="char">
884 <para>Equals DMX_GET_EVENT for this command.</para>
885 </entry>
886  </row><row><entry
887  align="char">
888 <para>struct dmx_event *ev</para>
889 </entry><entry
890  align="char">
891 <para>Pointer to the location where the event is to be stored.</para>
892 </entry>
893  </row></tbody></tgroup></informaltable>
894 &return-value-dvb;
895 <informaltable><tgroup cols="2"><tbody><row><entry
896  align="char">
897 <para>EBADF</para>
898 </entry><entry
899  align="char">
900 <para>fd is not a valid file descriptor.</para>
901 </entry>
902  </row><row><entry
903  align="char">
904 <para>EFAULT</para>
905 </entry><entry
906  align="char">
907 <para>ev points to an invalid address.</para>
908 </entry>
909  </row><row><entry
910  align="char">
911 <para>EWOULDBLOCK</para>
912 </entry><entry
913  align="char">
914 <para>There is no event pending, and the device is in
915  non-blocking mode.</para>
916 </entry>
917  </row></tbody></tgroup></informaltable>
918 </section>
920 <section id="DMX_GET_STC">
921 <title>DMX_GET_STC</title>
922 <para>DESCRIPTION
923 </para>
924 <informaltable><tgroup cols="1"><tbody><row><entry
925  align="char">
926 <para>This ioctl call returns the current value of the system time counter (which is driven
927  by a PES filter of type DMX_PES_PCR). Some hardware supports more than one
928  STC, so you must specify which one by setting the num field of stc before the ioctl
929  (range 0...n). The result is returned in form of a ratio with a 64 bit numerator
930  and a 32 bit denominator, so the real 90kHz STC value is stc-&#x003E;stc /
931  stc-&#x003E;base
932  .</para>
933 </entry>
934  </row></tbody></tgroup></informaltable>
935 <para>SYNOPSIS
936 </para>
937 <informaltable><tgroup cols="1"><tbody><row><entry
938  align="char">
939 <para>int ioctl( int fd, int request = DMX_GET_STC, struct
940  dmx_stc &#x22C6;stc);</para>
941 </entry>
942  </row></tbody></tgroup></informaltable>
943 <para>PARAMETERS
944 </para>
945 <informaltable><tgroup cols="2"><tbody><row><entry
946  align="char">
947 <para>int fd</para>
948 </entry><entry
949  align="char">
950 <para>File descriptor returned by a previous call to open().</para>
951 </entry>
952  </row><row><entry
953  align="char">
954 <para>int request</para>
955 </entry><entry
956  align="char">
957 <para>Equals DMX_GET_STC for this command.</para>
958 </entry>
959  </row><row><entry
960  align="char">
961 <para>struct dmx_stc *stc</para>
962 </entry><entry
963  align="char">
964 <para>Pointer to the location where the stc is to be stored.</para>
965 </entry>
966  </row></tbody></tgroup></informaltable>
967 &return-value-dvb;
968 <informaltable><tgroup cols="2"><tbody><row><entry
969  align="char">
970 <para>EBADF</para>
971 </entry><entry
972  align="char">
973 <para>fd is not a valid file descriptor.</para>
974 </entry>
975  </row><row><entry
976  align="char">
977 <para>EFAULT</para>
978 </entry><entry
979  align="char">
980 <para>stc points to an invalid address.</para>
981 </entry>
982  </row><row><entry
983  align="char">
984 <para>EINVAL</para>
985 </entry><entry
986  align="char">
987 <para>Invalid stc number.</para>
988 </entry>
989  </row></tbody></tgroup></informaltable>
990  </section></section>