mirror of
https://github.com/mpv-player/mpv
synced 2025-03-30 23:38:10 +00:00
ipc: alias set_property_string to set_property
The only effective difference is that the former explicitly checks whether the JSON value type is string, and errors out if not. The rest is exactly the same (mpv_set_property_string is mpv_set_property with MPV_FORMAT_STRING). It seems silly to keep this, so just remove it.
This commit is contained in:
parent
47ed894d19
commit
40ebedabcf
@ -180,14 +180,7 @@ extra commands can also be used as part of the protocol:
|
|||||||
{ "error": "success" }
|
{ "error": "success" }
|
||||||
|
|
||||||
``set_property_string``
|
``set_property_string``
|
||||||
Like ``set_property``, but the argument value must be passed as string.
|
Alias for ``set_property``. Both commands accept native values and strings.
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
{ "command": ["set_property_string", "pause", "yes"] }
|
|
||||||
{ "error": "success" }
|
|
||||||
|
|
||||||
``observe_property``
|
``observe_property``
|
||||||
Watch a property for changes. If the given property is changed, then an
|
Watch a property for changes. If the given property is changed, then an
|
||||||
|
23
input/ipc.c
23
input/ipc.c
@ -286,7 +286,9 @@ static char *json_execute_command(struct mpv_handle *client, void *ta_parent,
|
|||||||
mpv_node_map_add_string(ta_parent, &reply_node, "data", result);
|
mpv_node_map_add_string(ta_parent, &reply_node, "data", result);
|
||||||
mpv_free(result);
|
mpv_free(result);
|
||||||
}
|
}
|
||||||
} else if (!strcmp("set_property", cmd)) {
|
} else if (!strcmp("set_property", cmd) ||
|
||||||
|
!strcmp("set_property_string", cmd))
|
||||||
|
{
|
||||||
if (cmd_node->u.list->num != 3) {
|
if (cmd_node->u.list->num != 3) {
|
||||||
rc = MPV_ERROR_INVALID_PARAMETER;
|
rc = MPV_ERROR_INVALID_PARAMETER;
|
||||||
goto error;
|
goto error;
|
||||||
@ -299,25 +301,6 @@ static char *json_execute_command(struct mpv_handle *client, void *ta_parent,
|
|||||||
|
|
||||||
rc = mpv_set_property(client, cmd_node->u.list->values[1].u.string,
|
rc = mpv_set_property(client, cmd_node->u.list->values[1].u.string,
|
||||||
MPV_FORMAT_NODE, &cmd_node->u.list->values[2]);
|
MPV_FORMAT_NODE, &cmd_node->u.list->values[2]);
|
||||||
} else if (!strcmp("set_property_string", cmd)) {
|
|
||||||
if (cmd_node->u.list->num != 3) {
|
|
||||||
rc = MPV_ERROR_INVALID_PARAMETER;
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd_node->u.list->values[1].format != MPV_FORMAT_STRING) {
|
|
||||||
rc = MPV_ERROR_INVALID_PARAMETER;
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd_node->u.list->values[2].format != MPV_FORMAT_STRING) {
|
|
||||||
rc = MPV_ERROR_INVALID_PARAMETER;
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = mpv_set_property_string(client,
|
|
||||||
cmd_node->u.list->values[1].u.string,
|
|
||||||
cmd_node->u.list->values[2].u.string);
|
|
||||||
} else if (!strcmp("observe_property", cmd)) {
|
} else if (!strcmp("observe_property", cmd)) {
|
||||||
if (cmd_node->u.list->num != 3) {
|
if (cmd_node->u.list->num != 3) {
|
||||||
rc = MPV_ERROR_INVALID_PARAMETER;
|
rc = MPV_ERROR_INVALID_PARAMETER;
|
||||||
|
Loading…
Reference in New Issue
Block a user