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