summaryrefslogtreecommitdiff
path: root/dvb-spec/API/dvb_api/demux.xml
blob: b15824d0be1369b2b38e1c1bba60ced040166cfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>
		 	linuxtv.org|DVB Demux API</title></head><body bgcolor="#000000"
link="#ffcc00" text="#ffffff" vlink="#ffdd00"><table border="0"
cellpadding="0" cellspacing="0" width="100%"><tr><td><table border="0"
cellpadding="0" cellspacing="0" width="100%"><tr><td width="610"><table
border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td><table
border="0" cellpadding="0" cellspacing="0" width="180"><tr align="right"
valign="top"><td><img height="30" src="/images/top01.gif"
width="180"></td></tr><tr><td align="center" height="38"
valign="bottom"><img border="0" height="38" src="/images/cimlogo02.gif"
width="45"></td></tr></table></td><td><table border="0" cellpadding="0"
cellspacing="0" width="50"><tr><td><img height="30"
src="/images/top02.gif" width="284"></td></tr><tr><td><img height="45"
src="/images/top06.gif" width="20">&nbsp;
					
				</td></tr></table></td><td><table border="0" cellpadding="0"
cellspacing="0" width="170"><tr><td background="/images/squares05.gif"
colspan="2"><img height="68" src="/images/squares04.gif"
width="32"></td></tr></table></td></tr><tr><td></td></tr></table></td><td
height="68" valign="top" width="100%"><table border="0" cellpadding="0"
cellspacing="0" width="100%"><tr><td background="/images/squares05.gif"
height="68"
width="100%">&nbsp;</td></tr></table></td></tr></table></td></tr><tr><td height="30">
					&nbsp;
				</td></tr></table><table border="0" cellpadding="0"
cellspacing="0"><tr><td width="181"><table border="0" cellpadding="0"
cellspacing="0" width="181"><tr><td bgcolor="#000000" valign="top"
width="20"><img height="22" src="/images/gruen.gif" width="20"></td><td
bgcolor="#003d19" valign="top" width="19"><img height="22"
src="/images/pfeilgruen.gif" width="19"></td><td bgcolor="#000000"
valign="top" width="2"></td><td bgcolor="#003d19" width="120"><a
href="http://www.convergence.de"><font color="#ffcc00"
face="arial, helvetica" size="2"><b>
												&nbsp;convergence.de
											</b></font></a></td><td align="right" bgcolor="#003d19"
valign="bottom" width="20"><img height="22"
src="/images/eckeswgruen.gif" width="8"></td></tr><tr><td
height="2"></td></tr><tr><td bgcolor="#000000" valign="top"
width="20"><img height="22" src="/images/gruen.gif" width="20"></td><td
bgcolor="#003d19" valign="top" width="19"><img height="22"
src="/images/pfeilgruen.gif" width="19"></td><td bgcolor="#000000"
valign="top" width="2"></td><td bgcolor="#003d19" width="120"><a
href="http://www.cryptolabs.org"><font color="#ffcc00"
face="arial, helvetica" size="2"><b>
											&nbsp;cryptolabs.org</b></font></a></td><td align="right"
bgcolor="#003d19" valign="bottom" width="20"><img height="22"
src="/images/eckeswgruen.gif" width="8"></td></tr><tr><td
height="2"></td></tr><tr><td bgcolor="#000000" valign="top"
width="20"><img height="22" src="/images/gruen.gif" width="20"></td><td
bgcolor="#003d19" valign="top" width="19"><img height="22"
src="/images/pfeilgruen.gif" width="19"></td><td bgcolor="#000000"
valign="top" width="2"></td><td bgcolor="#003d19" width="120"><a
href="http://www.directfb.org"><font color="#ffcc00"
face="arial, helvetica" size="2"><b>
											&nbsp;directfb.org
											</b></font></a></td><td align="right" bgcolor="#003d19"
