162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: DTV.dmx
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _dmx_fopen:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci=======================
762306a36Sopenharmony_ciDigital TV demux open()
862306a36Sopenharmony_ci=======================
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci----
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciDigital TV demux open()
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci--------
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:function:: int open(const char *deviceName, int flags)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciArguments
2162306a36Sopenharmony_ci---------
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci``name``
2462306a36Sopenharmony_ci  Name of specific Digital TV demux device.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci``flags``
2762306a36Sopenharmony_ci  A bit-wise OR of the following flags:
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci.. flat-table::
3262306a36Sopenharmony_ci    :header-rows:  0
3362306a36Sopenharmony_ci    :stub-columns: 0
3462306a36Sopenharmony_ci    :widths: 1 16
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci    -
3762306a36Sopenharmony_ci       - ``O_RDONLY``
3862306a36Sopenharmony_ci       - read-only access
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci    -
4162306a36Sopenharmony_ci       - ``O_RDWR``
4262306a36Sopenharmony_ci       - read/write access
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci    -
4562306a36Sopenharmony_ci       - ``O_NONBLOCK``
4662306a36Sopenharmony_ci       - open in non-blocking mode
4762306a36Sopenharmony_ci         (blocking mode is the default)
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciDescription
5062306a36Sopenharmony_ci-----------
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciThis system call, used with a device name of ``/dev/dvb/adapter?/demux?``,
5362306a36Sopenharmony_ciallocates a new filter and returns a handle which can be used for
5462306a36Sopenharmony_cisubsequent control of that filter. This call has to be made for each
5562306a36Sopenharmony_cifilter to be used, i.e. every returned file descriptor is a reference to
5662306a36Sopenharmony_cia single filter. ``/dev/dvb/adapter?/dvr?`` is a logical device to be used
5762306a36Sopenharmony_cifor retrieving Transport Streams for digital video recording. When
5862306a36Sopenharmony_cireading from this device a transport stream containing the packets from
5962306a36Sopenharmony_ciall PES filters set in the corresponding demux device
6062306a36Sopenharmony_ci(``/dev/dvb/adapter?/demux?``) having the output set to ``DMX_OUT_TS_TAP``.
6162306a36Sopenharmony_ciA recorded Transport Stream is replayed by writing to this device.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciThe significance of blocking or non-blocking mode is described in the
6462306a36Sopenharmony_cidocumentation for functions where there is a difference. It does not
6562306a36Sopenharmony_ciaffect the semantics of the ``open()`` call itself. A device opened
6662306a36Sopenharmony_ciin blocking mode can later be put into non-blocking mode (and vice versa)
6762306a36Sopenharmony_ciusing the ``F_SETFL`` command of the fcntl system call.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ciReturn Value
7062306a36Sopenharmony_ci------------
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ciOn success 0 is returned.
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciOn error -1 is returned, and the ``errno`` variable is set
7562306a36Sopenharmony_ciappropriately.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci.. flat-table::
8062306a36Sopenharmony_ci    :header-rows:  0
8162306a36Sopenharmony_ci    :stub-columns: 0
8262306a36Sopenharmony_ci    :widths: 1 16
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci    -  -  ``EMFILE``
8562306a36Sopenharmony_ci       -  "Too many open files", i.e. no more filters available.
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ciThe generic error codes are described at the
8862306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
89