Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: add MPV_EVENT_INITIALIZED #15089

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DOCS/client-api-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ API changes

::

--- mpv 0.40.0 ---
2.5 - add MPV_EVENT_INITIALIZED event
--- mpv 0.39.0 ---
2.4 - mpv_render_param with the MPV_RENDER_PARAM_ICC_PROFILE argument no
longer has incorrect assumptions about memory allocation and can be
Expand Down
4 changes: 4 additions & 0 deletions DOCS/man/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,10 @@ This list uses the event name field value, and the C API symbol in brackets:
``data``
The new value of the property.

``initialized`` (``MPV_EVENT_INITIALIZED``)
Triggered after initialization is complete, including all scripts.
mpv is proceeding to play the file.

The following events also happen, but are deprecated: ``idle``, ``tick``
Use ``mpv_observe_property()`` (Lua: ``mp.observe_property()``) instead.

Expand Down
5 changes: 5 additions & 0 deletions libmpv/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,11 @@ typedef enum mpv_event_id {
* See also mpv_event and mpv_event_hook.
*/
MPV_EVENT_HOOK = 25,
/**
* Triggered after initialization is complete, including all scripts.
* mpv is proceeding to play the file.
*/
MPV_EVENT_INITIALIZED = 26,
// Internal note: adjust INTERNAL_EVENT_BASE when adding new events.
} mpv_event_id;

Expand Down
1 change: 1 addition & 0 deletions player/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,7 @@ static const char *const event_table[] = {
[MPV_EVENT_PROPERTY_CHANGE] = "property-change",
[MPV_EVENT_QUEUE_OVERFLOW] = "event-queue-overflow",
[MPV_EVENT_HOOK] = "hook",
[MPV_EVENT_INITIALIZED] = "initialized",
};

const char *mpv_event_name(mpv_event_id event)
Expand Down
2 changes: 1 addition & 1 deletion player/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ uint64_t mp_get_property_event_mask(const char *name);
enum {
// Must start with the first unused positive value in enum mpv_event_id
// MPV_EVENT_* and MP_EVENT_* must not overlap.
INTERNAL_EVENT_BASE = 26,
INTERNAL_EVENT_BASE = 27,
MP_EVENT_CHANGE_ALL,
MP_EVENT_CACHE_UPDATE,
MP_EVENT_WIN_RESIZE,
Expand Down
1 change: 1 addition & 0 deletions player/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,7 @@ void mp_play_files(struct MPContext *mpctx)
}
// After above is finished; but even if it's skipped.
mp_msg_set_early_logging(mpctx->global, false);
mp_notify(mpctx, MPV_EVENT_INITIALIZED, NULL);

prepare_playlist(mpctx, mpctx->playlist);

Expand Down
Loading