valign="bottom" width="20"><img height="22"
src="/images/eckeswgruen.gif" width="8"></td></tr><tr><td
height="2"></td></tr><tr><td bgcolor="#000000" valign="top"
width="20"><img height="22" src="/images/gleb.gif" width="20"></td><td
bgcolor="#ffcc00" valign="top" width="19"><img height="22"
src="/images/pfeilgelb.gif" width="19"></td><td bgcolor="#000000"
valign="top" width="2"></td><td bgcolor="#ffcc00" width="120"><a
href="/"><font color="#003d19" face="arial, helvetica" size="2"><b>
											&nbsp;linuxtv.org
											</b></font></a></td><td align="right" bgcolor="#ffcc00"
valign="bottom" width="20"><img height="22" src="/images/eckeswgelb.gif"
width="8"></td></tr><tr><td height="2"></td></tr></table></td><td width="20">
					&nbsp;
				</td><td valign="top" width="500"><img height="60"
src="/images/linuxtv.gif" width="245"></td></tr><tr><td align="left"
valign="top" width="181"><table bgcolor="#ffcc00" border="0"
cellpadding="0" cellspacing="0" width="185"><tr><td bgcolor="#000000"
valign="top" width="20"><img height="22" src="/images/gleb.gif"
width="20"></td><td bgcolor="#ffcc00" width="19"><img height="22"
src="/images/arrow_main.gif" width="19"></td><td bgcolor="#000000"
width="2"></td><td bgcolor="#ffcc00" width="131">
			&nbsp;<a href="/"><font color="#003d19" face="helvetica"
size="2"><b>linuxtv</b></font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" colspan="5"
height="2"></td></tr><tr><td bgcolor="#000000" valign="top"
width="20"><img height="22" src="/images/gleb.gif" width="20"></td><td
bgcolor="#ffcc00" width="19"><img height="22"
src="/images/arrow_main.gif" width="19"></td><td bgcolor="#000000"
width="2"></td><td bgcolor="#ffcc00" width="131">
			&nbsp;<a href="/projects.xml"><font color="#003d19" face="helvetica"
size="2"><b>projects</b></font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" colspan="5"
height="2"></td></tr><tr><td bgcolor="#000000" valign="top"
width="20"><img height="22" src="/images/gleb.gif" width="20"></td><td
bgcolor="#ffcc00" width="19"><img height="22"
src="/images/arrow_main_open.gif" width="19"></td><td bgcolor="#000000"
width="2"></td><td bgcolor="#ffcc00" width="131">
			&nbsp;<a href="/developer/"><font color="#003d19" face="helvetica"
size="2"><b>developer</b></font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" width="20"></td><td
bgcolor="#ffcc00" width="19">&nbsp;</td><td bgcolor="#000000"
width="2"></td><td width="131"><img height="13"
src="/images/arrow_sub_open.gif" width="13">
			&nbsp;<a href="/developer/dvb.xml"><font color="#000000"
face="helvetica" size="2">DVB</font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" width="20"></td><td
width="19">&nbsp;</td><td bgcolor="#000000" width="2"></td><td width="131">&nbsp;
			<img height="13" src="/images/space_sub.gif" width="13"><img
height="13" src="/images/kulleropen.gif" width="13"><a
href="/developer/dvb_api.xml"><font color="#000000" face="helvetica" size="2">
				&nbsp;API</font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" width="20"></td><td
bgcolor="#ffcc00" width="19">&nbsp;</td><td bgcolor="#000000"
width="2"></td><td width="131"><img height="13"
src="/images/arrow_sub.gif" width="13">
			&nbsp;<a href="/developer/dvd.xml"><font color="#000000"
face="helvetica" size="2">DVD</font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" width="20"></td><td
bgcolor="#ffcc00" width="19">&nbsp;</td><td bgcolor="#000000"
width="2"></td><td width="131"><img height="13"
src="/images/arrow_sub.gif" width="13">
			&nbsp;<a href="/developer/mbone.xml"><font color="#000000"
face="helvetica" size="2">Mbone</font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" width="20"></td><td
bgcolor="#ffcc00" width="19">&nbsp;</td><td bgcolor="#000000"
width="2"></td><td width="131"><img height="13"
src="/images/arrow_sub.gif" width="13">
			&nbsp;<a href="/cvs/"><font color="#000000" face="helvetica"
