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