logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

dmx.h (9440B)


  1. /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
  2. /*
  3. * dmx.h
  4. *
  5. * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
  6. * & Ralph Metzler <ralph@convergence.de>
  7. * for convergence integrated media GmbH
  8. */
  9. #ifndef _DVBDMX_H_
  10. #define _DVBDMX_H_
  11. #include <linux/types.h>
  12. #include <time.h>
  13. #define DMX_FILTER_SIZE 16
  14. /**
  15. * enum dmx_output - Output for the demux.
  16. *
  17. * @DMX_OUT_DECODER:
  18. * Streaming directly to decoder.
  19. * @DMX_OUT_TAP:
  20. * Output going to a memory buffer (to be retrieved via the read command).
  21. * Delivers the stream output to the demux device on which the ioctl
  22. * is called.
  23. * @DMX_OUT_TS_TAP:
  24. * Output multiplexed into a new TS (to be retrieved by reading from the
  25. * logical DVR device). Routes output to the logical DVR device
  26. * ``/dev/dvb/adapter?/dvr?``, which delivers a TS multiplexed from all
  27. * filters for which @DMX_OUT_TS_TAP was specified.
  28. * @DMX_OUT_TSDEMUX_TAP:
  29. * Like @DMX_OUT_TS_TAP but retrieved from the DMX device.
  30. */
  31. enum dmx_output {
  32. DMX_OUT_DECODER,
  33. DMX_OUT_TAP,
  34. DMX_OUT_TS_TAP,
  35. DMX_OUT_TSDEMUX_TAP
  36. };
  37. /**
  38. * enum dmx_input - Input from the demux.
  39. *
  40. * @DMX_IN_FRONTEND: Input from a front-end device.
  41. * @DMX_IN_DVR: Input from the logical DVR device.
  42. */
  43. enum dmx_input {
  44. DMX_IN_FRONTEND,
  45. DMX_IN_DVR
  46. };
  47. /**
  48. * enum dmx_ts_pes - type of the PES filter.
  49. *
  50. * @DMX_PES_AUDIO0: first audio PID. Also referred as @DMX_PES_AUDIO.
  51. * @DMX_PES_VIDEO0: first video PID. Also referred as @DMX_PES_VIDEO.
  52. * @DMX_PES_TELETEXT0: first teletext PID. Also referred as @DMX_PES_TELETEXT.
  53. * @DMX_PES_SUBTITLE0: first subtitle PID. Also referred as @DMX_PES_SUBTITLE.
  54. * @DMX_PES_PCR0: first Program Clock Reference PID.
  55. * Also referred as @DMX_PES_PCR.
  56. *
  57. * @DMX_PES_AUDIO1: second audio PID.
  58. * @DMX_PES_VIDEO1: second video PID.
  59. * @DMX_PES_TELETEXT1: second teletext PID.
  60. * @DMX_PES_SUBTITLE1: second subtitle PID.
  61. * @DMX_PES_PCR1: second Program Clock Reference PID.
  62. *
  63. * @DMX_PES_AUDIO2: third audio PID.
  64. * @DMX_PES_VIDEO2: third video PID.
  65. * @DMX_PES_TELETEXT2: third teletext PID.
  66. * @DMX_PES_SUBTITLE2: third subtitle PID.
  67. * @DMX_PES_PCR2: third Program Clock Reference PID.
  68. *
  69. * @DMX_PES_AUDIO3: fourth audio PID.
  70. * @DMX_PES_VIDEO3: fourth video PID.
  71. * @DMX_PES_TELETEXT3: fourth teletext PID.
  72. * @DMX_PES_SUBTITLE3: fourth subtitle PID.
  73. * @DMX_PES_PCR3: fourth Program Clock Reference PID.
  74. *
  75. * @DMX_PES_OTHER: any other PID.
  76. */
  77. enum dmx_ts_pes {
  78. DMX_PES_AUDIO0,
  79. DMX_PES_VIDEO0,
  80. DMX_PES_TELETEXT0,
  81. DMX_PES_SUBTITLE0,
  82. DMX_PES_PCR0,
  83. DMX_PES_AUDIO1,
  84. DMX_PES_VIDEO1,
  85. DMX_PES_TELETEXT1,
  86. DMX_PES_SUBTITLE1,
  87. DMX_PES_PCR1,
  88. DMX_PES_AUDIO2,
  89. DMX_PES_VIDEO2,
  90. DMX_PES_TELETEXT2,
  91. DMX_PES_SUBTITLE2,
  92. DMX_PES_PCR2,
  93. DMX_PES_AUDIO3,
  94. DMX_PES_VIDEO3,
  95. DMX_PES_TELETEXT3,
  96. DMX_PES_SUBTITLE3,
  97. DMX_PES_PCR3,
  98. DMX_PES_OTHER
  99. };
  100. #define DMX_PES_AUDIO DMX_PES_AUDIO0
  101. #define DMX_PES_VIDEO DMX_PES_VIDEO0
  102. #define DMX_PES_TELETEXT DMX_PES_TELETEXT0
  103. #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
  104. #define DMX_PES_PCR DMX_PES_PCR0
  105. /**
  106. * struct dmx_filter - Specifies a section header filter.
  107. *
  108. * @filter: bit array with bits to be matched at the section header.
  109. * @mask: bits that are valid at the filter bit array.
  110. * @mode: mode of match: if bit is zero, it will match if equal (positive
  111. * match); if bit is one, it will match if the bit is negated.
  112. *
  113. * Note: All arrays in this struct have a size of DMX_FILTER_SIZE (16 bytes).
  114. */
  115. struct dmx_filter {
  116. __u8 filter[DMX_FILTER_SIZE];
  117. __u8 mask[DMX_FILTER_SIZE];
  118. __u8 mode[DMX_FILTER_SIZE];
  119. };
  120. /**
  121. * struct dmx_sct_filter_params - Specifies a section filter.
  122. *
  123. * @pid: PID to be filtered.
  124. * @filter: section header filter, as defined by &struct dmx_filter.
  125. * @timeout: maximum time to filter, in milliseconds.
  126. * @flags: extra flags for the section filter.
  127. *
  128. * Carries the configuration for a MPEG-TS section filter.
  129. *
  130. * The @flags can be:
  131. *
  132. * - %DMX_CHECK_CRC - only deliver sections where the CRC check succeeded;
  133. * - %DMX_ONESHOT - disable the section filter after one section
  134. * has been delivered;
  135. * - %DMX_IMMEDIATE_START - Start filter immediately without requiring a
  136. * :ref:`DMX_START`.
  137. */
  138. struct dmx_sct_filter_params {
  139. __u16 pid;
  140. struct dmx_filter filter;
  141. __u32 timeout;
  142. __u32 flags;
  143. #define DMX_CHECK_CRC 1
  144. #define DMX_ONESHOT 2
  145. #define DMX_IMMEDIATE_START 4
  146. };
  147. /**
  148. * struct dmx_pes_filter_params - Specifies Packetized Elementary Stream (PES)
  149. * filter parameters.
  150. *
  151. * @pid: PID to be filtered.
  152. * @input: Demux input, as specified by &enum dmx_input.
  153. * @output: Demux output, as specified by &enum dmx_output.
  154. * @pes_type: Type of the pes filter, as specified by &enum dmx_pes_type.
  155. * @flags: Demux PES flags.
  156. */
  157. struct dmx_pes_filter_params {
  158. __u16 pid;
  159. enum dmx_input input;
  160. enum dmx_output output;
  161. enum dmx_ts_pes pes_type;
  162. __u32 flags;
  163. };
  164. /**
  165. * struct dmx_stc - Stores System Time Counter (STC) information.
  166. *
  167. * @num: input data: number of the STC, from 0 to N.
  168. * @base: output: divisor for STC to get 90 kHz clock.
  169. * @stc: output: stc in @base * 90 kHz units.
  170. */
  171. struct dmx_stc {
  172. unsigned int num;
  173. unsigned int base;
  174. __u64 stc;
  175. };
  176. /**
  177. * enum dmx_buffer_flags - DMX memory-mapped buffer flags
  178. *
  179. * @DMX_BUFFER_FLAG_HAD_CRC32_DISCARD:
  180. * Indicates that the Kernel discarded one or more frames due to wrong
  181. * CRC32 checksum.
  182. * @DMX_BUFFER_FLAG_TEI:
  183. * Indicates that the Kernel has detected a Transport Error indicator
  184. * (TEI) on a filtered pid.
  185. * @DMX_BUFFER_PKT_COUNTER_MISMATCH:
  186. * Indicates that the Kernel has detected a packet counter mismatch
  187. * on a filtered pid.
  188. * @DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED:
  189. * Indicates that the Kernel has detected one or more frame discontinuity.
  190. * @DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR:
  191. * Received at least one packet with a frame discontinuity indicator.
  192. */
  193. enum dmx_buffer_flags {
  194. DMX_BUFFER_FLAG_HAD_CRC32_DISCARD = 1 << 0,
  195. DMX_BUFFER_FLAG_TEI = 1 << 1,
  196. DMX_BUFFER_PKT_COUNTER_MISMATCH = 1 << 2,
  197. DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED = 1 << 3,
  198. DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR = 1 << 4,
  199. };
  200. /**
  201. * struct dmx_buffer - dmx buffer info
  202. *
  203. * @index: id number of the buffer
  204. * @bytesused: number of bytes occupied by data in the buffer (payload);
  205. * @offset: for buffers with memory == DMX_MEMORY_MMAP;
  206. * offset from the start of the device memory for this plane,
  207. * (or a "cookie" that should be passed to mmap() as offset)
  208. * @length: size in bytes of the buffer
  209. * @flags: bit array of buffer flags as defined by &enum dmx_buffer_flags.
  210. * Filled only at &DMX_DQBUF.
  211. * @count: monotonic counter for filled buffers. Helps to identify
  212. * data stream loses. Filled only at &DMX_DQBUF.
  213. *
  214. * Contains data exchanged by application and driver using one of the streaming
  215. * I/O methods.
  216. *
  217. * Please notice that, for &DMX_QBUF, only @index should be filled.
  218. * On &DMX_DQBUF calls, all fields will be filled by the Kernel.
  219. */
  220. struct dmx_buffer {
  221. __u32 index;
  222. __u32 bytesused;
  223. __u32 offset;
  224. __u32 length;
  225. __u32 flags;
  226. __u32 count;
  227. };
  228. /**
  229. * struct dmx_requestbuffers - request dmx buffer information
  230. *
  231. * @count: number of requested buffers,
  232. * @size: size in bytes of the requested buffer
  233. *
  234. * Contains data used for requesting a dmx buffer.
  235. * All reserved fields must be set to zero.
  236. */
  237. struct dmx_requestbuffers {
  238. __u32 count;
  239. __u32 size;
  240. };
  241. /**
  242. * struct dmx_exportbuffer - export of dmx buffer as DMABUF file descriptor
  243. *
  244. * @index: id number of the buffer
  245. * @flags: flags for newly created file, currently only O_CLOEXEC is
  246. * supported, refer to manual of open syscall for more details
  247. * @fd: file descriptor associated with DMABUF (set by driver)
  248. *
  249. * Contains data used for exporting a dmx buffer as DMABUF file descriptor.
  250. * The buffer is identified by a 'cookie' returned by DMX_QUERYBUF
  251. * (identical to the cookie used to mmap() the buffer to userspace). All
  252. * reserved fields must be set to zero. The field reserved0 is expected to
  253. * become a structure 'type' allowing an alternative layout of the structure
  254. * content. Therefore this field should not be used for any other extensions.
  255. */
  256. struct dmx_exportbuffer {
  257. __u32 index;
  258. __u32 flags;
  259. __s32 fd;
  260. };
  261. #define DMX_START _IO('o', 41)
  262. #define DMX_STOP _IO('o', 42)
  263. #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
  264. #define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
  265. #define DMX_SET_BUFFER_SIZE _IO('o', 45)
  266. #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
  267. #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
  268. #define DMX_ADD_PID _IOW('o', 51, __u16)
  269. #define DMX_REMOVE_PID _IOW('o', 52, __u16)
  270. /* This is needed for legacy userspace support */
  271. typedef enum dmx_output dmx_output_t;
  272. typedef enum dmx_input dmx_input_t;
  273. typedef enum dmx_ts_pes dmx_pes_type_t;
  274. typedef struct dmx_filter dmx_filter_t;
  275. #define DMX_REQBUFS _IOWR('o', 60, struct dmx_requestbuffers)
  276. #define DMX_QUERYBUF _IOWR('o', 61, struct dmx_buffer)
  277. #define DMX_EXPBUF _IOWR('o', 62, struct dmx_exportbuffer)
  278. #define DMX_QBUF _IOWR('o', 63, struct dmx_buffer)
  279. #define DMX_DQBUF _IOWR('o', 64, struct dmx_buffer)
  280. #endif /* _DVBDMX_H_ */