summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/client-api-changes.rst1
-rw-r--r--libmpv/client.h12
-rw-r--r--player/client.c6
3 files changed, 18 insertions, 1 deletions
diff --git a/DOCS/client-api-changes.rst b/DOCS/client-api-changes.rst
index f1203436b2..df01e5d755 100644
--- a/DOCS/client-api-changes.rst
+++ b/DOCS/client-api-changes.rst
@@ -33,6 +33,7 @@ API changes
::
--- mpv 0.35.0 ---
+ 2.1 - add mpv_del_property()
2.0 - remove headers/functions of the obsolete opengl_cb API
- remove mpv_opengl_init_params.extra_exts field
- remove deprecated mpv_detach_destroy. Use mpv_destroy instead.
diff --git a/libmpv/client.h b/libmpv/client.h
index fb10e5e01d..414c6fe80e 100644
--- a/libmpv/client.h
+++ b/libmpv/client.h
@@ -240,7 +240,7 @@ extern "C" {
* relational operators (<, >, <=, >=).
*/
#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
-#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(2, 0)
+#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(2, 1)
/**
* The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
@@ -1069,6 +1069,16 @@ MPV_EXPORT int mpv_set_property(mpv_handle *ctx, const char *name, mpv_format fo
MPV_EXPORT int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data);
/**
+ * Convenience function to delete a property.
+ *
+ * This is equivalent to running the command "del [name]".
+ *
+ * @param name The property name. See input.rst for a list of properties.
+ * @return error code
+ */
+MPV_EXPORT int mpv_del_property(mpv_handle *ctx, const char *name);
+
+/**
* Set a property asynchronously. You will receive the result of the operation
* as MPV_EVENT_SET_PROPERTY_REPLY event. The mpv_event.error field will contain
* the result status of the operation. Otherwise, this function is similar to
diff --git a/player/client.c b/player/client.c
index e6045b4c68..9b4c83b861 100644
--- a/player/client.c
+++ b/player/client.c
@@ -1337,6 +1337,12 @@ int mpv_set_property(mpv_handle *ctx, const char *name, mpv_format format,
return req.status;
}
+int mpv_del_property(mpv_handle *ctx, const char *name)
+{
+ const char* args[] = { "del", name, NULL };
+ return mpv_command(ctx, args);
+}
+
int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data)
{
return mpv_set_property(ctx, name, MPV_FORMAT_STRING, &data);