[FFmpeg-devel] [PATCH] vf_colorspace: don't spam console with warnings if range is unspecified.

Ronald S. Bultje rsbultje at gmail.com
Thu Oct 20 19:06:14 EEST 2016


---
 libavfilter/vf_colorspace.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index c74fe00..f64163f 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -163,6 +163,8 @@ typedef struct ColorSpaceContext {
     yuv2yuv_fn yuv2yuv;
     double yuv2rgb_dbl_coeffs[3][3], rgb2yuv_dbl_coeffs[3][3];
     int in_y_rng, in_uv_rng, out_y_rng, out_uv_rng;
+
+    int did_range_warn;
 } ColorSpaceContext;
 
 // FIXME deal with odd width/heights (or just forbid it)
@@ -523,9 +525,15 @@ static int get_range_off(AVFilterContext *ctx, int *off,
                          enum AVColorRange rng, int depth)
 {
     switch (rng) {
-    case AVCOL_RANGE_UNSPECIFIED:
-        av_log(ctx, AV_LOG_WARNING, "Input range not set, assuming tv/mpeg\n");
+    case AVCOL_RANGE_UNSPECIFIED: {
+        ColorSpaceContext *s = ctx->priv;
+
+        if (!s->did_range_warn) {
+            av_log(ctx, AV_LOG_WARNING, "Input range not set, assuming tv/mpeg\n");
+            s->did_range_warn = 1;
+        }
         // fall-through
+    }
     case AVCOL_RANGE_MPEG:
         *off = 16 << (depth - 8);
         *y_rng = 219 << (depth - 8);
-- 
2.8.1



More information about the ffmpeg-devel mailing list