xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/dvb/dmx-fopen.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: DTV.dmx
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _dmx_fopen:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun=======================
7*4882a593SmuzhiyunDigital TV demux open()
8*4882a593Smuzhiyun=======================
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun----
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunDigital TV demux open()
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun--------
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:function:: int open(const char *deviceName, int flags)
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunArguments
21*4882a593Smuzhiyun---------
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun``name``
24*4882a593Smuzhiyun  Name of specific Digital TV demux device.
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun``flags``
27*4882a593Smuzhiyun  A bit-wise OR of the following flags:
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun.. flat-table::
32*4882a593Smuzhiyun    :header-rows:  0
33*4882a593Smuzhiyun    :stub-columns: 0
34*4882a593Smuzhiyun    :widths: 1 16
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun    -
37*4882a593Smuzhiyun       - ``O_RDONLY``
38*4882a593Smuzhiyun       - read-only access
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun    -
41*4882a593Smuzhiyun       - ``O_RDWR``
42*4882a593Smuzhiyun       - read/write access
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun    -
45*4882a593Smuzhiyun       - ``O_NONBLOCK``
46*4882a593Smuzhiyun       - open in non-blocking mode
47*4882a593Smuzhiyun         (blocking mode is the default)
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunDescription
50*4882a593Smuzhiyun-----------
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunThis system call, used with a device name of ``/dev/dvb/adapter?/demux?``,
53*4882a593Smuzhiyunallocates a new filter and returns a handle which can be used for
54*4882a593Smuzhiyunsubsequent control of that filter. This call has to be made for each
55*4882a593Smuzhiyunfilter to be used, i.e. every returned file descriptor is a reference to
56*4882a593Smuzhiyuna single filter. ``/dev/dvb/adapter?/dvr?`` is a logical device to be used
57*4882a593Smuzhiyunfor retrieving Transport Streams for digital video recording. When
58*4882a593Smuzhiyunreading from this device a transport stream containing the packets from
59*4882a593Smuzhiyunall PES filters set in the corresponding demux device
60*4882a593Smuzhiyun(``/dev/dvb/adapter?/demux?``) having the output set to ``DMX_OUT_TS_TAP``.
61*4882a593SmuzhiyunA recorded Transport Stream is replayed by writing to this device.
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunThe significance of blocking or non-blocking mode is described in the
64*4882a593Smuzhiyundocumentation for functions where there is a difference. It does not
65*4882a593Smuzhiyunaffect the semantics of the ``open()`` call itself. A device opened
66*4882a593Smuzhiyunin blocking mode can later be put into non-blocking mode (and vice versa)
67*4882a593Smuzhiyunusing the ``F_SETFL`` command of the fcntl system call.
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunReturn Value
70*4882a593Smuzhiyun------------
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunOn success 0 is returned.
73*4882a593Smuzhiyun
74*4882a593SmuzhiyunOn error -1 is returned, and the ``errno`` variable is set
75*4882a593Smuzhiyunappropriately.
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun.. flat-table::
80*4882a593Smuzhiyun    :header-rows:  0
81*4882a593Smuzhiyun    :stub-columns: 0
82*4882a593Smuzhiyun    :widths: 1 16
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun    -  -  ``EMFILE``
85*4882a593Smuzhiyun       -  “Too many open files”, i.e. no more filters available.
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunThe generic error codes are described at the
88*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
89