[linux-dvb] How to extract several PID's from a TS

Trent Piepho xyzzy at speakeasy.org
Fri Mar 31 00:12:36 CEST 2006

On Thu, 30 Mar 2006, Peter Fassberg wrote:
> > many PIDs they can filter at once.  Devices without hardware PID filters (most
> > PCI cards) are, IMHO, poorly and inefficiently supported by this arrangement.
> > A software filter could filter a thousand PIDs just as easily as it does one.
> I use the special PID "8192" (0x2000) whith dvbstream to select *ALL* PIDs
> from my Twinhan (budget) cards.  Both DVB-T and DVB-S.

True, you can do this when you want lots of PIDs.  It's easy and it will work.

But say you want to just want to get all the meta-data on a ATSC QAM-256
channel.  This could be 50 to 60 PIDs and a few hundred packets per second.
The kernel is filtering 25830 packets per second and selecting them all, then
every packet is copied from the DMA buffer to the dvr0 device buffer, then
from there to user space, and then in userspace you re-filter all 25830
pkts/sec and just pick the 200 or so you care about.

Instead, the kernel could efficiently software filter all the PIDs you wanted,
it's a trivial O(1) algorithm, and then copy just those to the dvr buffer and
user space, where you don't need to re-filter them.  This would be more
efficient and make better use of buffer space, by dropping packets you don't
care about as soon as possible.

More information about the linux-dvb mailing list