Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[pandora-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 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>
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>
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 &#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>
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&#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>
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 &#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>
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 &#8221;one-shot&#8221; 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 &#x22C6;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 &#x22C6;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 &#x22C6;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-&#x003E;stc /
857  stc-&#x003E;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 &#x22C6;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></section>