1 .. -*- coding: utf-8; mode: rst -*-
18 This system call, used with a device name of /dev/dvb/adapter0/demux0,
19 allocates a new filter and returns a handle which can be used for
20 subsequent control of that filter. This call has to be made for each
21 filter to be used, i.e. every returned file descriptor is a reference to
22 a single filter. /dev/dvb/adapter0/dvr0 is a logical device to be used
23 for retrieving Transport Streams for digital video recording. When
24 reading from this device a transport stream containing the packets from
25 all PES filters set in the corresponding demux device
26 (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A
27 recorded Transport Stream is replayed by writing to this device.
29 The significance of blocking or non-blocking mode is described in the
30 documentation for functions where there is a difference. It does not
31 affect the semantics of the open() call itself. A device opened in
32 blocking mode can later be put into non-blocking mode (and vice versa)
33 using the F_SETFL command of the fcntl system call.
38 .. c:function:: int open(const char *deviceName, int flags)
52 - const char \*deviceName
54 - Name of demux device.
60 - A bit-wise OR of the following flags:
65 - O_RDWR read/write access
70 - O_NONBLOCK open in non-blocking mode
75 - (blocking mode is the default)
92 - Device driver not loaded/available.
104 - “Too many open files”, i.e. no more filters available.
110 - The driver failed to allocate enough memory.
122 This system call deactivates and deallocates a filter that was
123 previously allocated via the open() call.
128 .. c:function:: int close(int fd)
144 - File descriptor returned by a previous call to open().
161 - fd is not a valid open file descriptor.
173 This system call returns filtered data, which might be section or PES
174 data. The filtered data is transferred from the driver’s internal
175 circular buffer to buf. The maximum amount of data to be transferred is
181 .. c:function:: size_t read(int fd, void *buf, size_t count)
197 - File descriptor returned by a previous call to open().
203 - Pointer to the buffer to be used for returned filtered data.
226 - No data to return and O_NONBLOCK was specified.
232 - fd is not a valid open file descriptor.
238 - Last section had a CRC error - no data returned. The buffer is
250 - The filtered data was not read from the buffer in due time,
251 resulting in non-read data being lost. The buffer is flushed.
257 - The section was not loaded within the stated timeout period. See
258 ioctl DMX_SET_FILTER for how to set a timeout.
264 - The driver failed to write to the callers buffer due to an invalid
277 This system call is only provided by the logical device
278 /dev/dvb/adapter0/dvr0, associated with the physical demux device that
279 provides the actual DVR functionality. It is used for replay of a
280 digitally recorded Transport Stream. Matching filters have to be defined
281 in the corresponding physical demux device, /dev/dvb/adapter0/demux0.
282 The amount of data to be transferred is implied by count.
287 .. c:function:: ssize_t write(int fd, const void *buf, size_t count)
303 - File descriptor returned by a previous call to open().
309 - Pointer to the buffer containing the Transport Stream.
332 - No data was written. This might happen if O_NONBLOCK was
333 specified and there is no more buffer space available (if
334 O_NONBLOCK is not specified the function will block until buffer
341 - This error code indicates that there are conflicting requests. The
342 corresponding demux device is setup to receive data from the
343 front- end. Make sure that these filters are stopped and that the
344 filters with input set to DMX_IN_DVR are started.
350 - fd is not a valid open file descriptor.
362 This ioctl call is used to start the actual filtering operation defined
363 via the ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER.
368 .. c:function:: int ioctl( int fd, int request = DMX_START)
384 - File descriptor returned by a previous call to open().
390 - Equals DMX_START for this command.
396 On success 0 is returned, on error -1 and the ``errno`` variable is set
397 appropriately. The generic error codes are described at the
398 :ref:`Generic Error Codes <gen-errors>` chapter.
411 - Invalid argument, i.e. no filtering parameters provided via the
412 DMX_SET_FILTER or DMX_SET_PES_FILTER functions.
418 - This error code indicates that there are conflicting requests.
419 There are active filters filtering data from another input source.
420 Make sure that these filters are stopped before starting this
433 This ioctl call is used to stop the actual filtering operation defined
434 via the ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and
435 started via the DMX_START command.
440 .. c:function:: int ioctl( int fd, int request = DMX_STOP)
456 - File descriptor returned by a previous call to open().
462 - Equals DMX_STOP for this command.
468 On success 0 is returned, on error -1 and the ``errno`` variable is set
469 appropriately. The generic error codes are described at the
470 :ref:`Generic Error Codes <gen-errors>` chapter.
481 This ioctl call sets up a filter according to the filter and mask
482 parameters provided. A timeout may be defined stating number of seconds
483 to wait for a section to be loaded. A value of 0 means that no timeout
484 should be applied. Finally there is a flag field where it is possible to
485 state whether a section should be CRC-checked, whether the filter should
486 be a ”one-shot” filter, i.e. if the filtering operation should be
487 stopped after the first section is received, and whether the filtering
488 operation should be started immediately (without waiting for a
489 DMX_START ioctl call). If a filter was previously set-up, this filter
490 will be canceled, and the receive buffer will be flushed.
495 .. c:function:: int ioctl( int fd, int request = DMX_SET_FILTER, struct dmx_sct_filter_params *params)
511 - File descriptor returned by a previous call to open().
517 - Equals DMX_SET_FILTER for this command.
521 - struct dmx_sct_filter_params \*params
523 - Pointer to structure containing filter parameters.
529 On success 0 is returned, on error -1 and the ``errno`` variable is set
530 appropriately. The generic error codes are described at the
531 :ref:`Generic Error Codes <gen-errors>` chapter.
534 .. _DMX_SET_PES_FILTER:
542 This ioctl call sets up a PES filter according to the parameters
543 provided. By a PES filter is meant a filter that is based just on the
544 packet identifier (PID), i.e. no PES header or payload filtering
545 capability is supported.
550 .. c:function:: int ioctl( int fd, int request = DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params)
566 - File descriptor returned by a previous call to open().
572 - Equals DMX_SET_PES_FILTER for this command.
576 - struct dmx_pes_filter_params \*params
578 - Pointer to structure containing filter parameters.
584 On success 0 is returned, on error -1 and the ``errno`` variable is set
585 appropriately. The generic error codes are described at the
586 :ref:`Generic Error Codes <gen-errors>` chapter.
599 - This error code indicates that there are conflicting requests.
600 There are active filters filtering data from another input source.
601 Make sure that these filters are stopped before starting this
606 .. _DMX_SET_BUFFER_SIZE:
614 This ioctl call is used to set the size of the circular buffer used for
615 filtered data. The default size is two maximum sized sections, i.e. if
616 this function is not called a buffer size of 2 \* 4096 bytes will be
622 .. c:function:: int ioctl( int fd, int request = DMX_SET_BUFFER_SIZE, unsigned long size)
638 - File descriptor returned by a previous call to open().
644 - Equals DMX_SET_BUFFER_SIZE for this command.
650 - Size of circular buffer.
656 On success 0 is returned, on error -1 and the ``errno`` variable is set
657 appropriately. The generic error codes are described at the
658 :ref:`Generic Error Codes <gen-errors>` chapter.
669 This ioctl call returns an event if available. If an event is not
670 available, the behavior depends on whether the device is in blocking or
671 non-blocking mode. In the latter case, the call fails immediately with
672 errno set to ``EWOULDBLOCK``. In the former case, the call blocks until an
673 event becomes available.
678 .. c:function:: int ioctl( int fd, int request = DMX_GET_EVENT, struct dmx_event *ev)
694 - File descriptor returned by a previous call to open().
700 - Equals DMX_GET_EVENT for this command.
704 - struct dmx_event \*ev
706 - Pointer to the location where the event is to be stored.
712 On success 0 is returned, on error -1 and the ``errno`` variable is set
713 appropriately. The generic error codes are described at the
714 :ref:`Generic Error Codes <gen-errors>` chapter.
727 - There is no event pending, and the device is in non-blocking mode.
739 This ioctl call returns the current value of the system time counter
740 (which is driven by a PES filter of type DMX_PES_PCR). Some hardware
741 supports more than one STC, so you must specify which one by setting the
742 num field of stc before the ioctl (range 0...n). The result is returned
743 in form of a ratio with a 64 bit numerator and a 32 bit denominator, so
744 the real 90kHz STC value is stc->stc / stc->base .
749 .. c:function:: int ioctl( int fd, int request = DMX_GET_STC, struct dmx_stc *stc)
765 - File descriptor returned by a previous call to open().
771 - Equals DMX_GET_STC for this command.
775 - struct dmx_stc \*stc
777 - Pointer to the location where the stc is to be stored.
783 On success 0 is returned, on error -1 and the ``errno`` variable is set
784 appropriately. The generic error codes are described at the
785 :ref:`Generic Error Codes <gen-errors>` chapter.
798 - Invalid stc number.
802 .. _DMX_GET_PES_PIDS:
810 This ioctl is undocumented. Documentation is welcome.
815 .. c:function:: int ioctl(fd, int request = DMX_GET_PES_PIDS, __u16[5])
831 - File descriptor returned by a previous call to open().
837 - Equals DMX_GET_PES_PIDS for this command.
849 On success 0 is returned, on error -1 and the ``errno`` variable is set
850 appropriately. The generic error codes are described at the
851 :ref:`Generic Error Codes <gen-errors>` chapter.
862 This ioctl is undocumented. Documentation is welcome.
867 .. c:function:: int ioctl(fd, int request = DMX_GET_CAPS, dmx_caps_t *)
883 - File descriptor returned by a previous call to open().
889 - Equals DMX_GET_CAPS for this command.
901 On success 0 is returned, on error -1 and the ``errno`` variable is set
902 appropriately. The generic error codes are described at the
903 :ref:`Generic Error Codes <gen-errors>` chapter.
914 This ioctl is undocumented. Documentation is welcome.
919 .. c:function:: int ioctl(fd, int request = DMX_SET_SOURCE, dmx_source_t *)
935 - File descriptor returned by a previous call to open().
941 - Equals DMX_SET_SOURCE for this command.
953 On success 0 is returned, on error -1 and the ``errno`` variable is set
954 appropriately. The generic error codes are described at the
955 :ref:`Generic Error Codes <gen-errors>` chapter.
966 This ioctl call allows to add multiple PIDs to a transport stream filter
967 previously set up with DMX_SET_PES_FILTER and output equal to
973 .. c:function:: int ioctl(fd, int request = DMX_ADD_PID, __u16 *)
989 - File descriptor returned by a previous call to open().
995 - Equals DMX_ADD_PID for this command.
1001 - PID number to be filtered.
1007 On success 0 is returned, on error -1 and the ``errno`` variable is set
1008 appropriately. The generic error codes are described at the
1009 :ref:`Generic Error Codes <gen-errors>` chapter.
1020 This ioctl call allows to remove a PID when multiple PIDs are set on a
1021 transport stream filter, e. g. a filter previously set up with output
1022 equal to DMX_OUT_TSDEMUX_TAP, created via either
1023 DMX_SET_PES_FILTER or DMX_ADD_PID.
1028 .. c:function:: int ioctl(fd, int request = DMX_REMOVE_PID, __u16 *)
1044 - File descriptor returned by a previous call to open().
1050 - Equals DMX_REMOVE_PID for this command.
1056 - PID of the PES filter to be removed.
1062 On success 0 is returned, on error -1 and the ``errno`` variable is set
1063 appropriately. The generic error codes are described at the
1064 :ref:`Generic Error Codes <gen-errors>` chapter.