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.
This commit is contained in:
sfan5 2021-12-02 17:19:39 +01:00
parent dfcd561ba9
commit f9fd50c654
8 changed files with 20 additions and 65 deletions

View File

@ -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)

View File

@ -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
~~~~~

View File

@ -1265,24 +1265,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
@ -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

View File

@ -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",
};

View File

@ -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",

View File

@ -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);

View File

@ -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;

View File

@ -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);
}
}