Lines Matching refs:feed
100 return (f->feed.sec.crc_val = crc32_be(f->feed.sec.crc_val, src, len)); in dvb_dmx_crc32()
113 static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_payload() argument
127 ccok = ((feed->cc + 1) & 0x0f) == cc; in dvb_dmx_swfilter_payload()
129 set_buf_flags(feed, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED); in dvb_dmx_swfilter_payload()
131 cc, (feed->cc + 1) & 0x0f); in dvb_dmx_swfilter_payload()
133 feed->cc = cc; in dvb_dmx_swfilter_payload()
136 feed->peslen = 0xfffa; in dvb_dmx_swfilter_payload()
138 feed->peslen += count; in dvb_dmx_swfilter_payload()
140 return feed->cb.ts(&buf[p], count, NULL, 0, &feed->feed.ts, in dvb_dmx_swfilter_payload()
141 &feed->buffer_flags); in dvb_dmx_swfilter_payload()
144 static int dvb_dmx_swfilter_sectionfilter(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_sectionfilter() argument
151 u8 xor = f->filter.filter_value[i] ^ feed->feed.sec.secbuf[i]; in dvb_dmx_swfilter_sectionfilter()
162 return feed->cb.sec(feed->feed.sec.secbuf, feed->feed.sec.seclen, in dvb_dmx_swfilter_sectionfilter()
163 NULL, 0, &f->filter, &feed->buffer_flags); in dvb_dmx_swfilter_sectionfilter()
166 static inline int dvb_dmx_swfilter_section_feed(struct dvb_demux_feed *feed) in dvb_dmx_swfilter_section_feed() argument
168 struct dvb_demux *demux = feed->demux; in dvb_dmx_swfilter_section_feed()
169 struct dvb_demux_filter *f = feed->filter; in dvb_dmx_swfilter_section_feed()
170 struct dmx_section_feed *sec = &feed->feed.sec; in dvb_dmx_swfilter_section_feed()
182 demux->check_crc32(feed, sec->secbuf, sec->seclen)) { in dvb_dmx_swfilter_section_feed()
183 set_buf_flags(feed, DMX_BUFFER_FLAG_HAD_CRC32_DISCARD); in dvb_dmx_swfilter_section_feed()
189 if (dvb_dmx_swfilter_sectionfilter(feed, f) < 0) in dvb_dmx_swfilter_section_feed()
198 static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) in dvb_dmx_swfilter_section_new() argument
200 struct dmx_section_feed *sec = &feed->feed.sec; in dvb_dmx_swfilter_section_new()
211 set_buf_flags(feed, in dvb_dmx_swfilter_section_new()
241 static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_section_copy_dump() argument
244 struct dvb_demux *demux = feed->demux; in dvb_dmx_swfilter_section_copy_dump()
245 struct dmx_section_feed *sec = &feed->feed.sec; in dvb_dmx_swfilter_section_copy_dump()
252 set_buf_flags(feed, DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED); in dvb_dmx_swfilter_section_copy_dump()
262 demux->memcopy(feed, sec->secbuf_base + sec->tsfeedp, buf, len); in dvb_dmx_swfilter_section_copy_dump()
283 if (feed->pusi_seen) { in dvb_dmx_swfilter_section_copy_dump()
284 dvb_dmx_swfilter_section_feed(feed); in dvb_dmx_swfilter_section_copy_dump()
286 set_buf_flags(feed, in dvb_dmx_swfilter_section_copy_dump()
297 static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_section_packet() argument
312 ccok = ((feed->cc + 1) & 0x0f) == cc; in dvb_dmx_swfilter_section_packet()
322 set_buf_flags(feed, in dvb_dmx_swfilter_section_packet()
327 set_buf_flags(feed, in dvb_dmx_swfilter_section_packet()
330 cc, (feed->cc + 1) & 0x0f, count + 4); in dvb_dmx_swfilter_section_packet()
345 feed->pusi_seen = false; in dvb_dmx_swfilter_section_packet()
346 dvb_dmx_swfilter_section_new(feed); in dvb_dmx_swfilter_section_packet()
348 feed->cc = cc; in dvb_dmx_swfilter_section_packet()
358 dvb_dmx_swfilter_section_copy_dump(feed, before, in dvb_dmx_swfilter_section_packet()
361 feed->pusi_seen = true; in dvb_dmx_swfilter_section_packet()
362 dvb_dmx_swfilter_section_new(feed); in dvb_dmx_swfilter_section_packet()
363 dvb_dmx_swfilter_section_copy_dump(feed, after, in dvb_dmx_swfilter_section_packet()
366 set_buf_flags(feed, in dvb_dmx_swfilter_section_packet()
372 dvb_dmx_swfilter_section_copy_dump(feed, &buf[p], count); in dvb_dmx_swfilter_section_packet()
378 static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, in dvb_dmx_swfilter_packet_type() argument
381 switch (feed->type) { in dvb_dmx_swfilter_packet_type()
383 if (!feed->feed.ts.is_filtering) in dvb_dmx_swfilter_packet_type()
385 if (feed->ts_type & TS_PACKET) { in dvb_dmx_swfilter_packet_type()
386 if (feed->ts_type & TS_PAYLOAD_ONLY) in dvb_dmx_swfilter_packet_type()
387 dvb_dmx_swfilter_payload(feed, buf); in dvb_dmx_swfilter_packet_type()
389 feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, in dvb_dmx_swfilter_packet_type()
390 &feed->buffer_flags); in dvb_dmx_swfilter_packet_type()
393 if (feed->ts_type & TS_DECODER) in dvb_dmx_swfilter_packet_type()
394 if (feed->demux->write_to_decoder) in dvb_dmx_swfilter_packet_type()
395 feed->demux->write_to_decoder(feed, buf, 188); in dvb_dmx_swfilter_packet_type()
399 if (!feed->feed.sec.is_filtering) in dvb_dmx_swfilter_packet_type()
401 if (dvb_dmx_swfilter_section_packet(feed, buf) < 0) in dvb_dmx_swfilter_packet_type()
402 feed->feed.sec.seclen = feed->feed.sec.secbufp = 0; in dvb_dmx_swfilter_packet_type()
412 ((f)->feed.ts.is_filtering) && \
417 struct dvb_demux_feed *feed; in dvb_dmx_swfilter_packet() local
451 list_for_each_entry(feed, &demux->feed_list, list_head) { in dvb_dmx_swfilter_packet()
452 if ((feed->pid != pid) && (feed->pid != 0x2000)) in dvb_dmx_swfilter_packet()
454 set_buf_flags(feed, DMX_BUFFER_FLAG_TEI); in dvb_dmx_swfilter_packet()
471 list_for_each_entry(feed, &demux->feed_list, list_head) { in dvb_dmx_swfilter_packet()
472 if ((feed->pid != pid) && (feed->pid != 0x2000)) in dvb_dmx_swfilter_packet()
474 set_buf_flags(feed, in dvb_dmx_swfilter_packet()
487 list_for_each_entry(feed, &demux->feed_list, list_head) { in dvb_dmx_swfilter_packet()
488 if ((feed->pid != pid) && (feed->pid != 0x2000)) in dvb_dmx_swfilter_packet()
493 if ((DVR_FEED(feed)) && (dvr_done++)) in dvb_dmx_swfilter_packet()
496 if (feed->pid == pid) in dvb_dmx_swfilter_packet()
497 dvb_dmx_swfilter_packet_type(feed, buf); in dvb_dmx_swfilter_packet()
498 else if (feed->pid == 0x2000) in dvb_dmx_swfilter_packet()
499 feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, in dvb_dmx_swfilter_packet()
500 &feed->buffer_flags); in dvb_dmx_swfilter_packet()
619 demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts, in dvb_dmx_swfilter_raw()
620 &demux->feed->buffer_flags); in dvb_dmx_swfilter_raw()
647 if (demux->feed[i].state == DMX_STATE_FREE) in dvb_dmx_feed_alloc()
653 demux->feed[i].state = DMX_STATE_ALLOCATED; in dvb_dmx_feed_alloc()
655 return &demux->feed[i]; in dvb_dmx_feed_alloc()
658 static int dvb_demux_feed_find(struct dvb_demux_feed *feed) in dvb_demux_feed_find() argument
662 list_for_each_entry(entry, &feed->demux->feed_list, list_head) in dvb_demux_feed_find()
663 if (entry == feed) in dvb_demux_feed_find()
669 static void dvb_demux_feed_add(struct dvb_demux_feed *feed) in dvb_demux_feed_add() argument
671 spin_lock_irq(&feed->demux->lock); in dvb_demux_feed_add()
672 if (dvb_demux_feed_find(feed)) { in dvb_demux_feed_add()
674 __func__, feed->type, feed->state, feed->pid); in dvb_demux_feed_add()
678 list_add(&feed->list_head, &feed->demux->feed_list); in dvb_demux_feed_add()
680 spin_unlock_irq(&feed->demux->lock); in dvb_demux_feed_add()
683 static void dvb_demux_feed_del(struct dvb_demux_feed *feed) in dvb_demux_feed_del() argument
685 spin_lock_irq(&feed->demux->lock); in dvb_demux_feed_del()
686 if (!(dvb_demux_feed_find(feed))) { in dvb_demux_feed_del()
688 __func__, feed->type, feed->state, feed->pid); in dvb_demux_feed_del()
692 list_del(&feed->list_head); in dvb_demux_feed_del()
694 spin_unlock_irq(&feed->demux->lock); in dvb_demux_feed_del()
700 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; in dmx_ts_feed_set() local
701 struct dvb_demux *demux = feed->demux; in dmx_ts_feed_set()
716 demux->pesfilter[pes_type] != feed) { in dmx_ts_feed_set()
721 demux->pesfilter[pes_type] = feed; in dmx_ts_feed_set()
725 dvb_demux_feed_add(feed); in dmx_ts_feed_set()
727 feed->pid = pid; in dmx_ts_feed_set()
728 feed->timeout = timeout; in dmx_ts_feed_set()
729 feed->ts_type = ts_type; in dmx_ts_feed_set()
730 feed->pes_type = pes_type; in dmx_ts_feed_set()
732 feed->state = DMX_STATE_READY; in dmx_ts_feed_set()
740 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; in dmx_ts_feed_start_filtering() local
741 struct dvb_demux *demux = feed->demux; in dmx_ts_feed_start_filtering()
747 if (feed->state != DMX_STATE_READY || feed->type != DMX_TYPE_TS) { in dmx_ts_feed_start_filtering()
757 if ((ret = demux->start_feed(feed)) < 0) { in dmx_ts_feed_start_filtering()
764 feed->state = DMX_STATE_GO; in dmx_ts_feed_start_filtering()
773 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; in dmx_ts_feed_stop_filtering() local
774 struct dvb_demux *demux = feed->demux; in dmx_ts_feed_stop_filtering()
779 if (feed->state < DMX_STATE_GO) { in dmx_ts_feed_stop_filtering()
789 ret = demux->stop_feed(feed); in dmx_ts_feed_stop_filtering()
793 feed->state = DMX_STATE_ALLOCATED; in dmx_ts_feed_stop_filtering()
805 struct dvb_demux_feed *feed; in dvbdmx_allocate_ts_feed() local
810 if (!(feed = dvb_dmx_feed_alloc(demux))) { in dvbdmx_allocate_ts_feed()
815 feed->type = DMX_TYPE_TS; in dvbdmx_allocate_ts_feed()
816 feed->cb.ts = callback; in dvbdmx_allocate_ts_feed()
817 feed->demux = demux; in dvbdmx_allocate_ts_feed()
818 feed->pid = 0xffff; in dvbdmx_allocate_ts_feed()
819 feed->peslen = 0xfffa; in dvbdmx_allocate_ts_feed()
820 feed->buffer_flags = 0; in dvbdmx_allocate_ts_feed()
822 (*ts_feed) = &feed->feed.ts; in dvbdmx_allocate_ts_feed()
830 if (!(feed->filter = dvb_dmx_filter_alloc(demux))) { in dvbdmx_allocate_ts_feed()
831 feed->state = DMX_STATE_FREE; in dvbdmx_allocate_ts_feed()
836 feed->filter->type = DMX_TYPE_TS; in dvbdmx_allocate_ts_feed()
837 feed->filter->feed = feed; in dvbdmx_allocate_ts_feed()
838 feed->filter->state = DMX_STATE_READY; in dvbdmx_allocate_ts_feed()
849 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; in dvbdmx_release_ts_feed() local
853 if (feed->state == DMX_STATE_FREE) { in dvbdmx_release_ts_feed()
858 feed->state = DMX_STATE_FREE; in dvbdmx_release_ts_feed()
859 feed->filter->state = DMX_STATE_FREE; in dvbdmx_release_ts_feed()
861 dvb_demux_feed_del(feed); in dvbdmx_release_ts_feed()
863 feed->pid = 0xffff; in dvbdmx_release_ts_feed()
865 if (feed->ts_type & TS_DECODER && feed->pes_type < DMX_PES_OTHER) in dvbdmx_release_ts_feed()
866 demux->pesfilter[feed->pes_type] = NULL; in dvbdmx_release_ts_feed()
876 static int dmx_section_feed_allocate_filter(struct dmx_section_feed *feed, in dmx_section_feed_allocate_filter() argument
879 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_allocate_filter()
894 (*filter)->parent = feed; in dmx_section_feed_allocate_filter()
896 dvbdmxfilter->feed = dvbdmxfeed; in dmx_section_feed_allocate_filter()
907 static int dmx_section_feed_set(struct dmx_section_feed *feed, in dmx_section_feed_set() argument
910 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_set()
922 dvbdmxfeed->feed.sec.check_crc = check_crc; in dmx_section_feed_set()
951 static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed) in dmx_section_feed_start_filtering() argument
953 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_start_filtering()
960 if (feed->is_filtering) { in dmx_section_feed_start_filtering()
970 dvbdmxfeed->feed.sec.tsfeedp = 0; in dmx_section_feed_start_filtering()
971 dvbdmxfeed->feed.sec.secbuf = dvbdmxfeed->feed.sec.secbuf_base; in dmx_section_feed_start_filtering()
972 dvbdmxfeed->feed.sec.secbufp = 0; in dmx_section_feed_start_filtering()
973 dvbdmxfeed->feed.sec.seclen = 0; in dmx_section_feed_start_filtering()
989 feed->is_filtering = 1; in dmx_section_feed_start_filtering()
997 static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed) in dmx_section_feed_stop_filtering() argument
999 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_stop_filtering()
1014 feed->is_filtering = 0; in dmx_section_feed_stop_filtering()
1021 static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, in dmx_section_feed_release_filter() argument
1025 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dmx_section_feed_release_filter()
1030 if (dvbdmxfilter->feed != dvbdmxfeed) { in dmx_section_feed_release_filter()
1035 if (feed->is_filtering) { in dmx_section_feed_release_filter()
1039 feed->stop_filtering(feed); in dmx_section_feed_release_filter()
1061 struct dmx_section_feed **feed, in dvbdmx_allocate_section_feed() argument
1080 dvbdmxfeed->feed.sec.secbuf = dvbdmxfeed->feed.sec.secbuf_base; in dvbdmx_allocate_section_feed()
1081 dvbdmxfeed->feed.sec.secbufp = dvbdmxfeed->feed.sec.seclen = 0; in dvbdmx_allocate_section_feed()
1082 dvbdmxfeed->feed.sec.tsfeedp = 0; in dvbdmx_allocate_section_feed()
1085 (*feed) = &dvbdmxfeed->feed.sec; in dvbdmx_allocate_section_feed()
1086 (*feed)->is_filtering = 0; in dvbdmx_allocate_section_feed()
1087 (*feed)->parent = demux; in dvbdmx_allocate_section_feed()
1088 (*feed)->priv = NULL; in dvbdmx_allocate_section_feed()
1090 (*feed)->set = dmx_section_feed_set; in dvbdmx_allocate_section_feed()
1091 (*feed)->allocate_filter = dmx_section_feed_allocate_filter; in dvbdmx_allocate_section_feed()
1092 (*feed)->start_filtering = dmx_section_feed_start_filtering; in dvbdmx_allocate_section_feed()
1093 (*feed)->stop_filtering = dmx_section_feed_stop_filtering; in dvbdmx_allocate_section_feed()
1094 (*feed)->release_filter = dmx_section_feed_release_filter; in dvbdmx_allocate_section_feed()
1101 struct dmx_section_feed *feed) in dvbdmx_release_section_feed() argument
1103 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; in dvbdmx_release_section_feed()
1257 dvbdemux->feed = vmalloc(array_size(sizeof(struct dvb_demux_feed), in dvb_dmx_init()
1259 if (!dvbdemux->feed) { in dvb_dmx_init()
1269 dvbdemux->feed[i].state = DMX_STATE_FREE; in dvb_dmx_init()
1270 dvbdemux->feed[i].index = i; in dvb_dmx_init()
1325 vfree(dvbdemux->feed); in dvb_dmx_release()