From f9fd50c6546f2fa510251267d6423d3f342ca115 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 2 Dec 2021 17:19:39 +0100 Subject: player: make deprecated track/chapter/metadata events internal We still need these to track or notify of modifications to certain properties, but they're now gone from the libmpv ABI. --- player/client.c | 8 -------- player/command.c | 10 +++++----- player/command.h | 4 ++++ player/loadfile.c | 12 ++++++------ player/playloop.c | 2 +- 5 files changed, 16 insertions(+), 20 deletions(-) (limited to 'player') diff --git a/player/client.c b/player/client.c index 009f37d587..8d25513259 100644 --- a/player/client.c +++ b/player/client.c @@ -847,12 +847,8 @@ int mp_client_send_event_dup(struct MPContext *mpctx, const char *client_name, } const static bool deprecated_events[] = { - [MPV_EVENT_TRACKS_CHANGED] = true, - [MPV_EVENT_TRACK_SWITCHED] = true, [MPV_EVENT_IDLE] = true, [MPV_EVENT_TICK] = true, - [MPV_EVENT_METADATA_UPDATE] = true, - [MPV_EVENT_CHAPTER_CHANGE] = true, }; int mpv_request_event(mpv_handle *ctx, mpv_event_id event, int enable) @@ -2078,18 +2074,14 @@ static const char *const event_table[] = { [MPV_EVENT_START_FILE] = "start-file", [MPV_EVENT_END_FILE] = "end-file", [MPV_EVENT_FILE_LOADED] = "file-loaded", - [MPV_EVENT_TRACKS_CHANGED] = "tracks-changed", - [MPV_EVENT_TRACK_SWITCHED] = "track-switched", [MPV_EVENT_IDLE] = "idle", [MPV_EVENT_TICK] = "tick", [MPV_EVENT_CLIENT_MESSAGE] = "client-message", [MPV_EVENT_VIDEO_RECONFIG] = "video-reconfig", [MPV_EVENT_AUDIO_RECONFIG] = "audio-reconfig", - [MPV_EVENT_METADATA_UPDATE] = "metadata-update", [MPV_EVENT_SEEK] = "seek", [MPV_EVENT_PLAYBACK_RESTART] = "playback-restart", [MPV_EVENT_PROPERTY_CHANGE] = "property-change", - [MPV_EVENT_CHAPTER_CHANGE] = "chapter-change", [MPV_EVENT_QUEUE_OVERFLOW] = "event-queue-overflow", [MPV_EVENT_HOOK] = "hook", }; diff --git a/player/command.c b/player/command.c index 62c8ca8b13..809e3ed4d6 100644 --- a/player/command.c +++ b/player/command.c @@ -993,7 +993,7 @@ static int parse_node_chapters(struct MPContext *mpctx, } } - mp_notify(mpctx, MPV_EVENT_CHAPTER_CHANGE, NULL); + mp_notify(mpctx, MP_EVENT_CHAPTER_CHANGE, NULL); mp_notify_property(mpctx, "chapter-list"); return M_PROPERTY_OK; @@ -3770,8 +3770,8 @@ static const char *const *const mp_event_property_change[] = { E(MPV_EVENT_END_FILE, "*"), E(MPV_EVENT_FILE_LOADED, "*"), E(MP_EVENT_CHANGE_ALL, "*"), - E(MPV_EVENT_TRACKS_CHANGED, "track-list", "current-tracks"), - E(MPV_EVENT_TRACK_SWITCHED, "track-list", "current-tracks"), + E(MP_EVENT_TRACKS_CHANGED, "track-list", "current-tracks"), + E(MP_EVENT_TRACK_SWITCHED, "track-list", "current-tracks"), E(MPV_EVENT_IDLE, "*"), E(MPV_EVENT_TICK, "time-pos", "audio-pts", "stream-pos", "avsync", "percent-pos", "time-remaining", "playtime-remaining", "playback-time", @@ -3794,8 +3794,8 @@ static const char *const *const mp_event_property_change[] = { "audio-out-params", "volume-max", "mixer-active"), E(MPV_EVENT_SEEK, "seeking", "core-idle", "eof-reached"), E(MPV_EVENT_PLAYBACK_RESTART, "seeking", "core-idle", "eof-reached"), - E(MPV_EVENT_METADATA_UPDATE, "metadata", "filtered-metadata", "media-title"), - E(MPV_EVENT_CHAPTER_CHANGE, "chapter", "chapter-metadata"), + E(MP_EVENT_METADATA_UPDATE, "metadata", "filtered-metadata", "media-title"), + E(MP_EVENT_CHAPTER_CHANGE, "chapter", "chapter-metadata"), E(MP_EVENT_CACHE_UPDATE, "demuxer-cache-duration", "demuxer-cache-idle", "paused-for-cache", "demuxer-cache-time", "cache-buffering-state", "cache-speed", diff --git a/player/command.h b/player/command.h index b45e616497..ba3824cd9b 100644 --- a/player/command.h +++ b/player/command.h @@ -103,6 +103,10 @@ enum { MP_EVENT_CORE_IDLE, MP_EVENT_DURATION_UPDATE, MP_EVENT_INPUT_PROCESSED, + MP_EVENT_TRACKS_CHANGED, + MP_EVENT_TRACK_SWITCHED, + MP_EVENT_METADATA_UPDATE, + MP_EVENT_CHAPTER_CHANGE, }; bool mp_hook_test_completion(struct MPContext *mpctx, char *type); diff --git a/player/loadfile.c b/player/loadfile.c index 51865cf191..a4ef62f2aa 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -353,7 +353,7 @@ void update_demuxer_properties(struct MPContext *mpctx) } talloc_free(mpctx->filtered_tags); mpctx->filtered_tags = info; - mp_notify(mpctx, MPV_EVENT_METADATA_UPDATE, NULL); + mp_notify(mpctx, MP_EVENT_METADATA_UPDATE, NULL); } if (events & DEMUX_EVENT_DURATION) mp_notify(mpctx, MP_EVENT_DURATION_UPDATE, NULL); @@ -429,7 +429,7 @@ static struct track *add_stream_track(struct MPContext *mpctx, }; MP_TARRAY_APPEND(mpctx, mpctx->tracks, mpctx->num_tracks, track); - mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL); + mp_notify(mpctx, MP_EVENT_TRACKS_CHANGED, NULL); return track; } @@ -686,7 +686,7 @@ void mp_switch_track_n(struct MPContext *mpctx, int order, enum stream_type type reinit_sub(mpctx, track); } - mp_notify(mpctx, MPV_EVENT_TRACK_SWITCHED, NULL); + mp_notify(mpctx, MP_EVENT_TRACK_SWITCHED, NULL); mp_wakeup_core(mpctx); talloc_free(mpctx->track_layout_hash); @@ -752,7 +752,7 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track) if (!in_use) demux_cancel_and_free(d); - mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL); + mp_notify(mpctx, MP_EVENT_TRACKS_CHANGED, NULL); return true; } @@ -1358,7 +1358,7 @@ done: reselect_demux_stream(mpctx, mpctx->tracks[n], false); } - mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL); + mp_notify(mpctx, MP_EVENT_TRACKS_CHANGED, NULL); return success ? 1 : -1; } @@ -1721,7 +1721,7 @@ terminate_playback: talloc_free(mpctx->filtered_tags); mpctx->filtered_tags = NULL; - mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL); + mp_notify(mpctx, MP_EVENT_TRACKS_CHANGED, NULL); if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) mpctx->stop_play = PT_ERROR; diff --git a/player/playloop.c b/player/playloop.c index f2c39eb7a3..8d8f0fd8ae 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -962,7 +962,7 @@ static void handle_chapter_change(struct MPContext *mpctx) int chapter = get_current_chapter(mpctx); if (chapter != mpctx->last_chapter) { mpctx->last_chapter = chapter; - mp_notify(mpctx, MPV_EVENT_CHAPTER_CHANGE, NULL); + mp_notify(mpctx, MP_EVENT_CHAPTER_CHANGE, NULL); } } -- cgit v1.2.3