Mailing List archive

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

[linux-dvb] Re: DVB API extension: DMX_GET_STC



Hi,

On Thu, Feb 20, 2003 at 07:45:42PM +0100, I wrote:
> 
> The STC is a 33bit counter which is fed from the
> PTSs of PES packets from the stream specified by
> ioctl DMX_SET_PES_FILTER with DMX_OUT_DECODER and DMX_PES_PCR.
> The demux implements a PLL and some filtering to remove
> jitter etc. and get a stable clock. The STC is then used
> by the MPEG decoder as the reference clock to synchronize audio and
> video. It is common to use the video stream as PCR source.

This was inaccurate. The MPEG2 standard defines the STC
and PCR in terms of a clock running *typically*
at 27 MHz. After division by 300 one gets a 90 kHz
clock, the lower 33 bits of which can be used in comparision
with the 33bit PTS or DTS values from the PES packet header.
The hardware registers for the STC typically contain a 42 bit
value.

There are two problems:
- the MPEG2 spec does not require a 27 MHz STC, it just says
  that this is a typical value
- it seems to be difficult to do a 64bit division with a 64bit result
  in the kernel (at least on some architectures)

> Proposal:
> 
> I want to keep it simple. What I need is:
> 
>   struct dmx_stc {
>           uint     num; /* input: which STC? 0...n */
>           uint64_t stc; /* output */
>   };
>   #define DMX_GET_STC  _IOWR('o', 50, struct dmx_stc)

New proposal:

  struct dmx_stc {
          unsigned int num;  /* input : which STC? 0...n */
	  unsigned int base; /* output: divisor for stc to get 90kHz clock */
          uint64_t     stc;  /* output: STC denominator */
  };
  #define DMX_GET_STC  _IOWR('o', 50, struct dmx_stc)

'base' would then be 300 for a 27MHz STC.

Comments?

If no one objects, I would like to add this to the current
stable API within the next week (because I need it for DVB subtitles).


Regards,
Johannes


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index