[][src]Crate libmpv_sys

Re-exports

pub use self::mpv_render_update_flag as mpv_render_context_flag;

Structs

__fsid_t
_drmModeAtomicReq
max_align_t
mpv_byte_array

(see mpv_node)

mpv_event
mpv_event_client_message
mpv_event_command
mpv_event_end_file
mpv_event_hook
mpv_event_log_message
mpv_event_property
mpv_event_script_input_dispatch

@deprecated see MPV_EVENT_SCRIPT_INPUT_DISPATCH for remarks

mpv_event_start_file

Since API version 1.108.

mpv_handle
mpv_node

Generic data storage.

mpv_node_list

(see mpv_node)

mpv_opengl_drm_draw_surface_size

For MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE.

mpv_opengl_drm_params

Deprecated. For MPV_RENDER_PARAM_DRM_DISPLAY.

mpv_opengl_drm_params_v2

For MPV_RENDER_PARAM_DRM_DISPLAY_V2.

mpv_opengl_fbo

For MPV_RENDER_PARAM_OPENGL_FBO.

mpv_opengl_init_params

For initializing the mpv OpenGL state via MPV_RENDER_PARAM_OPENGL_INIT_PARAMS.

mpv_render_context
mpv_render_frame_info

Information about the next video frame that will be rendered. Can be retrieved with MPV_RENDER_PARAM_NEXT_FRAME_INFO.

mpv_render_param

Used to pass arbitrary parameters to some mpv_render_* functions. The meaning of the data parameter is determined by the type, and each MPV_RENDER_PARAM_* documents what type the value must point to.

mpv_stream_cb_info

See mpv_stream_cb_open_ro_fn callback.

Constants

INT8_MIN
INT8_MAX
INT16_MIN
INT16_MAX
INT32_MIN
INT32_MAX
INTPTR_MAX
INTPTR_MIN
INT_FAST8_MIN
INT_FAST8_MAX
INT_FAST16_MIN
INT_FAST16_MAX
INT_FAST32_MIN
INT_FAST32_MAX
INT_LEAST8_MIN
INT_LEAST8_MAX
INT_LEAST16_MIN
INT_LEAST16_MAX
INT_LEAST32_MIN
INT_LEAST32_MAX
MPV_ENABLE_DEPRECATED
MPV_RENDER_API_TYPE_OPENGL
PTRDIFF_MAX
PTRDIFF_MIN
SIG_ATOMIC_MAX
SIG_ATOMIC_MIN
SIZE_MAX
UINT8_MAX
UINT16_MAX
UINT32_MAX
UINTPTR_MAX
UINT_FAST8_MAX
UINT_FAST16_MAX
UINT_FAST32_MAX
UINT_LEAST8_MAX
UINT_LEAST16_MAX
UINT_LEAST32_MAX
WINT_MAX
WINT_MIN
_ATFILE_SOURCE
_BITS_STDINT_INTN_H
_BITS_STDINT_UINTN_H
_BITS_TIME64_H
_BITS_TYPESIZES_H
_BITS_TYPES_H
_BITS_WCHAR_H
_DEFAULT_SOURCE
_FEATURES_H
_POSIX_C_SOURCE
_POSIX_SOURCE
_STDC_PREDEF_H
_STDINT_H
_SYS_CDEFS_H
__FD_SETSIZE
__GLIBC_MINOR__
__GLIBC_USE_DEPRECATED_GETS
__GLIBC_USE_DEPRECATED_SCANF
__GLIBC_USE_IEC_60559_BFP_EXT
__GLIBC_USE_IEC_60559_FUNCS_EXT
__GLIBC_USE_IEC_60559_TYPES_EXT
__GLIBC_USE_IEC_60559_BFP_EXT_C2X
__GLIBC_USE_IEC_60559_FUNCS_EXT_C2X
__GLIBC_USE_ISOC2X
__GLIBC_USE_LIB_EXT2
__GLIBC__
__GNU_LIBRARY__
__HAVE_GENERIC_SELECTION
__INO_T_MATCHES_INO64_T
__LONG_DOUBLE_USES_FLOAT128
__OFF_T_MATCHES_OFF64_T
__RLIM_T_MATCHES_RLIM64_T
__STATFS_MATCHES_STATFS64
__STDC_IEC_559__
__STDC_IEC_559_COMPLEX__
__STDC_ISO_10646__
__SYSCALL_WORDSIZE
__TIMESIZE
__USE_ATFILE
__USE_FORTIFY_LEVEL
__USE_ISOC11
__USE_ISOC95
__USE_ISOC99
__USE_MISC
__USE_POSIX
__USE_POSIX2
__USE_POSIX199309
__USE_POSIX199506
__USE_POSIX_IMPLICITLY
__USE_XOPEN2K
__USE_XOPEN2K8
__WORDSIZE
__WORDSIZE_TIME64_COMPAT32
__glibc_c99_flexarr_available
mpv_end_file_reason_MPV_END_FILE_REASON_EOF

