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_fopen:
11
12=======================
13Digital TV demux open()
14=======================
15
16Name
17----
18
19Digital TV demux open()
20
21
22Synopsis
23--------
24
25.. c:function:: int open(const char *deviceName, int flags)
26    :name: dvb-dmx-open
27
28Arguments
29---------
30
31``name``
32  Name of specific Digital TV demux device.
33
34``flags``
35  A bit-wise OR of the following flags:
36
37.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
38
39.. flat-table::
40    :header-rows:  0
41    :stub-columns: 0
42    :widths: 1 16
43
44    -
45       - ``O_RDONLY``
46       - read-only access
47
48    -
49       - ``O_RDWR``
50       - read/write access
51
52    -
53       - ``O_NONBLOCK``
54       - open in non-blocking mode
55         (blocking mode is the default)
56
57
58Description
59-----------
60
61This system call, used with a device name of ``/dev/dvb/adapter?/demux?``,
62allocates a new filter and returns a handle which can be used for
63subsequent control of that filter. This call has to be made for each
64filter to be used, i.e. every returned file descriptor is a reference to
65a single filter. ``/dev/dvb/adapter?/dvr?`` is a logical device to be used
66for retrieving Transport Streams for digital video recording. When
67reading from this device a transport stream containing the packets from
68all PES filters set in the corresponding demux device
69(``/dev/dvb/adapter?/demux?``) having the output set to ``DMX_OUT_TS_TAP``.
70A recorded Transport Stream is replayed by writing to this device.
71
72The significance of blocking or non-blocking mode is described in the
73documentation for functions where there is a difference. It does not
74affect the semantics of the ``open()`` call itself. A device opened
75in blocking mode can later be put into non-blocking mode (and vice versa)
76using the ``F_SETFL`` command of the fcntl system call.
77
78
79Return Value
80------------
81
82On success 0 is returned.
83
84On error -1 is returned, and the ``errno`` variable is set
85appropriately.
86
87.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
88
89.. flat-table::
90    :header-rows:  0
91    :stub-columns: 0
92    :widths: 1 16
93
94    -  -  ``EMFILE``
95       -  “Too many open files”, i.e. no more filters available.
96
97The generic error codes are described at the
98:ref:`Generic Error Codes <gen-errors>` chapter.
99