diff options
author | Holger Waechtler <devnull@localhost> | 2003-12-03 19:29:32 +0000 |
---|---|---|
committer | Holger Waechtler <devnull@localhost> | 2003-12-03 19:29:32 +0000 |
commit | f3e7c1c071288e92cb53c08ec379ccf9a07a4136 (patch) | |
tree | 19539082c0199139453a15329e62ba2ec6bc031e /linux/drivers/media/dvb | |
parent | 05a58d29a472973dd746660dba8d7a709de73c95 (diff) | |
download | mediapointer-dvb-s2-f3e7c1c071288e92cb53c08ec379ccf9a07a4136.tar.gz mediapointer-dvb-s2-f3e7c1c071288e92cb53c08ec379ccf9a07a4136.tar.bz2 |
emard's cleanup
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_demux.c | 142 |
1 files changed, 7 insertions, 135 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c index 2dee75948..5c284a955 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c @@ -34,6 +34,11 @@ #include "dvb_functions.h" #define NOBUFS +/* +** #define DVB_DEMUX_SECTION_LOSS_LOG to monitor payload loss in the syslog +*/ +// #define DVB_DEMUX_SECTION_LOSS_LOG + LIST_HEAD(dmx_muxs); @@ -218,13 +223,6 @@ static inline int dvb_dmx_swfilter_section_feed (struct dvb_demux_feed *feed) } - -#if 1 -/* -** #define DVB_DEMUX_SECTION_LOSS_LOG to monitor payload loss in the syslog -*/ -// #define DVB_DEMUX_SECTION_LOSS_LOG - static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) { struct dmx_section_feed *sec = &feed->feed.sec; @@ -287,7 +285,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, const limit = sec->tsfeedp; if(limit > DMX_MAX_SECFEED_SIZE) - return -1; /* internal error shoud never happen */ + return -1; /* internal error should never happen */ /* to be sure always set secbuf */ sec->secbuf = sec->secbuf_base + sec->secbufp; @@ -331,7 +329,7 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 #ifdef DVB_DEMUX_SECTION_LOSS_LOG printk("dvb_demux.c discontinuity detected %d bytes lost\n", count); /* those bytes under sume circumstances will again be reported - ** in the fullowing dvb_dmx_swfilter_section_new + ** in the following dvb_dmx_swfilter_section_new */ #endif dvb_dmx_swfilter_section_new(feed); @@ -368,133 +366,7 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 } return 0; } -#else -static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 *buf) -{ - struct dvb_demux *demux = feed->demux; - struct dmx_section_feed *sec = &feed->feed.sec; - int p, count; - int ccok, rest; - u8 cc; - - if (!(count = payload(buf))) - return -1; - - p = 188-count; - - cc = buf[3] & 0x0f; - ccok = ((feed->cc+1) & 0x0f) == cc ? 1 : 0; - feed->cc = cc; - - if (buf[1] & 0x40) { // PUSI set - // offset to start of first section is in buf[p] - if (p+buf[p]>187) // trash if it points beyond packet - return -1; - - if (buf[p] && ccok) { // rest of previous section? - // did we have enough data in last packet to calc length? - int tmp = 3 - sec->secbufp; - - if (tmp > 0 && tmp != 3) { - if (p + tmp >= 187) - return -1; - - demux->memcopy (feed, sec->secbuf+sec->secbufp, - buf+p+1, tmp); - - sec->seclen = section_length(sec->secbuf); - - if (sec->seclen > 4096) - return -1; - } - - rest = sec->seclen - sec->secbufp; - - if (rest == buf[p] && sec->seclen) { - demux->memcopy (feed, sec->secbuf + sec->secbufp, - buf+p+1, buf[p]); - sec->secbufp += buf[p]; - dvb_dmx_swfilter_section_feed(feed); - } - } - - p += buf[p] + 1; // skip rest of last section - count = 188 - p; - while (count > 0) { - - sec->crc_val = ~0; - - if ((count>2) && // enough data to determine sec length? - ((sec->seclen = section_length(buf+p)) <= count)) { - if (sec->seclen>4096) - return -1; - - demux->memcopy (feed, sec->secbuf, buf+p, - sec->seclen); - - sec->secbufp = sec->seclen; - p += sec->seclen; - count = 188 - p; - - dvb_dmx_swfilter_section_feed(feed); - - // filling bytes until packet end? - if (count && buf[p]==0xff) - count=0; - - } else { // section continues to following TS packet - demux->memcopy(feed, sec->secbuf, buf+p, count); - sec->secbufp+=count; - count=0; - } - } - - return 0; - } - - // section continued below - if (!ccok) - return -1; - - if (!sec->secbufp) // any data in last ts packet? - return -1; - - // did we have enough data in last packet to calc section length? - if (sec->secbufp < 3) { - int tmp = 3 - sec->secbufp; - - if (tmp>count) - return -1; - - sec->crc_val = ~0; - - demux->memcopy (feed, sec->secbuf + sec->secbufp, buf+p, tmp); - - sec->seclen = section_length(sec->secbuf); - - if (sec->seclen > 4096) - return -1; - } - - rest = sec->seclen - sec->secbufp; - - if (rest < 0) - return -1; - - if (rest <= count) { // section completed in this TS packet - demux->memcopy (feed, sec->secbuf + sec->secbufp, buf+p, rest); - sec->secbufp += rest; - dvb_dmx_swfilter_section_feed(feed); - } else { // section continues in following ts packet - demux->memcopy (feed, sec->secbuf + sec->secbufp, buf+p, count); - sec->secbufp += count; - } - - return 0; -} - -#endif static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, const u8 *buf) { |