The end of file was reached. Sometimes this may also happen on incomplete or corrupted files, or if the network connection was interrupted when playing a remote file. It also happens if the playback range was restricted with --end or --frames or similar.

mpv_end_file_reason_MPV_END_FILE_REASON_ERROR

Some kind of error happened that lead to playback abort. Does not necessarily happen on incomplete or broken files (in these cases, both MPV_END_FILE_REASON_ERROR or MPV_END_FILE_REASON_EOF are possible).

mpv_end_file_reason_MPV_END_FILE_REASON_QUIT

Playback was stopped by the quit command or player shutdown.

mpv_end_file_reason_MPV_END_FILE_REASON_REDIRECT

The file was a playlist or similar. When the playlist is read, its entries will be appended to the playlist after the entry of the current file, the entry of the current file is removed, and a MPV_EVENT_END_FILE event is sent with reason set to MPV_END_FILE_REASON_REDIRECT. Then playback continues with the playlist contents. Since API version 1.18.

mpv_end_file_reason_MPV_END_FILE_REASON_STOP

Playback was stopped by an external action (e.g. playlist controls).

mpv_error_MPV_ERROR_AO_INIT_FAILED

Initializing the audio output failed.

mpv_error_MPV_ERROR_COMMAND

General error when running a command with mpv_command and similar.

mpv_error_MPV_ERROR_EVENT_QUEUE_FULL

The event ringbuffer is full. This means the client is choked, and can't receive any events. This can happen when too many asynchronous requests have been made, but not answered. Probably never happens in practice, unless the mpv core is frozen for some reason, and the client keeps making asynchronous requests. (Bugs in the client API implementation could also trigger this, e.g. if events become "lost".)

mpv_error_MPV_ERROR_GENERIC

Unspecified error.

mpv_error_MPV_ERROR_INVALID_PARAMETER

Generic catch-all error if a parameter is set to an invalid or unsupported value. This is used if there is no better error code.

mpv_error_MPV_ERROR_LOADING_FAILED

Generic error on loading (usually used with mpv_event_end_file.error).

mpv_error_MPV_ERROR_NOMEM

Memory allocation failed.

mpv_error_MPV_ERROR_NOTHING_TO_PLAY

There was no audio or video data to play. This also happens if the file was recognized, but did not contain any audio or video streams, or no streams were selected.

mpv_error_MPV_ERROR_NOT_IMPLEMENTED

The API function which was called is a stub only.

mpv_error_MPV_ERROR_OPTION_ERROR

Setting the option failed. Typically this happens if the provided option value could not be parsed.

mpv_error_MPV_ERROR_OPTION_FORMAT

Trying to set an option using an unsupported MPV_FORMAT.

mpv_error_MPV_ERROR_OPTION_NOT_FOUND

Trying to set an option that doesn't exist.

mpv_error_MPV_ERROR_PROPERTY_ERROR

