Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Mauro Carvalho Chehab | b2409b6 | 2012-10-19 07:29:17 -0300 | [diff] [blame] | 29 | #include <linux/time.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <linux/timer.h> |
| 31 | #include <linux/wait.h> |
| 32 | #include <linux/fs.h> |
| 33 | #include <linux/string.h> |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 34 | #include <linux/mutex.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 35 | #include <linux/slab.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | #include <linux/dvb/dmx.h> |
| 38 | |
| 39 | #include "dvbdev.h" |
| 40 | #include "demux.h" |
Andreas Oberritter | 34731df | 2006-03-14 17:31:01 -0300 | [diff] [blame] | 41 | #include "dvb_ringbuffer.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
Andreas Oberritter | bbad7dc | 2006-03-10 15:21:58 -0300 | [diff] [blame] | 43 | enum dmxdev_type { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | DMXDEV_TYPE_NONE, |
| 45 | DMXDEV_TYPE_SEC, |
| 46 | DMXDEV_TYPE_PES, |
| 47 | }; |
| 48 | |
| 49 | enum dmxdev_state { |
| 50 | DMXDEV_STATE_FREE, |
| 51 | DMXDEV_STATE_ALLOCATED, |
| 52 | DMXDEV_STATE_SET, |
| 53 | DMXDEV_STATE_GO, |
| 54 | DMXDEV_STATE_DONE, |
| 55 | DMXDEV_STATE_TIMEDOUT |
| 56 | }; |
| 57 | |
Andreas Oberritter | 1cb662a | 2009-07-14 20:28:50 -0300 | [diff] [blame] | 58 | struct dmxdev_feed { |
| 59 | u16 pid; |
| 60 | struct dmx_ts_feed *ts; |
| 61 | struct list_head next; |
| 62 | }; |
| 63 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | struct dmxdev_filter { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 65 | union { |
| 66 | struct dmx_section_filter *sec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | } filter; |
| 68 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 69 | union { |
Andreas Oberritter | 1cb662a | 2009-07-14 20:28:50 -0300 | [diff] [blame] | 70 | /* list of TS and PES feeds (struct dmxdev_feed) */ |
| 71 | struct list_head ts; |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 72 | struct dmx_section_feed *sec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | } feed; |
| 74 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 75 | union { |
| 76 | struct dmx_sct_filter_params sec; |
| 77 | struct dmx_pes_filter_params pes; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | } params; |
| 79 | |
Andreas Oberritter | bbad7dc | 2006-03-10 15:21:58 -0300 | [diff] [blame] | 80 | enum dmxdev_type type; |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 81 | enum dmxdev_state state; |
| 82 | struct dmxdev *dev; |
Andreas Oberritter | 34731df | 2006-03-14 17:31:01 -0300 | [diff] [blame] | 83 | struct dvb_ringbuffer buffer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 85 | struct mutex mutex; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 87 | /* only for sections */ |
| 88 | struct timer_list timer; |
| 89 | int todo; |
| 90 | u8 secheader[3]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | struct dmxdev { |
| 95 | struct dvb_device *dvbdev; |
| 96 | struct dvb_device *dvr_dvbdev; |
| 97 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 98 | struct dmxdev_filter *filter; |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 99 | struct dmx_demux *demux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 101 | int filternum; |
| 102 | int capabilities; |
Markus Rechberger | 57861b4 | 2007-04-14 10:19:18 -0300 | [diff] [blame] | 103 | |
| 104 | unsigned int exit:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | #define DMXDEV_CAP_DUPLEX 1 |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 106 | struct dmx_frontend *dvr_orig_fe; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | |
Andreas Oberritter | 34731df | 2006-03-14 17:31:01 -0300 | [diff] [blame] | 108 | struct dvb_ringbuffer dvr_buffer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | #define DVR_BUFFER_SIZE (10*188*1024) |
| 110 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 111 | struct mutex mutex; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | spinlock_t lock; |
| 113 | }; |
| 114 | |
| 115 | |
| 116 | int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *); |
| 117 | void dvb_dmxdev_release(struct dmxdev *dmxdev); |
| 118 | |
| 119 | #endif /* _DMXDEV_H_ */ |