blob: 02ebe28f830d811b9ea7079ad450cc626a6b3863 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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>
Ingo Molnar3593cab2006-02-07 06:49:14 -020033#include <linux/mutex.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090034#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36#include <linux/dvb/dmx.h>
37
38#include "dvbdev.h"
39#include "demux.h"
Andreas Oberritter34731df2006-03-14 17:31:01 -030040#include "dvb_ringbuffer.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Andreas Oberritterbbad7dc2006-03-10 15:21:58 -030042enum dmxdev_type {
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 DMXDEV_TYPE_NONE,
44 DMXDEV_TYPE_SEC,
45 DMXDEV_TYPE_PES,
46};
47
48enum dmxdev_state {
49 DMXDEV_STATE_FREE,
50 DMXDEV_STATE_ALLOCATED,
51 DMXDEV_STATE_SET,
52 DMXDEV_STATE_GO,
53 DMXDEV_STATE_DONE,
54 DMXDEV_STATE_TIMEDOUT
55};
56
Andreas Oberritter1cb662a2009-07-14 20:28:50 -030057struct dmxdev_feed {
58 u16 pid;
59 struct dmx_ts_feed *ts;
60 struct list_head next;
61};
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063struct dmxdev_filter {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080064 union {
65 struct dmx_section_filter *sec;
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 } filter;
67
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080068 union {
Andreas Oberritter1cb662a2009-07-14 20:28:50 -030069 /* list of TS and PES feeds (struct dmxdev_feed) */
70 struct list_head ts;
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080071 struct dmx_section_feed *sec;
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 } feed;
73
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080074 union {
75 struct dmx_sct_filter_params sec;
76 struct dmx_pes_filter_params pes;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 } params;
78
Andreas Oberritterbbad7dc2006-03-10 15:21:58 -030079 enum dmxdev_type type;
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080080 enum dmxdev_state state;
81 struct dmxdev *dev;
Andreas Oberritter34731df2006-03-14 17:31:01 -030082 struct dvb_ringbuffer buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
Ingo Molnar3593cab2006-02-07 06:49:14 -020084 struct mutex mutex;
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080086 /* only for sections */
87 struct timer_list timer;
88 int todo;
89 u8 secheader[3];
Linus Torvalds1da177e2005-04-16 15:20:36 -070090};
91
92
Linus Torvalds1da177e2005-04-16 15:20:36 -070093struct dmxdev {
94 struct dvb_device *dvbdev;
95 struct dvb_device *dvr_dvbdev;
96
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080097 struct dmxdev_filter *filter;
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080098 struct dmx_demux *demux;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800100 int filternum;
101 int capabilities;
Markus Rechberger57861b42007-04-14 10:19:18 -0300102
103 unsigned int exit:1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104#define DMXDEV_CAP_DUPLEX 1
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800105 struct dmx_frontend *dvr_orig_fe;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106
Andreas Oberritter34731df2006-03-14 17:31:01 -0300107 struct dvb_ringbuffer dvr_buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108#define DVR_BUFFER_SIZE (10*188*1024)
109
Ingo Molnar3593cab2006-02-07 06:49:14 -0200110 struct mutex mutex;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 spinlock_t lock;
112};
113
114
115int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *);
116void dvb_dmxdev_release(struct dmxdev *dmxdev);
117
118#endif /* _DMXDEV_H_ */