summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-30 11:26:31 +0100
committerwm4 <wm4@nowhere>2014-10-30 11:29:45 +0100
commit8c3baffadbff167a75c34024374cd08dae4a9cdd (patch)
tree901f958d54d47767082dfcb663c819f6ad038cfa
parentaa6b7fa07baa0066efb774deed8cb826e6193deb (diff)
downloadmpv-8c3baffadbff167a75c34024374cd08dae4a9cdd.tar.bz2
mpv-8c3baffadbff167a75c34024374cd08dae4a9cdd.tar.xz
client API: qthelper: add set_option_variant()
-rw-r--r--DOCS/client-api-changes.rst1
-rw-r--r--libmpv/qthelper.hpp10
2 files changed, 11 insertions, 0 deletions
diff --git a/DOCS/client-api-changes.rst b/DOCS/client-api-changes.rst
index 48d1facd95..eee27c6a3f 100644
--- a/DOCS/client-api-changes.rst
+++ b/DOCS/client-api-changes.rst
@@ -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
diff --git a/libmpv/qthelper.hpp b/libmpv/qthelper.hpp
index 2c3fe00596..1b0ff47a0b 100644
--- a/libmpv/qthelper.hpp
+++ b/libmpv/qthelper.hpp
@@ -217,6 +217,16 @@ static inline int set_property_variant(mpv_handle *ctx, const QString &name,
}
/**
+ * 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).
*/