A raw [[MPEG2 Transport Stream]] consists data of all the services transmitted on a particular transponder. The task on the receiver side is to filter out the interesting packets and schedule them to their target decoders: Audio packets to the audio-decoder, video packets to the video decoder, subtitle packets to the subtitle decoder etc...

+

A raw [[MPEG-2 Transport Stream]] consists data of all the services transmitted on a particular transponder. The task on the receiver side is to filter out the interesting packets and schedule them to their target decoders: Audio packets to the audio-decoder, video packets to the video decoder, subtitle packets to the subtitle decoder etc...

−

MPEG2 TS packets are identified by the Packet ID, the PID. This is a 13-bit number located in the 2nd and 3rd byte of a TS packet.

+

MPEG-2 TS packets are identified by the Packet ID, the PID. This is a 13-bit number located in the 2nd and 3rd byte of a TS packet.

== PID Filter Algorithm ==

== PID Filter Algorithm ==

Line 95:

Line 95:

if (scrambling_control != 0)

if (scrambling_control != 0)

−

return 0;

+

return;

if (pid_is_enabled(pid))

if (pid_is_enabled(pid))

Latest revision as of 22:11, 6 January 2008

Contents

Introduction

A raw MPEG-2 Transport Stream consists data of all the services transmitted on a particular transponder. The task on the receiver side is to filter out the interesting packets and schedule them to their target decoders: Audio packets to the audio-decoder, video packets to the video decoder, subtitle packets to the subtitle decoder etc...

MPEG-2 TS packets are identified by the Packet ID, the PID. This is a 13-bit number located in the 2nd and 3rd byte of a TS packet.

PID Filter Algorithm

The algorithm is easy: we simply check the 13 PID bits and look whether this PID is enabled in our PID filter list.

PID Filter Sample Code (the easy way)

This implementation uses a trivial PID table of 2^13 (=8192) bits where every bit is set to '1' if this particular PID is enabled and cleared to '0' if the PID is disabled. The entire table has a size of 8kbit (1kByte). pid_is_enabled() simply tests if the bit on position '<pid>' is set.

You can also organize you filters in a linked list and traverse this every time, but you don't need to do it that complicated unless you really want...

Section Filtering

Most DVB Hardware decoders provide so called Section Filters, these allow to specify which MPEG and DVB section tables we want to receive in a particular queue.

But in practice these tables are organized in a way that we want to update our clock, EPG state and DSM-CC caroussels continously and enable all section filters on a particular PID in most cases. So it's questionable whether it makes sense to implement a similiar solution in future designs, simple PID filtering is usually sufficient.

The MPEG table decoder receives now all tables of an enabled PID, these are usually related anyways.