Error setting or getting a property.

mpv_error_MPV_ERROR_PROPERTY_FORMAT

Trying to set or get a property using an unsupported MPV_FORMAT.

mpv_error_MPV_ERROR_PROPERTY_NOT_FOUND

The accessed property doesn't exist.

mpv_error_MPV_ERROR_PROPERTY_UNAVAILABLE

The property exists, but is not available. This usually happens when the associated subsystem is not active, e.g. querying audio parameters while audio is disabled.

mpv_error_MPV_ERROR_SUCCESS

No error happened (used to signal successful operation). Keep in mind that many API functions returning error codes can also return positive values, which also indicate success. API users can hardcode the fact that ">= 0" means success.

mpv_error_MPV_ERROR_UNINITIALIZED

The mpv core wasn't configured and initialized yet. See the notes in mpv_create().

mpv_error_MPV_ERROR_UNKNOWN_FORMAT

When trying to load the file, the file format could not be determined, or the file was too broken to open it.

mpv_error_MPV_ERROR_UNSUPPORTED

Generic error for signaling that certain system requirements are not fulfilled.

mpv_error_MPV_ERROR_VO_INIT_FAILED

Initializing the video output failed.

mpv_event_id_MPV_EVENT_AUDIO_RECONFIG

Similar to MPV_EVENT_VIDEO_RECONFIG. This is relatively uninteresting, because there is no such thing as audio output embedding.

mpv_event_id_MPV_EVENT_CHAPTER_CHANGE

Happens when the current chapter changes.

mpv_event_id_MPV_EVENT_CLIENT_MESSAGE

Triggered by the script-message input command. The command uses the first argument of the command as client name (see mpv_client_name()) to dispatch the message, and passes along all arguments starting from the second argument as strings. See also mpv_event and mpv_event_client_message.

mpv_event_id_MPV_EVENT_COMMAND_REPLY

Reply to a mpv_command_async() or mpv_command_node_async() request. See also mpv_event and mpv_event_command.

mpv_event_id_MPV_EVENT_END_FILE

Notification after playback end (after the file was unloaded). See also mpv_event and mpv_event_end_file.

mpv_event_id_MPV_EVENT_FILE_LOADED

Notification when the file has been loaded (headers were read etc.), and decoding starts.

mpv_event_id_MPV_EVENT_GET_PROPERTY_REPLY

Reply to a mpv_get_property_async() request. See also mpv_event and mpv_event_property.

mpv_event_id_MPV_EVENT_HOOK

Triggered if a hook handler was registered with mpv_hook_add(), and the hook is invoked. If you receive this, you must handle it, and continue the hook with mpv_hook_continue(). See also mpv_event and mpv_event_hook.

mpv_event_id_MPV_EVENT_IDLE

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 mpv_create(), idle mode is enabled by default.)

mpv_event_id_MPV_EVENT_LOG_MESSAGE

See mpv_request_log_messages().

mpv_event_id_MPV_EVENT_METADATA_UPDATE

