summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_demux.c44
1 files changed, 44 insertions, 0 deletions
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)
{