demux.xml 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  1. <title>DVB Demux Device</title>
  2. <para>The DVB demux device controls the filters of the DVB hardware/software. It can be
  3. accessed through <emphasis role="tt">/dev/adapter0/demux0</emphasis>. Data types and and ioctl definitions can be
  4. accessed by including <emphasis role="tt">linux/dvb/dmx.h</emphasis> in your application.
  5. </para>
  6. <section id="dmx_types">
  7. <title>Demux Data Types</title>
  8. <section id="dmx-output-t">
  9. <title>dmx_output_t</title>
  10. <programlisting>
  11. typedef enum
  12. {
  13. DMX_OUT_DECODER, /&#x22C6; Streaming directly to decoder. &#x22C6;/
  14. DMX_OUT_TAP, /&#x22C6; Output going to a memory buffer &#x22C6;/
  15. /&#x22C6; (to be retrieved via the read command).&#x22C6;/
  16. DMX_OUT_TS_TAP, /&#x22C6; Output multiplexed into a new TS &#x22C6;/
  17. /&#x22C6; (to be retrieved by reading from the &#x22C6;/
  18. /&#x22C6; logical DVR device). &#x22C6;/
  19. DMX_OUT_TSDEMUX_TAP /&#x22C6; Like TS_TAP but retrieved from the DMX device &#x22C6;/
  20. } dmx_output_t;
  21. </programlisting>
  22. <para><emphasis role="tt">DMX_OUT_TAP</emphasis> delivers the stream output to the demux device on which the ioctl is
  23. called.
  24. </para>
  25. <para><emphasis role="tt">DMX_OUT_TS_TAP</emphasis> routes output to the logical DVR device <emphasis role="tt">/dev/dvb/adapter0/dvr0</emphasis>,
  26. which delivers a TS multiplexed from all filters for which <emphasis role="tt">DMX_OUT_TS_TAP</emphasis> was
  27. specified.
  28. </para>
  29. </section>
  30. <section id="dmx-input-t">
  31. <title>dmx_input_t</title>
  32. <programlisting>
  33. typedef enum
  34. {
  35. DMX_IN_FRONTEND, /&#x22C6; Input from a front-end device. &#x22C6;/
  36. DMX_IN_DVR /&#x22C6; Input from the logical DVR device. &#x22C6;/
  37. } dmx_input_t;
  38. </programlisting>
  39. </section>
  40. <section id="dmx-pes-type-t">
  41. <title>dmx_pes_type_t</title>
  42. <programlisting>
  43. typedef enum
  44. {
  45. DMX_PES_AUDIO0,
  46. DMX_PES_VIDEO0,
  47. DMX_PES_TELETEXT0,
  48. DMX_PES_SUBTITLE0,
  49. DMX_PES_PCR0,
  50. DMX_PES_AUDIO1,
  51. DMX_PES_VIDEO1,
  52. DMX_PES_TELETEXT1,
  53. DMX_PES_SUBTITLE1,
  54. DMX_PES_PCR1,
  55. DMX_PES_AUDIO2,
  56. DMX_PES_VIDEO2,
  57. DMX_PES_TELETEXT2,
  58. DMX_PES_SUBTITLE2,
  59. DMX_PES_PCR2,
  60. DMX_PES_AUDIO3,
  61. DMX_PES_VIDEO3,
  62. DMX_PES_TELETEXT3,
  63. DMX_PES_SUBTITLE3,
  64. DMX_PES_PCR3,
  65. DMX_PES_OTHER
  66. } dmx_pes_type_t;
  67. </programlisting>
  68. </section>
  69. <section id="dmx-filter">
  70. <title>struct dmx_filter</title>
  71. <programlisting>
  72. typedef struct dmx_filter
  73. {
  74. __u8 filter[DMX_FILTER_SIZE];
  75. __u8 mask[DMX_FILTER_SIZE];
  76. __u8 mode[DMX_FILTER_SIZE];
  77. } dmx_filter_t;
  78. </programlisting>
  79. </section>
  80. <section id="dmx-sct-filter-params">
  81. <title>struct dmx_sct_filter_params</title>
  82. <programlisting>
  83. struct dmx_sct_filter_params
  84. {
  85. __u16 pid;
  86. dmx_filter_t filter;
  87. __u32 timeout;
  88. __u32 flags;
  89. #define DMX_CHECK_CRC 1
  90. #define DMX_ONESHOT 2
  91. #define DMX_IMMEDIATE_START 4
  92. #define DMX_KERNEL_CLIENT 0x8000
  93. };
  94. </programlisting>
  95. </section>
  96. <section id="dmx-pes-filter-params">
  97. <title>struct dmx_pes_filter_params</title>
  98. <programlisting>
  99. struct dmx_pes_filter_params
  100. {
  101. __u16 pid;
  102. dmx_input_t input;
  103. dmx_output_t output;
  104. dmx_pes_type_t pes_type;
  105. __u32 flags;
  106. };
  107. </programlisting>
  108. </section>
  109. <section id="dmx-event">
  110. <title>struct dmx_event</title>
  111. <programlisting>
  112. struct dmx_event
  113. {
  114. dmx_event_t event;
  115. time_t timeStamp;
  116. union
  117. {
  118. dmx_scrambling_status_t scrambling;
  119. } u;
  120. };
  121. </programlisting>
  122. </section>
  123. <section id="dmx-stc">
  124. <title>struct dmx_stc</title>
  125. <programlisting>
  126. struct dmx_stc {
  127. unsigned int num; /&#x22C6; input : which STC? 0..N &#x22C6;/
  128. unsigned int base; /&#x22C6; output: divisor for stc to get 90 kHz clock &#x22C6;/
  129. __u64 stc; /&#x22C6; output: stc in 'base'&#x22C6;90 kHz units &#x22C6;/
  130. };
  131. </programlisting>
  132. </section>
  133. <section id="dmx-caps">
  134. <title>struct dmx_caps</title>
  135. <programlisting>
  136. typedef struct dmx_caps {
  137. __u32 caps;
  138. int num_decoders;
  139. } dmx_caps_t;
  140. </programlisting>
  141. </section>
  142. <section id="dmx-source-t">
  143. <title>enum dmx_source_t</title>
  144. <programlisting>
  145. typedef enum {
  146. DMX_SOURCE_FRONT0 = 0,
  147. DMX_SOURCE_FRONT1,
  148. DMX_SOURCE_FRONT2,
  149. DMX_SOURCE_FRONT3,
  150. DMX_SOURCE_DVR0 = 16,
  151. DMX_SOURCE_DVR1,
  152. DMX_SOURCE_DVR2,
  153. DMX_SOURCE_DVR3
  154. } dmx_source_t;
  155. </programlisting>
  156. </section>
  157. </section>
  158. <section id="dmx_fcalls">
  159. <title>Demux Function Calls</title>
  160. <section id="dmx_fopen">
  161. <title>open()</title>
  162. <para>DESCRIPTION
  163. </para>
  164. <informaltable><tgroup cols="1"><tbody><row><entry
  165. align="char">
  166. <para>This system call, used with a device name of /dev/dvb/adapter0/demux0,
  167. allocates a new filter and returns a handle which can be used for subsequent
  168. control of that filter. This call has to be made for each filter to be used, i.e. every
  169. returned file descriptor is a reference to a single filter. /dev/dvb/adapter0/dvr0
  170. is a logical device to be used for retrieving Transport Streams for digital
  171. video recording. When reading from this device a transport stream containing
  172. the packets from all PES filters set in the corresponding demux device
  173. (/dev/dvb/adapter0/demux0) having the output set to DMX_OUT_TS_TAP. A
  174. recorded Transport Stream is replayed by writing to this device. </para>
  175. <para>The significance of blocking or non-blocking mode is described in the
  176. documentation for functions where there is a difference. It does not affect the
  177. semantics of the open() call itself. A device opened in blocking mode can later
  178. be put into non-blocking mode (and vice versa) using the F_SETFL command
  179. of the fcntl system call.</para>
  180. </entry>
  181. </row></tbody></tgroup></informaltable>
  182. <para>SYNOPSIS
  183. </para>
  184. <informaltable><tgroup cols="1"><tbody><row><entry
  185. align="char">
  186. <para>int open(const char &#x22C6;deviceName, int flags);</para>
  187. </entry>
  188. </row></tbody></tgroup></informaltable>
  189. <para>PARAMETERS
  190. </para>
  191. <informaltable><tgroup cols="2"><tbody><row><entry
  192. align="char">
  193. <para>const char
  194. *deviceName</para>
  195. </entry><entry
  196. align="char">
  197. <para>Name of demux device.</para>
  198. </entry>
  199. </row><row><entry
  200. align="char">
  201. <para>int flags</para>
  202. </entry><entry
  203. align="char">
  204. <para>A bit-wise OR of the following flags:</para>
  205. </entry>
  206. </row><row><entry
  207. align="char">
  208. </entry><entry
  209. align="char">
  210. <para>O_RDWR read/write access</para>
  211. </entry>
  212. </row><row><entry
  213. align="char">
  214. </entry><entry
  215. align="char">
  216. <para>O_NONBLOCK open in non-blocking mode</para>
  217. </entry>
  218. </row><row><entry
  219. align="char">
  220. </entry><entry
  221. align="char">
  222. <para>(blocking mode is the default)</para>
  223. </entry>
  224. </row></tbody></tgroup></informaltable>
  225. <para>ERRORS
  226. </para>
  227. <informaltable><tgroup cols="2"><tbody><row><entry
  228. align="char">
  229. <para>ENODEV</para>
  230. </entry><entry
  231. align="char">
  232. <para>Device driver not loaded/available.</para>
  233. </entry>
  234. </row><row><entry
  235. align="char">
  236. <para>EINVAL</para>
  237. </entry><entry
  238. align="char">
  239. <para>Invalid argument.</para>
  240. </entry>
  241. </row><row><entry
  242. align="char">
  243. <para>EMFILE</para>
  244. </entry><entry
  245. align="char">
  246. <para>&#8220;Too many open files&#8221;, i.e. no more filters available.</para>
  247. </entry>
  248. </row><row><entry
  249. align="char">
  250. <para>ENOMEM</para>
  251. </entry><entry
  252. align="char">
  253. <para>The driver failed to allocate enough memory.</para>
  254. </entry>
  255. </row></tbody></tgroup></informaltable>
  256. </section>
  257. <section id="dmx_fclose">
  258. <title>close()</title>
  259. <para>DESCRIPTION
  260. </para>
  261. <informaltable><tgroup cols="1"><tbody><row><entry
  262. align="char">
  263. <para>This system call deactivates and deallocates a filter that was previously
  264. allocated via the open() call.</para>
  265. </entry>
  266. </row></tbody></tgroup></informaltable>
  267. <para>SYNOPSIS
  268. </para>
  269. <informaltable><tgroup cols="1"><tbody><row><entry
  270. align="char">
  271. <para>int close(int fd);</para>
  272. </entry>
  273. </row></tbody></tgroup></informaltable>
  274. <para>PARAMETERS
  275. </para>
  276. <informaltable><tgroup cols="2"><tbody><row><entry
  277. align="char">
  278. <para>int fd</para>
  279. </entry><entry
  280. align="char">
  281. <para>File descriptor returned by a previous call to open().</para>
  282. </entry>
  283. </row></tbody></tgroup></informaltable>
  284. <para>ERRORS
  285. </para>
  286. <informaltable><tgroup cols="2"><tbody><row><entry
  287. align="char">
  288. <para>EBADF</para>
  289. </entry><entry
  290. align="char">
  291. <para>fd is not a valid open file descriptor.</para>
  292. </entry>
  293. </row></tbody></tgroup></informaltable>
  294. </section>
  295. <section id="dmx_fread">
  296. <title>read()</title>
  297. <para>DESCRIPTION
  298. </para>
  299. <informaltable><tgroup cols="1"><tbody><row><entry
  300. align="char">
  301. <para>This system call returns filtered data, which might be section or PES data. The
  302. filtered data is transferred from the driver&#8217;s internal circular buffer to buf. The
  303. maximum amount of data to be transferred is implied by count.</para>
  304. </entry>
  305. </row><row><entry
  306. align="char">
  307. <para>When returning section data the driver always tries to return a complete single
  308. section (even though buf would provide buffer space for more data). If the size
  309. of the buffer is smaller than the section as much as possible will be returned,
  310. and the remaining data will be provided in subsequent calls.</para>
  311. </entry>
  312. </row><row><entry
  313. align="char">
  314. <para>The size of the internal buffer is 2 * 4096 bytes (the size of two maximum
  315. sized sections) by default. The size of this buffer may be changed by using the
  316. DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if
  317. the read operations are not performed fast enough, this may result in a buffer
  318. overflow error. In this case EOVERFLOW will be returned, and the circular
  319. buffer will be emptied. This call is blocking if there is no data to return, i.e. the
  320. process will be put to sleep waiting for data, unless the O_NONBLOCK flag
  321. is specified.</para>
  322. </entry>
  323. </row><row><entry
  324. align="char">
  325. <para>Note that in order to be able to read, the filtering process has to be started
  326. by defining either a section or a PES filter by means of the ioctl functions,
  327. and then starting the filtering process via the DMX_START ioctl function
  328. or by setting the DMX_IMMEDIATE_START flag. If the reading is done
  329. from a logical DVR demux device, the data will constitute a Transport Stream
  330. including the packets from all PES filters in the corresponding demux device
  331. /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP.</para>
  332. </entry>
  333. </row></tbody></tgroup></informaltable>
  334. <para>SYNOPSIS
  335. </para>
  336. <informaltable><tgroup cols="1"><tbody><row><entry
  337. align="char">
  338. <para>size_t read(int fd, void &#x22C6;buf, size_t count);</para>
  339. </entry>
  340. </row></tbody></tgroup></informaltable>
  341. <para>PARAMETERS
  342. </para>
  343. <informaltable><tgroup cols="2"><tbody><row><entry
  344. align="char">
  345. <para>int fd</para>
  346. </entry><entry
  347. align="char">
  348. <para>File descriptor returned by a previous call to open().</para>
  349. </entry>
  350. </row><row><entry
  351. align="char">
  352. <para>void *buf</para>
  353. </entry><entry
  354. align="char">
  355. <para>Pointer to the buffer to be used for returned filtered data.</para>
  356. </entry>
  357. </row><row><entry
  358. align="char">
  359. <para>size_t count</para>
  360. </entry><entry
  361. align="char">
  362. <para>Size of buf.</para>
  363. </entry>
  364. </row></tbody></tgroup></informaltable>
  365. <para>ERRORS
  366. </para>
  367. <informaltable><tgroup cols="2"><tbody><row><entry
  368. align="char">
  369. <para>EWOULDBLOCK</para>
  370. </entry><entry
  371. align="char">
  372. <para>No data to return and O_NONBLOCK was specified.</para>
  373. </entry>
  374. </row><row><entry
  375. align="char">
  376. <para>EBADF</para>
  377. </entry><entry
  378. align="char">
  379. <para>fd is not a valid open file descriptor.</para>
  380. </entry>
  381. </row><row><entry
  382. align="char">
  383. <para>ECRC</para>
  384. </entry><entry
  385. align="char">
  386. <para>Last section had a CRC error - no data returned. The
  387. buffer is flushed.</para>
  388. </entry>
  389. </row><row><entry
  390. align="char">
  391. <para>EOVERFLOW</para>
  392. </entry><entry
  393. align="char">
  394. </entry>
  395. </row><row><entry
  396. align="char">
  397. </entry><entry
  398. align="char">
  399. <para>The filtered data was not read from the buffer in due
  400. time, resulting in non-read data being lost. The buffer is
  401. flushed.</para>
  402. </entry>
  403. </row><row><entry
  404. align="char">
  405. <para>ETIMEDOUT</para>
  406. </entry><entry
  407. align="char">
  408. <para>The section was not loaded within the stated timeout
  409. period. See ioctl DMX_SET_FILTER for how to set a
  410. timeout.</para>
  411. </entry>
  412. </row><row><entry
  413. align="char">
  414. <para>EFAULT</para>
  415. </entry><entry
  416. align="char">
  417. <para>The driver failed to write to the callers buffer due to an
  418. invalid *buf pointer.</para>
  419. </entry>
  420. </row></tbody></tgroup></informaltable>
  421. </section>
  422. <section id="dmx_fwrite">
  423. <title>write()</title>
  424. <para>DESCRIPTION
  425. </para>
  426. <informaltable><tgroup cols="1"><tbody><row><entry
  427. align="char">
  428. <para>This system call is only provided by the logical device /dev/dvb/adapter0/dvr0,
  429. associated with the physical demux device that provides the actual DVR
  430. functionality. It is used for replay of a digitally recorded Transport Stream.
  431. Matching filters have to be defined in the corresponding physical demux
  432. device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is
  433. implied by count.</para>
  434. </entry>
  435. </row></tbody></tgroup></informaltable>
  436. <para>SYNOPSIS
  437. </para>
  438. <informaltable><tgroup cols="1"><tbody><row><entry
  439. align="char">
  440. <para>ssize_t write(int fd, const void &#x22C6;buf, size_t
  441. count);</para>
  442. </entry>
  443. </row></tbody></tgroup></informaltable>
  444. <para>PARAMETERS
  445. </para>
  446. <informaltable><tgroup cols="2"><tbody><row><entry
  447. align="char">
  448. <para>int fd</para>
  449. </entry><entry
  450. align="char">
  451. <para>File descriptor returned by a previous call to open().</para>
  452. </entry>
  453. </row><row><entry
  454. align="char">
  455. <para>void *buf</para>
  456. </entry><entry
  457. align="char">
  458. <para>Pointer to the buffer containing the Transport Stream.</para>
  459. </entry>
  460. </row><row><entry
  461. align="char">
  462. <para>size_t count</para>
  463. </entry><entry
  464. align="char">
  465. <para>Size of buf.</para>
  466. </entry>
  467. </row></tbody></tgroup></informaltable>
  468. <para>ERRORS
  469. </para>
  470. <informaltable><tgroup cols="2"><tbody><row><entry
  471. align="char">
  472. <para>EWOULDBLOCK</para>
  473. </entry><entry
  474. align="char">
  475. <para>No data was written. This
  476. might happen if O_NONBLOCK was specified and there
  477. is no more buffer space available (if O_NONBLOCK is
  478. not specified the function will block until buffer space is
  479. available).</para>
  480. </entry>
  481. </row><row><entry
  482. align="char">
  483. <para>EBUSY</para>
  484. </entry><entry
  485. align="char">
  486. <para>This error code indicates that there are conflicting
  487. requests. The corresponding demux device is setup to
  488. receive data from the front- end. Make sure that these
  489. filters are stopped and that the filters with input set to
  490. DMX_IN_DVR are started.</para>
  491. </entry>
  492. </row><row><entry
  493. align="char">
  494. <para>EBADF</para>
  495. </entry><entry
  496. align="char">
  497. <para>fd is not a valid open file descriptor.</para>
  498. </entry>
  499. </row></tbody></tgroup></informaltable>
  500. </section>
  501. <section id="DMX_START">
  502. <title>DMX_START</title>
  503. <para>DESCRIPTION
  504. </para>
  505. <informaltable><tgroup cols="1"><tbody><row><entry
  506. align="char">
  507. <para>This ioctl call is used to start the actual filtering operation defined via the ioctl
  508. calls DMX_SET_FILTER or DMX_SET_PES_FILTER.</para>
  509. </entry>
  510. </row></tbody></tgroup></informaltable>
  511. <para>SYNOPSIS
  512. </para>
  513. <informaltable><tgroup cols="1"><tbody><row><entry
  514. align="char">
  515. <para>int ioctl( int fd, int request = DMX_START);</para>
  516. </entry>
  517. </row></tbody></tgroup></informaltable>
  518. <para>PARAMETERS
  519. </para>
  520. <informaltable><tgroup cols="2"><tbody><row><entry
  521. align="char">
  522. <para>int fd</para>
  523. </entry><entry
  524. align="char">
  525. <para>File descriptor returned by a previous call to open().</para>
  526. </entry>
  527. </row><row><entry
  528. align="char">
  529. <para>int request</para>
  530. </entry><entry
  531. align="char">
  532. <para>Equals DMX_START for this command.</para>
  533. </entry>
  534. </row></tbody></tgroup></informaltable>
  535. <para>ERRORS
  536. </para>
  537. <informaltable><tgroup cols="2"><tbody><row><entry
  538. align="char">
  539. <para>EBADF</para>
  540. </entry><entry
  541. align="char">
  542. <para>fd is not a valid file descriptor.</para>
  543. </entry>
  544. </row><row><entry
  545. align="char">
  546. <para>EINVAL</para>
  547. </entry><entry
  548. align="char">
  549. <para>Invalid argument, i.e. no filtering parameters provided via
  550. the DMX_SET_FILTER or DMX_SET_PES_FILTER
  551. functions.</para>
  552. </entry>
  553. </row><row><entry
  554. align="char">
  555. <para>EBUSY</para>
  556. </entry><entry
  557. align="char">
  558. <para>This error code indicates that there are conflicting
  559. requests. There are active filters filtering data from
  560. another input source. Make sure that these filters are
  561. stopped before starting this filter.</para>
  562. </entry>
  563. </row></tbody></tgroup></informaltable>
  564. </section>
  565. <section id="DMX_STOP">
  566. <title>DMX_STOP</title>
  567. <para>DESCRIPTION
  568. </para>
  569. <informaltable><tgroup cols="1"><tbody><row><entry
  570. align="char">
  571. <para>This ioctl call is used to stop the actual filtering operation defined via the
  572. ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via
  573. the DMX_START command.</para>
  574. </entry>
  575. </row></tbody></tgroup></informaltable>
  576. <para>SYNOPSIS
  577. </para>
  578. <informaltable><tgroup cols="1"><tbody><row><entry
  579. align="char">
  580. <para>int ioctl( int fd, int request = DMX_STOP);</para>
  581. </entry>
  582. </row></tbody></tgroup></informaltable>
  583. <para>PARAMETERS
  584. </para>
  585. <informaltable><tgroup cols="2"><tbody><row><entry
  586. align="char">
  587. <para>int fd</para>
  588. </entry><entry
  589. align="char">
  590. <para>File descriptor returned by a previous call to open().</para>
  591. </entry>
  592. </row><row><entry
  593. align="char">
  594. <para>int request</para>
  595. </entry><entry
  596. align="char">
  597. <para>Equals DMX_STOP for this command.</para>
  598. </entry>
  599. </row></tbody></tgroup></informaltable>
  600. <para>ERRORS
  601. </para>
  602. <informaltable><tgroup cols="2"><tbody><row><entry
  603. align="char">
  604. <para>EBADF</para>
  605. </entry><entry
  606. align="char">
  607. <para>fd is not a valid file descriptor.</para>
  608. </entry>
  609. </row></tbody></tgroup></informaltable>
  610. </section>
  611. <section id="DMX_SET_FILTER">
  612. <title>DMX_SET_FILTER</title>
  613. <para>DESCRIPTION
  614. </para>
  615. <informaltable><tgroup cols="1"><tbody><row><entry
  616. align="char">
  617. <para>This ioctl call sets up a filter according to the filter and mask parameters
  618. provided. A timeout may be defined stating number of seconds to wait for a
  619. section to be loaded. A value of 0 means that no timeout should be applied.
  620. Finally there is a flag field where it is possible to state whether a section should
  621. be CRC-checked, whether the filter should be a &#8221;one-shot&#8221; filter, i.e. if the
  622. filtering operation should be stopped after the first section is received, and
  623. whether the filtering operation should be started immediately (without waiting
  624. for a DMX_START ioctl call). If a filter was previously set-up, this filter will
  625. be canceled, and the receive buffer will be flushed.</para>
  626. </entry>
  627. </row></tbody></tgroup></informaltable>
  628. <para>SYNOPSIS
  629. </para>
  630. <informaltable><tgroup cols="1"><tbody><row><entry
  631. align="char">
  632. <para>int ioctl( int fd, int request = DMX_SET_FILTER,
  633. struct dmx_sct_filter_params &#x22C6;params);</para>
  634. </entry>
  635. </row></tbody></tgroup></informaltable>
  636. <para>PARAMETERS
  637. </para>
  638. <informaltable><tgroup cols="2"><tbody><row><entry
  639. align="char">
  640. <para>int fd</para>
  641. </entry><entry
  642. align="char">
  643. <para>File descriptor returned by a previous call to open().</para>
  644. </entry>
  645. </row><row><entry
  646. align="char">
  647. <para>int request</para>
  648. </entry><entry
  649. align="char">
  650. <para>Equals DMX_SET_FILTER for this command.</para>
  651. </entry>
  652. </row><row><entry
  653. align="char">
  654. <para>struct
  655. dmx_sct_filter_params
  656. *params</para>
  657. </entry><entry
  658. align="char">
  659. <para>Pointer to structure containing filter parameters.</para>
  660. </entry>
  661. </row></tbody></tgroup></informaltable>
  662. <para>ERRORS
  663. </para>
  664. <informaltable><tgroup cols="2"><tbody><row><entry
  665. align="char">
  666. <para>EBADF</para>
  667. </entry><entry
  668. align="char">
  669. <para>fd is not a valid file descriptor.</para>
  670. </entry>
  671. </row><row><entry
  672. align="char">
  673. <para>EINVAL</para>
  674. </entry><entry
  675. align="char">
  676. <para>Invalid argument.</para>
  677. </entry>
  678. </row></tbody></tgroup></informaltable>
  679. </section>
  680. <section id="DMX_SET_PES_FILTER">
  681. <title>DMX_SET_PES_FILTER</title>
  682. <para>DESCRIPTION
  683. </para>
  684. <informaltable><tgroup cols="1"><tbody><row><entry
  685. align="char">
  686. <para>This ioctl call sets up a PES filter according to the parameters provided. By a
  687. PES filter is meant a filter that is based just on the packet identifier (PID), i.e.
  688. no PES header or payload filtering capability is supported.</para>
  689. </entry>
  690. </row><row><entry
  691. align="char">
  692. <para>The transport stream destination for the filtered output may be set. Also the
  693. PES type may be stated in order to be able to e.g. direct a video stream directly
  694. to the video decoder. Finally there is a flag field where it is possible to state
  695. whether the filtering operation should be started immediately (without waiting
  696. for a DMX_START ioctl call). If a filter was previously set-up, this filter will
  697. be cancelled, and the receive buffer will be flushed.</para>
  698. </entry>
  699. </row></tbody></tgroup></informaltable>
  700. <para>SYNOPSIS
  701. </para>
  702. <informaltable><tgroup cols="1"><tbody><row><entry
  703. align="char">
  704. <para>int ioctl( int fd, int request = DMX_SET_PES_FILTER,
  705. struct dmx_pes_filter_params &#x22C6;params);</para>
  706. </entry>
  707. </row></tbody></tgroup></informaltable>
  708. <para>PARAMETERS
  709. </para>
  710. <informaltable><tgroup cols="2"><tbody><row><entry
  711. align="char">
  712. <para>int fd</para>
  713. </entry><entry
  714. align="char">
  715. <para>File descriptor returned by a previous call to open().</para>
  716. </entry>
  717. </row><row><entry
  718. align="char">
  719. <para>int request</para>
  720. </entry><entry
  721. align="char">
  722. <para>Equals DMX_SET_PES_FILTER for this command.</para>
  723. </entry>
  724. </row><row><entry
  725. align="char">
  726. <para>struct
  727. dmx_pes_filter_params
  728. *params</para>
  729. </entry><entry
  730. align="char">
  731. <para>Pointer to structure containing filter parameters.</para>
  732. </entry>
  733. </row></tbody></tgroup></informaltable>
  734. <para>ERRORS
  735. </para>
  736. <informaltable><tgroup cols="2"><tbody><row><entry
  737. align="char">
  738. <para>EBADF</para>
  739. </entry><entry
  740. align="char">
  741. <para>fd is not a valid file descriptor.</para>
  742. </entry>
  743. </row><row><entry
  744. align="char">
  745. <para>EINVAL</para>
  746. </entry><entry
  747. align="char">
  748. <para>Invalid argument.</para>
  749. </entry>
  750. </row><row><entry
  751. align="char">
  752. <para>EBUSY</para>
  753. </entry><entry
  754. align="char">
  755. <para>This error code indicates that there are conflicting
  756. requests. There are active filters filtering data from
  757. another input source. Make sure that these filters are
  758. stopped before starting this filter.</para>
  759. </entry>
  760. </row></tbody></tgroup></informaltable>
  761. </section>
  762. <section id="DMX_SET_BUFFER_SIZE">
  763. <title>DMX_SET_BUFFER_SIZE</title>
  764. <para>DESCRIPTION
  765. </para>
  766. <informaltable><tgroup cols="1"><tbody><row><entry
  767. align="char">
  768. <para>This ioctl call is used to set the size of the circular buffer used for filtered data.
  769. The default size is two maximum sized sections, i.e. if this function is not called
  770. a buffer size of 2 * 4096 bytes will be used.</para>
  771. </entry>
  772. </row></tbody></tgroup></informaltable>
  773. <para>SYNOPSIS
  774. </para>
  775. <informaltable><tgroup cols="1"><tbody><row><entry
  776. align="char">
  777. <para>int ioctl( int fd, int request =
  778. DMX_SET_BUFFER_SIZE, unsigned long size);</para>
  779. </entry>
  780. </row></tbody></tgroup></informaltable>
  781. <para>PARAMETERS
  782. </para>
  783. <informaltable><tgroup cols="2"><tbody><row><entry
  784. align="char">
  785. <para>int fd</para>
  786. </entry><entry
  787. align="char">
  788. <para>File descriptor returned by a previous call to open().</para>
  789. </entry>
  790. </row><row><entry
  791. align="char">
  792. <para>int request</para>
  793. </entry><entry
  794. align="char">
  795. <para>Equals DMX_SET_BUFFER_SIZE for this command.</para>
  796. </entry>
  797. </row><row><entry
  798. align="char">
  799. <para>unsigned long size</para>
  800. </entry><entry
  801. align="char">
  802. <para>Size of circular buffer.</para>
  803. </entry>
  804. </row></tbody></tgroup></informaltable>
  805. <para>ERRORS
  806. </para>
  807. <informaltable><tgroup cols="2"><tbody><row><entry
  808. align="char">
  809. <para>EBADF</para>
  810. </entry><entry
  811. align="char">
  812. <para>fd is not a valid file descriptor.</para>
  813. </entry>
  814. </row><row><entry
  815. align="char">
  816. <para>ENOMEM</para>
  817. </entry><entry
  818. align="char">
  819. <para>The driver was not able to allocate a buffer of the
  820. requested size.</para>
  821. </entry>
  822. </row></tbody></tgroup></informaltable>
  823. </section>
  824. <section id="DMX_GET_EVENT">
  825. <title>DMX_GET_EVENT</title>
  826. <para>DESCRIPTION
  827. </para>
  828. <informaltable><tgroup cols="1"><tbody><row><entry
  829. align="char">
  830. <para>This ioctl call returns an event if available. If an event is not available,
  831. the behavior depends on whether the device is in blocking or non-blocking
  832. mode. In the latter case, the call fails immediately with errno set to
  833. EWOULDBLOCK. In the former case, the call blocks until an event becomes
  834. available.</para>
  835. </entry>
  836. </row><row><entry
  837. align="char">
  838. <para>The standard Linux poll() and/or select() system calls can be used with the
  839. device file descriptor to watch for new events. For select(), the file descriptor
  840. should be included in the exceptfds argument, and for poll(), POLLPRI should
  841. be specified as the wake-up condition. Only the latest event for each filter is
  842. saved.</para>
  843. </entry>
  844. </row></tbody></tgroup></informaltable>
  845. <para>SYNOPSIS
  846. </para>
  847. <informaltable><tgroup cols="1"><tbody><row><entry
  848. align="char">
  849. <para>int ioctl( int fd, int request = DMX_GET_EVENT,
  850. struct dmx_event &#x22C6;ev);</para>
  851. </entry>
  852. </row></tbody></tgroup></informaltable>
  853. <para>PARAMETERS
  854. </para>
  855. <informaltable><tgroup cols="2"><tbody><row><entry
  856. align="char">
  857. <para>int fd</para>
  858. </entry><entry
  859. align="char">
  860. <para>File descriptor returned by a previous call to open().</para>
  861. </entry>
  862. </row><row><entry
  863. align="char">
  864. <para>int request</para>
  865. </entry><entry
  866. align="char">
  867. <para>Equals DMX_GET_EVENT for this command.</para>
  868. </entry>
  869. </row><row><entry
  870. align="char">
  871. <para>struct dmx_event *ev</para>
  872. </entry><entry
  873. align="char">
  874. <para>Pointer to the location where the event is to be stored.</para>
  875. </entry>
  876. </row></tbody></tgroup></informaltable>
  877. <para>ERRORS
  878. </para>
  879. <informaltable><tgroup cols="2"><tbody><row><entry
  880. align="char">
  881. <para>EBADF</para>
  882. </entry><entry
  883. align="char">
  884. <para>fd is not a valid file descriptor.</para>
  885. </entry>
  886. </row><row><entry
  887. align="char">
  888. <para>EFAULT</para>
  889. </entry><entry
  890. align="char">
  891. <para>ev points to an invalid address.</para>
  892. </entry>
  893. </row><row><entry
  894. align="char">
  895. <para>EWOULDBLOCK</para>
  896. </entry><entry
  897. align="char">
  898. <para>There is no event pending, and the device is in
  899. non-blocking mode.</para>
  900. </entry>
  901. </row></tbody></tgroup></informaltable>
  902. </section>
  903. <section id="DMX_GET_STC">
  904. <title>DMX_GET_STC</title>
  905. <para>DESCRIPTION
  906. </para>
  907. <informaltable><tgroup cols="1"><tbody><row><entry
  908. align="char">
  909. <para>This ioctl call returns the current value of the system time counter (which is driven
  910. by a PES filter of type DMX_PES_PCR). Some hardware supports more than one
  911. STC, so you must specify which one by setting the num field of stc before the ioctl
  912. (range 0...n). The result is returned in form of a ratio with a 64 bit numerator
  913. and a 32 bit denominator, so the real 90kHz STC value is stc-&#x003E;stc /
  914. stc-&#x003E;base
  915. .</para>
  916. </entry>
  917. </row></tbody></tgroup></informaltable>
  918. <para>SYNOPSIS
  919. </para>
  920. <informaltable><tgroup cols="1"><tbody><row><entry
  921. align="char">
  922. <para>int ioctl( int fd, int request = DMX_GET_STC, struct
  923. dmx_stc &#x22C6;stc);</para>
  924. </entry>
  925. </row></tbody></tgroup></informaltable>
  926. <para>PARAMETERS
  927. </para>
  928. <informaltable><tgroup cols="2"><tbody><row><entry
  929. align="char">
  930. <para>int fd</para>
  931. </entry><entry
  932. align="char">
  933. <para>File descriptor returned by a previous call to open().</para>
  934. </entry>
  935. </row><row><entry
  936. align="char">
  937. <para>int request</para>
  938. </entry><entry
  939. align="char">
  940. <para>Equals DMX_GET_STC for this command.</para>
  941. </entry>
  942. </row><row><entry
  943. align="char">
  944. <para>struct dmx_stc *stc</para>
  945. </entry><entry
  946. align="char">
  947. <para>Pointer to the location where the stc is to be stored.</para>
  948. </entry>
  949. </row></tbody></tgroup></informaltable>
  950. <para>ERRORS
  951. </para>
  952. <informaltable><tgroup cols="2"><tbody><row><entry
  953. align="char">
  954. <para>EBADF</para>
  955. </entry><entry
  956. align="char">
  957. <para>fd is not a valid file descriptor.</para>
  958. </entry>
  959. </row><row><entry
  960. align="char">
  961. <para>EFAULT</para>
  962. </entry><entry
  963. align="char">
  964. <para>stc points to an invalid address.</para>
  965. </entry>
  966. </row><row><entry
  967. align="char">
  968. <para>EINVAL</para>
  969. </entry><entry
  970. align="char">
  971. <para>Invalid stc number.</para>
  972. </entry>
  973. </row></tbody></tgroup></informaltable>
  974. </section></section>