[FFmpeg-cvslog] lavd/caca: provide more meaningful feedback if fails to set a dither option

Stefano Sabatini git at videolan.org
Sun Jul 22 10:34:55 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sat Jul 21 11:04:51 2012 +0200| [9ce0e19ab61e99cdfe29fcce84b9f6a7f17b431c] | committer: Stefano Sabatini

lavd/caca: provide more meaningful feedback if fails to set a dither option

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ce0e19ab61e99cdfe29fcce84b9f6a7f17b431c
---

 libavdevice/caca.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavdevice/caca.c b/libavdevice/caca.c
index 0f44edd..cfbb371 100644
--- a/libavdevice/caca.c
+++ b/libavdevice/caca.c
@@ -153,15 +153,17 @@ static int caca_write_header(AVFormatContext *s)
         goto fail;
     }
 
-    ret  = caca_set_dither_algorithm(c->dither, c->algorithm);
-    ret += caca_set_dither_antialias(c->dither, c->antialias);
-    ret +=   caca_set_dither_charset(c->dither, c->charset);
-    ret +=     caca_set_dither_color(c->dither, c->colors);
-    if (ret) {
-        av_log(s, AV_LOG_ERROR, "Invalid value given to one of options\n");
-        ret = AVERROR(EINVAL);
-        goto fail;
+#define CHECK_DITHER_OPT(opt)                                           \
+    if (caca_set_dither_##opt(c->dither, c->opt) < 0)  {                \
+        ret = AVERROR(errno);                                           \
+        av_log(s, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", \
+               c->opt, #opt);                                           \
+        goto fail;                                                      \
     }
+    CHECK_DITHER_OPT(algorithm);
+    CHECK_DITHER_OPT(antialias);
+    CHECK_DITHER_OPT(charset);
+    CHECK_DITHER_OPT(color);
 
     if (!c->window_title)
         c->window_title = av_strdup(s->filename);



More information about the ffmpeg-cvslog mailing list