From 0eabc6614a0d7c5d8d57a8a74d7b7447677038cd Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 22 Dec 2019 14:35:32 +0100 Subject: client API: deprecate tick event This is conceptually outdated and should not exist. This affects Lua scripting and JSON IPC too. --- DOCS/client-api-changes.rst | 1 + libmpv/client.h | 7 ++++--- player/client.c | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/DOCS/client-api-changes.rst b/DOCS/client-api-changes.rst index e52e04d54a..7a3fe9741d 100644 --- a/DOCS/client-api-changes.rst +++ b/DOCS/client-api-changes.rst @@ -33,6 +33,7 @@ API changes :: --- mpv 0.30.0 --- + 1.107 - Deprecate MPV_EVENT_TICK 1.106 - Add cancel_fn to mpv_stream_cb_info 1.105 - Fix deadlock problems with MPV_RENDER_PARAM_ADVANCED_CONTROL and if the "vd-lavc-dr" option is enabled (which it is by default). diff --git a/libmpv/client.h b/libmpv/client.h index 4319240888..2e8dcdc960 100644 --- a/libmpv/client.h +++ b/libmpv/client.h @@ -227,7 +227,7 @@ extern "C" { * relational operators (<, >, <=, >=). */ #define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL) -#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 106) +#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 107) /** * The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before @@ -1356,15 +1356,16 @@ typedef enum mpv_event_id { * removed in the far future. */ MPV_EVENT_UNPAUSE = 13, -#endif /** * Sent every time after a video frame is displayed. Note that currently, * this will be sent in lower frequency if there is no video, or playback * is paused - but that will be removed in the future, and it will be * restricted to video frames only. + * + * @deprecated Use mpv_observe_property() with relevant properties instead + * (such as "playback-time"). */ MPV_EVENT_TICK = 14, -#if MPV_ENABLE_DEPRECATED /** * @deprecated This was used internally with the internal "script_dispatch" * command to dispatch keyboard and mouse input for the OSC. diff --git a/player/client.c b/player/client.c index 0d1a4e6d53..e44f3cacea 100644 --- a/player/client.c +++ b/player/client.c @@ -840,6 +840,8 @@ int mpv_request_event(mpv_handle *ctx, mpv_event_id event, int enable) pthread_mutex_lock(&ctx->lock); uint64_t bit = 1ULL << event; ctx->event_mask = enable ? ctx->event_mask | bit : ctx->event_mask & ~bit; + if (enable && event == MPV_EVENT_TICK) + MP_WARN(ctx, "The 'tick' event is deprecated and will be removed.\n"); pthread_mutex_unlock(&ctx->lock); return 0; } -- cgit v1.2.3