From 1c6e3ff694080be6e59ec3b2dc75691e2094b15b Mon Sep 17 00:00:00 2001 From: Jamie Honan Date: Mon, 13 Oct 2003 00:34:51 +0000 Subject: Added Brad Campbell's dvb_dmx_swfilter_204 routine to handle data from DST-CI. --- linux/drivers/media/dvb/dvb-core/dvb_demux.c | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'linux') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c index 29108599d..fa73e43b8 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c @@ -446,6 +446,50 @@ bailout: spin_unlock(&demux->lock); } +void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) +{ + int p = 0,i, j; + u8 tmppack[188]; + spin_lock(&demux->lock); + + if ((i = demux->tsbufp)) { + if (count < (j=204-i)) { + memcpy(&demux->tsbuf[i], buf, count); + demux->tsbufp += count; + goto bailout; + } + memcpy(&demux->tsbuf[i], buf, j); + if ((demux->tsbuf[0] == 0x47)|(demux->tsbuf[0]==0xB8)) { + memcpy(tmppack, demux->tsbuf, 188); + if (tmppack[0] == 0xB8) tmppack[0] = 0x47; + dvb_dmx_swfilter_packet(demux, tmppack); + } + demux->tsbufp = 0; + p += j; + } + + while (p < count) { + if ((buf[p] == 0x47)|(buf[p] == 0xB8)) { + if (count-p >= 204) { + memcpy(tmppack, buf+p, 188); + if (tmppack[0] == 0xB8) tmppack[0] = 0x47; + dvb_dmx_swfilter_packet(demux, tmppack); + p += 204; + } else { + i = count-p; + memcpy(demux->tsbuf, buf+p, i); + demux->tsbufp=i; + goto bailout; + } + } else { + p++; + } + } + +bailout: + spin_unlock(&demux->lock); +} + static struct dvb_demux_filter * dvb_dmx_filter_alloc(struct dvb_demux *demux) { -- cgit v1.2.3