[FFmpeg-devel] [PATCHed] change PAT/PMT/SDT playout to be dependant on PTS and not a number of packets.

Michael Niedermayer michaelni at gmx.at
Fri May 20 15:23:29 CEST 2011


On Wed, May 18, 2011 at 07:52:08PM +0100, JULIAN GARDNER wrote:
> 
> 
> 
> >________________________________
> >From: Michael Niedermayer <michaelni at gmx.at>
> >To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> >Sent: Wednesday, 18 May 2011, 20:31
> >Subject: Re: [FFmpeg-devel] [PATCH] change PAT/PMT/SDT playout to be dependant on PTS and not a number of packets.
> >
> >On Wed, May 18, 2011 at 02:21:03PM +0100, JULIAN GARDNER wrote:
> >> Change the way in which the PAT, PMT and SDT are inserted into the Mpeg TS, now dependant on time.
> >> 
> >> Set to repeat at
> >> 
> >> PAT     250ms
> >> PMT     375ms
> >> SDT     1250ms
> >> 
> >> Maybe add a way of the user setting these values to give faster or slower playout rates, as this does add to the TS overhead.
> >>
> >
> >
> >> Also cleaned up the udp.c, removed some variables and an av_log
> >
> >ive applied the changes to udp.c
> >
> >
> >[...]
> >> @@ -594,21 +611,31 @@ static int mpegts_write_header(AVFormatContext *s)
> >>  }
> >>  
> >>  /* send SDT, PAT and PMT tables regulary */
> >> -static void retransmit_si_info(AVFormatContext *s)
> >> +static void retransmit_si_info(AVFormatContext *s, int64_t pts)    // MpegTSWriteStream *ts_st)
> >>  {
> >>      MpegTSWrite *ts = s->priv_data;
> >>      int i;
> >> +    int64_t temp_pts;
> >>  
> >> -    if (++ts->sdt_packet_count == ts->sdt_packet_period) {
> >> -        ts->sdt_packet_count = 0;
> >> +    temp_pts = 90*SDT_RETRANS_TIME;
> >> +    if (ts->sdt_pts==-1 || (abs(ts->sdt_pts-pts)>temp_pts)) {
> >>          mpegts_write_sdt(s);
> >
> >> +//    av_log( s, AV_LOG_INFO, "SDT %llx\r\n", pts); // ts_st->payload_pts);
> >> +        ts->sdt_pts = pts;
> >
> >tabs are not allowed in git
> >
> >
> >[...]
> >> @@ -636,15 +663,14 @@ static uint8_t* write_pcr_bits(uint8_t *buf, int64_t pcr)
> >>  static void mpegts_insert_null_packet(AVFormatContext *s)
> >>  {
> >>      uint8_t *q;
> >> -    uint8_t buf[TS_PACKET_SIZE];
> >>  
> >> -    q = buf;
> >> +    q = ts_buf;
> >>      *q++ = 0x47;
> >>      *q++ = 0x00 | 0x1f;
> >>      *q++ = 0xff;
> >>      *q++ = 0x10;
> >
> >this breaks multithreadad applications
> >
> >[...]
> >-- 
> >Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> >Republics decline into democracies and democracies degenerate into
> >despotisms. -- Aristotle
> >
> >_______________________________________________
> >ffmpeg-devel mailing list
> >ffmpeg-devel at ffmpeg.org
> >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >
> >
> 
> Fixed tabs, hope i got them all
> 
> fixed ts buffer, now back local
> 
> 
> joolz

>  mpegtsenc.c |   55 ++++++++++++++++++++++++++++++++-----------------------
>  1 file changed, 32 insertions(+), 23 deletions(-)
> 2051846343e2e6ba2181b13ca161d2d253a88126  mpegenc.diff

ill split & apply this soon if i hear no objections

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110520/f292695a/attachment.asc>


More information about the ffmpeg-devel mailing list