summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-12-02 17:19:39 +0100
committersfan5 <sfan5@live.de>2021-12-15 12:29:10 +0100
commitf9fd50c6546f2fa510251267d6423d3f342ca115 (patch)
tree2200756cb0da12b9b62e5ca381a5d139d4703da7
parentdfcd561ba9087c2a62cb7034c5e661d0b57ad660 (diff)
downloadmpv-f9fd50c6546f2fa510251267d6423d3f342ca115.tar.bz2
mpv-f9fd50c6546f2fa510251267d6423d3f342ca115.tar.xz
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.
-rw-r--r--DOCS/client-api-changes.rst3
-rw-r--r--DOCS/man/input.rst6
-rw-r--r--libmpv/client.h40
-rw-r--r--player/client.c8
-rw-r--r--player/command.c10
-rw-r--r--player/command.h4
-rw-r--r--player/loadfile.c12
-rw-r--r--player/playloop.c2
8 files changed, 20 insertions, 65 deletions
diff --git a/DOCS/client-api-changes.rst b/DOCS/client-api-changes.rst
index 203ada5906..f1203436b2 100644
--- a/DOCS/client-api-changes.rst
+++ b/DOCS/client-api-changes.rst
@@ -37,7 +37,8 @@ API changes
- remove mpv_opengl_init_params.extra_exts field
- remove deprecated mpv_detach_destroy. Use mpv_destroy instead.
- remove obsolete mpv_suspend and mpv_resume
- - remove deprecated SCRIPT_INPUT_DISPATCH, PAUSE and UNPAUSE events
+ - remove deprecated SCRIPT_INPUT_DISPATCH, PAUSE and UNPAUSE, TRACKS_CHANGED
+ TRACK_SWITCHED, METADATA_UPDATE, CHAPTER_CHANGE events
--- mpv 0.33.0 ---
1.109 - add MPV_RENDER_API_TYPE_SW and related (software rendering API)
- inactivate the opengl_cb API (always fails to initialize now)
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index c7af5842bd..514ec0ad53 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1600,10 +1600,8 @@ This list uses the event name field value, and the C API symbol in brackets:
``data``
The new value of the property.
-The following events also happen, but are deprecated: ``tracks-changed``,
-``track-switched``, ``metadata-update``, ``idle``,
-``tick``, ``chapter-change``. Use ``mpv_observe_property()``
-(Lua: ``mp.observe_property()``) instead.
+The following events also happen, but are deprecated: ``idle``, ``tick``
+Use ``mpv_observe_property()`` (Lua: ``mp.observe_property()``) instead.
Hooks
~~~~~
diff --git a/libmpv/client.h b/libmpv/client.h
index 77265c2d32..85d302a76a 100644
--- a/libmpv/client.h
+++ b/libmpv/client.h
@@ -1266,24 +1266,6 @@ typedef enum mpv_event_id {
MPV_EVENT_FILE_LOADED = 8,
#if MPV_ENABLE_DEPRECATED
/**
- * The list of video/audio/subtitle tracks was changed. (E.g. a new track
- * was found. This doesn't necessarily indicate a track switch; for this,
- * MPV_EVENT_TRACK_SWITCHED is used.)
- *
- * @deprecated This is equivalent to using mpv_observe_property() on the
- * "track-list" property. The event is redundant, and might
- * be removed in the far future.
- */
- MPV_EVENT_TRACKS_CHANGED = 9,
- /**
- * A video/audio/subtitle track was switched on or off.
- *
- * @deprecated This is equivalent to using mpv_observe_property() on the
- * "vid", "aid", and "sid" properties. The event is redundant,
- * and might be removed in the far future.
- */
- MPV_EVENT_TRACK_SWITCHED = 10,
- /**
* Idle mode was entered. In this mode, no file is played, and the playback
* core waits for new commands. (The command line player normally quits
* instead of entering idle mode, unless --idle was specified. If mpv
@@ -1331,18 +1313,6 @@ typedef enum mpv_event_id {
* because there is no such thing as audio output embedding.
*/
MPV_EVENT_AUDIO_RECONFIG = 18,
-#if MPV_ENABLE_DEPRECATED
- /**
- * Happens when metadata (like file tags) is possibly updated. (It's left
- * unspecified whether this happens on file start or only when it changes
- * within a file.)
- *
- * @deprecated This is equivalent to using mpv_observe_property() on the
- * "metadata" property. The event is redundant, and might
- * be removed in the far future.
- */
- MPV_EVENT_METADATA_UPDATE = 19,
-#endif
/**
* Happens when a seek was initiated. Playback stops. Usually it will
* resume with MPV_EVENT_PLAYBACK_RESTART as soon as the seek is finished.
@@ -1360,16 +1330,6 @@ typedef enum mpv_event_id {
* See also mpv_event and mpv_event_property.
*/
MPV_EVENT_PROPERTY_CHANGE = 22,
-#if MPV_ENABLE_DEPRECATED
- /**
- * Happens when the current chapter changes.
- *
- * @deprecated This is equivalent to using mpv_observe_property() on the
- * "chapter" property. The event is redundant, and might
- * be removed in the far future.
- */
- MPV_EVENT_CHAPTER_CHANGE = 23,
-#endif
/**
* Happens if the internal per-mpv_handle ringbuffer overflows, and at
* least 1 event had to be dropped. This can happen if the client doesn't
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);
}
}