Пример #1
0
static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
{
	struct dvb_demux_feed *feed;
	struct list_head *pos, *head=&demux->feed_list;
	u16 pid = ts_pid(buf);
	int dvr_done = 0;

	list_for_each(pos, head) {
		feed = list_entry(pos, struct dvb_demux_feed, list_head);

		if ((feed->pid != pid) && (feed->pid != 0x2000))
			continue;

		/* copy each packet only once to the dvr device, even
		 * if a PID is in multiple filters (e.g. video + PCR) */
		if ((DVR_FEED(feed)) && (dvr_done++))
			continue;

		if (feed->pid == pid) {
			dvb_dmx_swfilter_packet_type(feed, buf);
			if (DVR_FEED(feed))
				continue;
		}

		if (feed->pid == 0x2000)
			feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK);
	}
Пример #2
0
uchar *cSatipDevice::GetData(int *availableP)
{
  //debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
  if (isOpenDvrM && tsBufferM) {
     int count = 0;
     if (isPacketDeliveredM)
        SkipData(TS_SIZE);
     uchar *p = tsBufferM->Get(count);
     if (p && count >= TS_SIZE) {
        if (*p != TS_SYNC_BYTE) {
           for (int i = 1; i < count; i++) {
               if (p[i] == TS_SYNC_BYTE) {
                  count = i;
                  break;
                  }
               }
           tsBufferM->Del(count);
           info("Skipped %d bytes to sync on TS packet", count);
           return NULL;
           }
        isPacketDeliveredM = true;
        if (availableP)
           *availableP = count;
        // Update pid statistics
        AddPidStatistic(ts_pid(p), payload(p));
        return p;
        }
     }
  return NULL;
}
Пример #3
0
void demultiplexDvbPackets(struct dvb_demux *demux, const u8 *buf, int count)
{
	int first = 0;
	int next = 0;
	int cnt = 0;
	u16 pid, firstPid;
	struct DeviceContext_s *Context = (struct DeviceContext_s *)demux->priv;
	/* Group the packets by the PIDs and feed them into the kernel demuxer.
	 If there is data for the decoder we will be informed via the callback.
	 After the demuxer finished its work on the packet block that block is
	 fed into the decoder if required.
	 This workaround eliminates the scheduling bug caused by waiting while
	 the demux spin is locked. */
	while (count > 0)
	{
		first = next;
		cnt = 0;
		firstPid = ts_pid(&buf[first]);
		while (count > 0)
		{
			count--;
			next += 188;
			cnt++;
			pid = ts_pid(&buf[next]);
			if ((pid != firstPid) || (cnt > 8))
				break;
		}
		if ((next - first) > 0)
		{
			mutex_lock_interruptible(&Context->injectMutex);
			/* reset the flag (to be set by the callback */
			Context->provideToDecoder = 0;
			dvb_dmx_swfilter_packets(demux, buf + first, cnt);
			if (Context->provideToDecoder)
			{
				/* the demuxer indicated that the packets are for the decoder */
				writeToDecoder(demux, Context->feedPesType, buf + first, next - first);
			}
			mutex_unlock(&Context->injectMutex);
		}
	}
}
Пример #4
0
void tsd_packetin(uint8_t *ts) {
	uint16_t	pid;
	if (!ts_sync(ts)) {
		fprintf(stderr, "%06d Missing sync\n", pktno);
		return;
	}

	if (ts_tei(ts))
		fprintf(stderr, "%06d Packet has set TEI\n", pktno);

	pid=ts_pid(ts);

	switch(pid) {
		case(0):
			tsd_pat(ts, pid);
			break;
	}
}