public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* ivtv-utils/test/ps-analyzer.cpp: error in extracting SCR?
@ 2010-02-04  0:18 Lars Hanisch
  2010-02-04  3:16 ` Andy Walls
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Hanisch @ 2010-02-04  0:18 UTC (permalink / raw)
  To: linux-media

Hi,

  I'm writing some code repacking the program stream that ivtv delivers 
into a transport stream (BTW: is there existing code for this?). Since 
many players needs the PCR I would like to use the SCR of the PS and 
place it in the adaption field of the TS (if wikipedia [1] and my 
interpretation of it is correct it should be the same).

  I stumbled upon the ps-analyzer.cpp in the test-directory of the 
ivtv-utils (1.4.0). From line 190 to 198 the SCR and SCR extension are 
extracted from the PS-header. But referring to [2] the SCR extension has 
9 bits, the highest 2 bits in the fifth byte after the sync bytes and 
the lower 7 bits in the sixth byte. The last bit is a marker bit (always 1).

  So instead of

scr_ext = (hdr[4] & 0x1) << 8;
scr_ext |= hdr[5];

  I think it should be

scr_ext = (unsigned)(hdr[4] & 0x3) << 7;
scr_ext |= (hdr[5] & 0xfe) >> 1;

  And the bitrate is coded in the next 22 bits, so it should be

mux_rate = (unsigned)(hdr[6]) << 14;
mux_rate |= (unsigned)(hdr[7]) << 6;
mux_rate |= (unsigned)(hdr[8] & 0xfc) >> 2;

  Am I correct?

Regards,
Lars.

[1] http://en.wikipedia.org/wiki/Presentation_time_stamp
[2] http://en.wikipedia.org/wiki/MPEG_program_stream

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-07 20:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-04  0:18 ivtv-utils/test/ps-analyzer.cpp: error in extracting SCR? Lars Hanisch
2010-02-04  3:16 ` Andy Walls
2010-02-04  7:25   ` Hans Verkuil
2010-02-04 18:50     ` Lars Hanisch
2010-02-07 20:36     ` Lars Hanisch
2010-02-07 20:53       ` Andy Walls

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox