Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Format of /dev/video or where to get MPEG TS stream?



Terry Hardie writes:
 > On Mon, 20 Mar 2000, Ralph Metzler wrote:
 > 
 > > Terry Hardie writes:
 > >  > Hi,
 > >  > 
 > >  > I've got the Hauppage card working and locking signals. I'd like to know
 > >  > if I can get the Transport stream (TS) from somewhere of the locked
 > >  > signal, and/or what is the format of /dev/video?
 > >  > 
 > >  > I've look at the data I get from /dev/video, and it doesn't appear to be
 > >  > an MPEG2 TS (The 0x47 sync words don't match. The spec says there should
 > >  > eb 0x47 every 188 bytes)
 > > 
 > > Sorry, but you cannot get the raw transport stream from the card. 
 > > You can only define up to 32 section filters which get you the DVB
 > > section as defined in the various ETSI documents.
 > 
 > Which ETSI Docs exactly?

E.g. EN 300 468 for service information sections.
See www.dvb.org for details which docs should be interesting for DVB
and www.etsi.org to download them.
 
 > Do you know what format the data on /dev/video is then?
 > 

The data on /dev/video is the so called AV_PES format. 
It consists of packets which contain audio PES packets and video ES
packets + PTS info.
I won´t go into details here. mmpg2mpg in DVB/apps and also the oms
package of the linuxvideo project contain sources for this.


You can get section data on /dev/vbi (hmm, we should invent a /dev/dvb or
something ...)

The packets on this start like this:

   u16  ID="SI"
   u16  filter handle
   u16  PID  
   u16  data length
   u8[] data

Before you get data you have to define a section filter:

..

struct bitfilter filt = {
  0x200,
  { 0x3eff, 0x00ff, 0x00ff, 0x0000, 0x0000, 0x0000, 0x00ff, 0x00ff,
    0x00ff, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
  0x0c,0
};

..
 
and set it:

..

  if (ioctl(vid, VIDIOCSBITFILTER, &filt)<0)
    return 1;


..

where vid is a file handle for /dev/vbi


0x200 is the PID

the array specifies the filter info
It consists of 16 bit data entries, the lower 8 bits are the mask, the 
upper 8 the filter data, the filter applöies to the start of a section 
WITHOUT the length entries
So, the filter above looks for sections starting with 0x3e. The 0x00ff
entries look for exactly 0x00 on these positions. Here they are the
positions of the MAC in an IP/MPE section.

Another example: if you want all sections starting with 0x5a and bit 7 
of the third byte set and bit 0 not set, use this:

  { 0x5aff, 0x0000, 0x8081, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},


0x0c specifies the section filter mode the firmware should use
     I´ll write more about this in the documentation of the driver
     (next version ...)



Please remember that I just made up those structures, function calls
etc. as I needed them.
If you have any comments, complaints, ideas, wishes ... how to do this better 
please tell me or, even better, discuss it here on the list.


Ralph


Home | Main Index | Thread Index