mpv_create_weak_client method
This is the same as mpv_create_client(), but the created mpv_handle is treated as a weak reference. If all mpv_handles referencing a core are weak references, the core is automatically destroyed. (This still goes through normal uninit of course. Effectively, if the last non-weak mpv_handle is destroyed, then the weak mpv_handles receive MPV_EVENT_SHUTDOWN and are asked to terminate as well.)
Note if you want to use this like refcounting: you have to be aware that mpv_terminate_destroy() and mpv_destroy() for the last non-weak mpv_handle will block until all weak mpv_handles are destroyed.
Implementation
ffi.Pointer<mpv_handle> mpv_create_weak_client(
ffi.Pointer<mpv_handle> ctx,
ffi.Pointer<ffi.Int8> name,
) {
return _mpv_create_weak_client(
ctx,
name,
);
}