Linux-2.6.12-rc2
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / media / dvb / dvb-core / dmxdev.h
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
23 #ifndef _DMXDEV_H_
24 #define _DMXDEV_H_
25
26 #include <linux/types.h>
27 #include <linux/spinlock.h>
28 #include <linux/kernel.h>
29 #include <linux/timer.h>
30 #include <linux/wait.h>
31 #include <linux/fs.h>
32 #include <linux/string.h>
33 #include <asm/semaphore.h>
34
35 #include <linux/dvb/dmx.h>
36
37 #include "dvbdev.h"
38 #include "demux.h"
39
40 enum dmxdevype {
41 DMXDEV_TYPE_NONE,
42 DMXDEV_TYPE_SEC,
43 DMXDEV_TYPE_PES,
44 };
45
46 enum dmxdev_state {
47 DMXDEV_STATE_FREE,
48 DMXDEV_STATE_ALLOCATED,
49 DMXDEV_STATE_SET,
50 DMXDEV_STATE_GO,
51 DMXDEV_STATE_DONE,
52 DMXDEV_STATE_TIMEDOUT
53 };
54
55 struct dmxdev_buffer {
56 u8 *data;
57 int size;
58 int pread;
59 int pwrite;
60 wait_queue_head_t queue;
61 int error;
62 };
63
64 struct dmxdev_filter {
65 struct dvb_device *dvbdev;
66
67 union {
68 struct dmx_section_filter *sec;
69 } filter;
70
71 union {
72 struct dmx_ts_feed *ts;
73 struct dmx_section_feed *sec;
74 } feed;
75
76 union {
77 struct dmx_sct_filter_params sec;
78 struct dmx_pes_filter_params pes;
79 } params;
80
81 int type;
82 enum dmxdev_state state;
83 struct dmxdev *dev;
84 struct dmxdev_buffer buffer;
85
86 struct semaphore mutex;
87
88 /* only for sections */
89 struct timer_list timer;
90 int todo;
91 u8 secheader[3];
92
93 u16 pid;
94 };
95
96
97 struct dmxdev_dvr {
98 int state;
99 struct dmxdev *dev;
100 struct dmxdev_buffer buffer;
101 };
102
103
104 struct dmxdev {
105 struct dvb_device *dvbdev;
106 struct dvb_device *dvr_dvbdev;
107
108 struct dmxdev_filter *filter;
109 struct dmxdev_dvr *dvr;
110 struct dmx_demux *demux;
111
112 int filternum;
113 int capabilities;
114 #define DMXDEV_CAP_DUPLEX 1
115 struct dmx_frontend *dvr_orig_fe;
116
117 struct dmxdev_buffer dvr_buffer;
118 #define DVR_BUFFER_SIZE (10*188*1024)
119
120 struct semaphore mutex;
121 spinlock_t lock;
122 };
123
124
125 int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *);
126 void dvb_dmxdev_release(struct dmxdev *dmxdev);
127
128 #endif /* _DMXDEV_H_ */