demux.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  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. */
  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. ktime_t timeout);
  93. int (*start_filtering)(struct dmx_ts_feed *feed);
  94. int (*stop_filtering)(struct dmx_ts_feed *feed);
  95. };
  96. /*
  97. * Section reception
  98. */
  99. /**
  100. * struct dmx_section_filter - Structure that describes a section filter
  101. *
  102. * @filter_value: Contains up to 16 bytes (128 bits) of the TS section header
  103. * that will be matched by the section filter
  104. * @filter_mask: Contains a 16 bytes (128 bits) filter mask with the bits
  105. * specified by @filter_value that will be used on the filter
  106. * match logic.
  107. * @filter_mode: Contains a 16 bytes (128 bits) filter mode.
  108. * @parent: Back-pointer to struct dmx_section_feed.
  109. * @priv: Pointer to private data of the API client.
  110. *
  111. *
  112. * The @filter_mask controls which bits of @filter_value are compared with
  113. * the section headers/payload. On a binary value of 1 in filter_mask, the
  114. * corresponding bits are compared. The filter only accepts sections that are
  115. * equal to filter_value in all the tested bit positions.
  116. */
  117. struct dmx_section_filter {
  118. u8 filter_value[DMX_MAX_FILTER_SIZE];
  119. u8 filter_mask[DMX_MAX_FILTER_SIZE];
  120. u8 filter_mode[DMX_MAX_FILTER_SIZE];
  121. struct dmx_section_feed *parent;
  122. void *priv;
  123. };
  124. /**
  125. * struct dmx_section_feed - Structure that contains a section feed filter
  126. *
  127. * @is_filtering: Set to non-zero when filtering in progress
  128. * @parent: pointer to struct dmx_demux
  129. * @priv: pointer to private data of the API client
  130. * @check_crc: If non-zero, check the CRC values of filtered sections.
  131. * @set: sets the section filter
  132. * @allocate_filter: This function is used to allocate a section filter on
  133. * the demux. It should only be called when no filtering
  134. * is in progress on this section feed. If a filter cannot
  135. * be allocated, the function fails with -ENOSPC.
  136. * @release_filter: This function releases all the resources of a
  137. * previously allocated section filter. The function
  138. * should not be called while filtering is in progress
  139. * on this section feed. After calling this function,
  140. * the caller should not try to dereference the filter
  141. * pointer.
  142. * @start_filtering: starts section filtering
  143. * @stop_filtering: stops section filtering
  144. *
  145. * A TS feed is typically mapped to a hardware PID filter on the demux chip.
  146. * Using this API, the client can set the filtering properties to start/stop
  147. * filtering TS packets on a particular TS feed.
  148. */
  149. struct dmx_section_feed {
  150. int is_filtering;
  151. struct dmx_demux *parent;
  152. void *priv;
  153. int check_crc;
  154. /* private: Used internally at dvb_demux.c */
  155. u32 crc_val;
  156. u8 *secbuf;
  157. u8 secbuf_base[DMX_MAX_SECFEED_SIZE];
  158. u16 secbufp, seclen, tsfeedp;
  159. /* public: */
  160. int (*set)(struct dmx_section_feed *feed,
  161. u16 pid,
  162. int check_crc);
  163. int (*allocate_filter)(struct dmx_section_feed *feed,
  164. struct dmx_section_filter **filter);
  165. int (*release_filter)(struct dmx_section_feed *feed,
  166. struct dmx_section_filter *filter);
  167. int (*start_filtering)(struct dmx_section_feed *feed);
  168. int (*stop_filtering)(struct dmx_section_feed *feed);
  169. };
  170. /**
  171. * typedef dmx_ts_cb - DVB demux TS filter callback function prototype
  172. *
  173. * @buffer1: Pointer to the start of the filtered TS packets.
  174. * @buffer1_length: Length of the TS data in buffer1.
  175. * @buffer2: Pointer to the tail of the filtered TS packets, or NULL.
  176. * @buffer2_length: Length of the TS data in buffer2.
  177. * @source: Indicates which TS feed is the source of the callback.
  178. * @buffer_flags: Address where buffer flags are stored. Those are
  179. * used to report discontinuity users via DVB
  180. * memory mapped API, as defined by
  181. * &enum dmx_buffer_flags.
  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. u32 *buffer_flags);
  236. /**
  237. * typedef dmx_section_cb - DVB demux TS filter callback function prototype
  238. *
  239. * @buffer1: Pointer to the start of the filtered section, e.g.
  240. * within the circular buffer of the demux driver.
  241. * @buffer1_len: Length of the filtered section data in @buffer1,
  242. * including headers and CRC.
  243. * @buffer2: Pointer to the tail of the filtered section data,
  244. * or NULL. Useful to handle the wrapping of a
  245. * circular buffer.
  246. * @buffer2_len: Length of the filtered section data in @buffer2,
  247. * including headers and CRC.
  248. * @source: Indicates which section feed is the source of the
  249. * callback.
  250. * @buffer_flags: Address where buffer flags are stored. Those are
  251. * used to report discontinuity users via DVB
  252. * memory mapped API, as defined by
  253. * &enum dmx_buffer_flags.
  254. *
  255. * This function callback prototype, provided by the client of the demux API,
  256. * is called from the demux code. The function is only called when
  257. * filtering of sections has been enabled using the function
  258. * &dmx_ts_feed.@start_filtering. When the demux driver has received a
  259. * complete section that matches at least one section filter, the client
  260. * is notified via this callback function. Normally this function is called
  261. * for each received section; however, it is also possible to deliver
  262. * multiple sections with one callback, for example when the system load
  263. * is high. If an error occurs while receiving a section, this
  264. * function should be called with the corresponding error type set in the
  265. * success field, whether or not there is data to deliver. The Section Feed
  266. * implementation should maintain a circular buffer for received sections.
  267. * However, this is not necessary if the Section Feed API is implemented as
  268. * a client of the TS Feed API, because the TS Feed implementation then
  269. * buffers the received data. The size of the circular buffer can be
  270. * configured using the &dmx_ts_feed.@set function in the Section Feed API.
  271. * If there is no room in the circular buffer when a new section is received,
  272. * the section must be discarded. If this happens, the value of the success
  273. * parameter should be DMX_OVERRUN_ERROR on the next callback.
  274. */
  275. typedef int (*dmx_section_cb)(const u8 *buffer1,
  276. size_t buffer1_len,
  277. const u8 *buffer2,
  278. size_t buffer2_len,
  279. struct dmx_section_filter *source,
  280. u32 *buffer_flags);
  281. /*
  282. * DVB Front-End
  283. */
  284. /**
  285. * enum dmx_frontend_source - Used to identify the type of frontend
  286. *
  287. * @DMX_MEMORY_FE: The source of the demux is memory. It means that
  288. * the MPEG-TS to be filtered comes from userspace,
  289. * via write() syscall.
  290. *
  291. * @DMX_FRONTEND_0: The source of the demux is a frontend connected
  292. * to the demux.
  293. */
  294. enum dmx_frontend_source {
  295. DMX_MEMORY_FE,
  296. DMX_FRONTEND_0,
  297. };
  298. /**
  299. * struct dmx_frontend - Structure that lists the frontends associated with
  300. * a demux
  301. *
  302. * @connectivity_list: List of front-ends that can be connected to a
  303. * particular demux;
  304. * @source: Type of the frontend.
  305. *
  306. * FIXME: this structure should likely be replaced soon by some
  307. * media-controller based logic.
  308. */
  309. struct dmx_frontend {
  310. struct list_head connectivity_list;
  311. enum dmx_frontend_source source;
  312. };
  313. /*
  314. * MPEG-2 TS Demux
  315. */
  316. /**
  317. * enum dmx_demux_caps - MPEG-2 TS Demux capabilities bitmap
  318. *
  319. * @DMX_TS_FILTERING: set if TS filtering is supported;
  320. * @DMX_SECTION_FILTERING: set if section filtering is supported;
  321. * @DMX_MEMORY_BASED_FILTERING: set if write() available.
  322. *
  323. * Those flags are OR'ed in the &dmx_demux.capabilities field
  324. */
  325. enum dmx_demux_caps {
  326. DMX_TS_FILTERING = 1,
  327. DMX_SECTION_FILTERING = 4,
  328. DMX_MEMORY_BASED_FILTERING = 8,
  329. };
  330. /*
  331. * Demux resource type identifier.
  332. */
  333. /**
  334. * DMX_FE_ENTRY - Casts elements in the list of registered
  335. * front-ends from the generic type struct list_head
  336. * to the type * struct dmx_frontend
  337. *
  338. * @list: list of struct dmx_frontend
  339. */
  340. #define DMX_FE_ENTRY(list) \
  341. list_entry(list, struct dmx_frontend, connectivity_list)
  342. /**
  343. * struct dmx_demux - Structure that contains the demux capabilities and
  344. * callbacks.
  345. *
  346. * @capabilities: Bitfield of capability flags.
  347. *
  348. * @frontend: Front-end connected to the demux
  349. *
  350. * @priv: Pointer to private data of the API client
  351. *
  352. * @open: This function reserves the demux for use by the caller and, if
  353. * necessary, initializes the demux. When the demux is no longer needed,
  354. * the function @close should be called. It should be possible for
  355. * multiple clients to access the demux at the same time. Thus, the
  356. * function implementation should increment the demux usage count when
  357. * @open is called and decrement it when @close is called.
  358. * The @demux function parameter contains a pointer to the demux API and
  359. * instance data.
  360. * It returns:
  361. * 0 on success;
  362. * -EUSERS, if maximum usage count was reached;
  363. * -EINVAL, on bad parameter.
  364. *
  365. * @close: This function reserves the demux for use by the caller and, if
  366. * necessary, initializes the demux. When the demux is no longer needed,
  367. * the function @close should be called. It should be possible for
  368. * multiple clients to access the demux at the same time. Thus, the
  369. * function implementation should increment the demux usage count when
  370. * @open is called and decrement it when @close is called.
  371. * The @demux function parameter contains a pointer to the demux API and
  372. * instance data.
  373. * It returns:
  374. * 0 on success;
  375. * -ENODEV, if demux was not in use (e. g. no users);
  376. * -EINVAL, on bad parameter.
  377. *
  378. * @write: This function provides the demux driver with a memory buffer
  379. * containing TS packets. Instead of receiving TS packets from the DVB
  380. * front-end, the demux driver software will read packets from memory.
  381. * Any clients of this demux with active TS, PES or Section filters will
  382. * receive filtered data via the Demux callback API (see 0). The function
  383. * returns when all the data in the buffer has been consumed by the demux.
  384. * Demux hardware typically cannot read TS from memory. If this is the
  385. * case, memory-based filtering has to be implemented entirely in software.
  386. * The @demux function parameter contains a pointer to the demux API and
  387. * instance data.
  388. * The @buf function parameter contains a pointer to the TS data in
  389. * kernel-space memory.
  390. * The @count function parameter contains the length of the TS data.
  391. * It returns:
  392. * 0 on success;
  393. * -ERESTARTSYS, if mutex lock was interrupted;
  394. * -EINTR, if a signal handling is pending;
  395. * -ENODEV, if demux was removed;
  396. * -EINVAL, on bad parameter.
  397. *
  398. * @allocate_ts_feed: Allocates a new TS feed, which is used to filter the TS
  399. * packets carrying a certain PID. The TS feed normally corresponds to a
  400. * hardware PID filter on the demux chip.
  401. * The @demux function parameter contains a pointer to the demux API and
  402. * instance data.
  403. * The @feed function parameter contains a pointer to the TS feed API and
  404. * instance data.
  405. * The @callback function parameter contains a pointer to the callback
  406. * function for passing received TS packet.
  407. * It returns:
  408. * 0 on success;
  409. * -ERESTARTSYS, if mutex lock was interrupted;
  410. * -EBUSY, if no more TS feeds is available;
  411. * -EINVAL, on bad parameter.
  412. *
  413. * @release_ts_feed: Releases the resources allocated with @allocate_ts_feed.
  414. * Any filtering in progress on the TS feed should be stopped before
  415. * calling this function.
  416. * The @demux function parameter contains a pointer to the demux API and
  417. * instance data.
  418. * The @feed function parameter contains a pointer to the TS feed API and
  419. * instance data.
  420. * It returns:
  421. * 0 on success;
  422. * -EINVAL on bad parameter.
  423. *
  424. * @allocate_section_feed: Allocates a new section feed, i.e. a demux resource
  425. * for filtering and receiving sections. On platforms with hardware
  426. * support for section filtering, a section feed is directly mapped to
  427. * the demux HW. On other platforms, TS packets are first PID filtered in
  428. * hardware and a hardware section filter then emulated in software. The
  429. * caller obtains an API pointer of type dmx_section_feed_t as an out
  430. * parameter. Using this API the caller can set filtering parameters and
  431. * start receiving sections.
  432. * The @demux function parameter contains a pointer to the demux API and
  433. * instance data.
  434. * The @feed function parameter contains a pointer to the TS feed API and
  435. * instance data.
  436. * The @callback function parameter contains a pointer to the callback
  437. * function for passing received TS packet.
  438. * It returns:
  439. * 0 on success;
  440. * -EBUSY, if no more TS feeds is available;
  441. * -EINVAL, on bad parameter.
  442. *
  443. * @release_section_feed: Releases the resources allocated with
  444. * @allocate_section_feed, including allocated filters. Any filtering in
  445. * progress on the section feed should be stopped before calling this
  446. * function.
  447. * The @demux function parameter contains a pointer to the demux API and
  448. * instance data.
  449. * The @feed function parameter contains a pointer to the TS feed API and
  450. * instance data.
  451. * It returns:
  452. * 0 on success;
  453. * -EINVAL, on bad parameter.
  454. *
  455. * @add_frontend: Registers a connectivity between a demux and a front-end,
  456. * i.e., indicates that the demux can be connected via a call to
  457. * @connect_frontend to use the given front-end as a TS source. The
  458. * client of this function has to allocate dynamic or static memory for
  459. * the frontend structure and initialize its fields before calling this
  460. * function. This function is normally called during the driver
  461. * initialization. The caller must not free the memory of the frontend
  462. * struct before successfully calling @remove_frontend.
  463. * The @demux function parameter contains a pointer to the demux API and
  464. * instance data.
  465. * The @frontend function parameter contains a pointer to the front-end
  466. * instance data.
  467. * It returns:
  468. * 0 on success;
  469. * -EINVAL, on bad parameter.
  470. *
  471. * @remove_frontend: Indicates that the given front-end, registered by a call
  472. * to @add_frontend, can no longer be connected as a TS source by this
  473. * demux. The function should be called when a front-end driver or a demux
  474. * driver is removed from the system. If the front-end is in use, the
  475. * function fails with the return value of -EBUSY. After successfully
  476. * calling this function, the caller can free the memory of the frontend
  477. * struct if it was dynamically allocated before the @add_frontend
  478. * operation.
  479. * The @demux function parameter contains a pointer to the demux API and
  480. * instance data.
  481. * The @frontend function parameter contains a pointer to the front-end
  482. * instance data.
  483. * It returns:
  484. * 0 on success;
  485. * -ENODEV, if the front-end was not found,
  486. * -EINVAL, on bad parameter.
  487. *
  488. * @get_frontends: Provides the APIs of the front-ends that have been
  489. * registered for this demux. Any of the front-ends obtained with this
  490. * call can be used as a parameter for @connect_frontend. The include
  491. * file demux.h contains the macro DMX_FE_ENTRY() for converting an
  492. * element of the generic type struct &list_head * to the type
  493. * struct &dmx_frontend *. The caller must not free the memory of any of
  494. * the elements obtained via this function call.
  495. * The @demux function parameter contains a pointer to the demux API and
  496. * instance data.
  497. * It returns a struct list_head pointer to the list of front-end
  498. * interfaces, or NULL in the case of an empty list.
  499. *
  500. * @connect_frontend: Connects the TS output of the front-end to the input of
  501. * the demux. A demux can only be connected to a front-end registered to
  502. * the demux with the function @add_frontend. It may or may not be
  503. * possible to connect multiple demuxes to the same front-end, depending
  504. * on the capabilities of the HW platform. When not used, the front-end
  505. * should be released by calling @disconnect_frontend.
  506. * The @demux function parameter contains a pointer to the demux API and
  507. * instance data.
  508. * The @frontend function parameter contains a pointer to the front-end
  509. * instance data.
  510. * It returns:
  511. * 0 on success;
  512. * -EINVAL, on bad parameter.
  513. *
  514. * @disconnect_frontend: Disconnects the demux and a front-end previously
  515. * connected by a @connect_frontend call.
  516. * The @demux function parameter contains a pointer to the demux API and
  517. * instance data.
  518. * It returns:
  519. * 0 on success;
  520. * -EINVAL on bad parameter.
  521. *
  522. * @get_pes_pids: Get the PIDs for DMX_PES_AUDIO0, DMX_PES_VIDEO0,
  523. * DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0 and DMX_PES_PCR0.
  524. * The @demux function parameter contains a pointer to the demux API and
  525. * instance data.
  526. * The @pids function parameter contains an array with five u16 elements
  527. * where the PIDs will be stored.
  528. * It returns:
  529. * 0 on success;
  530. * -EINVAL on bad parameter.
  531. */
  532. struct dmx_demux {
  533. enum dmx_demux_caps capabilities;
  534. struct dmx_frontend *frontend;
  535. void *priv;
  536. int (*open)(struct dmx_demux *demux);
  537. int (*close)(struct dmx_demux *demux);
  538. int (*write)(struct dmx_demux *demux, const char __user *buf,
  539. size_t count);
  540. int (*allocate_ts_feed)(struct dmx_demux *demux,
  541. struct dmx_ts_feed **feed,
  542. dmx_ts_cb callback);
  543. int (*release_ts_feed)(struct dmx_demux *demux,
  544. struct dmx_ts_feed *feed);
  545. int (*allocate_section_feed)(struct dmx_demux *demux,
  546. struct dmx_section_feed **feed,
  547. dmx_section_cb callback);
  548. int (*release_section_feed)(struct dmx_demux *demux,
  549. struct dmx_section_feed *feed);
  550. int (*add_frontend)(struct dmx_demux *demux,
  551. struct dmx_frontend *frontend);
  552. int (*remove_frontend)(struct dmx_demux *demux,
  553. struct dmx_frontend *frontend);
  554. struct list_head *(*get_frontends)(struct dmx_demux *demux);
  555. int (*connect_frontend)(struct dmx_demux *demux,
  556. struct dmx_frontend *frontend);
  557. int (*disconnect_frontend)(struct dmx_demux *demux);
  558. int (*get_pes_pids)(struct dmx_demux *demux, u16 *pids);
  559. /* private: */
  560. /*
  561. * Only used at av7110, to read some data from firmware.
  562. * As this was never documented, we have no clue about what's
  563. * there, and its usage on other drivers aren't encouraged.
  564. */
  565. int (*get_stc)(struct dmx_demux *demux, unsigned int num,
  566. u64 *stc, unsigned int *base);
  567. };
  568. #endif /* #ifndef __DEMUX_H */