summaryrefslogtreecommitdiffstats
path: root/libmpv
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-03-09 04:46:09 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-03-15 00:00:04 -0700
commit410a1b49edfbbf7d528fd7dd06b73d06e2f9fce4 (patch)
tree0861a27aa393997ccf02fe4498beff564a1a538b /libmpv
parent782fa455b54f9153abefb64e26b8a25925118fc9 (diff)
downloadmpv-410a1b49edfbbf7d528fd7dd06b73d06e2f9fce4.tar.bz2
mpv-410a1b49edfbbf7d528fd7dd06b73d06e2f9fce4.tar.xz
client API: cleanup mpv_handle termination
This changes how mpv_terminate_destroy() and mpv_detach_destroy() behave. The doxygen in client.h tries to point out the differences. The goal is to make this more useful to the API user (making it behave like refcounting). This will be refined in follow up commits. Initialization is unfortunately closely tied to termination, so that changes as well. This also removes earlier hacks that make sure that some parts of FFmpeg initialization are run in the playback thread (instead of the user's thread). This does not matter with standard FFmpeg, and I have no reason to care about this anymore.
Diffstat (limited to 'libmpv')
-rw-r--r--libmpv/client.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/libmpv/client.h b/libmpv/client.h
index 07237c9d4d..536000229e 100644
--- a/libmpv/client.h
+++ b/libmpv/client.h
@@ -210,7 +210,7 @@ extern "C" {
* relational operators (<, >, <=, >=).
*/
#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
-#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 28)
+#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 29)
/**
* The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
@@ -449,9 +449,17 @@ int mpv_initialize(mpv_handle *ctx);
/**
* Disconnect and destroy the mpv_handle. ctx will be deallocated with this
- * API call. This leaves the player running. If you want to be sure that the
- * player is terminated, send a "quit" command, and wait until the
- * MPV_EVENT_SHUTDOWN event is received, or use mpv_terminate_destroy().
+ * API call.
+ *
+ * Since mpv client API version 1.29:
+ * If the last mpv_handle is detached, the core player is destroyed. Note that
+ * internal mpv_handles created due to scripts (e.g. the OSC) will keep the
+ * player running. (To be fixed in the following commit.)
+ *
+ * Before mpv client API version 1.29:
+ * This left the player running. If you want to be sure that the
+ * player is terminated, send a "quit" command, and wait until the
+ * MPV_EVENT_SHUTDOWN event is received, or use mpv_terminate_destroy().
*/
void mpv_detach_destroy(mpv_handle *ctx);
@@ -466,9 +474,19 @@ void mpv_detach_destroy(mpv_handle *ctx);
* Since mpv_detach_destroy() is called somewhere on the way, it's not safe to
* call other functions concurrently on the same context.
*
- * If this is called on a mpv_handle that was not created with mpv_create(),
- * this function will merely send a quit command and then call
- * mpv_detach_destroy(), without waiting for the actual shutdown.
+ * Since mpv client API version 1.29:
+ * The first call on any mpv_handle will block until the core is destroyed.
+ * This means it will wait until other mpv_handle have been destroyed. If you
+ * want asynchronous destruction, just run the "quit" command, and then react
+ * to the MPV_EVENT_SHUTDOWN event.
+ * If another mpv_handle already called mpv_terminate_destroy(), this call will
+ * not actually block. It will destroy the mpv_handle, and exit immediately,
+ * while other mpv_handles might still be uninitializing.
+ *
+ * Before mpv client API version 1.29:
+ * If this is called on a mpv_handle that was not created with mpv_create(),
+ * this function will merely send a quit command and then call
+ * mpv_detach_destroy(), without waiting for the actual shutdown.
*/
void mpv_terminate_destroy(mpv_handle *ctx);