Happens when metadata (like file tags) is possibly updated. (It's left unspecified whether this happens on file start or only when it changes within a file.)

mpv_event_id_MPV_EVENT_NONE

Nothing happened. Happens on timeouts or sporadic wakeups.

mpv_event_id_MPV_EVENT_PAUSE

Playback was paused. This indicates the user pause state.

mpv_event_id_MPV_EVENT_PLAYBACK_RESTART

There was a discontinuity of some sort (like a seek), and playback was reinitialized. Usually happens on start of playback and after seeking. The main purpose is allowing the client to detect when a seek request is finished.

mpv_event_id_MPV_EVENT_PROPERTY_CHANGE

Event sent due to mpv_observe_property(). See also mpv_event and mpv_event_property.

mpv_event_id_MPV_EVENT_QUEUE_OVERFLOW

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 mpv_wait_event(), or if the client makes a very large number of asynchronous calls at once.

mpv_event_id_MPV_EVENT_SCRIPT_INPUT_DISPATCH

@deprecated This was used internally with the internal "script_dispatch" command to dispatch keyboard and mouse input for the OSC. It was never useful in general and has been completely replaced with "script-binding". This event never happens anymore, and is included in this header only for compatibility.

mpv_event_id_MPV_EVENT_SEEK

Happens when a seek was initiated. Playback stops. Usually it will resume with MPV_EVENT_PLAYBACK_RESTART as soon as the seek is finished.

mpv_event_id_MPV_EVENT_SET_PROPERTY_REPLY

Reply to a mpv_set_property_async() request. (Unlike MPV_EVENT_GET_PROPERTY, mpv_event_property is not used.)

mpv_event_id_MPV_EVENT_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 and quit with mpv_destroy() as soon as possible.

mpv_event_id_MPV_EVENT_START_FILE

Notification before playback start of a file (before the file is loaded). See also mpv_event and mpv_event_start_file.

mpv_event_id_MPV_EVENT_TICK

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.

mpv_event_id_MPV_EVENT_TRACKS_CHANGED

The list of video/audio/subtitle tracks was changed. (E.g. a new track was found. This doesn't necessarily indicate a track switch; for this, MPV_EVENT_TRACK_SWITCHED is used.)

mpv_event_id_MPV_EVENT_TRACK_SWITCHED

A video/audio/subtitle track was switched on or off.

mpv_event_id_MPV_EVENT_UNPAUSE

Playback was unpaused. See MPV_EVENT_PAUSE for not so obvious details.

mpv_event_id_MPV_EVENT_VIDEO_RECONFIG

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 in order 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.

mpv_format_MPV_FORMAT_BYTE_ARRAY

A raw, untyped byte array. Only used only with mpv_node, and only in some very specific situations. (Some commands use it.)

mpv_format_MPV_FORMAT_DOUBLE

The basic type is double.

mpv_format_MPV_FORMAT_FLAG

The basic type is int. The only allowed values are 0 ("no") and 1 ("yes").

mpv_format_MPV_FORMAT_INT64

The basic type is int64_t.

mpv_format_MPV_FORMAT_NODE

The type is mpv_node.

mpv_format_MPV_FORMAT_NODE_ARRAY

Used with mpv_node only. Can usually not be used directly.

mpv_format_MPV_FORMAT_NODE_MAP

See MPV_FORMAT_NODE_ARRAY.

mpv_format_MPV_FORMAT_NONE

Invalid. Sometimes used for empty values. This is always defined to 0, so a normal 0-init of mpv_format (or e.g. mpv_node) is guaranteed to set this it to MPV_FORMAT_NONE (which makes some things saner as consequence).

mpv_format_MPV_FORMAT_OSD_STRING

The basic type is char*. It returns the OSD property string, like using ${property} in input.conf (see input.rst). In many cases, this is the same as the raw string, but in other cases it's formatted for display on OSD. It's intended to be human readable. Do not attempt to parse these strings.

mpv_format_MPV_FORMAT_STRING

The basic type is char*. It returns the raw property string, like using ${=property} in input.conf (see input.rst).

mpv_log_level_MPV_LOG_LEVEL_DEBUG

"v" - noisy informational message

mpv_log_level_MPV_LOG_LEVEL_ERROR

"fatal" - critical/aborting errors

mpv_log_level_MPV_LOG_LEVEL_FATAL

"no" - disable absolutely all messages

mpv_log_level_MPV_LOG_LEVEL_INFO

"warn" - possible problems

mpv_log_level_MPV_LOG_LEVEL_NONE
mpv_log_level_MPV_LOG_LEVEL_TRACE

"debug" - very noisy technical information

mpv_log_level_MPV_LOG_LEVEL_V

"info" - informational message

mpv_log_level_MPV_LOG_LEVEL_WARN

"error" - simple errors

mpv_render_frame_info_flag_MPV_RENDER_FRAME_INFO_BLOCK_VSYNC

If set, the player timing code expects that the user thread blocks on vsync (by either delaying the render call, or by making a call to mpv_render_context_report_swap() at vsync time).

mpv_render_frame_info_flag_MPV_RENDER_FRAME_INFO_PRESENT

Set if there is actually a next frame. If unset, there is no next frame yet, and other flags and fields that require a frame to be queued will be unset.

mpv_render_frame_info_flag_MPV_RENDER_FRAME_INFO_REDRAW

If set, the frame is not an actual new video frame, but a redraw request. For example if the video is paused, and an option that affects video rendering was changed (or any other reason), an update request can be issued and this flag will be set.

mpv_render_frame_info_flag_MPV_RENDER_FRAME_INFO_REPEAT

If set, this is supposed to reproduce the previous frame perfectly. This is usually used for certain "video-sync" options ("display-..." modes). Typically the renderer will blit the video from a FBO. Unset otherwise.

mpv_render_param_type_MPV_RENDER_PARAM_ADVANCED_CONTROL

Better control about rendering and enabling some advanced features. Valid for mpv_render_context_create().

mpv_render_param_type_MPV_RENDER_PARAM_AMBIENT_LIGHT

Ambient light in lux. Valid for mpv_render_context_set_parameter(). Type: int* This can be used for automatic gamma correction.

mpv_render_param_type_MPV_RENDER_PARAM_API_TYPE

The render API to use. Valid for mpv_render_context_create().

mpv_render_param_type_MPV_RENDER_PARAM_BLOCK_FOR_TARGET_TIME

Enable or disable video timing. Valid for mpv_render_context_render().

mpv_render_param_type_MPV_RENDER_PARAM_DEPTH

Control surface depth. Valid for mpv_render_context_render(). Type: int* This implies the depth of the surface passed to the render function in bits per channel. If omitted or set to 0, the renderer will assume 8. Typically used to control dithering.

mpv_render_param_type_MPV_RENDER_PARAM_DRM_DISPLAY

Deprecated. Not supported. Use MPV_RENDER_PARAM_DRM_DISPLAY_V2 instead. Type : struct mpv_opengl_drm_params*

mpv_render_param_type_MPV_RENDER_PARAM_DRM_DISPLAY_V2

DRM display, contains drm display handles. Valid for mpv_render_context_create(). Type : struct mpv_opengl_drm_params_v2*

mpv_render_param_type_MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE

DRM draw surface size, contains draw surface dimensions. Valid for mpv_render_context_create(). Type : struct mpv_opengl_drm_draw_surface_size*

mpv_render_param_type_MPV_RENDER_PARAM_FLIP_Y

Control flipped rendering. Valid for mpv_render_context_render(). Type: int* If the value is set to 0, render normally. Otherwise, render it flipped, which is needed e.g. when rendering to an OpenGL default framebuffer (which has a flipped coordinate system).

mpv_render_param_type_MPV_RENDER_PARAM_ICC_PROFILE

ICC profile blob. Valid for mpv_render_context_set_parameter(). Type: mpv_byte_array* Set an ICC profile for use with the "icc-profile-auto" option. (If the option is not enabled, the ICC data will not be used.)

mpv_render_param_type_MPV_RENDER_PARAM_INVALID

Not a valid value, but also used to terminate a params array. Its value is always guaranteed to be 0 (even if the ABI changes in the future).

mpv_render_param_type_MPV_RENDER_PARAM_NEXT_FRAME_INFO

Return information about the next frame to render. Valid for mpv_render_context_get_info().

mpv_render_param_type_MPV_RENDER_PARAM_OPENGL_FBO

Describes a GL render target. Valid for mpv_render_context_render(). Type: mpv_opengl_fbo*

mpv_render_param_type_MPV_RENDER_PARAM_OPENGL_INIT_PARAMS

Required parameters for initializing the OpenGL renderer. Valid for mpv_render_context_create(). Type: mpv_opengl_init_params*

mpv_render_param_type_MPV_RENDER_PARAM_SKIP_RENDERING

Use to skip rendering in mpv_render_context_render().

mpv_render_param_type_MPV_RENDER_PARAM_WL_DISPLAY

Wayland display, sometimes used for hwdec. Valid for mpv_render_context_create(). The wl_display must stay valid for the lifetime of the mpv_render_context. Type: struct wl_display*

mpv_render_param_type_MPV_RENDER_PARAM_X11_DISPLAY

X11 Display, sometimes used for hwdec. Valid for mpv_render_context_create(). The Display must stay valid for the lifetime of the mpv_render_context. Type: Display*

mpv_render_update_flag_MPV_RENDER_UPDATE_FRAME

A new video frame must be rendered. mpv_render_context_render() must be called.

mpv_sub_api_MPV_SUB_API_OPENGL_CB

For using mpv's OpenGL renderer on an external OpenGL context. mpv_get_sub_api(MPV_SUB_API_OPENGL_CB) returns mpv_opengl_cb_context*. This context can be used with mpv_opengl_cb_* functions. Will return NULL if unavailable (if OpenGL support was not compiled in). See opengl_cb.h for details.

Functions

mpv_abort_async_command

Signal to all async requests with the matching ID to abort. This affects the following API calls:

mpv_client_api_version

Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with.

mpv_client_id

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

Return the name of this client handle. Every client has its own unique name, which is mostly used for user interface purposes.

mpv_command

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

Same as mpv_command, but run the command asynchronously.

mpv_command_node

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

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

This is essentially identical to mpv_command() but it also returns a result.

mpv_command_string

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

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

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

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

Disconnect and destroy the mpv_handle. ctx will be deallocated with this API call.

mpv_detach_destroy

@deprecated use mpv_destroy(), which has exactly the same semantics (the deprecation is a mere rename)

mpv_error_str

Returns the associated error string.

mpv_error_string

Return a string describing the error. For unknown errors, the string "unknown error" is returned.

mpv_event_name

Return a string describing the event. For unknown events, NULL is returned.

mpv_event_to_node

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

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

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

Read the value of the given property.

mpv_get_property_async

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

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

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

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

Return the internal time in microseconds. This has an arbitrary start offset, but will never wrap or go backwards.

mpv_get_wakeup_pipe

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

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

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

Initialize an uninitialized mpv instance. If the mpv instance is already running, an error is returned.

mpv_load_config_file

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

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_render_context_create

Initialize the renderer state. Depending on the backend used, this will access the underlying GPU API and initialize its own objects.

mpv_render_context_free

Destroy the mpv renderer state.

mpv_render_context_get_info

Retrieve information from the render context. This is NOT a counterpart to mpv_render_context_set_parameter(), because you generally can't read parameters set with it, and this function is not meant for this purpose. Instead, this is for communicating information from the renderer back to the user. See mpv_render_param_type; entries which support this function explicitly mention it, and for other entries you can assume it will fail.

mpv_render_context_render

Render video.

mpv_render_context_report_swap

Tell the renderer that a frame was flipped at the given time. This is optional, but can help the player to achieve better timing.

mpv_render_context_set_parameter

Attempt to change a single parameter. Not all backends and parameter types support all kinds of changes.

mpv_render_context_set_update_callback

Set the callback that notifies you when a new video frame is available, or if the video display configuration somehow changed and requires a redraw. Similar to mpv_set_wakeup_callback(), you must not call any mpv API from the callback, and all the other listed restrictions apply (such as not exiting the callback by throwing exceptions).

mpv_render_context_update

The API user is supposed to call this when the update callback was invoked (like all mpv_render_* functions, this has to happen on the render thread, and not from the update callback itself).

mpv_request_event

Enable or disable the given event.

mpv_request_log_messages

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

See mpv_suspend().

mpv_set_option

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

Convenience function to set an option to a string value. This is like calling mpv_set_option() with MPV_FORMAT_STRING.

mpv_set_property

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

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

Convenience function to set a property to a string value.

mpv_set_wakeup_callback

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_stream_cb_add_ro

Add a custom stream protocol. This will register a protocol handler under the given protocol prefix, and invoke the given callbacks if an URI with the matching protocol prefix is opened.

mpv_suspend

This does nothing since mpv 0.23.0 (API version 1.24). Below is the description of the old behavior.

mpv_terminate_destroy

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

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

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

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

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).

Type Definitions

__blkcnt64_t
__blkcnt_t
__blksize_t
__caddr_t
__clock_t
__clockid_t
__daddr_t
__dev_t
__fsblkcnt64_t
__fsblkcnt_t
__fsfilcnt64_t
__fsfilcnt_t
__fsword_t
__gid_t
__id_t
__ino64_t
__ino_t
__int8_t
__int16_t
__int32_t
__int64_t
__int_least8_t
__int_least16_t
__int_least32_t
__int_least64_t
__intmax_t
__intptr_t
__key_t
__loff_t
__mode_t
__nlink_t
__off64_t
__off_t
__pid_t
__quad_t
__rlim64_t
__rlim_t
__sig_atomic_t
__socklen_t
__ssize_t
__suseconds_t
__syscall_slong_t
__syscall_ulong_t
__time_t
__timer_t
__u_char
__u_int
__u_long
__u_quad_t
__u_short
__uid_t
__uint8_t
__uint16_t
__uint32_t
__uint64_t
__uint_least8_t
__uint_least16_t
__uint_least32_t
__uint_least64_t
__uintmax_t
__useconds_t
int_fast8_t
int_fast16_t
int_fast32_t
int_fast64_t
int_least8_t
int_least16_t
int_least32_t
int_least64_t
intmax_t
mpv_end_file_reason

Since API version 1.9.

mpv_error

List of error codes than can be returned by API functions. 0 and positive return values always mean success, negative values are always errors.

mpv_event_id
mpv_format

Data format for options and properties. The API functions to get/set properties and options support multiple formats, and this enum describes them.

mpv_log_level

Numeric log levels. The lower the number, the more important the message is. MPV_LOG_LEVEL_NONE is never used when receiving messages. The string in the comment after the value is the name of the log level as used for the mpv_request_log_messages() function. Unused numeric values are unused, but reserved for future use.

mpv_render_frame_info_flag

Flags used in mpv_render_frame_info.flags. Each value represents a bit in it.

mpv_render_param_type

Parameters for mpv_render_param (which is used in a few places such as mpv_render_context_create().

mpv_render_update_flag

Flags returned by mpv_render_context_update(). Each value represents a bit in the function's return value.

mpv_render_update_fn
mpv_stream_cb_cancel_fn

Cancel callback used to implement a custom stream.

mpv_stream_cb_close_fn

Close callback used to implement a custom stream.

mpv_stream_cb_open_ro_fn

Open callback used to implement a custom read-only (ro) stream. The user must set the callback fields in the passed info struct. The cookie field also can be set to store state associated to the stream instance.

mpv_stream_cb_read_fn

Read callback used to implement a custom stream. The semantics of the callback match read(2) in blocking mode. Short reads are allowed (you can return less bytes than requested, and libmpv will retry reading the rest with another call). If no data can be immediately read, the callback must block until there is new data. A return of 0 will be interpreted as final EOF, although libmpv might retry the read, or seek to a different position.

mpv_stream_cb_seek_fn

Seek callback used to implement a custom stream.

mpv_stream_cb_size_fn

Size callback used to implement a custom stream.

mpv_sub_api

@deprecated use render.h

size_t
uint_fast8_t
uint_fast16_t
uint_fast32_t
uint_fast64_t
uint_least8_t
uint_least16_t
uint_least32_t
uint_least64_t
uintmax_t
wchar_t

Unions

mpv_node__bindgen_ty_1