dmxdev.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * dmxdev.h
  3. *
  4. * Copyright (C) 2000 Ralph Metzler & Marcus Metzler
  5. * for convergence integrated media GmbH
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public License
  9. * as published by the Free Software Foundation; either version 2.1
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. *
  21. */
  22. #ifndef _DMXDEV_H_
  23. #define _DMXDEV_H_
  24. #include <linux/types.h>
  25. #include <linux/spinlock.h>
  26. #include <linux/kernel.h>
  27. #include <linux/timer.h>
  28. #include <linux/wait.h>
  29. #include <linux/fs.h>
  30. #include <linux/string.h>
  31. #include <asm/semaphore.h>
  32. #include <linux/dvb/dmx.h>
  33. #include "dvbdev.h"
  34. #include "demux.h"
  35. enum dmxdevype {
  36. DMXDEV_TYPE_NONE,
  37. DMXDEV_TYPE_SEC,
  38. DMXDEV_TYPE_PES,
  39. };
  40. enum dmxdev_state {
  41. DMXDEV_STATE_FREE,
  42. DMXDEV_STATE_ALLOCATED,
  43. DMXDEV_STATE_SET,
  44. DMXDEV_STATE_GO,
  45. DMXDEV_STATE_DONE,
  46. DMXDEV_STATE_TIMEDOUT
  47. };
  48. struct dmxdev_buffer {
  49. u8 *data;
  50. int size;
  51. int pread;
  52. int pwrite;
  53. wait_queue_head_t queue;
  54. int error;
  55. };
  56. struct dmxdev_filter {
  57. struct dvb_device *dvbdev;
  58. union {
  59. struct dmx_section_filter *sec;
  60. } filter;
  61. union {
  62. struct dmx_ts_feed *ts;
  63. struct dmx_section_feed *sec;
  64. } feed;
  65. union {
  66. struct dmx_sct_filter_params sec;
  67. struct dmx_pes_filter_params pes;
  68. } params;
  69. int type;
  70. enum dmxdev_state state;
  71. struct dmxdev *dev;
  72. struct dmxdev_buffer buffer;
  73. struct semaphore mutex;
  74. /* only for sections */
  75. struct timer_list timer;
  76. int todo;
  77. u8 secheader[3];
  78. u16 pid;
  79. };
  80. struct dmxdev_dvr {
  81. int state;
  82. struct dmxdev *dev;
  83. struct dmxdev_buffer buffer;
  84. };
  85. struct dmxdev {
  86. struct dvb_device *dvbdev;
  87. struct dvb_device *dvr_dvbdev;
  88. struct dmxdev_filter *filter;
  89. struct dmxdev_dvr *dvr;
  90. struct dmx_demux *demux;
  91. int filternum;
  92. int capabilities;
  93. #define DMXDEV_CAP_DUPLEX 1
  94. struct dmx_frontend *dvr_orig_fe;
  95. struct dmxdev_buffer dvr_buffer;
  96. #define DVR_BUFFER_SIZE (10*188*1024)
  97. struct semaphore mutex;
  98. spinlock_t lock;
  99. };
  100. int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *);
  101. void dvb_dmxdev_release(struct dmxdev *dmxdev);
  102. #endif /* _DMXDEV_H_ */