summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-24 16:27:24 +0200
committerwm4 <wm4@nowhere>2019-10-24 16:27:24 +0200
commit436bf04d5f59ace8c001f7f22ae3e177f6b90a2a (patch)
treeda6137c39bd3a2419148ae1867a82fcb5c829468
parent962a9fa9812eacd25dd96ce6bf3c0f7cdce4df1c (diff)
downloadmpv-436bf04d5f59ace8c001f7f22ae3e177f6b90a2a.tar.bz2
mpv-436bf04d5f59ace8c001f7f22ae3e177f6b90a2a.tar.xz
client API: remove unused global event mask
Apparently this was only added and used for cache update stuff, which was changed in commit 8dbc93a94cdc3c. Now it's unused, messy, ugly, and is in the way, so get rid of it.
-rw-r--r--player/client.c35
-rw-r--r--player/client.h1
2 files changed, 0 insertions, 36 deletions
diff --git a/player/client.c b/player/client.c
index 6a45ec7fb6..86cdf80677 100644
--- a/player/client.c
+++ b/player/client.c
@@ -69,7 +69,6 @@ struct mp_client_api {
struct mpv_handle **clients;
int num_clients;
- uint64_t event_masks; // combined events of all clients, or 0 if unknown
bool shutting_down; // do not allow new clients
bool have_terminator; // a client took over the role of destroying the core
bool terminate_core_thread; // make libmpv core thread exit
@@ -193,13 +192,6 @@ bool mp_clients_all_initialized(struct MPContext *mpctx)
return all_ok;
}
-static void invalidate_global_event_mask(struct mpv_handle *ctx)
-{
- pthread_mutex_lock(&ctx->clients->lock);
- ctx->clients->event_masks = 0;
- pthread_mutex_unlock(&ctx->clients->lock);
-}
-
static struct mpv_handle *find_client(struct mp_client_api *clients,
const char *name)
{
@@ -265,7 +257,6 @@ struct mpv_handle *mp_new_client(struct mp_client_api *clients, const char *name
if (clients->num_clients == 1 && !clients->mpctx->is_cli)
client->fuzzy_initialized = true;
- clients->event_masks = 0;
pthread_mutex_unlock(&clients->lock);
mpv_request_event(client, MPV_EVENT_TICK, 0);
@@ -726,29 +717,6 @@ static void send_reply(struct mpv_handle *ctx, uint64_t userdata,
pthread_mutex_unlock(&ctx->lock);
}
-// Return whether there's any client listening to this event.
-// If false is returned, the core doesn't need to send it.
-bool mp_client_event_is_registered(struct MPContext *mpctx, int event)
-{
- struct mp_client_api *clients = mpctx->clients;
-
- pthread_mutex_lock(&clients->lock);
-
- if (!clients->event_masks) { // lazy update
- for (int n = 0; n < clients->num_clients; n++) {
- struct mpv_handle *ctx = clients->clients[n];
- pthread_mutex_lock(&ctx->lock);
- clients->event_masks |= ctx->event_mask | ctx->property_event_masks;
- pthread_mutex_unlock(&ctx->lock);
- }
- }
- bool r = clients->event_masks & (1ULL << event);
-
- pthread_mutex_unlock(&clients->lock);
-
- return r;
-}
-
void mp_client_broadcast_event(struct MPContext *mpctx, int event, void *data)
{
struct mp_client_api *clients = mpctx->clients;
@@ -828,7 +796,6 @@ int mpv_request_event(mpv_handle *ctx, mpv_event_id event, int enable)
uint64_t bit = 1ULL << event;
ctx->event_mask = enable ? ctx->event_mask | bit : ctx->event_mask & ~bit;
pthread_mutex_unlock(&ctx->lock);
- invalidate_global_event_mask(ctx);
return 0;
}
@@ -1484,7 +1451,6 @@ int mpv_observe_property(mpv_handle *ctx, uint64_t userdata,
ctx->property_event_masks |= prop->event_mask;
ctx->lowest_changed = 0;
pthread_mutex_unlock(&ctx->lock);
- invalidate_global_event_mask(ctx);
return 0;
}
@@ -1513,7 +1479,6 @@ int mpv_unobserve_property(mpv_handle *ctx, uint64_t userdata)
}
ctx->lowest_changed = 0;
pthread_mutex_unlock(&ctx->lock);
- invalidate_global_event_mask(ctx);
return count;
}
diff --git a/player/client.h b/player/client.h
index e9e8665e70..186238396d 100644
--- a/player/client.h
+++ b/player/client.h
@@ -29,7 +29,6 @@ int mp_client_send_event(struct MPContext *mpctx, const char *client_name,
uint64_t reply_userdata, int event, void *data);
int mp_client_send_event_dup(struct MPContext *mpctx, const char *client_name,
int event, void *data);
-bool mp_client_event_is_registered(struct MPContext *mpctx, int event);
void mp_client_property_change(struct MPContext *mpctx, const char *name);
struct mpv_handle *mp_new_client(struct mp_client_api *clients, const char *name);