Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.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 <linux/mutex.h>
34
35 #include <linux/dvb/dmx.h>
36
37 #include "dvbdev.h"
38 #include "demux.h"
39 #include "dvb_ringbuffer.h"
40
41 enum dmxdev_type {
42         DMXDEV_TYPE_NONE,
43         DMXDEV_TYPE_SEC,
44         DMXDEV_TYPE_PES,
45 };
46
47 enum dmxdev_state {
48         DMXDEV_STATE_FREE,
49         DMXDEV_STATE_ALLOCATED,
50         DMXDEV_STATE_SET,
51         DMXDEV_STATE_GO,
52         DMXDEV_STATE_DONE,
53         DMXDEV_STATE_TIMEDOUT
54 };
55
56 struct dmxdev_filter {
57         union {
58                 struct dmx_section_filter *sec;
59         } filter;
60
61         union {
62                 struct dmx_ts_feed *ts;
63                 struct dmx_section_feed *sec;
64         } feed;
65
66         union {
67                 struct dmx_sct_filter_params sec;
68                 struct dmx_pes_filter_params pes;
69         } params;
70
71         enum dmxdev_type type;
72         enum dmxdev_state state;
73         struct dmxdev *dev;
74         struct dvb_ringbuffer buffer;
75
76         struct mutex mutex;
77
78         /* only for sections */
79         struct timer_list timer;
80         int todo;
81         u8 secheader[3];
82 };
83
84
85 struct dmxdev {
86         struct dvb_device *dvbdev;
87         struct dvb_device *dvr_dvbdev;
88
89         struct dmxdev_filter *filter;
90         struct dmx_demux *demux;
91
92         int filternum;
93         int capabilities;
94 #define DMXDEV_CAP_DUPLEX 1
95         struct dmx_frontend *dvr_orig_fe;
96
97         struct dvb_ringbuffer dvr_buffer;
98 #define DVR_BUFFER_SIZE (10*188*1024)
99
100         struct mutex mutex;
101         spinlock_t lock;
102 };
103
104
105 int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *);
106 void dvb_dmxdev_release(struct dmxdev *dmxdev);
107
108 #endif /* _DMXDEV_H_ */