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

This commit is contained in:
Stefano Sabatini 2012-07-21 11:04:51 +02:00
parent fa71471cef
commit 9ce0e19ab6

View File

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