In function func_eval_expr_int_format inside
libavfilter/vf_drawtext.c, the functions feclearexcept and
fetestexcept are used. They are missing on uclibc. On that platform,
instead of checking if the FPU raised an exception after trying to
convert a floating-point number to an integer, do the check beforehand
using isfinite and comparisons against the maximum and minimum value
of an int32_t.

Signed-off-by: René Rhéaume <rene.rhea...@gmail.com>
--- ffmpeg-2.6.3/libavfilter/vf_drawtext.c
+++ ffmpeg-2.6.3-uclibc/libavfilter/vf_drawtext.c
@@ -921,12 +921,23 @@ static int func_eval_expr_int_format(AVF
         }
     }
 
+#ifdef __UCLIBC__
+    if (isfinite(res) && (res <= 2147483647.0) && (res >= -2147483647.0)) {
+        intval = res;
+    } else {
+        av_log(ctx, AV_LOG_ERROR,
+               "Conversion of floating-point result to int failed. Conversion result: %d\n",
+               intval);
+        return AVERROR(EINVAL);
+    }
+#else
     feclearexcept(FE_ALL_EXCEPT);
     intval = res;
     if ((ret = fetestexcept(FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW))) {
         av_log(ctx, AV_LOG_ERROR, "Conversion of floating-point result to int failed. Control register: 0x%08x. Conversion result: %d\n", ret, intval);
         return AVERROR(EINVAL);
     }
+#endif
 
     if (argc == 3)
         av_strlcatf(fmt_str, sizeof(fmt_str), "0%u", positions);
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to