xref: /linux/Documentation/userspace-api/media/dvb/dmx-fread.rst (revision 2c739ced5886cd8c8361faa79a9522ec05174ed0)
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3.. _dmx_fread:
4
5=======================
6Digital TV demux read()
7=======================
8
9Name
10----
11
12Digital TV demux read()
13
14
15Synopsis
16--------
17
18.. c:function:: size_t read(int fd, void *buf, size_t count)
19    :name: dvb-dmx-read
20
21Arguments
22---------
23
24``fd``
25  File descriptor returned by a previous call to :c:func:`open() <dvb-ca-open>`.
26
27 ``buf``
28   Buffer to be filled
29
30``count``
31   Max number of bytes to read
32
33Description
34-----------
35
36This system call returns filtered data, which might be section or Packetized
37Elementary Stream (PES) data. The filtered data is transferred from
38the driver’s internal circular buffer to ``buf``. The maximum amount of data
39to be transferred is implied by count.
40
41.. note::
42
43   if a section filter created with
44   :c:type:`DMX_CHECK_CRC <dmx_sct_filter_params>` flag set,
45   data that fails on CRC check will be silently ignored.
46
47
48Return Value
49------------
50
51On success 0 is returned.
52
53On error -1 is returned, and the ``errno`` variable is set
54appropriately.
55
56.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
57
58.. flat-table::
59    :header-rows:  0
60    :stub-columns: 0
61    :widths: 1 16
62
63    -  -  ``EWOULDBLOCK``
64       -  No data to return and ``O_NONBLOCK`` was specified.
65
66    -  -  ``EOVERFLOW``
67       -  The filtered data was not read from the buffer in due time,
68	  resulting in non-read data being lost. The buffer is flushed.
69
70    -  -  ``ETIMEDOUT``
71       -  The section was not loaded within the stated timeout period.
72          See ioctl :ref:`DMX_SET_FILTER` for how to set a timeout.
73
74    -  -  ``EFAULT``
75       -  The driver failed to write to the callers buffer due to an
76          invalid \*buf pointer.
77
78
79The generic error codes are described at the
80:ref:`Generic Error Codes <gen-errors>` chapter.
81