[FFmpeg-devel] [PATCH] avformat/mpsubdec: Use double instead of float for timestamp calculations

Michael Niedermayer michaelni at gmx.at
Wed May 27 17:44:31 CEST 2015


On Wed, May 27, 2015 at 03:49:10PM +0200, Clément Bœsch wrote:
> On Wed, May 27, 2015 at 03:40:55PM +0200, Michael Niedermayer wrote:
> > This provides higher precission
> > 
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavformat/mpsubdec.c |    6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c
> > index c49f149..7c26d4f 100644
> > --- a/libavformat/mpsubdec.c
> > +++ b/libavformat/mpsubdec.c
> > @@ -59,13 +59,13 @@ static int mpsub_read_header(AVFormatContext *s)
> >      AVRational pts_info = (AVRational){ 100, 1 }; // ts based by default
> >      int res = 0;
> 
> >      int multiplier = 100;
> 
> did you change that in a previous commit?

yes


> 
> > -    float current_pts = 0;
> > +    double current_pts = 0;
> >  
> >      av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
> >  
> >      while (!avio_feof(s->pb)) {
> >          char line[1024];
> > -        float start, duration;
> > +        double start, duration;
> >          int fps, len = ff_get_line(s->pb, line, sizeof(line));
> >  
> >          if (!len)
> > @@ -77,7 +77,7 @@ static int mpsub_read_header(AVFormatContext *s)
> >              /* frame based timing */
> >              pts_info = (AVRational){ fps, 1 };
> >              multiplier = 1;
> > -        } else if (sscanf(line, "%f %f", &start, &duration) == 2) {
> > +        } else if (sscanf(line, "%lf %lf", &start, &duration) == 2) {
> >              AVPacket *sub;
> >              const int64_t pos = avio_tell(s->pb);
> 
> LGTM

applied


> 
> (no impact on fate i suppose?)

no, fate doesnt change

thanks

[..]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150527/28efda8d/attachment.asc>


More information about the ffmpeg-devel mailing list