avfilter/vf_telecine: Avoid floating point values
authorHimangi Saraogi <himangi774@gmail.com>
Fri, 27 Mar 2015 14:05:12 +0000 (19:35 +0530)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 27 Mar 2015 14:52:59 +0000 (15:52 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/vf_telecine.c

index 73447df..93e5aa9 100644 (file)
@@ -41,7 +41,7 @@ typedef struct {
     int64_t start_time;
 
     AVRational pts;
-    double ts_unit;
+    AVRational ts_unit;
     int out_cnt;
     int occupied;
 
@@ -164,7 +164,7 @@ static int config_output(AVFilterLink *outlink)
     av_log(ctx, AV_LOG_VERBOSE, "TB: %d/%d -> %d/%d\n",
            inlink->time_base.num, inlink->time_base.den, outlink->time_base.num, outlink->time_base.den);
 
-    s->ts_unit = av_q2d(av_inv_q(av_mul_q(fps, outlink->time_base)));
+    s->ts_unit = av_inv_q(av_mul_q(fps, outlink->time_base));
 
     return 0;
 }
@@ -243,7 +243,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
 
         av_frame_copy_props(frame, inpicref);
         frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
-                     outlink->frame_count * s->ts_unit;
+                     av_rescale(outlink->frame_count, s->ts_unit.num,
+                                s->ts_unit.den);
         ret = ff_filter_frame(outlink, frame);
     }
     av_frame_free(&inpicref);