summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
Diffstat (limited to 'player')
-rw-r--r--player/client.c52
-rw-r--r--player/client.h2
-rw-r--r--player/core.h1
-rw-r--r--player/lua.c12
-rw-r--r--player/lua/defaults.lua12
-rw-r--r--player/playloop.c3
6 files changed, 8 insertions, 74 deletions
diff --git a/player/client.c b/player/client.c
index 774a4e05c0..85e3c4021c 100644
--- a/player/client.c
+++ b/player/client.c
@@ -329,59 +329,11 @@ void mpv_set_wakeup_callback(mpv_handle *ctx, void (*cb)(void *d), void *d)
void mpv_suspend(mpv_handle *ctx)
{
- bool do_suspend = false;
-
- MP_WARN(ctx, "warning: mpv_suspend() is deprecated.\n");
-
- pthread_mutex_lock(&ctx->lock);
- if (ctx->suspend_count == INT_MAX) {
- MP_ERR(ctx, "suspend counter overflow");
- } else {
- do_suspend = ctx->suspend_count == 0;
- ctx->suspend_count++;
- }
- pthread_mutex_unlock(&ctx->lock);
-
- if (do_suspend) {
- mp_dispatch_lock(ctx->mpctx->dispatch);
- ctx->mpctx->suspend_count++;
- mp_dispatch_unlock(ctx->mpctx->dispatch);
- }
+ MP_ERR(ctx, "mpv_suspend() is deprecated and does nothing.\n");
}
void mpv_resume(mpv_handle *ctx)
{
- bool do_resume = false;
-
- pthread_mutex_lock(&ctx->lock);
- if (ctx->suspend_count == 0) {
- MP_ERR(ctx, "suspend counter underflow");
- } else {
- do_resume = ctx->suspend_count == 1;
- ctx->suspend_count--;
- }
- pthread_mutex_unlock(&ctx->lock);
-
- if (do_resume) {
- mp_dispatch_lock(ctx->mpctx->dispatch);
- ctx->mpctx->suspend_count--;
- mp_dispatch_unlock(ctx->mpctx->dispatch);
- mp_dispatch_interrupt(ctx->mpctx->dispatch);
- }
-}
-
-void mp_resume_all(mpv_handle *ctx)
-{
- pthread_mutex_lock(&ctx->lock);
- bool do_resume = ctx->suspend_count > 0;
- ctx->suspend_count = 0;
- pthread_mutex_unlock(&ctx->lock);
-
- if (do_resume) {
- mp_dispatch_lock(ctx->mpctx->dispatch);
- ctx->mpctx->suspend_count--;
- mp_dispatch_unlock(ctx->mpctx->dispatch);
- }
}
static void lock_core(mpv_handle *ctx)
@@ -396,8 +348,6 @@ static void unlock_core(mpv_handle *ctx)
void mpv_wait_async_requests(mpv_handle *ctx)
{
- mp_resume_all(ctx);
-
pthread_mutex_lock(&ctx->lock);
while (ctx->reserved_events || ctx->properties_updating)
wait_wakeup(ctx, INT64_MAX);
diff --git a/player/client.h b/player/client.h
index e39d0e676a..67b287b67f 100644
--- a/player/client.h
+++ b/player/client.h
@@ -35,8 +35,6 @@ struct mp_log *mp_client_get_log(struct mpv_handle *ctx);
struct MPContext *mp_client_get_core(struct mpv_handle *ctx);
struct MPContext *mp_client_api_get_core(struct mp_client_api *api);
-void mp_resume_all(struct mpv_handle *ctx);
-
// m_option.c
void *node_get_alloc(struct mpv_node *node);
diff --git a/player/core.h b/player/core.h
index b33d367cec..9a71ce33de 100644
--- a/player/core.h
+++ b/player/core.h
@@ -226,7 +226,6 @@ enum playback_status {
typedef struct MPContext {
bool initialized;
bool autodetach;
- int suspend_count;
struct mpv_global *global;
struct MPOpts *opts;
struct mp_log *log;
diff --git a/player/lua.c b/player/lua.c
index 442a2ba073..e76dc46fca 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -393,7 +393,6 @@ static int load_lua(struct mpv_handle *client, const char *fname)
r = 0;
error_out:
- mp_resume_all(client);
if (ctx->state)
lua_close(ctx->state);
talloc_free(ctx);
@@ -451,22 +450,17 @@ static int script_find_config_file(lua_State *L)
static int script_suspend(lua_State *L)
{
struct script_ctx *ctx = get_ctx(L);
- MP_WARN(ctx, "mp.suspend() (possibly triggered by mp.use_suspend) is "
- "deprecated.\n");
- mpv_suspend(ctx->client);
+ MP_ERR(ctx, "mp.suspend() is deprecated and does nothing.\n");
return 0;
}
static int script_resume(lua_State *L)
{
- struct script_ctx *ctx = get_ctx(L);
- mpv_resume(ctx->client);
return 0;
}
static int script_resume_all(lua_State *L)
{
- mp_resume_all(get_ctx(L)->client);
return 0;
}
@@ -1134,8 +1128,6 @@ static int script_subprocess(lua_State *L)
luaL_checktype(L, 1, LUA_TTABLE);
void *tmp = mp_lua_PITA(L);
- mp_resume_all(ctx->client);
-
lua_getfield(L, 1, "args"); // args
int num_args = mp_lua_len(L, -1);
char *args[256];
@@ -1193,8 +1185,6 @@ static int script_subprocess_detached(lua_State *L)
luaL_checktype(L, 1, LUA_TTABLE);
void *tmp = mp_lua_PITA(L);
- mp_resume_all(ctx->client);
-
lua_getfield(L, 1, "args"); // args
int num_args = mp_lua_len(L, -1);
char *args[256];
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index c65fda7c9b..08616c5638 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -452,10 +452,15 @@ end
mp.use_suspend = false
+local suspend_warned = false
+
function mp.dispatch_events(allow_wait)
local more_events = true
if mp.use_suspend then
- mp.suspend()
+ if not suspend_warned then
+ mp.msg.error("mp.use_suspend is now ignored.")
+ suspend_warned = true
+ end
end
while mp.keep_running do
local wait = 0
@@ -475,11 +480,6 @@ function mp.dispatch_events(allow_wait)
end
end
local e = mp.wait_event(wait)
- -- Empty the event queue while suspended; otherwise, each
- -- event will keep us waiting until the core suspends again.
- if mp.use_suspend then
- mp.suspend()
- end
more_events = false
if e.event ~= "none" then
call_event_handlers(e)
diff --git a/player/playloop.c b/player/playloop.c
index f72994e8a9..9db9396f95 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -62,9 +62,6 @@ void mp_wait_events(struct MPContext *mpctx)
mp_dispatch_queue_process(mpctx->dispatch, mpctx->sleeptime);
- while (mpctx->suspend_count)
- mp_dispatch_queue_process(mpctx->dispatch, 100);
-
mpctx->in_dispatch = false;
mpctx->sleeptime = INFINITY;