streambuf.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * AMLOGIC Audio/Video streaming port driver.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the named License,
  7. * or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
  17. *
  18. * Author: Tim Yao <timyao@amlogic.com>
  19. *
  20. */
  21. #ifndef STREAMBUF_H
  22. #define STREAMBUF_H
  23. #define BUF_FLAG_ALLOC 0x01
  24. #define BUF_FLAG_IN_USE 0x02
  25. #define BUF_FLAG_PARSER 0x04
  26. #define BUF_FLAG_FIRST_TSTAMP 0x08
  27. #define BUF_FLAG_IOMEM 0x10
  28. #define BUF_TYPE_VIDEO 0
  29. #define BUF_TYPE_AUDIO 1
  30. #define BUF_TYPE_SUBTITLE 2
  31. #define BUF_MAX_NUM 3
  32. #define INVALID_PTS 0xffffffff
  33. #define FETCHBUF_SIZE (64*1024)
  34. typedef struct stream_buf_s {
  35. s32 flag;
  36. u32 type;
  37. u32 buf_start;
  38. u32 buf_size;
  39. u32 first_tstamp;
  40. const ulong reg_base;
  41. wait_queue_head_t wq;
  42. struct timer_list timer;
  43. u32 wcnt;
  44. } stream_buf_t;
  45. typedef struct stream_port_s {
  46. /* driver info */
  47. const char *name;
  48. struct device *class_dev;
  49. const struct file_operations *fops;
  50. /* ports control */
  51. s32 type;
  52. s32 flag;
  53. /* decoder info */
  54. s32 vformat;
  55. s32 aformat;
  56. s32 achanl;
  57. s32 asamprate;
  58. s32 adatawidth;
  59. /* parser info */
  60. u32 vid;
  61. u32 aid;
  62. u32 sid;
  63. } stream_port_t;
  64. extern ulong fetchbuf, *fetchbuf_remap;
  65. extern u32 stbuf_level(struct stream_buf_s *buf);
  66. extern u32 stbuf_rp(struct stream_buf_s *buf);
  67. extern u32 stbuf_space(struct stream_buf_s *buf);
  68. extern u32 stbuf_size(struct stream_buf_s *buf);
  69. extern s32 stbuf_init(struct stream_buf_s *buf);
  70. extern s32 stbuf_wait_space(struct stream_buf_s *stream_buf, size_t count);
  71. extern void stbuf_release(struct stream_buf_s *buf);
  72. extern int stbuf_change_size(struct stream_buf_s *buf, int size);
  73. extern int stbuf_fetch_init(void);
  74. extern void stbuf_fetch_release(void);
  75. extern u32 stbuf_sub_rp_get(void);
  76. extern void stbuf_sub_rp_set(unsigned int sub_rp);
  77. extern u32 stbuf_sub_wp_get(void);
  78. extern u32 stbuf_sub_start_get(void);
  79. extern stream_buf_t* get_stream_buffer(int id);
  80. #endif /* STREAMBUF_H */