summaryrefslogtreecommitdiffstats
path: root/player/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/client.c')
-rw-r--r--player/client.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/player/client.c b/player/client.c
index d3b0567a97..f5a321b41d 100644
--- a/player/client.c
+++ b/player/client.c
@@ -280,7 +280,7 @@ static void wakeup_client(struct mpv_handle *ctx)
if (ctx->wakeup_cb)
ctx->wakeup_cb(ctx->wakeup_cb_ctx);
if (ctx->wakeup_pipe[0] != -1)
- write(ctx->wakeup_pipe[1], &(char){0}, 1);
+ (void)write(ctx->wakeup_pipe[1], &(char){0}, 1);
}
pthread_mutex_unlock(&ctx->wakeup_lock);
}
@@ -1071,42 +1071,18 @@ static void setproperty_fn(void *arg)
struct setproperty_request *req = arg;
const struct m_option *type = get_mp_type(req->format);
- int err;
- switch (req->format) {
- case MPV_FORMAT_STRING: {
- // Go through explicit string conversion. M_PROPERTY_SET_NODE doesn't
- // do this, because it tries to be somewhat type-strict. But the client
- // needs a way to set everything by string.
- char *s = *(char **)req->data;
- MP_VERBOSE(req->mpctx, "Set property string: %s='%s'\n", req->name, s);
- err = mp_property_do(req->name, M_PROPERTY_SET_STRING, s, req->mpctx);
- break;
- }
- case MPV_FORMAT_NODE:
- case MPV_FORMAT_FLAG:
- case MPV_FORMAT_INT64:
- case MPV_FORMAT_DOUBLE: {
- struct mpv_node node;
- if (req->format == MPV_FORMAT_NODE) {
- node = *(struct mpv_node *)req->data;
- } else {
- // These are basically emulated via mpv_node.
- node.format = req->format;
- memcpy(&node.u, req->data, type->type->size);
- }
- if (mp_msg_test(req->mpctx->log, MSGL_V)) {
- struct m_option ot = {.type = &m_option_type_node};
- char *t = m_option_print(&ot, &node);
- MP_VERBOSE(req->mpctx, "Set property: %s=%s\n", req->name, t ? t : "?");
- talloc_free(t);
- }
- err = mp_property_do(req->name, M_PROPERTY_SET_NODE, &node, req->mpctx);
- break;
- }
- default:
- abort();
+ struct mpv_node *node;
+ struct mpv_node tmp;
+ if (req->format == MPV_FORMAT_NODE) {
+ node = req->data;
+ } else {
+ tmp.format = req->format;
+ memcpy(&tmp.u, req->data, type->type->size);
+ node = &tmp;
}
+ int err = mp_property_do(req->name, M_PROPERTY_SET_NODE, node, req->mpctx);
+
req->status = translate_property_error(err);
if (req->reply_ctx) {
@@ -1583,7 +1559,7 @@ int mpv_get_wakeup_pipe(mpv_handle *ctx)
pthread_mutex_lock(&ctx->wakeup_lock);
if (ctx->wakeup_pipe[0] == -1) {
if (mp_make_wakeup_pipe(ctx->wakeup_pipe) >= 0)
- write(ctx->wakeup_pipe[1], &(char){0}, 1);
+ (void)write(ctx->wakeup_pipe[1], &(char){0}, 1);
}
int fd = ctx->wakeup_pipe[0];
pthread_mutex_unlock(&ctx->wakeup_lock);