size="2">CVS</font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" colspan="5"
height="2"></td></tr><tr><td bgcolor="#000000" valign="top"
width="20"><img height="22" src="/images/gleb.gif" width="20"></td><td
bgcolor="#ffcc00" width="19"><img height="22"
src="/images/arrow_main.gif" width="19"></td><td bgcolor="#000000"
width="2"></td><td bgcolor="#ffcc00" width="131">
			&nbsp;<a href="/download/"><font color="#003d19" face="helvetica"
size="2"><b>download</b></font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" colspan="5"
height="2"></td></tr><tr><td bgcolor="#000000" valign="top"
width="20"><img height="22" src="/images/gleb.gif" width="20"></td><td
bgcolor="#ffcc00" width="19"><img height="22"
src="/images/arrow_main.gif" width="19"></td><td bgcolor="#000000"
width="2"></td><td bgcolor="#ffcc00" width="131">
			&nbsp;<a href="/contact.xml"><font color="#003d19" face="helvetica"
size="2"><b>contact</b></font></a></td><td bgcolor="#000000"
width="9"></td></tr><tr><td bgcolor="#000000" colspan="5"
height="2"></td></tr></table></td><td width="20">
					&nbsp;
				</td><td valign="top" width="500"><font color="#ffcc00" face="arial, helvetica"><h2>DVB Demux API</h2></font>

	<p>
	The DVB demux device lets you set TS, PID and section filters in the DVB 
	device. This is internally accomplished through calls to the 
	<a href="demux_mod.xml">demux kernel module</a>.
	The demux device can be accessed through /dev/ost/demux.
	</p>

	<p>
	The function calls defined in the include file 
	<a href="dmx.h">dmx.h</a> are described in detail below:
	</p>

	<p>
	<font face="arial, helvetica" size="+1">Demux API IO control calls</font>

<p>
<pre>

int open(const char *deviceName, int flags);
 
    DESCRIPTION
 
	This system call, used with a device name of /dev/ost/demuxn, where n 
	denotes the specific demux device to be opened, allocates a new filter 
	and returns a handle which can be used for subsequent control of that 
	filter. This call has to be made for each filter to be used, i.e. every
	returned file descriptor is a reference to a single filter.
        /dev/ost/dvrn is a logical device to be used for retrieving Transport 
	Streams for digital video recording. n identifies the physical demux 
	device that provides the actual DVR functionlaity. When reading from  
	this device a transport stream containing the packets from all PES
	filters set in the corresponfing demux device (/dev/osst/demuxn)             	having the output set to DMX_OUT_TS_TAP.  A recorded Transport Stream 
	is replayed by writing to this device.
	This device can only be opened in read-write mode.
        The significance of blocking or non-blocking mode is described in the
	documentation for functions where there is a difference. It does not 
	affect the semantics of the open() call itself. A device opened in 
	blocking mode can later be put into non-blocking mode
        (and vice versa) using the F_SETFL command of the fcntl system call.

 
    PARAMETERS

	const char *deviceName	     I Name of the demux device, which should be
	                               /dev/ost/demuxn where  n denotes the
                                       specific demux device to be opened, or the
                                       name of a logical DVR device, /dev/ost/dvrn.

	int flags                    I A bit-wise OR of the following flags:
                                       O_RDWR read/write access.
                                       O_NONBLOCK open in non-blocking mode
                                                 (blocking mode is the default).

    RETURNS
    
	ENODEV				Device driver not loaded/available.

        EINVAL 	                        Invalid argument.

        EMFILE                          &quot;Too many open files&quot;, i.e. no more filters available.

        ENOMEM                          The driver failed to allocate enough memory.



</pre>
</p>

<p>
<pre>

int close(int fd);

    DESCRIPTION

	This system call deactivates and deallocates a filter that was previously
	allocated via the open() call.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

    RETURNS

	EBADF			fd is not a valid open file descriptor



</pre>
</p>

<p>
<pre>

