demux.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  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>RETURN VALUE</para>
  226. <informaltable><tgroup cols="2"><tbody><row><entry
  227. align="char">
  228. <para>ENODEV</para>
  229. </entry><entry
  230. align="char">
  231. <para>Device driver not loaded/available.</para>
  232. </entry>
  233. </row><row><entry
  234. align="char">
  235. <para>EINVAL</para>
  236. </entry><entry
  237. align="char">
  238. <para>Invalid argument.</para>
  239. </entry>
  240. </row><row><entry
  241. align="char">
  242. <para>EMFILE</para>
  243. </entry><entry
  244. align="char">
  245. <para>&#8220;Too many open files&#8221;, i.e. no more filters available.</para>
  246. </entry>
  247. </row><row><entry
  248. align="char">
  249. <para>ENOMEM</para>
  250. </entry><entry
  251. align="char">
  252. <para>The driver failed to allocate enough memory.</para>
  253. </entry>
  254. </row></tbody></tgroup></informaltable>
  255. </section>
  256. <section id="dmx_fclose">
  257. <title>close()</title>
  258. <para>DESCRIPTION
  259. </para>
  260. <informaltable><tgroup cols="1"><tbody><row><entry
  261. align="char">
  262. <para>This system call deactivates and deallocates a filter that was previously
  263. allocated via the open() call.</para>
  264. </entry>
  265. </row></tbody></tgroup></informaltable>
  266. <para>SYNOPSIS
  267. </para>
  268. <informaltable><tgroup cols="1"><tbody><row><entry
  269. align="char">
  270. <para>int close(int fd);</para>
  271. </entry>
  272. </row></tbody></tgroup></informaltable>
  273. <para>PARAMETERS
  274. </para>
  275. <informaltable><tgroup cols="2"><tbody><row><entry
  276. align="char">
  277. <para>int fd</para>
  278. </entry><entry
  279. align="char">
  280. <para>File descriptor returned by a previous call to open().</para>
  281. </entry>
  282. </row></tbody></tgroup></informaltable>
  283. <para>RETURN VALUE</para>
  284. <informaltable><tgroup cols="2"><tbody><row><entry
  285. align="char">
  286. <para>EBADF</para>
  287. </entry><entry
  288. align="char">
  289. <para>fd is not a valid open file descriptor.</para>
  290. </entry>
  291. </row></tbody></tgroup></informaltable>
  292. </section>
  293. <section id="dmx_fread">
  294. <title>read()</title>
  295. <para>DESCRIPTION
  296. </para>
  297. <informaltable><tgroup cols="1"><tbody><row><entry
  298. align="char">
  299. <para>This system call returns filtered data, which might be section or PES data. The
  300. filtered data is transferred from the driver&#8217;s internal circular buffer to buf. The
  301. maximum amount of data to be transferred is implied by count.</para>
  302. </entry>
  303. </row><row><entry
  304. align="char">
  305. <para>When returning section data the driver always tries to return a complete single
  306. section (even though buf would provide buffer space for more data). If the size
  307. of the buffer is smaller than the section as much as possible will be returned,
  308. and the remaining data will be provided in subsequent calls.</para>
  309. </entry>
  310. </row><row><entry
  311. align="char">
  312. <para>The size of the internal buffer is 2 * 4096 bytes (the size of two maximum
  313. sized sections) by default. The size of this buffer may be changed by using the
  314. DMX_SET_BUFFER_SIZE function. If the buffer is not large enough, or if
  315. the read operations are not performed fast enough, this may result in a buffer
  316. overflow error. In this case EOVERFLOW will be returned, and the circular
  317. buffer will be emptied. This call is blocking if there is no data to return, i.e. the
  318. process will be put to sleep waiting for data, unless the O_NONBLOCK flag
  319. is specified.</para>
  320. </entry>
  321. </row><row><entry
  322. align="char">
  323. <para>Note that in order to be able to read, the filtering process has to be started
  324. by defining either a section or a PES filter by means of the ioctl functions,
  325. and then starting the filtering process via the DMX_START ioctl function
  326. or by setting the DMX_IMMEDIATE_START flag. If the reading is done
  327. from a logical DVR demux device, the data will constitute a Transport Stream
  328. including the packets from all PES filters in the corresponding demux device
  329. /dev/dvb/adapter0/demux0 having the output set to DMX_OUT_TS_TAP.</para>
  330. </entry>
  331. </row></tbody></tgroup></informaltable>
  332. <para>SYNOPSIS
  333. </para>
  334. <informaltable><tgroup cols="1"><tbody><row><entry
  335. align="char">
  336. <para>size_t read(int fd, void &#x22C6;buf, size_t count);</para>
  337. </entry>
  338. </row></tbody></tgroup></informaltable>
  339. <para>PARAMETERS
  340. </para>
  341. <informaltable><tgroup cols="2"><tbody><row><entry
  342. align="char">
  343. <para>int fd</para>
  344. </entry><entry
  345. align="char">
  346. <para>File descriptor returned by a previous call to open().</para>
  347. </entry>
  348. </row><row><entry
  349. align="char">
  350. <para>void *buf</para>
  351. </entry><entry
  352. align="char">
  353. <para>Pointer to the buffer to be used for returned filtered data.</para>
  354. </entry>
  355. </row><row><entry
  356. align="char">
  357. <para>size_t count</para>
  358. </entry><entry
  359. align="char">
  360. <para>Size of buf.</para>
  361. </entry>
  362. </row></tbody></tgroup></informaltable>
  363. <para>RETURN VALUE</para>
  364. <informaltable><tgroup cols="2"><tbody><row><entry
  365. align="char">
  366. <para>EWOULDBLOCK</para>
  367. </entry><entry
  368. align="char">
  369. <para>No data to return and O_NONBLOCK was specified.</para>
  370. </entry>
  371. </row><row><entry
  372. align="char">
  373. <para>EBADF</para>
  374. </entry><entry
  375. align="char">
  376. <para>fd is not a valid open file descriptor.</para>
  377. </entry>
  378. </row><row><entry
  379. align="char">
  380. <para>ECRC</para>
  381. </entry><entry
  382. align="char">
  383. <para>Last section had a CRC error - no data returned. The
  384. buffer is flushed.</para>
  385. </entry>
  386. </row><row><entry
  387. align="char">
  388. <para>EOVERFLOW</para>
  389. </entry><entry
  390. align="char">
  391. </entry>
  392. </row><row><entry
  393. align="char">
  394. </entry><entry
  395. align="char">
  396. <para>The filtered data was not read from the buffer in due
  397. time, resulting in non-read data being lost. The buffer is
  398. flushed.</para>
  399. </entry>
  400. </row><row><entry
  401. align="char">
  402. <para>ETIMEDOUT</para>
  403. </entry><entry
  404. align="char">
  405. <para>The section was not loaded within the stated timeout
  406. period. See ioctl DMX_SET_FILTER for how to set a
  407. timeout.</para>
  408. </entry>
  409. </row><row><entry
  410. align="char">
  411. <para>EFAULT</para>
  412. </entry><entry
  413. align="char">
  414. <para>The driver failed to write to the callers buffer due to an
  415. invalid *buf pointer.</para>
  416. </entry>
  417. </row></tbody></tgroup></informaltable>
  418. </section>
  419. <section id="dmx_fwrite">
  420. <title>write()</title>
  421. <para>DESCRIPTION
  422. </para>
  423. <informaltable><tgroup cols="1"><tbody><row><entry
  424. align="char">
  425. <para>This system call is only provided by the logical device /dev/dvb/adapter0/dvr0,
  426. associated with the physical demux device that provides the actual DVR
  427. functionality. It is used for replay of a digitally recorded Transport Stream.
  428. Matching filters have to be defined in the corresponding physical demux
  429. device, /dev/dvb/adapter0/demux0. The amount of data to be transferred is
  430. implied by count.</para>
  431. </entry>
  432. </row></tbody></tgroup></informaltable>
  433. <para>SYNOPSIS
  434. </para>
  435. <informaltable><tgroup cols="1"><tbody><row><entry
  436. align="char">
  437. <para>ssize_t write(int fd, const void &#x22C6;buf, size_t
  438. count);</para>
  439. </entry>
  440. </row></tbody></tgroup></informaltable>
  441. <para>PARAMETERS
  442. </para>
  443. <informaltable><tgroup cols="2"><tbody><row><entry
  444. align="char">
  445. <para>int fd</para>
  446. </entry><entry
  447. align="char">
  448. <para>File descriptor returned by a previous call to open().</para>
  449. </entry>
  450. </row><row><entry
  451. align="char">
  452. <para>void *buf</para>
  453. </entry><entry
  454. align="char">
  455. <para>Pointer to the buffer containing the Transport Stream.</para>
  456. </entry>
  457. </row><row><entry
  458. align="char">
  459. <para>size_t count</para>
  460. </entry><entry
  461. align="char">
  462. <para>Size of buf.</para>
  463. </entry>
  464. </row></tbody></tgroup></informaltable>
  465. <para>RETURN VALUE</para>
  466. <informaltable><tgroup cols="2"><tbody><row><entry
  467. align="char">
  468. <para>EWOULDBLOCK</para>
  469. </entry><entry
  470. align="char">
  471. <para>No data was written. This
  472. might happen if O_NONBLOCK was specified and there
  473. is no more buffer space available (if O_NONBLOCK is
  474. not specified the function will block until buffer space is
  475. available).</para>
  476. </entry>
  477. </row><row><entry
  478. align="char">
  479. <para>EBUSY</para>
  480. </entry><entry
  481. align="char">
  482. <para>This error code indicates that there are conflicting
  483. requests. The corresponding demux device is setup to
  484. receive data from the front- end. Make sure that these
  485. filters are stopped and that the filters with input set to
  486. DMX_IN_DVR are started.</para>
  487. </entry>
  488. </row><row><entry
  489. align="char">
  490. <para>EBADF</para>
  491. </entry><entry
  492. align="char">
  493. <para>fd is not a valid open file descriptor.</para>
  494. </entry>
  495. </row></tbody></tgroup></informaltable>
  496. </section>
  497. <section id="DMX_START">
  498. <title>DMX_START</title>
  499. <para>DESCRIPTION
  500. </para>
  501. <informaltable><tgroup cols="1"><tbody><row><entry
  502. align="char">
  503. <para>This ioctl call is used to start the actual filtering operation defined via the ioctl
  504. calls DMX_SET_FILTER or DMX_SET_PES_FILTER.</para>
  505. </entry>
  506. </row></tbody></tgroup></informaltable>
  507. <para>SYNOPSIS
  508. </para>
  509. <informaltable><tgroup cols="1"><tbody><row><entry
  510. align="char">
  511. <para>int ioctl( int fd, int request = DMX_START);</para>
  512. </entry>
  513. </row></tbody></tgroup></informaltable>
  514. <para>PARAMETERS
  515. </para>
  516. <informaltable><tgroup cols="2"><tbody><row><entry
  517. align="char">
  518. <para>int fd</para>
  519. </entry><entry
  520. align="char">
  521. <para>File descriptor returned by a previous call to open().</para>
  522. </entry>
  523. </row><row><entry
  524. align="char">
  525. <para>int request</para>
  526. </entry><entry
  527. align="char">
  528. <para>Equals DMX_START for this command.</para>
  529. </entry>
  530. </row></tbody></tgroup></informaltable>
  531. &return-value-dvb;
  532. <informaltable><tgroup cols="2"><tbody><row><entry
  533. align="char">
  534. <para>EINVAL</para>
  535. </entry><entry
  536. align="char">
  537. <para>Invalid argument, i.e. no filtering parameters provided via
  538. the DMX_SET_FILTER or DMX_SET_PES_FILTER
  539. functions.</para>
  540. </entry>
  541. </row><row><entry
  542. align="char">
  543. <para>EBUSY</para>
  544. </entry><entry
  545. align="char">
  546. <para>This error code indicates that there are conflicting
  547. requests. There are active filters filtering data from
  548. another input source. Make sure that these filters are
  549. stopped before starting this filter.</para>
  550. </entry>
  551. </row></tbody></tgroup></informaltable>
  552. </section>
  553. <section id="DMX_STOP">
  554. <title>DMX_STOP</title>
  555. <para>DESCRIPTION
  556. </para>
  557. <informaltable><tgroup cols="1"><tbody><row><entry
  558. align="char">
  559. <para>This ioctl call is used to stop the actual filtering operation defined via the
  560. ioctl calls DMX_SET_FILTER or DMX_SET_PES_FILTER and started via
  561. the DMX_START command.</para>
  562. </entry>
  563. </row></tbody></tgroup></informaltable>
  564. <para>SYNOPSIS
  565. </para>
  566. <informaltable><tgroup cols="1"><tbody><row><entry
  567. align="char">
  568. <para>int ioctl( int fd, int request = DMX_STOP);</para>
  569. </entry>
  570. </row></tbody></tgroup></informaltable>
  571. <para>PARAMETERS
  572. </para>
  573. <informaltable><tgroup cols="2"><tbody><row><entry
  574. align="char">
  575. <para>int fd</para>
  576. </entry><entry
  577. align="char">
  578. <para>File descriptor returned by a previous call to open().</para>
  579. </entry>
  580. </row><row><entry
  581. align="char">
  582. <para>int request</para>
  583. </entry><entry
  584. align="char">
  585. <para>Equals DMX_STOP for this command.</para>
  586. </entry>
  587. </row></tbody></tgroup></informaltable>
  588. &return-value-dvb;
  589. </section>
  590. <section id="DMX_SET_FILTER">
  591. <title>DMX_SET_FILTER</title>
  592. <para>DESCRIPTION
  593. </para>
  594. <informaltable><tgroup cols="1"><tbody><row><entry
  595. align="char">
  596. <para>This ioctl call sets up a filter according to the filter and mask parameters
  597. provided. A timeout may be defined stating number of seconds to wait for a
  598. section to be loaded. A value of 0 means that no timeout should be applied.
  599. Finally there is a flag field where it is possible to state whether a section should
  600. be CRC-checked, whether the filter should be a &#8221;one-shot&#8221; filter, i.e. if the
  601. filtering operation should be stopped after the first section is received, and
  602. whether the filtering operation should be started immediately (without waiting
  603. for a DMX_START ioctl call). If a filter was previously set-up, this filter will
  604. be canceled, and the receive buffer will be flushed.</para>
  605. </entry>
  606. </row></tbody></tgroup></informaltable>
  607. <para>SYNOPSIS
  608. </para>
  609. <informaltable><tgroup cols="1"><tbody><row><entry
  610. align="char">
  611. <para>int ioctl( int fd, int request = DMX_SET_FILTER,
  612. struct dmx_sct_filter_params &#x22C6;params);</para>
  613. </entry>
  614. </row></tbody></tgroup></informaltable>
  615. <para>PARAMETERS
  616. </para>
  617. <informaltable><tgroup cols="2"><tbody><row><entry
  618. align="char">
  619. <para>int fd</para>
  620. </entry><entry
  621. align="char">
  622. <para>File descriptor returned by a previous call to open().</para>
  623. </entry>
  624. </row><row><entry
  625. align="char">
  626. <para>int request</para>
  627. </entry><entry
  628. align="char">
  629. <para>Equals DMX_SET_FILTER for this command.</para>
  630. </entry>
  631. </row><row><entry
  632. align="char">
  633. <para>struct
  634. dmx_sct_filter_params
  635. *params</para>
  636. </entry><entry
  637. align="char">
  638. <para>Pointer to structure containing filter parameters.</para>
  639. </entry>
  640. </row></tbody></tgroup></informaltable>
  641. &return-value-dvb;
  642. </section>
  643. <section id="DMX_SET_PES_FILTER">
  644. <title>DMX_SET_PES_FILTER</title>
  645. <para>DESCRIPTION
  646. </para>
  647. <informaltable><tgroup cols="1"><tbody><row><entry
  648. align="char">
  649. <para>This ioctl call sets up a PES filter according to the parameters provided. By a
  650. PES filter is meant a filter that is based just on the packet identifier (PID), i.e.
  651. no PES header or payload filtering capability is supported.</para>
  652. </entry>
  653. </row><row><entry
  654. align="char">
  655. <para>The transport stream destination for the filtered output may be set. Also the
  656. PES type may be stated in order to be able to e.g. direct a video stream directly
  657. to the video decoder. Finally there is a flag field where it is possible to state
  658. whether the filtering operation should be started immediately (without waiting
  659. for a DMX_START ioctl call). If a filter was previously set-up, this filter will
  660. be cancelled, and the receive buffer will be flushed.</para>
  661. </entry>
  662. </row></tbody></tgroup></informaltable>
  663. <para>SYNOPSIS
  664. </para>
  665. <informaltable><tgroup cols="1"><tbody><row><entry
  666. align="char">
  667. <para>int ioctl( int fd, int request = DMX_SET_PES_FILTER,
  668. struct dmx_pes_filter_params &#x22C6;params);</para>
  669. </entry>
  670. </row></tbody></tgroup></informaltable>
  671. <para>PARAMETERS
  672. </para>
  673. <informaltable><tgroup cols="2"><tbody><row><entry
  674. align="char">
  675. <para>int fd</para>
  676. </entry><entry
  677. align="char">
  678. <para>File descriptor returned by a previous call to open().</para>
  679. </entry>
  680. </row><row><entry
  681. align="char">
  682. <para>int request</para>
  683. </entry><entry
  684. align="char">
  685. <para>Equals DMX_SET_PES_FILTER for this command.</para>
  686. </entry>
  687. </row><row><entry
  688. align="char">
  689. <para>struct
  690. dmx_pes_filter_params
  691. *params</para>
  692. </entry><entry
  693. align="char">
  694. <para>Pointer to structure containing filter parameters.</para>
  695. </entry>
  696. </row></tbody></tgroup></informaltable>
  697. &return-value-dvb;
  698. <informaltable><tgroup cols="2"><tbody><row><entry
  699. align="char">
  700. <para>EBUSY</para>
  701. </entry><entry
  702. align="char">
  703. <para>This error code indicates that there are conflicting
  704. requests. There are active filters filtering data from
  705. another input source. Make sure that these filters are
  706. stopped before starting this filter.</para>
  707. </entry>
  708. </row></tbody></tgroup></informaltable>
  709. </section>
  710. <section id="DMX_SET_BUFFER_SIZE">
  711. <title>DMX_SET_BUFFER_SIZE</title>
  712. <para>DESCRIPTION
  713. </para>
  714. <informaltable><tgroup cols="1"><tbody><row><entry
  715. align="char">
  716. <para>This ioctl call is used to set the size of the circular buffer used for filtered data.
  717. The default size is two maximum sized sections, i.e. if this function is not called
  718. a buffer size of 2 * 4096 bytes will be used.</para>
  719. </entry>
  720. </row></tbody></tgroup></informaltable>
  721. <para>SYNOPSIS
  722. </para>
  723. <informaltable><tgroup cols="1"><tbody><row><entry
  724. align="char">
  725. <para>int ioctl( int fd, int request =
  726. DMX_SET_BUFFER_SIZE, unsigned long size);</para>
  727. </entry>
  728. </row></tbody></tgroup></informaltable>
  729. <para>PARAMETERS
  730. </para>
  731. <informaltable><tgroup cols="2"><tbody><row><entry
  732. align="char">
  733. <para>int fd</para>
  734. </entry><entry
  735. align="char">
  736. <para>File descriptor returned by a previous call to open().</para>
  737. </entry>
  738. </row><row><entry
  739. align="char">
  740. <para>int request</para>
  741. </entry><entry
  742. align="char">
  743. <para>Equals DMX_SET_BUFFER_SIZE for this command.</para>
  744. </entry>
  745. </row><row><entry
  746. align="char">
  747. <para>unsigned long size</para>
  748. </entry><entry
  749. align="char">
  750. <para>Size of circular buffer.</para>
  751. </entry>
  752. </row></tbody></tgroup></informaltable>
  753. &return-value-dvb;
  754. </section>
  755. <section id="DMX_GET_EVENT">
  756. <title>DMX_GET_EVENT</title>
  757. <para>DESCRIPTION
  758. </para>
  759. <informaltable><tgroup cols="1"><tbody><row><entry
  760. align="char">
  761. <para>This ioctl call returns an event if available. If an event is not available,
  762. the behavior depends on whether the device is in blocking or non-blocking
  763. mode. In the latter case, the call fails immediately with errno set to
  764. EWOULDBLOCK. In the former case, the call blocks until an event becomes
  765. available.</para>
  766. </entry>
  767. </row><row><entry
  768. align="char">
  769. <para>The standard Linux poll() and/or select() system calls can be used with the
  770. device file descriptor to watch for new events. For select(), the file descriptor
  771. should be included in the exceptfds argument, and for poll(), POLLPRI should
  772. be specified as the wake-up condition. Only the latest event for each filter is
  773. saved.</para>
  774. </entry>
  775. </row></tbody></tgroup></informaltable>
  776. <para>SYNOPSIS
  777. </para>
  778. <informaltable><tgroup cols="1"><tbody><row><entry
  779. align="char">
  780. <para>int ioctl( int fd, int request = DMX_GET_EVENT,
  781. struct dmx_event &#x22C6;ev);</para>
  782. </entry>
  783. </row></tbody></tgroup></informaltable>
  784. <para>PARAMETERS
  785. </para>
  786. <informaltable><tgroup cols="2"><tbody><row><entry
  787. align="char">
  788. <para>int fd</para>
  789. </entry><entry
  790. align="char">
  791. <para>File descriptor returned by a previous call to open().</para>
  792. </entry>
  793. </row><row><entry
  794. align="char">
  795. <para>int request</para>
  796. </entry><entry
  797. align="char">
  798. <para>Equals DMX_GET_EVENT for this command.</para>
  799. </entry>
  800. </row><row><entry
  801. align="char">
  802. <para>struct dmx_event *ev</para>
  803. </entry><entry
  804. align="char">
  805. <para>Pointer to the location where the event is to be stored.</para>
  806. </entry>
  807. </row></tbody></tgroup></informaltable>
  808. &return-value-dvb;
  809. <informaltable><tgroup cols="2"><tbody><row><entry
  810. align="char">
  811. <para>EWOULDBLOCK</para>
  812. </entry><entry
  813. align="char">
  814. <para>There is no event pending, and the device is in
  815. non-blocking mode.</para>
  816. </entry>
  817. </row></tbody></tgroup></informaltable>
  818. </section>
  819. <section id="DMX_GET_STC">
  820. <title>DMX_GET_STC</title>
  821. <para>DESCRIPTION
  822. </para>
  823. <informaltable><tgroup cols="1"><tbody><row><entry
  824. align="char">
  825. <para>This ioctl call returns the current value of the system time counter (which is driven
  826. by a PES filter of type DMX_PES_PCR). Some hardware supports more than one
  827. STC, so you must specify which one by setting the num field of stc before the ioctl
  828. (range 0...n). The result is returned in form of a ratio with a 64 bit numerator
  829. and a 32 bit denominator, so the real 90kHz STC value is stc-&#x003E;stc /
  830. stc-&#x003E;base
  831. .</para>
  832. </entry>
  833. </row></tbody></tgroup></informaltable>
  834. <para>SYNOPSIS
  835. </para>
  836. <informaltable><tgroup cols="1"><tbody><row><entry
  837. align="char">
  838. <para>int ioctl( int fd, int request = DMX_GET_STC, struct
  839. dmx_stc &#x22C6;stc);</para>
  840. </entry>
  841. </row></tbody></tgroup></informaltable>
  842. <para>PARAMETERS
  843. </para>
  844. <informaltable><tgroup cols="2"><tbody><row><entry
  845. align="char">
  846. <para>int fd</para>
  847. </entry><entry
  848. align="char">
  849. <para>File descriptor returned by a previous call to open().</para>
  850. </entry>
  851. </row><row><entry
  852. align="char">
  853. <para>int request</para>
  854. </entry><entry
  855. align="char">
  856. <para>Equals DMX_GET_STC for this command.</para>
  857. </entry>
  858. </row><row><entry
  859. align="char">
  860. <para>struct dmx_stc *stc</para>
  861. </entry><entry
  862. align="char">
  863. <para>Pointer to the location where the stc is to be stored.</para>
  864. </entry>
  865. </row></tbody></tgroup></informaltable>
  866. &return-value-dvb;
  867. <informaltable><tgroup cols="2"><tbody><row><entry
  868. align="char">
  869. <para>EINVAL</para>
  870. </entry><entry
  871. align="char">
  872. <para>Invalid stc number.</para>
  873. </entry>
  874. </row></tbody></tgroup></informaltable>
  875. </section></section>