Lines Matching full:feed

90 	return (f->feed.sec.crc_val = crc32_be(f->feed.sec.crc_val, src, len));  in dvb_dmx_crc32()
103 static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_payload() argument
117 ccok = ((feed->cc + 1) & 0x0f) == cc; in dvb_dmx_swfilter_payload()
118 feed->cc = cc; in dvb_dmx_swfilter_payload()
120 set_buf_flags(feed, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED); in dvb_dmx_swfilter_payload()
122 cc, (feed->cc + 1) & 0x0f); in dvb_dmx_swfilter_payload()
126 feed->peslen = 0xfffa; in dvb_dmx_swfilter_payload()
128 feed->peslen += count; in dvb_dmx_swfilter_payload()
130 return feed->cb.ts(&buf[p], count, NULL, 0, &feed->feed.ts, in dvb_dmx_swfilter_payload()
131 &feed->buffer_flags); in dvb_dmx_swfilter_payload()
134 static int dvb_dmx_swfilter_sectionfilter(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_sectionfilter() argument
141 u8 xor = f->filter.filter_value[i] ^ feed->feed.sec.secbuf[i]; in dvb_dmx_swfilter_sectionfilter()
152 return feed->cb.sec(feed->feed.sec.secbuf, feed->feed.sec.seclen, in dvb_dmx_swfilter_sectionfilter()
153 NULL, 0, &f->filter, &feed->buffer_flags); in dvb_dmx_swfilter_sectionfilter()
156 static inline int dvb_dmx_swfilter_section_feed(struct dvb_demux_feed *feed) in dvb_dmx_swfilter_section_feed() argument
158 struct dvb_demux *demux = feed->demux; in dvb_dmx_swfilter_section_feed()
159 struct dvb_demux_filter *f = feed->filter; in dvb_dmx_swfilter_section_feed()
160 struct dmx_section_feed *sec = &feed->feed.sec; in dvb_dmx_swfilter_section_feed()
172 demux->check_crc32(feed, sec->secbuf, sec->seclen)) { in dvb_dmx_swfilter_section_feed()
173 set_buf_flags(feed, DMX_BUFFER_FLAG_HAD_CRC32_DISCARD); in dvb_dmx_swfilter_section_feed()
179 if (dvb_dmx_swfilter_sectionfilter(feed, f) < 0) in dvb_dmx_swfilter_section_feed()
188 static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) in dvb_dmx_swfilter_section_new() argument
190 struct dmx_section_feed *sec = &feed->feed.sec; in dvb_dmx_swfilter_section_new()
201 set_buf_flags(feed, in dvb_dmx_swfilter_section_new()
220 * In this case, without feed->pusi_seen you'll receive a garbage section
226 * when demux is started, let feed->pusi_seen = false to
229 * then set feed->pusi_seen = true
231 static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_section_copy_dump() argument
234 struct dvb_demux *demux = feed->demux; in dvb_dmx_swfilter_section_copy_dump()
235 struct dmx_section_feed *sec = &feed->feed.sec; in dvb_dmx_swfilter_section_copy_dump()
242 set_buf_flags(feed, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED); in dvb_dmx_swfilter_section_copy_dump()
252 demux->memcopy(feed, sec->secbuf_base + sec->tsfeedp, buf, len); in dvb_dmx_swfilter_section_copy_dump()
273 if (feed->pusi_seen) { in dvb_dmx_swfilter_section_copy_dump()
274 dvb_dmx_swfilter_section_feed(feed); in dvb_dmx_swfilter_section_copy_dump()
276 set_buf_flags(feed, in dvb_dmx_swfilter_section_copy_dump()
287 static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_section_packet() argument
302 ccok = ((feed->cc + 1) & 0x0f) == cc; in dvb_dmx_swfilter_section_packet()
303 feed->cc = cc; in dvb_dmx_swfilter_section_packet()
313 set_buf_flags(feed, in dvb_dmx_swfilter_section_packet()
318 set_buf_flags(feed, in dvb_dmx_swfilter_section_packet()
321 cc, (feed->cc + 1) & 0x0f, count + 4); in dvb_dmx_swfilter_section_packet()
336 feed->pusi_seen = false; in dvb_dmx_swfilter_section_packet()
337 dvb_dmx_swfilter_section_new(feed); in dvb_dmx_swfilter_section_packet()
348 dvb_dmx_swfilter_section_copy_dump(feed, before, in dvb_dmx_swfilter_section_packet()
351 feed->pusi_seen = true; in dvb_dmx_swfilter_section_packet()
352 dvb_dmx_swfilter_section_new(feed); in dvb_dmx_swfilter_section_packet()
353 dvb_dmx_swfilter_section_copy_dump(feed, after, in dvb_dmx_swfilter_section_packet()
356 set_buf_flags(feed, in dvb_dmx_swfilter_section_packet()
362 dvb_dmx_swfilter_section_copy_dump(feed, &buf[p], count); in dvb_dmx_swfilter_section_packet()
368 static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_packet_type() argument
371 switch (feed->type) { in dvb_dmx_swfilter_packet_type()
373 if (!feed->feed.ts.is_filtering) in dvb_dmx_swfilter_packet_type()
375 if (feed->ts_type & TS_PACKET) { in dvb_dmx_swfilter_packet_type()
376 if (feed->ts_type & TS_PAYLOAD_ONLY) in dvb_dmx_swfilter_packet_type()
377 dvb_dmx_swfilter_payload(feed, buf); in dvb_dmx_swfilter_packet_type()
379 feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, in dvb_dmx_swfilter_packet_type()
380 &feed->buffer_flags); in dvb_dmx_swfilter_packet_type()
383 if (feed->ts_type & TS_DECODER) in dvb_dmx_swfilter_packet_type()
384 if (feed->demux->write_to_decoder) in dvb_dmx_swfilter_packet_type()
385 feed->demux->write_to_decoder(feed, buf, 188); in dvb_dmx_swfilter_packet_type()
389 if (!feed->feed.sec.is_filtering) in dvb_dmx_swfilter_packet_type()
391 if (dvb_dmx_swfilter_section_packet(feed, buf) < 0) in dvb_dmx_swfilter_packet_type()
392 feed->feed.sec.seclen = feed->feed.sec.secbufp = 0; in dvb_dmx_swfilter_packet_type()
402 ((f)->feed.ts.is_filtering) && \
407 struct dvb_demux_feed *feed; in dvb_dmx_swfilter_packet() local
441 list_for_each_entry(feed, &demux->feed_list, list_head) { in dvb_dmx_swfilter_packet()
442 if ((feed->pid != pid) && (feed->pid != 0x2000)) in dvb_dmx_swfilter_packet()
444 set_buf_flags(feed, DMX_BUFFER_FLAG_TEI); in dvb_dmx_swfilter_packet()
461 list_for_each_entry(feed, &demux->feed_list, list_head) { in dvb_dmx_swfilter_packet()
462 if ((feed->pid != pid) && (feed->pid != 0x2000)) in dvb_dmx_swfilter_packet()
464 set_buf_flags(feed, in dvb_dmx_swfilter_packet()
477 list_for_each_entry(feed, &demux->feed_list, list_head) { in dvb_dmx_swfilter_packet()
478 if ((feed->pid != pid) && (feed->pid != 0x2000)) in dvb_dmx_swfilter_packet()
483 if ((DVR_FEED(feed)) && (dvr_done++)) in dvb_dmx_swfilter_packet()
486 if (feed->pid == pid) in dvb_dmx_swfilter_packet()
487 dvb_dmx_swfilter_packet_type(feed, buf); in dvb_dmx_swfilter_packet()
488 else if (feed->pid == 0x2000) in dvb_dmx_swfilter_packet()
489 feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, in dvb_dmx_swfilter_packet()
490 &feed->buffer_flags); in dvb_dmx_swfilter_packet()
609 demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts, in dvb_dmx_swfilter_raw()
610 &demux->feed->buffer_flags); in dvb_dmx_swfilter_raw()
637 if (demux->feed[i].state == DMX_STATE_FREE) in dvb_dmx_feed_alloc()
643 demux->feed[i].state = DMX_STATE_ALLOCATED; in dvb_dmx_feed_alloc()
645 return &demux->feed[i]; in dvb_dmx_feed_alloc()
648 static int dvb_demux_feed_find(struct dvb_demux_feed *feed) in dvb_demux_feed_find() argument
652 list_for_each_entry(entry, &feed->demux->feed_list, list_head) in dvb_demux_feed_find()
653 if (entry == feed) in dvb_demux_feed_find()
659 static void dvb_demux_feed_add(struct dvb_demux_feed *feed) in dvb_demux_feed_add() argument
661 spin_lock_irq(&feed->demux->lock); in dvb_demux_feed_add()
662 if (dvb_demux_feed_find(feed)) { in dvb_demux_feed_add()
663 pr_err("%s: feed already in list (type=%x state=%x pid=%x)\n", in dvb_demux_feed_add()
664 __func__, feed->type, feed->state, feed->pid); in dvb_demux_feed_add()
668 list_add(&feed->list_head, &feed->demux->feed_list); in dvb_demux_feed_add()
670 spin_unlock_irq(&feed->demux->lock); in dvb_demux_feed_add()
673 static void dvb_demux_feed_del(struct dvb_demux_feed *feed) in dvb_demux_feed_del() argument
675 spin_lock_irq(&feed->demux->lock); in dvb_demux_feed_del()
676 if (!(dvb_demux_feed_find(feed))) { in dvb_demux_feed_del()
677 pr_err("%s: feed not in list (type=%x state=%x pid=%x)\n", in dvb_demux_feed_del()
678 __func__, feed->type, feed->state, feed->pid); in dvb_demux_feed_del()
682 list_del(&feed->list_head); in dvb_demux_feed_del()
684 spin_unlock_irq(&feed->demux->lock); in dvb_demux_feed_del()
690 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; in dmx_ts_feed_set() local
691 struct dvb_demux *demux = feed->demux; in dmx_ts_feed_set()
706 demux->pesfilter[pes_type] != feed) { in dmx_ts_feed_set()
711 demux->pesfilter[pes_type] = feed; in dmx_ts_feed_set()
715 dvb_demux_feed_add(feed); in dmx_ts_feed_set()
717 feed->pid = pid; in dmx_ts_feed_set()
718 feed->timeout = timeout; in dmx_ts_feed_set()
719 feed->ts_type = ts_type; in dmx_ts_feed_set()
720 feed->pes_type = pes_type; in dmx_ts_feed_set()
722 feed->state = DMX_STATE_READY; in dmx_ts_feed_set()
730 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; in dmx_ts_feed_start_filtering() local
731 struct dvb_demux *demux = feed->demux; in dmx_ts_feed_start_filtering()
737 if (feed->state != DMX_STATE_READY || feed->type != DMX_TYPE_TS) { in dmx_ts_feed_start_filtering()
747 if ((ret = demux->start_feed(feed)) < 0) { in dmx_ts_feed_start_filtering()
754 feed->state = DMX_STATE_GO; in dmx_ts_feed_start_filtering()
763 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; in dmx_ts_feed_stop_filtering() local
764 struct dvb_demux *demux = feed->demux; in dmx_ts_feed_stop_filtering()
769 if (feed->state < DMX_STATE_GO) { in dmx_ts_feed_stop_filtering()
779 ret = demux->stop_feed(feed); in dmx_ts_feed_stop_filtering()
783 feed->state = DMX_STATE_ALLOCATED; in dmx_ts_feed_stop_filtering()
795 struct dvb_demux_feed *feed; in dvbdmx_allocate_ts_feed() local
800 if (!(feed = dvb_dmx_feed_alloc(demux))) { in dvbdmx_allocate_ts_feed()
805 feed->type = DMX_TYPE_TS; in dvbdmx_allocate_ts_feed()
806 feed->cb.ts = callback; in dvbdmx_allocate_ts_feed()
807 feed->demux = demux; in dvbdmx_allocate_ts_feed()
808 feed->pid = 0xffff; in dvbdmx_allocate_ts_feed()
809 feed->peslen = 0xfffa; in dvbdmx_allocate_ts_feed()
810 feed->buffer_flags = 0; in dvbdmx_allocate_ts_feed()
812 (*ts_feed) = &feed->feed.ts; in dvbdmx_allocate_ts_feed()
820 if (!(feed->filter = dvb_dmx_filter_alloc(demux))) { in dvbdmx_allocate_ts_feed()
821 feed->state = DMX_STATE_FREE; in dvbdmx_allocate_ts_feed()
826 feed->filter->type = DMX_TYPE_TS; in dvbdmx_allocate_ts_feed()
827 feed->filter->feed = feed; in dvbdmx_allocate_ts_feed()
828 feed->filter->state = DMX_STATE_READY; in dvbdmx_allocate_ts_feed()
839 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; in dvbdmx_release_ts_feed() local
843 if (feed->state == DMX_STATE_FREE) { in dvbdmx_release_ts_feed()
848 feed->state = DMX_STATE_FREE; in dvbdmx_release_ts_feed()
849 feed->filter->state = DMX_STATE_FREE; in dvbdmx_release_ts_feed()
851 dvb_demux_feed_del(feed); in dvbdmx_release_ts_feed()
853 feed->pid = 0xffff; in dvbdmx_release_ts_feed()
855 if (feed->ts_type & TS_DECODER && feed->pes_type < DMX_PES_OTHER) in dvbdmx_release_ts_feed()
856 demux->pesfilter[feed->pes_type] = NULL; in dvbdmx_release_ts_feed()
866 static int dmx_section_feed_allocate_filter(struct dmx_section_feed *feed, in dmx_section_feed_allocate_filter() argument
869 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_allocate_filter()
884 (*filter)->parent = feed; in dmx_section_feed_allocate_filter()
886 dvbdmxfilter->feed = dvbdmxfeed; in dmx_section_feed_allocate_filter()
897 static int dmx_section_feed_set(struct dmx_section_feed *feed, in dmx_section_feed_set() argument
900 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_set()
912 dvbdmxfeed->feed.sec.check_crc = check_crc; in dmx_section_feed_set()
941 static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed) in dmx_section_feed_start_filtering() argument
943 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_start_filtering()
950 if (feed->is_filtering) { in dmx_section_feed_start_filtering()
960 dvbdmxfeed->feed.sec.tsfeedp = 0; in dmx_section_feed_start_filtering()
961 dvbdmxfeed->feed.sec.secbuf = dvbdmxfeed->feed.sec.secbuf_base; in dmx_section_feed_start_filtering()
962 dvbdmxfeed->feed.sec.secbufp = 0; in dmx_section_feed_start_filtering()
963 dvbdmxfeed->feed.sec.seclen = 0; in dmx_section_feed_start_filtering()
979 feed->is_filtering = 1; in dmx_section_feed_start_filtering()
987 static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed) in dmx_section_feed_stop_filtering() argument
989 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_stop_filtering()
1004 feed->is_filtering = 0; in dmx_section_feed_stop_filtering()
1011 static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, in dmx_section_feed_release_filter() argument
1015 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_release_filter()
1020 if (dvbdmxfilter->feed != dvbdmxfeed) { in dmx_section_feed_release_filter()
1025 if (feed->is_filtering) { in dmx_section_feed_release_filter()
1029 feed->stop_filtering(feed); in dmx_section_feed_release_filter()
1051 struct dmx_section_feed **feed, in dvbdmx_allocate_section_feed() argument
1070 dvbdmxfeed->feed.sec.secbuf = dvbdmxfeed->feed.sec.secbuf_base; in dvbdmx_allocate_section_feed()
1071 dvbdmxfeed->feed.sec.secbufp = dvbdmxfeed->feed.sec.seclen = 0; in dvbdmx_allocate_section_feed()
1072 dvbdmxfeed->feed.sec.tsfeedp = 0; in dvbdmx_allocate_section_feed()
1075 (*feed) = &dvbdmxfeed->feed.sec; in dvbdmx_allocate_section_feed()
1076 (*feed)->is_filtering = 0; in dvbdmx_allocate_section_feed()
1077 (*feed)->parent = demux; in dvbdmx_allocate_section_feed()
1078 (*feed)->priv = NULL; in dvbdmx_allocate_section_feed()
1080 (*feed)->set = dmx_section_feed_set; in dvbdmx_allocate_section_feed()
1081 (*feed)->allocate_filter = dmx_section_feed_allocate_filter; in dvbdmx_allocate_section_feed()
1082 (*feed)->start_filtering = dmx_section_feed_start_filtering; in dvbdmx_allocate_section_feed()
1083 (*feed)->stop_filtering = dmx_section_feed_stop_filtering; in dvbdmx_allocate_section_feed()
1084 (*feed)->release_filter = dmx_section_feed_release_filter; in dvbdmx_allocate_section_feed()
1091 struct dmx_section_feed *feed) in dvbdmx_release_section_feed() argument
1093 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dvbdmx_release_section_feed()
1247 dvbdemux->feed = vmalloc(array_size(sizeof(struct dvb_demux_feed), in dvb_dmx_init()
1249 if (!dvbdemux->feed) { in dvb_dmx_init()
1259 dvbdemux->feed[i].state = DMX_STATE_FREE; in dvb_dmx_init()
1260 dvbdemux->feed[i].index = i; in dvb_dmx_init()
1315 vfree(dvbdemux->feed); in dvb_dmx_release()