demux.h 23 KB

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