Lines Matching defs:demux
2 * dvb_demux.c - DVB kernel demux API
138 struct dvb_demux *demux = feed->demux;
152 demux->check_crc32(feed, sec->secbuf, sec->seclen))
207 * when demux is started, let feed->pusi_seen = 0 to
215 struct dvb_demux *demux = feed->demux;
234 demux->memcopy(feed, sec->secbuf_base + sec->tsfeedp, buf, len);
352 if (feed->demux->write_to_decoder)
353 feed->demux->write_to_decoder(feed, buf, 188);
373 static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
376 struct list_head *pos, *head = &demux->feed_list;
402 void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
405 spin_lock(&demux->lock);
409 dvb_dmx_swfilter_packet(demux, buf);
413 spin_unlock(&demux->lock);
418 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
422 spin_lock(&demux->lock);
424 if (demux->tsbufp) {
425 i = demux->tsbufp;
428 memcpy(&demux->tsbuf[i], buf, count);
429 demux->tsbufp += count;
432 memcpy(&demux->tsbuf[i], buf, j);
433 if (demux->tsbuf[0] == 0x47)
434 dvb_dmx_swfilter_packet(demux, demux->tsbuf);
435 demux->tsbufp = 0;
442 dvb_dmx_swfilter_packet(demux, &buf[p]);
446 memcpy(demux->tsbuf, &buf[p], i);
447 demux->tsbufp = i;
455 spin_unlock(&demux->lock);
460 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
465 spin_lock(&demux->lock);
467 if (demux->tsbufp) {
468 i = demux->tsbufp;
471 memcpy(&demux->tsbuf[i], buf, count);
472 demux->tsbufp += count;
475 memcpy(&demux->tsbuf[i], buf, j);
476 if ((demux->tsbuf[0] == 0x47) || (demux->tsbuf[0] == 0xB8)) {
477 memcpy(tmppack, demux->tsbuf, 188);
480 dvb_dmx_swfilter_packet(demux, tmppack);
482 demux->tsbufp = 0;
492 dvb_dmx_swfilter_packet(demux, tmppack);
496 memcpy(demux->tsbuf, &buf[p], i);
497 demux->tsbufp = i;
506 spin_unlock(&demux->lock);
511 static struct dvb_demux_filter *dvb_dmx_filter_alloc(struct dvb_demux *demux)
515 for (i = 0; i < demux->filternum; i++)
516 if (demux->filter[i].state == DMX_STATE_FREE)
519 if (i == demux->filternum)
522 demux->filter[i].state = DMX_STATE_ALLOCATED;
524 return &demux->filter[i];
527 static struct dvb_demux_feed *dvb_dmx_feed_alloc(struct dvb_demux *demux)
531 for (i = 0; i < demux->feednum; i++)
532 if (demux->feed[i].state == DMX_STATE_FREE)
535 if (i == demux->feednum)
538 demux->feed[i].state = DMX_STATE_ALLOCATED;
540 return &demux->feed[i];
547 list_for_each_entry(entry, &feed->demux->feed_list, list_head)
556 spin_lock_irq(&feed->demux->lock);
563 list_add(&feed->list_head, &feed->demux->feed_list);
565 spin_unlock_irq(&feed->demux->lock);
570 spin_lock_irq(&feed->demux->lock);
579 spin_unlock_irq(&feed->demux->lock);
587 struct dvb_demux *demux = feed->demux;
592 if (mutex_lock_interruptible(&demux->mutex))
597 mutex_unlock(&demux->mutex);
601 if (demux->pesfilter[pes_type] &&
602 demux->pesfilter[pes_type] != feed) {
603 mutex_unlock(&demux->mutex);
607 demux->pesfilter[pes_type] = feed;
608 demux->pids[pes_type] = pid;
625 mutex_unlock(&demux->mutex);
632 mutex_unlock(&demux->mutex);
640 struct dvb_demux *demux = feed->demux;
643 if (mutex_lock_interruptible(&demux->mutex))
647 mutex_unlock(&demux->mutex);
651 if (!demux->start_feed) {
652 mutex_unlock(&demux->mutex);
656 if ((ret = demux->start_feed(feed)) < 0) {
657 mutex_unlock(&demux->mutex);
661 spin_lock_irq(&demux->lock);
664 spin_unlock_irq(&demux->lock);
665 mutex_unlock(&demux->mutex);
673 struct dvb_demux *demux = feed->demux;
676 mutex_lock(&demux->mutex);
679 mutex_unlock(&demux->mutex);
683 if (!demux->stop_feed) {
684 mutex_unlock(&demux->mutex);
688 ret = demux->stop_feed(feed);
690 spin_lock_irq(&demux->lock);
693 spin_unlock_irq(&demux->lock);
694 mutex_unlock(&demux->mutex);
703 struct dvb_demux *demux = (struct dvb_demux *)dmx;
706 if (mutex_lock_interruptible(&demux->mutex))
709 if (!(feed = dvb_dmx_feed_alloc(demux))) {
710 mutex_unlock(&demux->mutex);
716 feed->demux = demux;
729 if (!(feed->filter = dvb_dmx_filter_alloc(demux))) {
731 mutex_unlock(&demux->mutex);
739 mutex_unlock(&demux->mutex);
747 struct dvb_demux *demux = (struct dvb_demux *)dmx;
750 mutex_lock(&demux->mutex);
753 mutex_unlock(&demux->mutex);
769 demux->pesfilter[feed->pes_type] = NULL;
771 mutex_unlock(&demux->mutex);
783 struct dvb_demux *dvbdemux = dvbdmxfeed->demux;
815 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
869 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
914 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
940 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
969 static int dvbdmx_allocate_section_feed(struct dmx_demux *demux,
973 struct dvb_demux *dvbdmx = (struct dvb_demux *)demux;
986 dvbdmxfeed->demux = dvbdmx;
996 (*feed)->parent = demux;
1009 static int dvbdmx_release_section_feed(struct dmx_demux *demux,
1013 struct dvb_demux *dvbdmx = (struct dvb_demux *)demux;
1039 static int dvbdmx_open(struct dmx_demux *demux)
1041 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1050 static int dvbdmx_close(struct dmx_demux *demux)
1052 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1061 static int dvbdmx_write(struct dmx_demux *demux, const char *buf, size_t count)
1063 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1065 if ((!demux->frontend) || (demux->frontend->source != DMX_MEMORY_FE))
1078 static int dvbdmx_add_frontend(struct dmx_demux *demux,
1081 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1089 static int dvbdmx_remove_frontend(struct dmx_demux *demux,
1092 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1105 static struct list_head *dvbdmx_get_frontends(struct dmx_demux *demux)
1107 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1115 static int dvbdmx_connect_frontend(struct dmx_demux *demux,
1118 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1120 if (demux->frontend)
1125 demux->frontend = frontend;
1130 static int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
1132 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1136 demux->frontend = NULL;
1141 static int dvbdmx_get_pes_pids(struct dmx_demux *demux, u16 * pids)
1143 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;