pub enum Event {
Show 19 variants
None,
Shutdown,
LogMessage(LogMessage),
GetPropertyReply(GetPropertyReply),
SetPropertyReply(SetPropertyReply),
CommandReply(CommandReply),
StartFile(StartFile),
EndFile(EndFile),
FileLoaded,
Idle,
Tick,
ClientMessage(ClientMessage),
VideoReconfig,
AudioReconfig,
Seek,
PlaybackRestart,
PropertyChange(PropertyChange),
QueueOverflow,
Hook(Hook),
}
Expand description
Events that may be received from Handle::wait_event()
.
Some are just informational, while some contain additional data and some are responses to mpv commands.
Variants§
None
Nothing happened. Happens on timeouts or sporadic wakeups.
Shutdown
Happens when the player quits. The player enters a state where it tries to disconnect all clients.
Most requests to the player will fail, and the client should react to this accordingly;
a Handle
should return execution from whatever context it was passed its mpv_handle
,
while a Client
should call Client::destroy
and quit as soon as possible.
LogMessage(LogMessage)
Happens when mpv receives a log message that matches the level filter set up with Handle::request_log_messages()
.
GetPropertyReply(GetPropertyReply)
Reply to a mpv_get_property_async()
request.
SetPropertyReply(SetPropertyReply)
Reply to a mpv_set_property_async()
request.
CommandReply(CommandReply)
Reply to a mpv_command_async()
or mpv_command_node_async()
request.
StartFile(StartFile)
Notification before playback start of a file (before the file is loaded).
EndFile(EndFile)
Notification after playback end (after the file was unloaded).
FileLoaded
Notification when the file has been loaded (headers were read etc.), and decoding starts.
Idle
idle-active
property. The event is redundant, and might be removed in the far future. As a further warning, this event is not necessarily sent at the right point anymore (at the start of the program), while the property behaves correctly.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 was started with Handle::create()
, idle mode is enabled by default.)
Tick
Handle::observe_property()
with relevant properties instead (such as playback-time
).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.
ClientMessage(ClientMessage)
Triggered by the script-message
input command.
The command uses the first argument of the command as a client name (see Handle::client_name()
) to dispatch the message and passes along all arguments starting from the second argument as strings.
VideoReconfig
Happens after video changed in some way. This can happen on resolution changes, pixel format changes, or video filter changes. The event is sent after the video filters and the VO are reconfigured. Applications embedding a mpv window should listen to this event to resize the window if needed.
Note that this event can happen sporadically, and you should check yourself whether the video parameters really changed before doing something expensive.
AudioReconfig
Similar to Event::VideoReconfig
.
This is relatively uninteresting because there is no such thing as audio output embedding.
Seek
Happens when a seek was initiated. Playback stops.
Usually it will resume with Event::PlaybackRestart
as soon as the seek is finished.
PlaybackRestart
There was a discontinuity of some sort (like a seek), and playback was reinitialized.
Usually happens at the start of playback and after seeking. The main purpose is allowing the client to detect when a seek request is finished.
PropertyChange(PropertyChange)
Event sent when a property observed with Handle::observe_property()
is changed.
QueueOverflow
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 read the event queue quickly enough with Handle::wait_event()
, or if the client makes a very large number of asynchronous calls at once.
Event delivery will continue normally once this event was returned (this forces the client to empty the queue completely).
Hook(Hook)
Triggered if a hook handler was registered with Handle::hook_add()
, and the hook is invoked.
If you receive this, you must handle it and continue the hook with Handle::hook_continue()
.