blob: 6758739cd6118c4e90fe2292e2424c7d3ab9996c [file] [log] [blame]
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -03001<title>DVB Demux Device</title>
2
3<para>The DVB demux device controls the filters of the DVB hardware/software. It can be
4accessed through <emphasis role="tt">/dev/adapter0/demux0</emphasis>. Data types and and ioctl definitions can be
5accessed by including <emphasis role="tt">linux/dvb/dmx.h</emphasis> in your application.
6</para>
7<section id="dmx_types">
8<title>Demux Data Types</title>
9
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030010<section id="dmx-output-t">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030011<title>dmx_output_t</title>
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030012<programlisting>
13typedef 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;
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030023</programlisting>
24<para><emphasis role="tt">DMX_OUT_TAP</emphasis> delivers the stream output to the demux device on which the ioctl is
25called.
26</para>
27<para><emphasis role="tt">DMX_OUT_TS_TAP</emphasis> routes output to the logical DVR device <emphasis role="tt">/dev/dvb/adapter0/dvr0</emphasis>,
28which delivers a TS multiplexed from all filters for which <emphasis role="tt">DMX_OUT_TS_TAP</emphasis> was
29specified.
30</para>
31</section>
32
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030033<section id="dmx-input-t">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030034<title>dmx_input_t</title>
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030035<programlisting>
36typedef 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;
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030041</programlisting>
42</section>
43
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030044<section id="dmx-pes-type-t">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030045<title>dmx_pes_type_t</title>
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030046<programlisting>
47typedef enum
48{
49 DMX_PES_AUDIO0,
50 DMX_PES_VIDEO0,
51 DMX_PES_TELETEXT0,
52 DMX_PES_SUBTITLE0,
53 DMX_PES_PCR0,
54
55 DMX_PES_AUDIO1,
56 DMX_PES_VIDEO1,
57 DMX_PES_TELETEXT1,
58 DMX_PES_SUBTITLE1,
59 DMX_PES_PCR1,
60
61 DMX_PES_AUDIO2,
62 DMX_PES_VIDEO2,
63 DMX_PES_TELETEXT2,
64 DMX_PES_SUBTITLE2,
65 DMX_PES_PCR2,
66
67 DMX_PES_AUDIO3,
68 DMX_PES_VIDEO3,
69 DMX_PES_TELETEXT3,
70 DMX_PES_SUBTITLE3,
71 DMX_PES_PCR3,
72
73 DMX_PES_OTHER
74} dmx_pes_type_t;
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030075</programlisting>
76</section>
77
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030078<section id="dmx-filter">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030079<title>struct dmx_filter</title>
80 <programlisting>
81 typedef struct dmx_filter
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030082{
83 __u8 filter[DMX_FILTER_SIZE];
84 __u8 mask[DMX_FILTER_SIZE];
85 __u8 mode[DMX_FILTER_SIZE];
86} dmx_filter_t;
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030087</programlisting>
88</section>
89
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030090<section id="dmx-sct-filter-params">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030091<title>struct dmx_sct_filter_params</title>
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -030092<programlisting>
93struct dmx_sct_filter_params
94{
95 __u16 pid;
96 dmx_filter_t filter;
97 __u32 timeout;
98 __u32 flags;
99#define DMX_CHECK_CRC 1
100#define DMX_ONESHOT 2
101#define DMX_IMMEDIATE_START 4
102#define DMX_KERNEL_CLIENT 0x8000
103};
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300104</programlisting>
105</section>
106
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300107<section id="dmx-pes-filter-params">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300108<title>struct dmx_pes_filter_params</title>
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300109<programlisting>
110struct dmx_pes_filter_params
111{
112 __u16 pid;
113 dmx_input_t input;
114 dmx_output_t output;
115 dmx_pes_type_t pes_type;
116 __u32 flags;
117};
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300118</programlisting>
119</section>
120
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300121<section id="dmx-event">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300122<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
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300136<section id="dmx-stc">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300137<title>struct dmx_stc</title>
Mauro Carvalho Chehabab947822011-06-08 14:14:31 -0300138<programlisting>
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300139struct 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};
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300144</programlisting>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300145</section>
146
Mauro Carvalho Chehabab947822011-06-08 14:14:31 -0300147<section id="dmx-caps">
148<title>struct dmx_caps</title>
149<programlisting>
150 typedef struct dmx_caps {
151 __u32 caps;
152 int num_decoders;
153} dmx_caps_t;
154</programlisting>
155</section>
156
157<section id="dmx-source-t">
158<title>enum dmx_source_t</title>
159<programlisting>
160typedef enum {
161 DMX_SOURCE_FRONT0 = 0,
162 DMX_SOURCE_FRONT1,
163 DMX_SOURCE_FRONT2,
164 DMX_SOURCE_FRONT3,
165 DMX_SOURCE_DVR0 = 16,
166 DMX_SOURCE_DVR1,
167 DMX_SOURCE_DVR2,
168 DMX_SOURCE_DVR3
169} dmx_source_t;
170</programlisting>
171</section>
172
173</section>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300174<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>ERRORS
243</para>
244<informaltable><tgroup cols="2"><tbody><row><entry
245 align="char">
246<para>ENODEV</para>
247</entry><entry
248 align="char">
249<para>Device driver not loaded/available.</para>
250</entry>
251 </row><row><entry
252 align="char">
253<para>EINVAL</para>
254</entry><entry
255 align="char">
256<para>Invalid argument.</para>
257</entry>
258 </row><row><entry
259 align="char">
260<para>EMFILE</para>
261</entry><entry
262 align="char">
263<para>&#8220;Too many open files&#8221;, i.e. no more filters available.</para>
264</entry>
265 </row><row><entry
266 align="char">
267<para>ENOMEM</para>
268</entry><entry
269 align="char">
270<para>The driver failed to allocate enough memory.</para>
271</entry>
272 </row></tbody></tgroup></informaltable>
273</section>
274
275<section id="dmx_fclose">
276<title>close()</title>
277<para>DESCRIPTION
278</para>
279<informaltable><tgroup cols="1"><tbody><row><entry
280 align="char">
281<para>This system call deactivates and deallocates a filter that was previously
282 allocated via the open() call.</para>
283</entry>
284 </row></tbody></tgroup></informaltable>
285<para>SYNOPSIS
286</para>
287<informaltable><tgroup cols="1"><tbody><row><entry
288 align="char">
289<para>int close(int fd);</para>
290</entry>
291 </row></tbody></tgroup></informaltable>
292<para>PARAMETERS
293</para>
294<informaltable><tgroup cols="2"><tbody><row><entry
295 align="char">
296<para>int fd</para>
297</entry><entry
298 align="char">
299<para>File descriptor returned by a previous call to open().</para>
300</entry>
301 </row></tbody></tgroup></informaltable>
302<para>ERRORS
303</para>
304<informaltable><tgroup cols="2"><tbody><row><entry
305 align="char">
306<para>EBADF</para>
307</entry><entry
308 align="char">
309<para>fd is not a valid open file descriptor.</para>
310</entry>
311 </row></tbody></tgroup></informaltable>
312</section>
313
314<section id="dmx_fread">
315<title>read()</title>
316<para>DESCRIPTION
317</para>
318<informaltable><tgroup cols="1"><tbody><row><entry
319 align="char">
320<para>This system call returns filtered data, which might be section or PES data. The
321 filtered data is transferred from the driver&#8217;s internal circular buffer to buf. The
322 maximum amount of data to be transferred is implied by count.</para>
323</entry>
324 </row><row><entry
325 align="char">
326<para>When returning section data the driver always tries to return a complete single
327 section (even though buf would provide buffer space for more data). If the size
328 of the buffer is smaller than the section as much as possible will be returned,
329 and the remaining data will be provided in subsequent calls.</para>
330</entry>
331 </row><row><entry
332 align="char">
333<para>The size of the internal buffer is 2 * 4096 bytes (the size of two maximum
334 sized sections) by default. The size of this buffer may be changed by using the
335 DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if
336 the read operations are not performed fast enough, this may result in a buffer
337 overflow error. In this case EOVERFLOW will be returned, and the circular
338 buffer will be emptied. This call is blocking if there is no data to return, i.e. the
339 process will be put to sleep waiting for data, unless the O_NONBLOCK flag
340 is specified.</para>
341</entry>
342 </row><row><entry
343 align="char">
344<para>Note that in order to be able to read, the filtering process has to be started
345 by defining either a section or a PES filter by means of the ioctl functions,
346 and then starting the filtering process via the DMX_START ioctl function
347 or by setting the DMX_IMMEDIATE_START flag. If the reading is done
348 from a logical DVR demux device, the data will constitute a Transport Stream
349 including the packets from all PES filters in the corresponding demux device
350 /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP.</para>
351</entry>
352 </row></tbody></tgroup></informaltable>
353<para>SYNOPSIS
354</para>
355<informaltable><tgroup cols="1"><tbody><row><entry
356 align="char">
357<para>size_t read(int fd, void &#x22C6;buf, size_t count);</para>
358</entry>
359 </row></tbody></tgroup></informaltable>
360<para>PARAMETERS
361</para>
362<informaltable><tgroup cols="2"><tbody><row><entry
363 align="char">
364<para>int fd</para>
365</entry><entry
366 align="char">
367<para>File descriptor returned by a previous call to open().</para>
368</entry>
369 </row><row><entry
370 align="char">
371<para>void *buf</para>
372</entry><entry
373 align="char">
374<para>Pointer to the buffer to be used for returned filtered data.</para>
375</entry>
376 </row><row><entry
377 align="char">
378<para>size_t count</para>
379</entry><entry
380 align="char">
381<para>Size of buf.</para>
382</entry>
383 </row></tbody></tgroup></informaltable>
384<para>ERRORS
385</para>
386<informaltable><tgroup cols="2"><tbody><row><entry
387 align="char">
388<para>EWOULDBLOCK</para>
389</entry><entry
390 align="char">
391<para>No data to return and O_NONBLOCK was specified.</para>
392</entry>
393 </row><row><entry
394 align="char">
395<para>EBADF</para>
396</entry><entry
397 align="char">
398<para>fd is not a valid open file descriptor.</para>
399</entry>
400 </row><row><entry
401 align="char">
402<para>ECRC</para>
403</entry><entry
404 align="char">
405<para>Last section had a CRC error - no data returned. The
406 buffer is flushed.</para>
407</entry>
408 </row><row><entry
409 align="char">
410<para>EOVERFLOW</para>
411</entry><entry
412 align="char">
413</entry>
414 </row><row><entry
415 align="char">
416</entry><entry
417 align="char">
418<para>The filtered data was not read from the buffer in due
419 time, resulting in non-read data being lost. The buffer is
420 flushed.</para>
421</entry>
422 </row><row><entry
423 align="char">
424<para>ETIMEDOUT</para>
425</entry><entry
426 align="char">
427<para>The section was not loaded within the stated timeout
428 period. See ioctl DMX_SET_FILTER for how to set a
429 timeout.</para>
430</entry>
431 </row><row><entry
432 align="char">
433<para>EFAULT</para>
434</entry><entry
435 align="char">
436<para>The driver failed to write to the callers buffer due to an
437 invalid *buf pointer.</para>
438</entry>
439 </row></tbody></tgroup></informaltable>
440</section>
441
442<section id="dmx_fwrite">
443<title>write()</title>
444<para>DESCRIPTION
445</para>
446<informaltable><tgroup cols="1"><tbody><row><entry
447 align="char">
448<para>This system call is only provided by the logical device /dev/dvb/adapter0/dvr0,
449 associated with the physical demux device that provides the actual DVR
450 functionality. It is used for replay of a digitally recorded Transport Stream.
451 Matching filters have to be defined in the corresponding physical demux
452 device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is
453 implied by count.</para>
454</entry>
455 </row></tbody></tgroup></informaltable>
456<para>SYNOPSIS
457</para>
458<informaltable><tgroup cols="1"><tbody><row><entry
459 align="char">
460<para>ssize_t write(int fd, const void &#x22C6;buf, size_t
461 count);</para>
462</entry>
463 </row></tbody></tgroup></informaltable>
464<para>PARAMETERS
465</para>
466<informaltable><tgroup cols="2"><tbody><row><entry
467 align="char">
468<para>int fd</para>
469</entry><entry
470 align="char">
471<para>File descriptor returned by a previous call to open().</para>
472</entry>
473 </row><row><entry
474 align="char">
475<para>void *buf</para>
476</entry><entry
477 align="char">
478<para>Pointer to the buffer containing the Transport Stream.</para>
479</entry>
480 </row><row><entry
481 align="char">
482<para>size_t count</para>
483</entry><entry
484 align="char">
485<para>Size of buf.</para>
486</entry>
487 </row></tbody></tgroup></informaltable>
488<para>ERRORS
489</para>
490<informaltable><tgroup cols="2"><tbody><row><entry
491 align="char">
492<para>EWOULDBLOCK</para>
493</entry><entry
494 align="char">
495<para>No data was written. This
496 might happen if O_NONBLOCK was specified and there
497 is no more buffer space available (if O_NONBLOCK is
498 not specified the function will block until buffer space is
499 available).</para>
500</entry>
501 </row><row><entry
502 align="char">
503<para>EBUSY</para>
504</entry><entry
505 align="char">
506<para>This error code indicates that there are conflicting
507 requests. The corresponding demux device is setup to
508 receive data from the front- end. Make sure that these
509 filters are stopped and that the filters with input set to
510 DMX_IN_DVR are started.</para>
511</entry>
512 </row><row><entry
513 align="char">
514<para>EBADF</para>
515</entry><entry
516 align="char">
517<para>fd is not a valid open file descriptor.</para>
518</entry>
519 </row></tbody></tgroup></informaltable>
520</section>
521
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300522<section id="DMX_START">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300523<title>DMX_START</title>
524<para>DESCRIPTION
525</para>
526<informaltable><tgroup cols="1"><tbody><row><entry
527 align="char">
528<para>This ioctl call is used to start the actual filtering operation defined via the ioctl
529 calls DMX_SET_FILTER or DMX_SET_PES_FILTER.</para>
530</entry>
531 </row></tbody></tgroup></informaltable>
532<para>SYNOPSIS
533</para>
534<informaltable><tgroup cols="1"><tbody><row><entry
535 align="char">
536<para>int ioctl( int fd, int request = DMX_START);</para>
537</entry>
538 </row></tbody></tgroup></informaltable>
539<para>PARAMETERS
540</para>
541<informaltable><tgroup cols="2"><tbody><row><entry
542 align="char">
543<para>int fd</para>
544</entry><entry
545 align="char">
546<para>File descriptor returned by a previous call to open().</para>
547</entry>
548 </row><row><entry
549 align="char">
550<para>int request</para>
551</entry><entry
552 align="char">
553<para>Equals DMX_START for this command.</para>
554</entry>
555 </row></tbody></tgroup></informaltable>
556<para>ERRORS
557</para>
558<informaltable><tgroup cols="2"><tbody><row><entry
559 align="char">
560<para>EBADF</para>
561</entry><entry
562 align="char">
563<para>fd is not a valid file descriptor.</para>
564</entry>
565 </row><row><entry
566 align="char">
567<para>EINVAL</para>
568</entry><entry
569 align="char">
570<para>Invalid argument, i.e. no filtering parameters provided via
571 the DMX_SET_FILTER or DMX_SET_PES_FILTER
572 functions.</para>
573</entry>
574 </row><row><entry
575 align="char">
576<para>EBUSY</para>
577</entry><entry
578 align="char">
579<para>This error code indicates that there are conflicting
580 requests. There are active filters filtering data from
581 another input source. Make sure that these filters are
582 stopped before starting this filter.</para>
583</entry>
584 </row></tbody></tgroup></informaltable>
585</section>
586
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300587<section id="DMX_STOP">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300588<title>DMX_STOP</title>
589<para>DESCRIPTION
590</para>
591<informaltable><tgroup cols="1"><tbody><row><entry
592 align="char">
593<para>This ioctl call is used to stop the actual filtering operation defined via the
594 ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via
595 the DMX_START command.</para>
596</entry>
597 </row></tbody></tgroup></informaltable>
598<para>SYNOPSIS
599</para>
600<informaltable><tgroup cols="1"><tbody><row><entry
601 align="char">
602<para>int ioctl( int fd, int request = DMX_STOP);</para>
603</entry>
604 </row></tbody></tgroup></informaltable>
605<para>PARAMETERS
606</para>
607<informaltable><tgroup cols="2"><tbody><row><entry
608 align="char">
609<para>int fd</para>
610</entry><entry
611 align="char">
612<para>File descriptor returned by a previous call to open().</para>
613</entry>
614 </row><row><entry
615 align="char">
616<para>int request</para>
617</entry><entry
618 align="char">
619<para>Equals DMX_STOP for this command.</para>
620</entry>
621 </row></tbody></tgroup></informaltable>
622<para>ERRORS
623</para>
624<informaltable><tgroup cols="2"><tbody><row><entry
625 align="char">
626<para>EBADF</para>
627</entry><entry
628 align="char">
629<para>fd is not a valid file descriptor.</para>
630</entry>
631 </row></tbody></tgroup></informaltable>
632</section>
633
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300634<section id="DMX_SET_FILTER">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300635<title>DMX_SET_FILTER</title>
636<para>DESCRIPTION
637</para>
638<informaltable><tgroup cols="1"><tbody><row><entry
639 align="char">
640<para>This ioctl call sets up a filter according to the filter and mask parameters
641 provided. A timeout may be defined stating number of seconds to wait for a
642 section to be loaded. A value of 0 means that no timeout should be applied.
643 Finally there is a flag field where it is possible to state whether a section should
644 be CRC-checked, whether the filter should be a &#8221;one-shot&#8221; filter, i.e. if the
645 filtering operation should be stopped after the first section is received, and
646 whether the filtering operation should be started immediately (without waiting
647 for a DMX_START ioctl call). If a filter was previously set-up, this filter will
648 be canceled, and the receive buffer will be flushed.</para>
649</entry>
650 </row></tbody></tgroup></informaltable>
651<para>SYNOPSIS
652</para>
653<informaltable><tgroup cols="1"><tbody><row><entry
654 align="char">
655<para>int ioctl( int fd, int request = DMX_SET_FILTER,
656 struct dmx_sct_filter_params &#x22C6;params);</para>
657</entry>
658 </row></tbody></tgroup></informaltable>
659<para>PARAMETERS
660</para>
661<informaltable><tgroup cols="2"><tbody><row><entry
662 align="char">
663<para>int fd</para>
664</entry><entry
665 align="char">
666<para>File descriptor returned by a previous call to open().</para>
667</entry>
668 </row><row><entry
669 align="char">
670<para>int request</para>
671</entry><entry
672 align="char">
673<para>Equals DMX_SET_FILTER for this command.</para>
674</entry>
675 </row><row><entry
676 align="char">
677<para>struct
678 dmx_sct_filter_params
679 *params</para>
680</entry><entry
681 align="char">
682<para>Pointer to structure containing filter parameters.</para>
683</entry>
684 </row></tbody></tgroup></informaltable>
685<para>ERRORS
686</para>
687<informaltable><tgroup cols="2"><tbody><row><entry
688 align="char">
689<para>EBADF</para>
690</entry><entry
691 align="char">
692<para>fd is not a valid file descriptor.</para>
693</entry>
694 </row><row><entry
695 align="char">
696<para>EINVAL</para>
697</entry><entry
698 align="char">
699<para>Invalid argument.</para>
700</entry>
701 </row></tbody></tgroup></informaltable>
702</section>
703
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300704<section id="DMX_SET_PES_FILTER">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300705<title>DMX_SET_PES_FILTER</title>
706<para>DESCRIPTION
707</para>
708<informaltable><tgroup cols="1"><tbody><row><entry
709 align="char">
710<para>This ioctl call sets up a PES filter according to the parameters provided. By a
711 PES filter is meant a filter that is based just on the packet identifier (PID), i.e.
712 no PES header or payload filtering capability is supported.</para>
713</entry>
714 </row><row><entry
715 align="char">
716<para>The transport stream destination for the filtered output may be set. Also the
717 PES type may be stated in order to be able to e.g. direct a video stream directly
718 to the video decoder. Finally there is a flag field where it is possible to state
719 whether the filtering operation should be started immediately (without waiting
720 for a DMX_START ioctl call). If a filter was previously set-up, this filter will
721 be cancelled, and the receive buffer will be flushed.</para>
722</entry>
723 </row></tbody></tgroup></informaltable>
724<para>SYNOPSIS
725</para>
726<informaltable><tgroup cols="1"><tbody><row><entry
727 align="char">
728<para>int ioctl( int fd, int request = DMX_SET_PES_FILTER,
729 struct dmx_pes_filter_params &#x22C6;params);</para>
730</entry>
731 </row></tbody></tgroup></informaltable>
732<para>PARAMETERS
733</para>
734<informaltable><tgroup cols="2"><tbody><row><entry
735 align="char">
736<para>int fd</para>
737</entry><entry
738 align="char">
739<para>File descriptor returned by a previous call to open().</para>
740</entry>
741 </row><row><entry
742 align="char">
743<para>int request</para>
744</entry><entry
745 align="char">
746<para>Equals DMX_SET_PES_FILTER for this command.</para>
747</entry>
748 </row><row><entry
749 align="char">
750<para>struct
751 dmx_pes_filter_params
752 *params</para>
753</entry><entry
754 align="char">
755<para>Pointer to structure containing filter parameters.</para>
756</entry>
757 </row></tbody></tgroup></informaltable>
758<para>ERRORS
759</para>
760<informaltable><tgroup cols="2"><tbody><row><entry
761 align="char">
762<para>EBADF</para>
763</entry><entry
764 align="char">
765<para>fd is not a valid file descriptor.</para>
766</entry>
767 </row><row><entry
768 align="char">
769<para>EINVAL</para>
770</entry><entry
771 align="char">
772<para>Invalid argument.</para>
773</entry>
774 </row><row><entry
775 align="char">
776<para>EBUSY</para>
777</entry><entry
778 align="char">
779<para>This error code indicates that there are conflicting
780 requests. There are active filters filtering data from
781 another input source. Make sure that these filters are
782 stopped before starting this filter.</para>
783</entry>
784 </row></tbody></tgroup></informaltable>
785</section>
786
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300787<section id="DMX_SET_BUFFER_SIZE">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300788<title>DMX_SET_BUFFER_SIZE</title>
789<para>DESCRIPTION
790</para>
791<informaltable><tgroup cols="1"><tbody><row><entry
792 align="char">
793<para>This ioctl call is used to set the size of the circular buffer used for filtered data.
794 The default size is two maximum sized sections, i.e. if this function is not called
795 a buffer size of 2 * 4096 bytes will be used.</para>
796</entry>
797 </row></tbody></tgroup></informaltable>
798<para>SYNOPSIS
799</para>
800<informaltable><tgroup cols="1"><tbody><row><entry
801 align="char">
802<para>int ioctl( int fd, int request =
803 DMX_SET_BUFFER_SIZE, unsigned long size);</para>
804</entry>
805 </row></tbody></tgroup></informaltable>
806<para>PARAMETERS
807</para>
808<informaltable><tgroup cols="2"><tbody><row><entry
809 align="char">
810<para>int fd</para>
811</entry><entry
812 align="char">
813<para>File descriptor returned by a previous call to open().</para>
814</entry>
815 </row><row><entry
816 align="char">
817<para>int request</para>
818</entry><entry
819 align="char">
820<para>Equals DMX_SET_BUFFER_SIZE for this command.</para>
821</entry>
822 </row><row><entry
823 align="char">
824<para>unsigned long size</para>
825</entry><entry
826 align="char">
827<para>Size of circular buffer.</para>
828</entry>
829 </row></tbody></tgroup></informaltable>
830<para>ERRORS
831</para>
832<informaltable><tgroup cols="2"><tbody><row><entry
833 align="char">
834<para>EBADF</para>
835</entry><entry
836 align="char">
837<para>fd is not a valid file descriptor.</para>
838</entry>
839 </row><row><entry
840 align="char">
841<para>ENOMEM</para>
842</entry><entry
843 align="char">
844<para>The driver was not able to allocate a buffer of the
845 requested size.</para>
846</entry>
847 </row></tbody></tgroup></informaltable>
848</section>
849
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300850<section id="DMX_GET_EVENT">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300851<title>DMX_GET_EVENT</title>
852<para>DESCRIPTION
853</para>
854<informaltable><tgroup cols="1"><tbody><row><entry
855 align="char">
856<para>This ioctl call returns an event if available. If an event is not available,
857 the behavior depends on whether the device is in blocking or non-blocking
858 mode. In the latter case, the call fails immediately with errno set to
859 EWOULDBLOCK. In the former case, the call blocks until an event becomes
860 available.</para>
861</entry>
862 </row><row><entry
863 align="char">
864<para>The standard Linux poll() and/or select() system calls can be used with the
865 device file descriptor to watch for new events. For select(), the file descriptor
866 should be included in the exceptfds argument, and for poll(), POLLPRI should
867 be specified as the wake-up condition. Only the latest event for each filter is
868 saved.</para>
869</entry>
870 </row></tbody></tgroup></informaltable>
871<para>SYNOPSIS
872</para>
873<informaltable><tgroup cols="1"><tbody><row><entry
874 align="char">
875<para>int ioctl( int fd, int request = DMX_GET_EVENT,
876 struct dmx_event &#x22C6;ev);</para>
877</entry>
878 </row></tbody></tgroup></informaltable>
879<para>PARAMETERS
880</para>
881<informaltable><tgroup cols="2"><tbody><row><entry
882 align="char">
883<para>int fd</para>
884</entry><entry
885 align="char">
886<para>File descriptor returned by a previous call to open().</para>
887</entry>
888 </row><row><entry
889 align="char">
890<para>int request</para>
891</entry><entry
892 align="char">
893<para>Equals DMX_GET_EVENT for this command.</para>
894</entry>
895 </row><row><entry
896 align="char">
897<para>struct dmx_event *ev</para>
898</entry><entry
899 align="char">
900<para>Pointer to the location where the event is to be stored.</para>
901</entry>
902 </row></tbody></tgroup></informaltable>
903<para>ERRORS
904</para>
905<informaltable><tgroup cols="2"><tbody><row><entry
906 align="char">
907<para>EBADF</para>
908</entry><entry
909 align="char">
910<para>fd is not a valid file descriptor.</para>
911</entry>
912 </row><row><entry
913 align="char">
914<para>EFAULT</para>
915</entry><entry
916 align="char">
917<para>ev points to an invalid address.</para>
918</entry>
919 </row><row><entry
920 align="char">
921<para>EWOULDBLOCK</para>
922</entry><entry
923 align="char">
924<para>There is no event pending, and the device is in
925 non-blocking mode.</para>
926</entry>
927 </row></tbody></tgroup></informaltable>
928</section>
929
Mauro Carvalho Chehabfb029092011-06-08 11:56:57 -0300930<section id="DMX_GET_STC">
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300931<title>DMX_GET_STC</title>
932<para>DESCRIPTION
933</para>
934<informaltable><tgroup cols="1"><tbody><row><entry
935 align="char">
936<para>This ioctl call returns the current value of the system time counter (which is driven
937 by a PES filter of type DMX_PES_PCR). Some hardware supports more than one
938 STC, so you must specify which one by setting the num field of stc before the ioctl
939 (range 0...n). The result is returned in form of a ratio with a 64 bit numerator
940 and a 32 bit denominator, so the real 90kHz STC value is stc-&#x003E;stc /
941 stc-&#x003E;base
942 .</para>
943</entry>
944 </row></tbody></tgroup></informaltable>
945<para>SYNOPSIS
946</para>
947<informaltable><tgroup cols="1"><tbody><row><entry
948 align="char">
949<para>int ioctl( int fd, int request = DMX_GET_STC, struct
950 dmx_stc &#x22C6;stc);</para>
951</entry>
952 </row></tbody></tgroup></informaltable>
953<para>PARAMETERS
954</para>
955<informaltable><tgroup cols="2"><tbody><row><entry
956 align="char">
957<para>int fd</para>
958</entry><entry
959 align="char">
960<para>File descriptor returned by a previous call to open().</para>
961</entry>
962 </row><row><entry
963 align="char">
964<para>int request</para>
965</entry><entry
966 align="char">
967<para>Equals DMX_GET_STC for this command.</para>
968</entry>
969 </row><row><entry
970 align="char">
971<para>struct dmx_stc *stc</para>
972</entry><entry
973 align="char">
974<para>Pointer to the location where the stc is to be stored.</para>
975</entry>
976 </row></tbody></tgroup></informaltable>
977<para>ERRORS
978</para>
979<informaltable><tgroup cols="2"><tbody><row><entry
980 align="char">
981<para>EBADF</para>
982</entry><entry
983 align="char">
984<para>fd is not a valid file descriptor.</para>
985</entry>
986 </row><row><entry
987 align="char">
988<para>EFAULT</para>
989</entry><entry
990 align="char">
991<para>stc points to an invalid address.</para>
992</entry>
993 </row><row><entry
994 align="char">
995<para>EINVAL</para>
996</entry><entry
997 align="char">
998<para>Invalid stc number.</para>
999</entry>
1000 </row></tbody></tgroup></informaltable>
1001 </section></section>