[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
Tue May 24 14:38:52 CEST 2011




>________________________________
>From: JULIAN GARDNER <joolzg at btinternet.com>
>To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
>Sent: Saturday, 21 May 2011, 7:50
>Subject: Re: [FFmpeg-devel] [PATCHed] change PAT/PMT/SDT playout to be dependant on PTS and not a number of packets.
>
>
>
>
>
>----- Original Message -----
>> From: Baptiste Coudurier <baptiste.coudurier at gmail.com>
>> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
>> Cc: 
>> Sent: Friday, 20 May 2011, 23:23
>> Subject: Re: [FFmpeg-devel] [PATCHed] change PAT/PMT/SDT playout to be dependant on PTS and not a number of packets.
>> 
>> Hi,
>> 
>> On 05/20/2011 07:07 AM, JULIAN GARDNER wrote:
>>>  ----- Original Message -----
>>>>  From: Michael Niedermayer <michaelni at gmx.at>
>>>>  To: FFmpeg development discussions and patches 
>> <ffmpeg-devel at ffmpeg.org>
>>>>  Cc: 
>>>>  Sent: Friday, 20 May 2011, 16:02
>>>>  Subject: Re: [FFmpeg-devel] [PATCHed] change PAT/PMT/SDT playout to be 
>> dependant on PTS and not a number of packets.
>>>> 
>>>>  On Fri, May 20, 2011 at 02:29:19PM +0100, JULIAN GARDNER wrote:
>>>>  [...]
>>>>>   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.
>>>> 
>>>>  please post it
>>>> 
>>>>  [...]
>>> 
>>>  New version, still uses pts as its base.
>>> 
>>>  Will look at changing to PCR but i dont think they need to be so accurate 
>> +-40ms wont make a difference.
>>> 
>>>  Added 3 new options in the AVOption structure
>>> 
>>>  mpegts_pat_playout_rate
>>>  mpegts_pmt_playout_rate
>>>  mpegts_sdt_playout_rate
>>> 
>>>  joolz
>>> 
>>> 
>>>  mpegtsenc.diff
>>> 
>>> 
>>>  diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
>>>  index 39185bb..f96934e 100644
>>>  --- a/libavformat/mpegtsenc.c
>>>  +++ b/libavformat/mpegtsenc.c
>>>  @@ -58,8 +58,11 @@ typedef struct MpegTSWrite {
>>>       MpegTSService **services;
>>>   
>>>       int64_t sdt_pts;
>>>  +    int sdt_timeout;
>>>       int64_t pmt_pts;
>>>  +    int pmt_timeout;
>>>       int64_t pat_pts;
>>>  +    int pat_timeout;
>>>   
>>>       int nb_services;
>>>       int onid;
>>>  @@ -86,6 +89,12 @@ static const AVOption options[] = {
>>>         offsetof(MpegTSWrite, pmt_start_pid), FF_OPT_TYPE_INT, {.dbl = 
>> 0x1000 }, 0x1000, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM},
>>>       { "mpegts_start_pid", "Set the first pid.",
>>>         offsetof(MpegTSWrite, start_pid), FF_OPT_TYPE_INT, {.dbl = 0x0100 }, 
>> 0x0100, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM},
>>>  +    { "mpegts_pat_playout_rate", "Set the rate to playout 
>> the PAT in ms.",
>>>  +      offsetof(MpegTSWrite, pat_timeout), FF_OPT_TYPE_INT, {.dbl = 250 }, 
>> 125, 500, AV_OPT_FLAG_ENCODING_PARAM},
>>>  +    { "mpegts_pmt_playout_rate", "Set the rate to playout 
>> the PMT in ms.",
>>>  +      offsetof(MpegTSWrite, pmt_timeout), FF_OPT_TYPE_INT, {.dbl = 375 }, 
>> 250, 750, AV_OPT_FLAG_ENCODING_PARAM},
>>>  +    { "mpegts_sdt_playout_rate", "Set the rate to playout 
>> the SDT in ms.",
>>>  +      offsetof(MpegTSWrite, sdt_timeout), FF_OPT_TYPE_INT, {.dbl = 1250 }, 
>> 250, 10000, AV_OPT_FLAG_ENCODING_PARAM},
>>>       { NULL },
>>>   };
>>>   
>>>  @@ -574,9 +583,9 @@ static int mpegts_write_header(AVFormatContext *s)
>>>       else
>>>           av_log(s, AV_LOG_INFO, "muxrate %d, ", ts->mux_rate);
>>>       av_log(s, AV_LOG_INFO, "pcr every %d pkts, "
>>>  -           "sdt every %d, pat %d, pmt every %d pkts\n",
>>>  +           "sdt every %d, pat %d, pmt every %d ms\n",
>>>              service->pcr_packet_period,
>>>  -           SDT_RETRANS_TIME, PAT_RETRANS_TIME, PMT_RETRANS_TIME);
>>>  +           ts->sdt_timeout, ts->pat_timeout, ts->pmt_timeout);
>>>   
>>>       avio_flush(s->pb);
>>>   
>>>  @@ -596,20 +605,16 @@ static void retransmit_si_info(AVFormatContext *s, 
>> int64_t pts)
>>>   {
>>>       MpegTSWrite *ts = s->priv_data;
>>>       int i;
>>>  -    int64_t temp_pts;
>>>   
>>>  -    temp_pts = 90*SDT_RETRANS_TIME;
>>>  -    if (ts->sdt_pts==-1 || (abs(ts->sdt_pts-pts)>temp_pts)) {
>>>  +    if (ts->sdt_pts==-1 || 
>> (abs(ts->sdt_pts-pts)>(90*ts->sdt_timeout))) {
>>>           mpegts_write_sdt(s);
>>>           ts->sdt_pts = pts;
>>>       }
>> 
>> Is it possible to write everything in write_header the first time and do
>> not check for -1 here ?
>> 
>> [...]
>> 
>> -- 
>> Baptiste COUDURIER
>> Key fingerprint          8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
>> FFmpeg maintainer                          http://www.ffmpeg.org
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>yep i can do that,  will post in a little while
>
>joolz
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
>

Removed the -1 settomg and the -1 checks as per request.

joolz
ps. please not i dont know if this is all you need but i did a "git commit -a" the other day so i do a pull and i seem to gave no differences. Can some one tell me how to pull my other modifications that are still noy in the main tree, mainly my dvbsubtitle modifications.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpegtsenc.diff
Type: application/octet-stream
Size: 1260 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110524/9dcee4b3/attachment.obj>


More information about the ffmpeg-devel mailing list