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

Linux 6.18.37 · Userspace API / Media / DVB / Demux

Digital TV demux read()

드라이버 circular buffer의 section 또는 PES 데이터를 사용자 버퍼로 읽습니다.

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

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

1. 요약·해설

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

요약·해설

dmx-fread.rst:1-77

read()는 필터 결과를 최대 count 바이트만큼 buf로 옮깁니다. CRC 실패 section의 조용한 폐기와 비차단·오버플로·시간 초과 오류를 구분해야 합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: DTV.dmx
3
4 .. _dmx_fread:
5
6 =======================
7 Digital TV demux read()
8 =======================
9
10 Name
11 ----
12
13 Digital TV demux read()
14
15 Synopsis
16 --------
17
18 .. c:function:: size_t read(int fd, void *buf, size_t count)
19
20 Arguments
21 ---------
22
23 ``fd``
24 File descriptor returned by a previous call to :c:func:`open()`.
25
26 ``buf``
27 Buffer to be filled
28
29 ``count``
30 Max number of bytes to read
31
32 Description
33 -----------
34
35 This system call returns filtered data, which might be section or Packetized
36 Elementary Stream (PES) data. The filtered data is transferred from
37 the driver's internal circular buffer to ``buf``. The maximum amount of data
38 to be transferred is implied by count.
39
40 .. note::
41
42 if a section filter created with
43 :c:type:`DMX_CHECK_CRC <dmx_sct_filter_params>` flag set,
44 data that fails on CRC check will be silently ignored.
45
46 Return Value
47 ------------
48
49 On success 0 is returned.
50
51 On error -1 is returned, and the ``errno`` variable is set
52 appropriately.
53
54 .. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
55
56 .. flat-table::
57 :header-rows: 0
58 :stub-columns: 0
59 :widths: 1 16
60
61 - - ``EWOULDBLOCK``
62 - No data to return and ``O_NONBLOCK`` was specified.
63
64 - - ``EOVERFLOW``
65 - The filtered data was not read from the buffer in due time,
66 resulting in non-read data being lost. The buffer is flushed.
67
68 - - ``ETIMEDOUT``
69 - The section was not loaded within the stated timeout period.
70 See ioctl :ref:`DMX_SET_FILTER` for how to set a timeout.
71
72 - - ``EFAULT``
73 - The driver failed to write to the callers buffer due to an
74 invalid \*buf pointer.
75
76 The generic error codes are described at the
77 :ref:`Generic Error Codes <gen-errors>` chapter.
78

3. 한국어 전문 번역

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

이름과 호출 형식

1-18

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

함수 원형은 `size_t read(int fd, void *buf, size_t count)`입니다.

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

.. _dmx_fread:

=======================
Digital TV demux read()
=======================

Name
----

Digital TV demux read()

Synopsis
--------

.. c:function:: size_t read(int fd, void *buf, size_t count)

읽기 인자

19-30

`fd`는 앞선 `open()` 호출이 반환한 file descriptor입니다.

`buf`는 읽은 데이터를 채울 버퍼이고, `count`는 읽을 최대 바이트 수입니다.

read 인자
항목설명
fd필터를 참조하는 file descriptor
buf필터링된 데이터를 받을 버퍼
count최대 전송 바이트 수

필터 데이터 전송에 쓰는 세 인자입니다.


Arguments
---------

``fd``
  File descriptor returned by a previous call to :c:func:`open()`.

 ``buf``
   Buffer to be filled

``count``
   Max number of bytes to read

필터 데이터와 CRC 처리

31-45

이 시스템 호출은 필터링된 데이터를 반환합니다. 데이터는 section일 수도 있고 Packetized Elementary Stream(PES)일 수도 있습니다.

필터링된 데이터는 드라이버 내부 circular buffer에서 `buf`로 복사되며, 최대 전송량은 `count`로 정합니다.

section 필터를 만들 때 `DMX_CHECK_CRC <dmx_sct_filter_params>` 플래그를 설정했다면 CRC 검사에 실패한 데이터는 알림 없이 버려집니다.

Demux read 데이터 경로
section 또는 PES 필터가 데이터 선택드라이버 내부 circular buffer에 저장read(fd, buf, count) 호출최대 count 바이트를 buf로 전달DMX_CHECK_CRC 실패 section은 조용히 폐기

드라이버 버퍼에서 사용자 버퍼로 필터 결과가 이동합니다.


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

This system call returns filtered data, which might be section or Packetized
Elementary Stream (PES) data. The filtered data is transferred from
the driver's internal circular buffer to ``buf``. The maximum amount of data
to be transferred is implied by count.

.. note::

   if a section filter created with
   :c:type:`DMX_CHECK_CRC <dmx_sct_filter_params>` flag set,
   data that fails on CRC check will be silently ignored.

반환값과 오류

46-77

원문은 성공 시 0을 반환한다고 명시합니다. 함수 원형은 `size_t`이지만 반환 절의 문구는 수정하지 않고 그대로 옮깁니다.

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

Demux read 전용 오류
오류조건
EWOULDBLOCK반환할 데이터가 없고 O_NONBLOCK을 지정함
EOVERFLOW필터 데이터를 제때 읽지 않아 읽지 않은 데이터가 유실됨. 버퍼는 비워짐
ETIMEDOUT지정한 제한 시간 안에 section이 적재되지 않음. 제한 시간은 DMX_SET_FILTER에서 설정
EFAULT유효하지 않은 *buf 포인터 때문에 드라이버가 호출자 버퍼에 쓰지 못함

원문의 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

    -  -  ``EWOULDBLOCK``
       -  No data to return and ``O_NONBLOCK`` was specified.

    -  -  ``EOVERFLOW``
       -  The filtered data was not read from the buffer in due time,
	  resulting in non-read data being lost. The buffer is flushed.

    -  -  ``ETIMEDOUT``
       -  The section was not loaded within the stated timeout period.
          See ioctl :ref:`DMX_SET_FILTER` for how to set a timeout.

    -  -  ``EFAULT``
       -  The driver failed to write to the callers buffer due to an
          invalid \*buf pointer.

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