History

libmpv: add mpv_del_property() convenience function

rcombs committed 3 years ago

Commit 2cfaa821 parent 04241ab3 files · +18 −1Browse files

Unified · Split

3 files
  1. DOCS/client-api-changes.rst +1 −0
  2. libmpv/client.h +11 −1
  3. player/client.c +6 −0
DOCS/client-api-changes.rst+1−0
@@ -33,6 +33,7 @@ API changes · 32 unmodified lines
3333 ::
3434
3535 --- mpv 0.35.0 ---
36+ 2.1 - add mpv_del_property()
3637 2.0 - remove headers/functions of the obsolete opengl_cb API
3738 - remove mpv_opengl_init_params.extra_exts field
3839 - remove deprecated mpv_detach_destroy. Use mpv_destroy instead.
libmpv/client.h+11−1
@@ -240,7 +240,7 @@ extern "C" { · 239 unmodified lines
240240 * relational operators (<, >, <=, >=).
241241 */
242242 #define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
243−#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(2, 0)
243+#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(2, 1)
244244
245245 /**
246246 * The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
@@ -1068,6 +1068,16 @@ MPV_EXPORT int mpv_set_property(mpv_handle *ctx, const char *name, mpv_format fo · 821 unmodified lines
10681068 */
10691069 MPV_EXPORT int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data);
10701070
1071+/**
1072+ * Convenience function to delete a property.
1073+ *
1074+ * This is equivalent to running the command "del [name]".
1075+ *
1076+ * @param name The property name. See input.rst for a list of properties.
1077+ * @return error code
1078+ */
1079+MPV_EXPORT int mpv_del_property(mpv_handle *ctx, const char *name);
1080+
10711081 /**
10721082 * Set a property asynchronously. You will receive the result of the operation
10731083 * as MPV_EVENT_SET_PROPERTY_REPLY event. The mpv_event.error field will contain
player/client.c+6−0
@@ -1337,6 +1337,12 @@ int mpv_set_property(mpv_handle *ctx, const char *name, mpv_format format, · 1336 unmodified lines
13371337 return req.status;
13381338 }
13391339
1340+int mpv_del_property(mpv_handle *ctx, const char *name)
1341+{
1342+ const char* args[] = { "del", name, NULL };
1343+ return mpv_command(ctx, args);
1344+}
1345+
13401346 int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data)
13411347 {
13421348 return mpv_set_property(ctx, name, MPV_FORMAT_STRING, &data);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t