demux.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. /*
  2. * demux.h
  3. *
  4. * Copyright (c) 2002 Convergence GmbH
  5. *
  6. * based on code:
  7. * Copyright (c) 2000 Nokia Research Center
  8. * Tampere, FINLAND
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public License
  12. * as published by the Free Software Foundation; either version 2.1
  13. * of the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. *
  24. */
  25. #ifndef __DEMUX_H
  26. #define __DEMUX_H
  27. #include <linux/types.h>
  28. #include <linux/errno.h>
  29. #include <linux/list.h>
  30. #include <linux/time.h>
  31. #include <linux/dvb/dmx.h>
  32. /*
  33. * Common definitions
  34. */
  35. /*
  36. * DMX_MAX_FILTER_SIZE: Maximum length (in bytes) of a section/PES filter.
  37. */
  38. #ifndef DMX_MAX_FILTER_SIZE
  39. #define DMX_MAX_FILTER_SIZE 18
  40. #endif
  41. /*
  42. * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed
  43. * filter.
  44. */
  45. #ifndef DMX_MAX_SECTION_SIZE
  46. #define DMX_MAX_SECTION_SIZE 4096
  47. #endif
  48. #ifndef DMX_MAX_SECFEED_SIZE
  49. #define DMX_MAX_SECFEED_SIZE (DMX_MAX_SECTION_SIZE + 188)
  50. #endif
  51. /*
  52. * TS packet reception
  53. */
  54. /**
  55. * enum ts_filter_type - filter type bitmap for dmx_ts_feed.set()
  56. *
  57. * @TS_PACKET: Send TS packets (188 bytes) to callback (default).
  58. * @TS_PAYLOAD_ONLY: In case TS_PACKET is set, only send the TS payload
  59. * (<=184 bytes per packet) to callback
  60. * @TS_DECODER: Send stream to built-in decoder (if present).
  61. * @TS_DEMUX: In case TS_PACKET is set, send the TS to the demux
  62. * device, not to the dvr device
  63. */
  64. enum ts_filter_type {
  65. TS_PACKET = 1,
  66. TS_PAYLOAD_ONLY = 2,
  67. TS_DECODER = 4,
  68. TS_DEMUX = 8,
  69. };
  70. /**
  71. * struct dmx_ts_feed - Structure that contains a TS feed filter
  72. *
  73. * @is_filtering: Set to non-zero when filtering in progress
  74. * @parent: pointer to struct dmx_demux
  75. * @priv: pointer to private data of the API client
  76. * @set: sets the TS filter
  77. * @start_filtering: starts TS filtering
  78. * @stop_filtering: stops TS filtering
  79. *
  80. * A TS feed is typically mapped to a hardware PID filter on the demux chip.
  81. * Using this API, the client can set the filtering properties to start/stop
  82. * filtering TS packets on a particular TS feed.
  83. */
  84. struct dmx_ts_feed {
  85. int is_filtering;
  86. struct dmx_demux *parent;
  87. void *priv;
  88. int (*set)(struct dmx_ts_feed *feed,
  89. u16 pid,
  90. int type,
  91. enum dmx_ts_pes pes_type,
  92. size_t circular_buffer_size,
  93. struct timespec timeout);
  94. int (*start_filtering)(struct dmx_ts_feed *feed);
  95. int (*stop_filtering)(struct dmx_ts_feed *feed);
  96. };
  97. /*
  98. * Section reception
  99. */
  100. /**
  101. * struct dmx_section_filter - Structure that describes a section filter
  102. *
  103. * @filter_value: Contains up to 16 bytes (128 bits) of the TS section header
  104. * that will be matched by the section filter
  105. * @filter_mask: Contains a 16 bytes (128 bits) filter mask with the bits
  106. * specified by @filter_value that will be used on the filter
  107. * match logic.
  108. * @filter_mode: Contains a 16 bytes (128 bits) filter mode.
  109. * @parent: Pointer to struct dmx_section_feed.
  110. * @priv: Pointer to private data of the API client.
  111. *
  112. *
  113. * The @filter_mask controls which bits of @filter_value are compared with
  114. * the section headers/payload. On a binary value of 1 in filter_mask, the
  115. * corresponding bits are compared. The filter only accepts sections that are
  116. * equal to filter_value in all the tested bit positions.
  117. */
  118. struct dmx_section_filter {
  119. u8 filter_value[DMX_MAX_FILTER_SIZE];
  120. u8 filter_mask[DMX_MAX_FILTER_SIZE];
  121. u8 filter_mode[DMX_MAX_FILTER_SIZE];
  122. struct dmx_section_feed *parent; /* Back-pointer */
  123. void *priv; /* Pointer to private data of the API client */
  124. };
  125. /**
  126. * struct dmx_section_feed - Structure that contains a section feed filter
  127. *
  128. * @is_filtering: Set to non-zero when filtering in progress
  129. * @parent: pointer to struct dmx_demux
  130. * @priv: pointer to private data of the API client
  131. * @check_crc: If non-zero, check the CRC values of filtered sections.
  132. * @set: sets the section filter
  133. * @allocate_filter: This function is used to allocate a section filter on
  134. * the demux. It should only be called when no filtering
  135. * is in progress on this section feed. If a filter cannot
  136. * be allocated, the function fails with -ENOSPC.
  137. * @release_filter: This function releases all the resources of a
  138. * previously allocated section filter. The function
  139. * should not be called while filtering is in progress
  140. * on this section feed. After calling this function,
  141. * the caller should not try to dereference the filter
  142. * pointer.
  143. * @start_filtering: starts section filtering
  144. * @stop_filtering: stops section filtering
  145. *
  146. * A TS feed is typically mapped to a hardware PID filter on the demux chip.
  147. * Using this API, the client can set the filtering properties to start/stop
  148. * filtering TS packets on a particular TS feed.
  149. */
  150. struct dmx_section_feed {
  151. int is_filtering;
  152. struct dmx_demux *parent;
  153. void *priv;
  154. int check_crc;
  155. /* private: Used internally at dvb_demux.c */
  156. u32 crc_val;
  157. u8 *secbuf;
  158. u8 secbuf_base[DMX_MAX_SECFEED_SIZE];
  159. u16 secbufp, seclen, tsfeedp;
  160. /* public: */
  161. int (*set)(struct dmx_section_feed *feed,
  162. u16 pid,
  163. size_t circular_buffer_size,
  164. int check_crc);
  165. int (*allocate_filter)(struct dmx_section_feed *feed,
  166. struct dmx_section_filter **filter);
  167. int (*release_filter)(struct dmx_section_feed *feed,
  168. struct dmx_section_filter *filter);
  169. int (*start_filtering)(struct dmx_section_feed *feed);
  170. int (*stop_filtering)(struct dmx_section_feed *feed);
  171. };
  172. /*
  173. * Callback functions
  174. */
  175. /**
  176. * typedef dmx_ts_cb - DVB demux TS filter callback function prototype
  177. *
  178. * @buffer1: Pointer to the start of the filtered TS packets.
  179. * @buffer1_length: Length of the TS data in buffer1.
  180. * @buffer2: Pointer to the tail of the filtered TS packets, or NULL.
  181. * @buffer2_length: Length of the TS data in buffer2.
  182. * @source: Indicates which TS feed is the source of the callback.
  183. *
  184. * This function callback prototype, provided by the client of the demux API,
  185. * is called from the demux code. The function is only called when filtering
  186. * on ae TS feed has been enabled using the start_filtering() function at
  187. * the &dmx_demux.
  188. * Any TS packets that match the filter settings are copied to a circular
  189. * buffer. The filtered TS packets are delivered to the client using this
  190. * callback function. The size of the circular buffer is controlled by the
  191. * circular_buffer_size parameter of the &dmx_ts_feed.@set function.
  192. * It is expected that the @buffer1 and @buffer2 callback parameters point to
  193. * addresses within the circular buffer, but other implementations are also
  194. * possible. Note that the called party should not try to free the memory
  195. * the @buffer1 and @buffer2 parameters point to.
  196. *
  197. * When this function is called, the @buffer1 parameter typically points to
  198. * the start of the first undelivered TS packet within a circular buffer.
  199. * The @buffer2 buffer parameter is normally NULL, except when the received
  200. * TS packets have crossed the last address of the circular buffer and
  201. * ”wrapped” to the beginning of the buffer. In the latter case the @buffer1
  202. * parameter would contain an address within the circular buffer, while the
  203. * @buffer2 parameter would contain the first address of the circular buffer.
  204. * The number of bytes delivered with this function (i.e. @buffer1_length +
  205. * @buffer2_length) is usually equal to the value of callback_length parameter
  206. * given in the set() function, with one exception: if a timeout occurs before
  207. * receiving callback_length bytes of TS data, any undelivered packets are
  208. * immediately delivered to the client by calling this function. The timeout
  209. * duration is controlled by the set() function in the TS Feed API.
  210. *
  211. * If a TS packet is received with errors that could not be fixed by the
  212. * TS-level forward error correction (FEC), the Transport_error_indicator
  213. * flag of the TS packet header should be set. The TS packet should not be
  214. * discarded, as the error can possibly be corrected by a higher layer
  215. * protocol. If the called party is slow in processing the callback, it
  216. * is possible that the circular buffer eventually fills up. If this happens,
  217. * the demux driver should discard any TS packets received while the buffer
  218. * is full and return -EOVERFLOW.
  219. *
  220. * The type of data returned to the callback can be selected by the
  221. * &dmx_ts_feed.@set function. The type parameter decides if the raw
  222. * TS packet (TS_PACKET) or just the payload (TS_PACKET|TS_PAYLOAD_ONLY)
  223. * should be returned. If additionally the TS_DECODER bit is set the stream
  224. * will also be sent to the hardware MPEG decoder.
  225. *
  226. * Return:
  227. * 0, on success;
  228. * -EOVERFLOW, on buffer overflow.
  229. */
  230. typedef int (*dmx_ts_cb)(const u8 *buffer1,
  231. size_t buffer1_length,
  232. const u8 *buffer2,
  233. size_t buffer2_length,
  234. struct dmx_ts_feed *source);
  235. /**
  236. * typedef dmx_section_cb - DVB demux TS filter callback function prototype
  237. *
  238. * @buffer1: Pointer to the start of the filtered section, e.g.
  239. * within the circular buffer of the demux driver.
  240. * @buffer1_len: Length of the filtered section data in @buffer1,
  241. * including headers and CRC.
  242. * @buffer2: Pointer to the tail of the filtered section data,
  243. * or NULL. Useful to handle the wrapping of a
  244. * circular buffer.
  245. * @buffer2_len: Length of the filtered section data in @buffer2,
  246. * including headers and CRC.
  247. * @source: Indicates which section feed is the source of the
  248. * callback.
  249. *
  250. * This function callback prototype, provided by the client of the demux API,
  251. * is called from the demux code. The function is only called when
  252. * filtering of sections has been enabled using the function
  253. * &dmx_ts_feed.@start_filtering. When the demux driver has received a
  254. * complete section that matches at least one section filter, the client
  255. * is notified via this callback function. Normally this function is called
  256. * for each received section; however, it is also possible to deliver
  257. * multiple sections with one callback, for example when the system load
  258. * is high. If an error occurs while receiving a section, this
  259. * function should be called with the corresponding error type set in the
  260. * success field, whether or not there is data to deliver. The Section Feed
  261. * implementation should maintain a circular buffer for received sections.
  262. * However, this is not necessary if the Section Feed API is implemented as
  263. * a client of the TS Feed API, because the TS Feed implementation then
  264. * buffers the received data. The size of the circular buffer can be
  265. * configured using the &dmx_ts_feed.@set function in the Section Feed API.
  266. * If there is no room in the circular buffer when a new section is received,
  267. * the section must be discarded. If this happens, the value of the success
  268. * parameter should be DMX_OVERRUN_ERROR on the next callback.
  269. */
  270. typedef int (*dmx_section_cb)(const u8 *buffer1,
  271. size_t buffer1_len,
  272. const u8 *buffer2,
  273. size_t buffer2_len,
  274. struct dmx_section_filter *source);
  275. /*--------------------------------------------------------------------------*/
  276. /* DVB Front-End */
  277. /*--------------------------------------------------------------------------*/
  278. /**
  279. * enum dmx_frontend_source - Used to identify the type of frontend
  280. *
  281. * @DMX_MEMORY_FE: The source of the demux is memory. It means that
  282. * the MPEG-TS to be filtered comes from userspace,
  283. * via write() syscall.
  284. *
  285. * @DMX_FRONTEND_0: The source of the demux is a frontend connected
  286. * to the demux.
  287. */
  288. enum dmx_frontend_source {
  289. DMX_MEMORY_FE,
  290. DMX_FRONTEND_0,
  291. };
  292. /**
  293. * struct dmx_frontend - Structure that lists the frontends associated with
  294. * a demux
  295. *
  296. * @connectivity_list: List of front-ends that can be connected to a
  297. * particular demux;
  298. * @source: Type of the frontend.
  299. *
  300. * FIXME: this structure should likely be replaced soon by some
  301. * media-controller based logic.
  302. */
  303. struct dmx_frontend {
  304. struct list_head connectivity_list;
  305. enum dmx_frontend_source source;
  306. };
  307. /*
  308. * MPEG-2 TS Demux
  309. */
  310. /**
  311. * enum dmx_demux_caps - MPEG-2 TS Demux capabilities bitmap
  312. *
  313. * @DMX_TS_FILTERING: set if TS filtering is supported;
  314. * @DMX_SECTION_FILTERING: set if section filtering is supported;
  315. * @DMX_MEMORY_BASED_FILTERING: set if write() available.
  316. *
  317. * Those flags are OR'ed in the &dmx_demux.&capabilities field
  318. */
  319. enum dmx_demux_caps {
  320. DMX_TS_FILTERING = 1,
  321. DMX_SECTION_FILTERING = 4,
  322. DMX_MEMORY_BASED_FILTERING = 8,
  323. };
  324. /*
  325. * Demux resource type identifier.
  326. */
  327. /*
  328. * DMX_FE_ENTRY(): Casts elements in the list of registered
  329. * front-ends from the generic type struct list_head
  330. * to the type * struct dmx_frontend
  331. *.
  332. */
  333. #define DMX_FE_ENTRY(list) \
  334. list_entry(list, struct dmx_frontend, connectivity_list)
  335. /**
  336. * struct dmx_demux - Structure that contains the demux capabilities and
  337. * callbacks.
  338. *
  339. * @capabilities: Bitfield of capability flags.
  340. *
  341. * @frontend: Front-end connected to the demux
  342. *
  343. * @priv: Pointer to private data of the API client
  344. *
  345. * @open: This function reserves the demux for use by the caller and, if
  346. * necessary, initializes the demux. When the demux is no longer needed,
  347. * the function @close should be called. It should be possible for
  348. * multiple clients to access the demux at the same time. Thus, the
  349. * function implementation should increment the demux usage count when
  350. * @open is called and decrement it when @close is called.
  351. * The @demux function parameter contains a pointer to the demux API and
  352. * instance data.
  353. * It returns
  354. * 0 on success;
  355. * -EUSERS, if maximum usage count was reached;
  356. * -EINVAL, on bad parameter.
  357. *
  358. * @close: This function reserves the demux for use by the caller and, if
  359. * necessary, initializes the demux. When the demux is no longer needed,
  360. * the function @close should be called. It should be possible for
  361. * multiple clients to access the demux at the same time. Thus, the
  362. * function implementation should increment the demux usage count when
  363. * @open is called and decrement it when @close is called.
  364. * The @demux function parameter contains a pointer to the demux API and
  365. * instance data.
  366. * It returns
  367. * 0 on success;
  368. * -ENODEV, if demux was not in use (e. g. no users);
  369. * -EINVAL, on bad parameter.
  370. *
  371. * @write: This function provides the demux driver with a memory buffer
  372. * containing TS packets. Instead of receiving TS packets from the DVB
  373. * front-end, the demux driver software will read packets from memory.
  374. * Any clients of this demux with active TS, PES or Section filters will
  375. * receive filtered data via the Demux callback API (see 0). The function
  376. * returns when all the data in the buffer has been consumed by the demux.
  377. * Demux hardware typically cannot read TS from memory. If this is the
  378. * case, memory-based filtering has to be implemented entirely in software.
  379. * The @demux function parameter contains a pointer to the demux API and
  380. * instance data.
  381. * The @buf function parameter contains a pointer to the TS data in
  382. * kernel-space memory.
  383. * The @count function parameter contains the length of the TS data.
  384. * It returns
  385. * 0 on success;
  386. * -ERESTARTSYS, if mutex lock was interrupted;
  387. * -EINTR, if a signal handling is pending;
  388. * -ENODEV, if demux was removed;
  389. * -EINVAL, on bad parameter.
  390. *
  391. * @allocate_ts_feed: Allocates a new TS feed, which is used to filter the TS
  392. * packets carrying a certain PID. The TS feed normally corresponds to a
  393. * hardware PID filter on the demux chip.
  394. * The @demux function parameter contains a pointer to the demux API and
  395. * instance data.
  396. * The @feed function parameter contains a pointer to the TS feed API and
  397. * instance data.
  398. * The @callback function parameter contains a pointer to the callback
  399. * function for passing received TS packet.
  400. * It returns
  401. * 0 on success;
  402. * -ERESTARTSYS, if mutex lock was interrupted;
  403. * -EBUSY, if no more TS feeds is available;
  404. * -EINVAL, on bad parameter.
  405. *
  406. * @release_ts_feed: Releases the resources allocated with @allocate_ts_feed.
  407. * Any filtering in progress on the TS feed should be stopped before
  408. * calling this function.
  409. * The @demux function parameter contains a pointer to the demux API and
  410. * instance data.
  411. * The @feed function parameter contains a pointer to the TS feed API and
  412. * instance data.
  413. * It returns
  414. * 0 on success;
  415. * -EINVAL on bad parameter.
  416. *
  417. * @allocate_section_feed: Allocates a new section feed, i.e. a demux resource
  418. * for filtering and receiving sections. On platforms with hardware
  419. * support for section filtering, a section feed is directly mapped to
  420. * the demux HW. On other platforms, TS packets are first PID filtered in
  421. * hardware and a hardware section filter then emulated in software. The
  422. * caller obtains an API pointer of type dmx_section_feed_t as an out
  423. * parameter. Using this API the caller can set filtering parameters and
  424. * start receiving sections.
  425. * The @demux function parameter contains a pointer to the demux API and
  426. * instance data.
  427. * The @feed function parameter contains a pointer to the TS feed API and
  428. * instance data.
  429. * The @callback function parameter contains a pointer to the callback
  430. * function for passing received TS packet.
  431. * It returns
  432. * 0 on success;
  433. * -EBUSY, if no more TS feeds is available;
  434. * -EINVAL, on bad parameter.
  435. *
  436. * @release_section_feed: Releases the resources allocated with
  437. * @allocate_section_feed, including allocated filters. Any filtering in
  438. * progress on the section feed should be stopped before calling this
  439. * function.
  440. * The @demux function parameter contains a pointer to the demux API and
  441. * instance data.
  442. * The @feed function parameter contains a pointer to the TS feed API and
  443. * instance data.
  444. * It returns
  445. * 0 on success;
  446. * -EINVAL, on bad parameter.
  447. *
  448. * @add_frontend: Registers a connectivity between a demux and a front-end,
  449. * i.e., indicates that the demux can be connected via a call to
  450. * @connect_frontend to use the given front-end as a TS source. The
  451. * client of this function has to allocate dynamic or static memory for
  452. * the frontend structure and initialize its fields before calling this
  453. * function. This function is normally called during the driver
  454. * initialization. The caller must not free the memory of the frontend
  455. * struct before successfully calling @remove_frontend.
  456. * The @demux function parameter contains a pointer to the demux API and
  457. * instance data.
  458. * The @frontend function parameter contains a pointer to the front-end
  459. * instance data.
  460. * It returns
  461. * 0 on success;
  462. * -EINVAL, on bad parameter.
  463. *
  464. * @remove_frontend: Indicates that the given front-end, registered by a call
  465. * to @add_frontend, can no longer be connected as a TS source by this
  466. * demux. The function should be called when a front-end driver or a demux
  467. * driver is removed from the system. If the front-end is in use, the
  468. * function fails with the return value of -EBUSY. After successfully
  469. * calling this function, the caller can free the memory of the frontend
  470. * struct if it was dynamically allocated before the @add_frontend
  471. * operation.
  472. * The @demux function parameter contains a pointer to the demux API and
  473. * instance data.
  474. * The @frontend function parameter contains a pointer to the front-end
  475. * instance data.
  476. * It returns
  477. * 0 on success;
  478. * -ENODEV, if the front-end was not found,
  479. * -EINVAL, on bad parameter.
  480. *
  481. * @get_frontends: Provides the APIs of the front-ends that have been
  482. * registered for this demux. Any of the front-ends obtained with this
  483. * call can be used as a parameter for @connect_frontend. The include
  484. * file demux.h contains the macro DMX_FE_ENTRY() for converting an
  485. * element of the generic type struct &list_head * to the type
  486. * struct &dmx_frontend *. The caller must not free the memory of any of
  487. * the elements obtained via this function call.
  488. * The @demux function parameter contains a pointer to the demux API and
  489. * instance data.
  490. * It returns a struct list_head pointer to the list of front-end
  491. * interfaces, or NULL in the case of an empty list.
  492. *
  493. * @connect_frontend: Connects the TS output of the front-end to the input of
  494. * the demux. A demux can only be connected to a front-end registered to
  495. * the demux with the function @add_frontend. It may or may not be
  496. * possible to connect multiple demuxes to the same front-end, depending
  497. * on the capabilities of the HW platform. When not used, the front-end
  498. * should be released by calling @disconnect_frontend.
  499. * The @demux function parameter contains a pointer to the demux API and
  500. * instance data.
  501. * The @frontend function parameter contains a pointer to the front-end
  502. * instance data.
  503. * It returns
  504. * 0 on success;
  505. * -EINVAL, on bad parameter.
  506. *
  507. * @disconnect_frontend: Disconnects the demux and a front-end previously
  508. * connected by a @connect_frontend call.
  509. * The @demux function parameter contains a pointer to the demux API and
  510. * instance data.
  511. * It returns
  512. * 0 on success;
  513. * -EINVAL on bad parameter.
  514. *
  515. * @get_pes_pids: Get the PIDs for DMX_PES_AUDIO0, DMX_PES_VIDEO0,
  516. * DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0 and DMX_PES_PCR0.
  517. * The @demux function parameter contains a pointer to the demux API and
  518. * instance data.
  519. * The @pids function parameter contains an array with five u16 elements
  520. * where the PIDs will be stored.
  521. * It returns
  522. * 0 on success;
  523. * -EINVAL on bad parameter.
  524. */
  525. struct dmx_demux {
  526. enum dmx_demux_caps capabilities;
  527. struct dmx_frontend *frontend;
  528. void *priv;
  529. int (*open)(struct dmx_demux *demux);
  530. int (*close)(struct dmx_demux *demux);
  531. int (*write)(struct dmx_demux *demux, const char __user *buf,
  532. size_t count);
  533. int (*allocate_ts_feed)(struct dmx_demux *demux,
  534. struct dmx_ts_feed **feed,
  535. dmx_ts_cb callback);
  536. int (*release_ts_feed)(struct dmx_demux *demux,
  537. struct dmx_ts_feed *feed);
  538. int (*allocate_section_feed)(struct dmx_demux *demux,
  539. struct dmx_section_feed **feed,
  540. dmx_section_cb callback);
  541. int (*release_section_feed)(struct dmx_demux *demux,
  542. struct dmx_section_feed *feed);
  543. int (*add_frontend)(struct dmx_demux *demux,
  544. struct dmx_frontend *frontend);
  545. int (*remove_frontend)(struct dmx_demux *demux,
  546. struct dmx_frontend *frontend);
  547. struct list_head *(*get_frontends)(struct dmx_demux *demux);
  548. int (*connect_frontend)(struct dmx_demux *demux,
  549. struct dmx_frontend *frontend);
  550. int (*disconnect_frontend)(struct dmx_demux *demux);
  551. int (*get_pes_pids)(struct dmx_demux *demux, u16 *pids);
  552. /* private: Not used upstream and never documented */
  553. #if 0
  554. int (*get_caps)(struct dmx_demux *demux, struct dmx_caps *caps);
  555. int (*set_source)(struct dmx_demux *demux, const dmx_source_t *src);
  556. #endif
  557. /*
  558. * private: Only used at av7110, to read some data from firmware.
  559. * As this was never documented, we have no clue about what's
  560. * there, and its usage on other drivers aren't encouraged.
  561. */
  562. int (*get_stc)(struct dmx_demux *demux, unsigned int num,
  563. u64 *stc, unsigned int *base);
  564. };
  565. #endif /* #ifndef __DEMUX_H */