IPN mpegts

From Virtualsquare
Revision as of 19:26, 27 December 2012 by Renzo (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



The submodule ipn_mpegts provides the support for the MPEG Transport Stream on a IPN network. It parses any single TS packet and particularly it extracts and analyses 3 tables:

  1. The Program Association Table (PAT)
  2. The Service Description Table (SDT)
  3. The Program Map Table (PMT)

The first holds the association between program numbers and the correspectives PMT PIDS. The second describes the relations among program numbers and service names, while the latter contains all the PIDS of every stream associated with a specific program number.

The module is relatively customizable through a series of #define.


First of all you need a program that acts like a bridge from the TS stream to the IPN network. This program has to create a IPN socket (with protocol IPN_MPEGTS) and bind to it, then has to register a chrdev and finally has to copy the stream into the socket so the module can easily manages/handles it.

The module (default) supports up to 4 network with 8 devices each, so remember to register the chrdev with different names per every different network.

Anyway in the sources a sample program is given: mpegts_bridge.


To control the module you can use several ioctl:

ioctl(int socket, IPN_MPEGTS_GET_PROGRAM_LIST, struct ipn_mpegts_ioctl_info pinfo);
ioctl(int socket, IPN_MPEGTS_GET_DEVICE_ASSOCIATION, struct ipn_mpegts_ioctl_info dinfo);
ioctl(int socket, IPN_MPEGTS_SET_PROGRAM, int directives[2]);

The data structures are the following:

 struct ipn_mpegts_ioctl_info {
   unsigned int  program_number;
   unsigned char service_name[32];

 int directives[0]; // device number
 int directives[1]; // program number

Get the association list between program numbers and program names.


Get the association list between device numbers and program names.


Set which program you want for a specific device.

Personal tools