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
33::33::
34 34
35 --- mpv 0.35.0 ---35 --- mpv 0.35.0 ---
36 2.1 - add mpv_del_property()
36 2.0 - remove headers/functions of the obsolete opengl_cb API37 2.0 - remove headers/functions of the obsolete opengl_cb API
37 - remove mpv_opengl_init_params.extra_exts field38 - remove mpv_opengl_init_params.extra_exts field
38 - remove deprecated mpv_detach_destroy. Use mpv_destroy instead.39 - remove deprecated mpv_detach_destroy. Use mpv_destroy instead.
libmpv/client.h+11−1
@@ -240,7 +240,7 @@ extern "C" { · 239 unmodified lines
240 * relational operators (<, >, <=, >=).240 * relational operators (<, >, <=, >=).
241 */241 */
242#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)242#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)
244 244
245/**245/**
246 * The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before246 * 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
1068 */1068 */
1069MPV_EXPORT int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data);1069MPV_EXPORT int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data);
1070 1070
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 */
1079MPV_EXPORT int mpv_del_property(mpv_handle *ctx, const char *name);
1080
1071/**1081/**
1072 * Set a property asynchronously. You will receive the result of the operation1082 * Set a property asynchronously. You will receive the result of the operation
1073 * as MPV_EVENT_SET_PROPERTY_REPLY event. The mpv_event.error field will contain1083 * 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
1337 return req.status;1337 return req.status;
1338}1338}
1339 1339
1340int 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
1340int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data)1346int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data)
1341{1347{
1342 return mpv_set_property(ctx, name, MPV_FORMAT_STRING, &data);1348 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