1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-31 20:21:49 +00:00

m_option: add print callback to color type

This lets scripts query the value of 'background' and similar properties
This commit is contained in:
Olivier Perret 2018-01-21 14:39:29 +01:00 committed by Kevin Mitchell
parent 0cd501dac1
commit 70b2be3cf7

View File

@ -1830,10 +1830,17 @@ exit:
return is_help ? M_OPT_EXIT : M_OPT_INVALID;
}
static char *print_color(const m_option_t *opt, const void *val)
{
const struct m_color *c = val;
return talloc_asprintf(NULL, "#%02X%02X%02X%02X", c->a, c->r, c->g, c->b);
}
const m_option_type_t m_option_type_color = {
.name = "Color",
.size = sizeof(struct m_color),
.parse = parse_color,
.print = print_color,
.copy = copy_opt,
};