Path: blob/master/drivers/media/dvb/dvb-core/dvb_demux.h
15112 views
/*1* dvb_demux.h: DVB kernel demux API2*3* Copyright (C) 2000-2001 Marcus Metzler & Ralph Metzler4* for convergence integrated media GmbH5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU Lesser General Public License8* as published by the Free Software Foundation; either version 2.19* of the License, or (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU Lesser General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.19*20*/2122#ifndef _DVB_DEMUX_H_23#define _DVB_DEMUX_H_2425#include <linux/time.h>26#include <linux/timer.h>27#include <linux/spinlock.h>28#include <linux/mutex.h>2930#include "demux.h"3132#define DMX_TYPE_TS 033#define DMX_TYPE_SEC 134#define DMX_TYPE_PES 23536#define DMX_STATE_FREE 037#define DMX_STATE_ALLOCATED 138#define DMX_STATE_SET 239#define DMX_STATE_READY 340#define DMX_STATE_GO 44142#define DVB_DEMUX_MASK_MAX 184344#define MAX_PID 0x1fff4546#define SPEED_PKTS_INTERVAL 500004748struct dvb_demux_filter {49struct dmx_section_filter filter;50u8 maskandmode[DMX_MAX_FILTER_SIZE];51u8 maskandnotmode[DMX_MAX_FILTER_SIZE];52int doneq;5354struct dvb_demux_filter *next;55struct dvb_demux_feed *feed;56int index;57int state;58int type;5960u16 hw_handle;61struct timer_list timer;62};6364#define DMX_FEED_ENTRY(pos) list_entry(pos, struct dvb_demux_feed, list_head)6566struct dvb_demux_feed {67union {68struct dmx_ts_feed ts;69struct dmx_section_feed sec;70} feed;7172union {73dmx_ts_cb ts;74dmx_section_cb sec;75} cb;7677struct dvb_demux *demux;78void *priv;79int type;80int state;81u16 pid;82u8 *buffer;83int buffer_size;8485struct timespec timeout;86struct dvb_demux_filter *filter;8788int ts_type;89enum dmx_ts_pes pes_type;9091int cc;92int pusi_seen; /* prevents feeding of garbage from previous section */9394u16 peslen;9596struct list_head list_head;97unsigned int index; /* a unique index for each feed (can be used as hardware pid filter index) */98};99100struct dvb_demux {101struct dmx_demux dmx;102void *priv;103int filternum;104int feednum;105int (*start_feed)(struct dvb_demux_feed *feed);106int (*stop_feed)(struct dvb_demux_feed *feed);107int (*write_to_decoder)(struct dvb_demux_feed *feed,108const u8 *buf, size_t len);109u32 (*check_crc32)(struct dvb_demux_feed *feed,110const u8 *buf, size_t len);111void (*memcopy)(struct dvb_demux_feed *feed, u8 *dst,112const u8 *src, size_t len);113114int users;115#define MAX_DVB_DEMUX_USERS 10116struct dvb_demux_filter *filter;117struct dvb_demux_feed *feed;118119struct list_head frontend_list;120121struct dvb_demux_feed *pesfilter[DMX_TS_PES_OTHER];122u16 pids[DMX_TS_PES_OTHER];123int playing;124int recording;125126#define DMX_MAX_PID 0x2000127struct list_head feed_list;128u8 tsbuf[204];129int tsbufp;130131struct mutex mutex;132spinlock_t lock;133134uint8_t *cnt_storage; /* for TS continuity check */135136struct timespec speed_last_time; /* for TS speed check */137uint32_t speed_pkts_cnt; /* for TS speed check */138};139140int dvb_dmx_init(struct dvb_demux *dvbdemux);141void dvb_dmx_release(struct dvb_demux *dvbdemux);142void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf,143size_t count);144void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count);145void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf,146size_t count);147148#endif /* _DVB_DEMUX_H_ */149150151