Skip to content

Commit 9c171cd

Browse files
committed
media: dvb: add continuity error indicators for memory mapped buffers
While userspace can detect discontinuity errors, it is useful to also let Kernelspace reporting discontinuity, as it can help to identify if the data loss happened either at Kernel or userspace side. Update documentation accordingly. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
1 parent 0b23498 commit 9c171cd

File tree

3 files changed

+49
-7
lines changed

3 files changed

+49
-7
lines changed

Documentation/media/dmx.h.rst.exceptions

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ replace typedef dmx_filter_t :c:type:`dmx_filter`
5050
replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
5151
replace typedef dmx_input_t :c:type:`dmx_input`
5252

53-
ignore symbol DMX_OUT_DECODER
54-
ignore symbol DMX_OUT_TAP
55-
ignore symbol DMX_OUT_TS_TAP
56-
ignore symbol DMX_OUT_TSDEMUX_TAP
53+
replace symbol DMX_BUFFER_FLAG_HAD_CRC32_DISCARD :c:type:`dmx_buffer_flags`
54+
replace symbol DMX_BUFFER_FLAG_TEI :c:type:`dmx_buffer_flags`
55+
replace symbol DMX_BUFFER_PKT_COUNTER_MISMATCH :c:type:`dmx_buffer_flags`
56+
replace symbol DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED :c:type:`dmx_buffer_flags`
57+
replace symbol DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR :c:type:`dmx_buffer_flags`
58+
59+
replace symbol DMX_OUT_DECODER :c:type:`dmx_output`
60+
replace symbol DMX_OUT_TAP :c:type:`dmx_output`
61+
replace symbol DMX_OUT_TS_TAP :c:type:`dmx_output`
62+
replace symbol DMX_OUT_TSDEMUX_TAP :c:type:`dmx_output`
5763

5864
replace ioctl DMX_DQBUF dmx_qbuf

Documentation/media/uapi/dvb/dmx-qbuf.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ out to disk. Buffers remain locked until dequeued, until the
5151
the device is closed.
5252
5353
Applications call the ``DMX_DQBUF`` ioctl to dequeue a filled
54-
(capturing) buffer from the driver's outgoing queue. They just set the ``reserved`` field array to zero. When ``DMX_DQBUF`` is called with a
55-
pointer to this structure, the driver fills the remaining fields or
56-
returns an error code.
54+
(capturing) buffer from the driver's outgoing queue.
55+
They just set the ``index`` field withe the buffer ID to be queued.
56+
When ``DMX_DQBUF`` is called with a pointer to struct :c:type:`dmx_buffer`,
57+
the driver fills the remaining fields or returns an error code.
5758
5859
By default ``DMX_DQBUF`` blocks when no buffer is in the outgoing
5960
queue. When the ``O_NONBLOCK`` flag was given to the

include/uapi/linux/dvb/dmx.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,32 @@ struct dmx_stc {
211211
__u64 stc;
212212
};
213213

214+
/**
215+
* enum dmx_buffer_flags - DMX memory-mapped buffer flags
216+
*
217+
* @DMX_BUFFER_FLAG_HAD_CRC32_DISCARD:
218+
* Indicates that the Kernel discarded one or more frames due to wrong
219+
* CRC32 checksum.
220+
* @DMX_BUFFER_FLAG_TEI:
221+
* Indicates that the Kernel has detected a Transport Error indicator
222+
* (TEI) on a filtered pid.
223+
* @DMX_BUFFER_PKT_COUNTER_MISMATCH:
224+
* Indicates that the Kernel has detected a packet counter mismatch
225+
* on a filtered pid.
226+
* @DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED:
227+
* Indicates that the Kernel has detected one or more frame discontinuity.
228+
* @DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR:
229+
* Received at least one packet with a frame discontinuity indicator.
230+
*/
231+
232+
enum dmx_buffer_flags {
233+
DMX_BUFFER_FLAG_HAD_CRC32_DISCARD = 1 << 0,
234+
DMX_BUFFER_FLAG_TEI = 1 << 1,
235+
DMX_BUFFER_PKT_COUNTER_MISMATCH = 1 << 2,
236+
DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED = 1 << 3,
237+
DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR = 1 << 4,
238+
};
239+
214240
/**
215241
* struct dmx_buffer - dmx buffer info
216242
*
@@ -220,15 +246,24 @@ struct dmx_stc {
220246
* offset from the start of the device memory for this plane,
221247
* (or a "cookie" that should be passed to mmap() as offset)
222248
* @length: size in bytes of the buffer
249+
* @flags: bit array of buffer flags as defined by &enum dmx_buffer_flags.
250+
* Filled only at &DMX_DQBUF.
251+
* @count: monotonic counter for filled buffers. Helps to identify
252+
* data stream loses. Filled only at &DMX_DQBUF.
223253
*
224254
* Contains data exchanged by application and driver using one of the streaming
225255
* I/O methods.
256+
*
257+
* Please notice that, for &DMX_QBUF, only @index should be filled.
258+
* On &DMX_DQBUF calls, all fields will be filled by the Kernel.
226259
*/
227260
struct dmx_buffer {
228261
__u32 index;
229262
__u32 bytesused;
230263
__u32 offset;
231264
__u32 length;
265+
__u32 flags;
266+
__u32 count;
232267
};
233268

234269
/**

0 commit comments

Comments
 (0)