demux.xml 26 KB

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