About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Documentation / DocBook / media / dvb / demux.xml


Based on kernel version 4.7.2. Page generated on 2016-08-22 22:44 EST.

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


About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog