client API: qthelper: add set_option_variant()

This commit is contained in:
wm4 2014-10-30 11:26:31 +01:00
parent aa6b7fa07b
commit 8c3baffadb
2 changed files with 11 additions and 0 deletions

View File

@ -30,6 +30,7 @@ API changes
for slightly better error reporting on playback failure
- add --stop-playback-on-init-failure option, and make it the default
behavior for libmpv only
- add qthelper.hpp set_option_variant()
1.8 - add qthelper.hpp
1.7 - add mpv_command_node(), mpv_command_node_async()
1.6 - modify "core-idle" property behavior

View File

@ -216,6 +216,16 @@ static inline int set_property_variant(mpv_handle *ctx, const QString &name,
return mpv_set_property(ctx, name.toUtf8().data(), MPV_FORMAT_NODE, node.node());
}
/**
* Set the given option as mpv_node converted from the QVariant argument.
*/
static inline int set_option_variant(mpv_handle *ctx, const QString &name,
const QVariant &v)
{
node_builder node(v);
return mpv_set_option(ctx, name.toUtf8().data(), MPV_FORMAT_NODE, node.node());
}
/**
* mpv_command_node() equivalent. Returns QVariant() on error (and
* unfortunately, the same on success).