size_t read(int fd, void *buf, size_t count);

    DESCRIPTION

	This system call returns filtered data, which might be section or PES 
	data. The filtered data is transferred from the driver's internal circular
	buffer to buf. The maximum amount of data to be transferred is implied by
	count.

        When returning section data the driver always tries to return a complete 
	single section (even though buf would provide buffer space for more data).
	If the size of the buffer is smaller than the section as much as possible
	will be returned, and the remaining data will be provided in subsequent 
	calls.
        The size of the internal buffer is 2 * 4096 bytes (the size of two maximum
	sized sections) by default. The size of this buffer may be changed by 
	using the DMX_SET_BUFFER_SIZE function. If the buffer is not large enough,
	or if the read operations are not performed fast enough, this may result 
	in a buffer overflow error. In this case EBUFFEROVERFLOW will be returned,
	and the circular buffer will be emptied.
        This call is blocking if there is no data to return, i.e. the process 
	will be put to sleep waiting for data, unless the O_NONBLOCK flag is 
	specified.
        Note that in order to be able to read, the filtering process has to be
	started by defining either a section or a PES filter by means of the 
	ioctl functions, and then starting the filtering process via the DMX_START
	ioctl function or by setting the DMX_IMMEDIATE_START flag.
        If the reading is done from a logical DVR demux device, the data will 
	constitute a Transport Stream including the packets from all PES filters
	in the corresponding demux device /dev/ost/demuxn having the output set 
	to DMX_OUT_TS_TAP.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

	void *buf             O Pointer to the buffer to be used for returned filtered data.

	size_t count          I Size of buf.

    RETURNS

	EWOULDBLOCK		No data to return and O_NONBLOCK was specified.

        EBADF                   fd is not a valid open file descriptor

        ECRC                    Last section had a CRC error &shy; no data
	                        returned. The buffer is flushed.

        EBUFFEROVERFLOW         The filtered data was not read from the buffer in
                                due time, resulting in non-read data being lost.
                                The buffer is flushed.

        ETIMEDOUT               The section was not loaded within the stated
                                timeout period. See ioctl DMX_SET_FILTER for
                                how to set a timeout.

        EFAULT                  The driver failed to write to the callers buffer
				due to an invalid *buf pointer.



</pre>
</p>

<p>
<pre>

ssize_t write(int fd, const void *buf, size_t count);

    DESCRIPTION

	This system call is only provided by the logical device /dev/ost/dvrn, 
	where n identifies the physical demux device that provides the actual 
	DVR  functionality.  It is used for replay of a digitally recorded 
	Transport Stream. Matching filters have to be defined in the 
	corresponding physical demux device, /dev/ost/demuxn.
	The amount of data to be transferred is implied by count.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

	void *buf             I Pointer to the buffer containing the Transport Stream.

        size_t count          I Size of buf.

    RETURNS

	EWOULDBLOCK             No data was written. This might happen if
                                O_NONBLOCK was specified and there is no more
                                buffer space available (if O_NONBLOCK is not
                                specified the function will block until buffer 
				space is available).

	EBUSY                   This error code indicates that there are
                                conflicting requests. The corresponding demux
                                device is setup to receive data from the front-
                                end. Make sure that these filters are stopped
                                and that the filters with input set to DMX_IN_DVR
                                are started.

	EBADF                   fd is not a valid open file descriptor



</pre>
</p>

<p>
<pre>

int ioctl( int fd, int request = DMX_START);

    DESCRIPTION

	This ioctl call is used to start the actual filtering operation 
	defined via the ioctl  calls DMX_SET_FILTER or DMX_SET_PES_FILTER.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

	int request           I Equals DMX_START for this command.

    RETURNS

	EBADF                   fd is not a valid file descriptor

        EINVAL                  Invalid argument, i.e. no filtering parameters
                                provided via the DMX_SET_FILTER or
                                DMX_SET_PES_FILTER functions.

        EBUSY                   This error code indicates that there are
                                conflicting requests. There are active filters
                                filtering data from another input source. Make
                                sure that these filters are stopped before starting
                                this filter.



</pre>
</p>

<p>
<pre>

int ioctl( int fd, int request = DMX_STOP);

    DESCRIPTION

	This  ioctl call is used to stop the actual filtering operation defined 
	via the ioctl  calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via
	the DMX_START command.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

        int request           I Equals DMX_STOP for this command.
 
    RETURNS

	EBADF                   fd is not a valid file descriptor

</pre>
</p>

<p>
<pre>

