Wait for the next event, or until the timeout expires, or if another thread
makes a call to mpv_wakeup(). Passing 0 as timeout will never wait, and
is suitable for polling.
The internal event queue has a limited size (per client handle). If you
don't empty the event queue quickly enough with mpv_wait_event(), it will
overflow and silently discard further events. If this happens, making
asynchronous requests will fail as well (with MPV_ERROR_EVENT_QUEUE_FULL).
Only one thread is allowed to call this on the same mpv_handle at a time.
The API won't complain if more than one thread calls this, but it will cause
race conditions in the client when accessing the shared mpv_event struct.
Note that most other API functions are not restricted by this, and no API
function internally calls mpv_wait_event(). Additionally, concurrent calls
to different mpv_handles are always safe.
As long as the timeout is 0, this is safe to be called from mpv render API
threads.
@param timeout Timeout in seconds, after which the function returns even if
no event was received. A MPV_EVENT_NONE is returned on
timeout. A value of 0 will disable waiting. Negative values
will wait with an infinite timeout.
@return A struct containing the event ID and other data. The pointer (and
fields in the struct) stay valid until the next mpv_wait_event()
call, or until the mpv_handle is destroyed. You must not write to
the struct, and all memory referenced by it will be automatically
released by the API on the next mpv_wait_event() call, or when the
context is destroyed. The return value is never NULL.
Wait for the next event, or until the timeout expires, or if another thread makes a call to mpv_wakeup(). Passing 0 as timeout will never wait, and is suitable for polling.
The internal event queue has a limited size (per client handle). If you don't empty the event queue quickly enough with mpv_wait_event(), it will overflow and silently discard further events. If this happens, making asynchronous requests will fail as well (with MPV_ERROR_EVENT_QUEUE_FULL).
Only one thread is allowed to call this on the same mpv_handle at a time. The API won't complain if more than one thread calls this, but it will cause race conditions in the client when accessing the shared mpv_event struct. Note that most other API functions are not restricted by this, and no API function internally calls mpv_wait_event(). Additionally, concurrent calls to different mpv_handles are always safe.
As long as the timeout is 0, this is safe to be called from mpv render API threads.
@param timeout Timeout in seconds, after which the function returns even if no event was received. A MPV_EVENT_NONE is returned on timeout. A value of 0 will disable waiting. Negative values will wait with an infinite timeout. @return A struct containing the event ID and other data. The pointer (and fields in the struct) stay valid until the next mpv_wait_event() call, or until the mpv_handle is destroyed. You must not write to the struct, and all memory referenced by it will be automatically released by the API on the next mpv_wait_event() call, or when the context is destroyed. The return value is never NULL.