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

JULIAN GARDNER joolzg at btinternet.com
Fri May 20 15:29:19 CEST 2011




>________________________________
>From: Michael Niedermayer <michaelni at gmx.at>
>To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
>Sent: Friday, 20 May 2011, 15:23
>Subject: Re: [FFmpeg-devel] [PATCHed] change PAT/PMT/SDT playout to be dependant on PTS and not a number of packets.
>
>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
>
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
>

I have a newer version if you want this, i removed the temp variables and also added in 3 AVOption options to allow these 3 values to be set.

Was looking into making it work with pcr, but as these are not so critical if the tables come 40ms early i dont this it will matter.

joolz



More information about the ffmpeg-devel mailing list