18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: DTV.dmx
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _dmx_fopen:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci=======================
78c2ecf20Sopenharmony_ciDigital TV demux open()
88c2ecf20Sopenharmony_ci=======================
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci----
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciDigital TV demux open()
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci--------
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:function:: int open(const char *deviceName, int flags)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciArguments
218c2ecf20Sopenharmony_ci---------
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci``name``
248c2ecf20Sopenharmony_ci  Name of specific Digital TV demux device.
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci``flags``
278c2ecf20Sopenharmony_ci  A bit-wise OR of the following flags:
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci.. flat-table::
328c2ecf20Sopenharmony_ci    :header-rows:  0
338c2ecf20Sopenharmony_ci    :stub-columns: 0
348c2ecf20Sopenharmony_ci    :widths: 1 16
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci    -
378c2ecf20Sopenharmony_ci       - ``O_RDONLY``
388c2ecf20Sopenharmony_ci       - read-only access
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci    -
418c2ecf20Sopenharmony_ci       - ``O_RDWR``
428c2ecf20Sopenharmony_ci       - read/write access
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci    -
458c2ecf20Sopenharmony_ci       - ``O_NONBLOCK``
468c2ecf20Sopenharmony_ci       - open in non-blocking mode
478c2ecf20Sopenharmony_ci         (blocking mode is the default)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciDescription
508c2ecf20Sopenharmony_ci-----------
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciThis system call, used with a device name of ``/dev/dvb/adapter?/demux?``,
538c2ecf20Sopenharmony_ciallocates a new filter and returns a handle which can be used for
548c2ecf20Sopenharmony_cisubsequent control of that filter. This call has to be made for each
558c2ecf20Sopenharmony_cifilter to be used, i.e. every returned file descriptor is a reference to
568c2ecf20Sopenharmony_cia single filter. ``/dev/dvb/adapter?/dvr?`` is a logical device to be used
578c2ecf20Sopenharmony_cifor retrieving Transport Streams for digital video recording. When
588c2ecf20Sopenharmony_cireading from this device a transport stream containing the packets from
598c2ecf20Sopenharmony_ciall PES filters set in the corresponding demux device
608c2ecf20Sopenharmony_ci(``/dev/dvb/adapter?/demux?``) having the output set to ``DMX_OUT_TS_TAP``.
618c2ecf20Sopenharmony_ciA recorded Transport Stream is replayed by writing to this device.
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciThe significance of blocking or non-blocking mode is described in the
648c2ecf20Sopenharmony_cidocumentation for functions where there is a difference. It does not
658c2ecf20Sopenharmony_ciaffect the semantics of the ``open()`` call itself. A device opened
668c2ecf20Sopenharmony_ciin blocking mode can later be put into non-blocking mode (and vice versa)
678c2ecf20Sopenharmony_ciusing the ``F_SETFL`` command of the fcntl system call.
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ciReturn Value
708c2ecf20Sopenharmony_ci------------
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ciOn success 0 is returned.
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ciOn error -1 is returned, and the ``errno`` variable is set
758c2ecf20Sopenharmony_ciappropriately.
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci.. flat-table::
808c2ecf20Sopenharmony_ci    :header-rows:  0
818c2ecf20Sopenharmony_ci    :stub-columns: 0
828c2ecf20Sopenharmony_ci    :widths: 1 16
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci    -  -  ``EMFILE``
858c2ecf20Sopenharmony_ci       -  “Too many open files”, i.e. no more filters available.
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciThe generic error codes are described at the
888c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
89