← Documents Documentation/userspace-api/media/dvb/dmx-fopen.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / DVB / Demux

Digital TV demux open()

필터별 file descriptor를 할당하고 DVR 논리 장치의 역할을 설명합니다.

Source pathDocumentation/userspace-api/media/dvb/dmx-fopen.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

dmx-fopen.rst:1-88

open()은 demux 장치에서 필터 하나당 fd 하나를 할당합니다. 원문의 성공 반환값 문구는 handle 설명과 불일치하므로 원문을 보존하면서 해설에 표시했습니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

이름과 호출 형식

1-18

이 문서는 GFDL-1.1-no-invariants-or-later 라이선스와 `DTV.dmx` C namespace를 사용하며 `dmx_fopen` 참조 대상으로 Digital TV demux의 `open()`을 설명합니다.

함수 원형은 `int open(const char *deviceName, int flags)`입니다. 뒤의 인자 절에서는 첫 번째 인자를 `name`이라고 표기하지만 의미는 특정 demux 장치 이름으로 같습니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx

.. _dmx_fopen:

=======================
Digital TV demux open()
=======================

Name
----

Digital TV demux open()

Synopsis
--------

.. c:function:: int open(const char *deviceName, int flags)

장치 이름과 열기 플래그

19-48

`name`은 열려는 특정 Digital TV demux 장치의 이름입니다.

`flags`는 아래 플래그들을 비트 OR로 결합한 값입니다. 접근 모드는 읽기 전용 또는 읽기/쓰기로 선택하고, 필요하면 비차단 모드를 추가합니다.

Demux open 플래그
플래그의미
O_RDONLY읽기 전용 접근
O_RDWR읽기/쓰기 접근
O_NONBLOCK비차단 모드로 열기. 기본값은 차단 모드

원문의 flat-table을 구조화해 옮겼습니다.


Arguments
---------

``name``
  Name of specific Digital TV demux device.

``flags``
  A bit-wise OR of the following flags:

.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|

.. flat-table::
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 16

    -
       - ``O_RDONLY``
       - read-only access

    -
       - ``O_RDWR``
       - read/write access

    -
       - ``O_NONBLOCK``
       - open in non-blocking mode
         (blocking mode is the default)

필터 할당과 DVR 논리 장치

49-62

장치 이름으로 `/dev/dvb/adapter?/demux?`를 지정해 호출하면 새 필터를 할당하고, 이후 그 필터를 제어할 때 사용할 handle을 반환합니다.

사용할 필터마다 이 호출을 별도로 수행해야 하므로, 반환된 file descriptor 하나는 필터 하나만 참조합니다.

`/dev/dvb/adapter?/dvr?`는 디지털 비디오 녹화용 Transport Stream을 가져오는 논리 장치입니다. 이 장치를 읽으면 대응하는 demux 장치에서 출력이 `DMX_OUT_TS_TAP`으로 설정된 모든 PES 필터의 패킷을 포함한 전송 스트림을 받습니다.

녹화된 Transport Stream을 재생할 때는 DVR 논리 장치에 데이터를 씁니다.

Demux와 DVR 장치 관계
/dev/dvb/adapter?/demux?를 필터마다 open각 fd로 하나의 필터 구성DMX_OUT_TS_TAP PES 패킷이 대응 DVR 장치에 집계/dev/dvb/adapter?/dvr?에서 TS 읽기 또는 재생 TS 쓰기

필터별 fd와 녹화·재생용 논리 장치의 역할을 구분합니다.

Description
-----------

This system call, used with a device name of ``/dev/dvb/adapter?/demux?``,
allocates a new filter and returns a handle which can be used for
subsequent control of that filter. This call has to be made for each
filter to be used, i.e. every returned file descriptor is a reference to
a single filter. ``/dev/dvb/adapter?/dvr?`` is a logical device to be used
for retrieving Transport Streams for digital video recording. When
reading from this device a transport stream containing the packets from
all PES filters set in the corresponding demux device
(``/dev/dvb/adapter?/demux?``) having the output set to ``DMX_OUT_TS_TAP``.
A recorded Transport Stream is replayed by writing to this device.

차단 모드 전환

63-67

차단 모드와 비차단 모드의 의미가 달라지는 경우는 해당 함수 문서에서 따로 설명하며, 모드 선택 자체는 `open()` 호출의 의미를 바꾸지 않습니다.

차단 모드로 연 장치는 나중에 `fcntl` 시스템 호출의 `F_SETFL` 명령으로 비차단 모드로 바꿀 수 있고, 반대 방향으로도 전환할 수 있습니다.

I/O 모드 변경
open()에서 기본 차단 또는 O_NONBLOCK 선택장치 사용 중 모드 변경 필요fcntl(fd, F_SETFL, ...) 호출차단과 비차단 모드 전환

장치를 다시 열지 않고 상태 플래그를 전환할 수 있습니다.

The significance of blocking or non-blocking mode is described in the
documentation for functions where there is a difference. It does not
affect the semantics of the ``open()`` call itself. A device opened
in blocking mode can later be put into non-blocking mode (and vice versa)
using the ``F_SETFL`` command of the fcntl system call.

반환값과 EMFILE

68-88

원문은 성공 시 0을 반환한다고 명시하고, 앞선 설명에서는 후속 필터 제어용 handle과 file descriptor를 반환한다고 설명합니다. 이 내부 불일치는 원문을 수정하지 않고 그대로 번역합니다.

오류가 발생하면 -1을 반환하고 `errno`를 적절히 설정합니다.

Demux open 전용 오류
오류조건
EMFILE열린 파일이 너무 많음. 즉, 더 사용할 수 있는 필터가 없음

원문의 flat-table 오류 항목입니다.

그 밖의 공통 오류 코드는 `Generic Error Codes <gen-errors>` 장에서 설명합니다.


Return Value
------------

On success 0 is returned.

On error -1 is returned, and the ``errno`` variable is set
appropriately.

.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|

.. flat-table::
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 16

    -  -  ``EMFILE``
       -  "Too many open files", i.e. no more filters available.

The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.