int ioctl( int fd, int request = DMX_SET_FILTER, struct dmxSctFilterParams *params);

    DESCRIPTION

	This ioctl call sets up a filter according to the filter and mask 
	parameters provided. A timeout may be defined stating number of seconds 
	to wait for a section to be loaded. A value of 0 means that no timeout 
	should be applied. Finally there is a flag field where it is possible to
	state whether a section should be CRC-checked, whether the filter should
        be a &quot;one-shot&quot; filter, i.e. if the filtering operation should be stopped
	after the first section is received, and whether the filtering operation 
	should be started immediately (without waiting for a DMX_START ioctl call).
        If a filter was previously set-up, this filter will be cancelled, and the
	receive buffer will be flushed.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

        int request           I Equals DMX_SET_FILTER for this command.

        struct                I Pointer to structure containing filter

        dmxSctFilterParams      parameters.
               *params

    RETURNS

	EBADF                   fd is not a valid file descriptor

        EINVAL                  Invalid argument.

</pre>
</p>

<p>
<pre>

int ioctl( int fd, int request = DMX_SET_PES_FILTER, struct dmxPesFilterParams *params);

    DESCRIPTION

	This ioctl call sets up a PES filter according to the parameters provided.
	By a PES filter is meant a filter that is based just on the packet 
	identifier (PID), i.e. no PES header or payload filtering capability is 
	supported.
        The transport stream destination for the filtered output may be set. Also
	the PES type may be stated in order to be able to e.g. direct a video 
	stream directly to the video decoder. Finally there is a flag field where
	it is possible to state whether the filtering operation should be started
	immediately (without waiting for a DMX_START ioctl call).
        If a filter was previously set-up, this filter will be cancelled, and the
	receive buffer will be flushed.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

	int request           I Equals DMX_SET_PES_FILTER for this command.

        struct                I Pointer to structure containing filter

        dmxPesFilterParams      parameters.
               *params

    RETURNS

	EBADF                   fd is not a valid file descriptor

        EINVAL                  Invalid argument.

        EBUSY                   This error code indicates that there are
                                conflicting requests. There are active filters
                                filtering data from another input source. Make
                                sure that these filters are stopped before starting
                                this filter.



</pre>
</p>

<p>
<pre>

int ioctl( int fd, int request = DMX_SET_BUFFER_SIZE, unsigned long size);

    DESCRIPTION

	This ioctl call is used to set the size of the circular buffer used
	for filtered data. The default size is two maximum sized sections, i.e. 
	if this function is not called a buffer size of 2 * 4096 bytes will be
	used.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

        int request           I Equals DMX_SET_BUFFER_SIZE for this command.

        unsigned long size    I Size of circular buffer.

    RETURNS

	EBADF                   fd is not a valid file descriptor.

        ENOMEM                  The driver was not able to allocate a buffer of the requested size.



</pre>
</p>

<p>
<pre>

int ioctl( int fd, int request = DMX_GET_EVENT, struct dmxEvent *ev);

    DESCRIPTION

	This  ioctl call returns an event if available. If an event is not 
	available, the behavior depends on whether the device is in blocking or 
	non-blocking mode.  In the latter case, the call fails immediately with
	errno set to EWOULDBLOCK. In the former case, the call blocks until an
	event becomes available.
        The standard Linux poll() and/or select() system calls can be used with
	the device file descriptor to watch for new events.  For select(), the 
	file descriptor should be included in the exceptfds argument, and for 
	poll(), POLLPRI should be specified as the wake-up condition.
        Only the latest event for each filter is saved.

    PARAMETERS

	int fd		      I File descriptor returned by a previous call to open().

	int request           I Equals DMX_SET_BUFFER_SIZE for this command.

        struct dmxEvent *ev   O Pointer to the location where the event is to be stored.

    RETURNS

	EBADF                   fd is not a valid file descriptor.
        
	EFAULT                  ev points to an invalid address.

	EWOULDBLOCK             There is no event pending, and the device is in non-blocking mode.



</pre>
</p>
	</p>

	</td></tr></table></body></html>

<!-- This page was served in 1643 milliseconds by Cocoon 1.7.4 -->