MPV class

Constructors

MPV(DynamicLibrary dynamicLibrary)
The symbols are looked up in dynamicLibrary.
MPV.fromLookup(Pointer<T> lookup<T extends NativeType>(String symbolName))
The symbols are looked up with lookup.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

mpv_abort_async_command(Pointer<mpv_handle> ctx, int reply_userdata) → void
Signal to all async requests with the matching ID to abort. This affects the following API calls:
mpv_client_api_version() int
Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with.
mpv_client_id(Pointer<mpv_handle> ctx) int
Return the ID of this client handle. Every client has its own unique ID. This ID is never reused by the core, even if the mpv_handle at hand gets destroyed and new handles get allocated.
mpv_client_name(Pointer<mpv_handle> ctx) Pointer<Int8>
Return the name of this client handle. Every client has its own unique name, which is mostly used for user interface purposes.
mpv_command(Pointer<mpv_handle> ctx, Pointer<Pointer<Int8>> args) int
Send a command to the player. Commands are the same as those used in input.conf, except that this function takes parameters in a pre-split form.
mpv_command_async(Pointer<mpv_handle> ctx, int reply_userdata, Pointer<Pointer<Int8>> args) int
Same as mpv_command, but run the command asynchronously.
mpv_command_node(Pointer<mpv_handle> ctx, Pointer<mpv_node> args, Pointer<mpv_node> result) int
Same as mpv_command(), but allows passing structured data in any format. In particular, calling mpv_command() is exactly like calling mpv_command_node() with the format set to MPV_FORMAT_NODE_ARRAY, and every arg passed in order as MPV_FORMAT_STRING.
mpv_command_node_async(Pointer<mpv_handle> ctx, int reply_userdata, Pointer<mpv_node> args) int
Same as mpv_command_node(), but run it asynchronously. Basically, this function is to mpv_command_node() what mpv_command_async() is to mpv_command().
mpv_command_ret(Pointer<mpv_handle> ctx, Pointer<Pointer<Int8>> args, Pointer<mpv_node> result) int
This is essentially identical to mpv_command() but it also returns a result.
mpv_command_string(Pointer<mpv_handle> ctx, Pointer<Int8> args) int
Same as mpv_command, but use input.conf parsing for splitting arguments. This is slightly simpler, but also more error prone, since arguments may need quoting/escaping.
mpv_create() Pointer<mpv_handle>
Create a new mpv instance and an associated client API handle to control the mpv instance. This instance is in a pre-initialized state, and needs to be initialized to be actually used with most other API functions.
mpv_create_client(Pointer<mpv_handle> ctx, Pointer<Int8> name) Pointer<mpv_handle>
Create a new client handle connected to the same player core as ctx. This context has its own event queue, its own mpv_request_event() state, its own mpv_request_log_messages() state, its own set of observed properties, and its own state for asynchronous operations. Otherwise, everything is shared.
mpv_create_weak_client(Pointer<mpv_handle> ctx, Pointer<Int8> name) Pointer<mpv_handle>
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.)
mpv_destroy(Pointer<mpv_handle> ctx) → void
Disconnect and destroy the mpv_handle. ctx will be deallocated with this API call.
mpv_detach_destroy(Pointer<mpv_handle> ctx) → void
@deprecated use mpv_destroy(), which has exactly the same semantics (the deprecation is a mere rename)
mpv_error_string(int error) Pointer<Int8>
Return a string describing the error. For unknown errors, the string "unknown error" is returned.
mpv_event_name(int event) Pointer<Int8>
Return a string describing the event. For unknown events, NULL is returned.
mpv_event_to_node(Pointer<mpv_node> dst, Pointer<mpv_event> src) int
Convert the given src event to a mpv_node, and set *dst to the result. dst is set to a MPV_FORMAT_NODE_MAP, with fields for corresponding mpv_event and mpv_event.data/mpv_event_ fields.
mpv_free(Pointer<Void> data) → void
General function to deallocate memory returned by some of the API functions. Call this only if it's explicitly documented as allowed. Calling this on mpv memory not owned by the caller will lead to undefined behavior.
mpv_free_node_contents(Pointer<mpv_node> node) → void
Frees any data referenced by the node. It doesn't free the node itself. Call this only if the mpv client API set the node. If you constructed the node yourself (manually), you have to free it yourself.
mpv_get_property(Pointer<mpv_handle> ctx, Pointer<Int8> name, int format, Pointer<Void> data) int
Read the value of the given property.
mpv_get_property_async(Pointer<mpv_handle> ctx, int reply_userdata, Pointer<Int8> name, int format) int
Get a property asynchronously. You will receive the result of the operation as well as the property data with the MPV_EVENT_GET_PROPERTY_REPLY event. You should check the mpv_event.error field on the reply event.
mpv_get_property_osd_string(Pointer<mpv_handle> ctx, Pointer<Int8> name) Pointer<Int8>
Return the property as "OSD" formatted string. This is the same as mpv_get_property_string, but using MPV_FORMAT_OSD_STRING.
mpv_get_property_string(Pointer<mpv_handle> ctx, Pointer<Int8> name) Pointer<Int8>
Return the value of the property with the given name as string. This is equivalent to mpv_get_property() with MPV_FORMAT_STRING.
mpv_get_sub_api(Pointer<mpv_handle> ctx, int sub_api) Pointer<Void>
This is used for additional APIs that are not strictly part of the core API. See the individual mpv_sub_api member values.
mpv_get_time_us(Pointer<mpv_handle> ctx) int
Return the internal time in microseconds. This has an arbitrary start offset, but will never wrap or go backwards.
mpv_get_wakeup_pipe(Pointer<mpv_handle> ctx) int
Return a UNIX file descriptor referring to the read end of a pipe. This pipe can be used to wake up a poll() based processing loop. The purpose of this function is very similar to mpv_set_wakeup_callback(), and provides a primitive mechanism to handle coordinating a foreign event loop and the libmpv event loop. The pipe is non-blocking. It's closed when the mpv_handle is destroyed. This function always returns the same value (on success).
mpv_hook_add(Pointer<mpv_handle> ctx, int reply_userdata, Pointer<Int8> name, int priority) int
A hook is like a synchronous event that blocks the player. You register a hook handler with this function. You will get an event, which you need to handle, and once things are ready, you can let the player continue with mpv_hook_continue().
mpv_hook_continue(Pointer<mpv_handle> ctx, int id) int
Respond to a MPV_EVENT_HOOK event. You must call this after you have handled the event. There is no way to "cancel" or "stop" the hook.
mpv_initialize(Pointer<mpv_handle> ctx) int
Initialize an uninitialized mpv instance. If the mpv instance is already running, an error is returned.
mpv_load_config_file(Pointer<mpv_handle> ctx, Pointer<Int8> filename) int
Load a config file. This loads and parses the file, and sets every entry in the config file's default section as if mpv_set_option_string() is called.
mpv_observe_property(Pointer<mpv_handle> mpv, int reply_userdata, Pointer<Int8> name, int format) int
Get a notification whenever the given property changes. You will receive updates as MPV_EVENT_PROPERTY_CHANGE. Note that this is not very precise: for some properties, it may not send updates even if the property changed. This depends on the property, and it's a valid feature request to ask for better update handling of a specific property. (For some properties, like clock, which shows the wall clock, this mechanism doesn't make too much sense anyway.)
mpv_request_event(Pointer<mpv_handle> ctx, int event, int enable) int
Enable or disable the given event.
mpv_request_log_messages(Pointer<mpv_handle> ctx, Pointer<Int8> min_level) int
Enable or disable receiving of log messages. These are the messages the command line player prints to the terminal. This call sets the minimum required log level for a message to be received with MPV_EVENT_LOG_MESSAGE.
mpv_resume(Pointer<mpv_handle> ctx) → void
See mpv_suspend().
mpv_set_option(Pointer<mpv_handle> ctx, Pointer<Int8> name, int format, Pointer<Void> data) int
Set an option. Note that you can't normally set options during runtime. It works in uninitialized state (see mpv_create()), and in some cases in at runtime.
mpv_set_option_string(Pointer<mpv_handle> ctx, Pointer<Int8> name, Pointer<Int8> data) int
Convenience function to set an option to a string value. This is like calling mpv_set_option() with MPV_FORMAT_STRING.
mpv_set_property(Pointer<mpv_handle> ctx, Pointer<Int8> name, int format, Pointer<Void> data) int
Set a property to a given value. Properties are essentially variables which can be queried or set at runtime. For example, writing to the pause property will actually pause or unpause playback.
mpv_set_property_async(Pointer<mpv_handle> ctx, int reply_userdata, Pointer<Int8> name, int format, Pointer<Void> data) int
Set a property asynchronously. You will receive the result of the operation as MPV_EVENT_SET_PROPERTY_REPLY event. The mpv_event.error field will contain the result status of the operation. Otherwise, this function is similar to mpv_set_property().
mpv_set_property_string(Pointer<mpv_handle> ctx, Pointer<Int8> name, Pointer<Int8> data) int
Convenience function to set a property to a string value.
mpv_set_wakeup_callback(Pointer<mpv_handle> ctx, Pointer<NativeFunction<Void Function(Pointer<Void>)>> cb, Pointer<Void> d) → void
Set a custom function that should be called when there are new events. Use this if blocking in mpv_wait_event() to wait for new events is not feasible.
mpv_suspend(Pointer<mpv_handle> ctx) → void
This does nothing since mpv 0.23.0 (API version 1.24). Below is the description of the old behavior.
mpv_terminate_destroy(Pointer<mpv_handle> ctx) → void
Similar to mpv_destroy(), but brings the player and all clients down as well, and waits until all of them are destroyed. This function blocks. The advantage over mpv_destroy() is that while mpv_destroy() merely detaches the client handle from the player, this function quits the player, waits until all other clients are destroyed (i.e. all mpv_handles are detached), and also waits for the final termination of the player.
mpv_unobserve_property(Pointer<mpv_handle> mpv, int registered_reply_userdata) int
Undo mpv_observe_property(). This will remove all observed properties for which the given number was passed as reply_userdata to mpv_observe_property.
mpv_wait_async_requests(Pointer<mpv_handle> ctx) → void
Block until all asynchronous requests are done. This affects functions like mpv_command_async(), which return immediately and return their result as events.
mpv_wait_event(Pointer<mpv_handle> ctx, double timeout) Pointer<mpv_event>
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.
mpv_wakeup(Pointer<mpv_handle> ctx) → void
Interrupt the current mpv_wait_event() call. This will wake up the thread currently waiting in mpv_wait_event(). If no thread is waiting, the next mpv_wait_event() call will return immediately (this is to avoid lost wakeups).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited