755 lines
81 KiB
Rust
755 lines
81 KiB
Rust
/* automatically generated by rust-bindgen 0.70.1 */
|
|
|
|
pub const __STDC_ISO_10646__: u32 = 201206;
|
|
pub const __STDC_IEC_559__: u32 = 1;
|
|
pub const __BYTE_ORDER: u32 = 1234;
|
|
pub const __LONG_MAX: u64 = 9223372036854775807;
|
|
pub const __LITTLE_ENDIAN: u32 = 1234;
|
|
pub const __BIG_ENDIAN: u32 = 4321;
|
|
pub const __USE_TIME_BITS64: u32 = 1;
|
|
pub const INT8_MIN: i32 = -128;
|
|
pub const INT16_MIN: i32 = -32768;
|
|
pub const INT32_MIN: i32 = -2147483648;
|
|
pub const INT64_MIN: i64 = -9223372036854775808;
|
|
pub const INT8_MAX: u32 = 127;
|
|
pub const INT16_MAX: u32 = 32767;
|
|
pub const INT32_MAX: u32 = 2147483647;
|
|
pub const INT64_MAX: u64 = 9223372036854775807;
|
|
pub const UINT8_MAX: u32 = 255;
|
|
pub const UINT16_MAX: u32 = 65535;
|
|
pub const UINT32_MAX: u32 = 4294967295;
|
|
pub const UINT64_MAX: i32 = -1;
|
|
pub const INT_FAST8_MIN: i32 = -128;
|
|
pub const INT_FAST64_MIN: i64 = -9223372036854775808;
|
|
pub const INT_LEAST8_MIN: i32 = -128;
|
|
pub const INT_LEAST16_MIN: i32 = -32768;
|
|
pub const INT_LEAST32_MIN: i32 = -2147483648;
|
|
pub const INT_LEAST64_MIN: i64 = -9223372036854775808;
|
|
pub const INT_FAST8_MAX: u32 = 127;
|
|
pub const INT_FAST64_MAX: u64 = 9223372036854775807;
|
|
pub const INT_LEAST8_MAX: u32 = 127;
|
|
pub const INT_LEAST16_MAX: u32 = 32767;
|
|
pub const INT_LEAST32_MAX: u32 = 2147483647;
|
|
pub const INT_LEAST64_MAX: u64 = 9223372036854775807;
|
|
pub const UINT_FAST8_MAX: u32 = 255;
|
|
pub const UINT_FAST64_MAX: i32 = -1;
|
|
pub const UINT_LEAST8_MAX: u32 = 255;
|
|
pub const UINT_LEAST16_MAX: u32 = 65535;
|
|
pub const UINT_LEAST32_MAX: u32 = 4294967295;
|
|
pub const UINT_LEAST64_MAX: i32 = -1;
|
|
pub const INTMAX_MIN: i64 = -9223372036854775808;
|
|
pub const INTMAX_MAX: u64 = 9223372036854775807;
|
|
pub const UINTMAX_MAX: i32 = -1;
|
|
pub const WINT_MIN: u32 = 0;
|
|
pub const WINT_MAX: u32 = 4294967295;
|
|
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
|
|
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
|
|
pub const INT_FAST16_MIN: i32 = -2147483648;
|
|
pub const INT_FAST32_MIN: i32 = -2147483648;
|
|
pub const INT_FAST16_MAX: u32 = 2147483647;
|
|
pub const INT_FAST32_MAX: u32 = 2147483647;
|
|
pub const UINT_FAST16_MAX: u32 = 4294967295;
|
|
pub const UINT_FAST32_MAX: u32 = 4294967295;
|
|
pub const INTPTR_MIN: i64 = -9223372036854775808;
|
|
pub const INTPTR_MAX: u64 = 9223372036854775807;
|
|
pub const UINTPTR_MAX: i32 = -1;
|
|
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
|
|
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
|
|
pub const SIZE_MAX: i32 = -1;
|
|
pub const MPV_ENABLE_DEPRECATED: u32 = 1;
|
|
pub type wchar_t = ::std::os::raw::c_int;
|
|
#[repr(C)]
|
|
#[repr(align(16))]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct max_align_t {
|
|
pub __ll: ::std::os::raw::c_longlong,
|
|
pub __bindgen_padding_0: u64,
|
|
pub __ld: u128,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of max_align_t"][::std::mem::size_of::<max_align_t>() - 32usize];
|
|
["Alignment of max_align_t"][::std::mem::align_of::<max_align_t>() - 16usize];
|
|
["Offset of field: max_align_t::__ll"][::std::mem::offset_of!(max_align_t, __ll) - 0usize];
|
|
["Offset of field: max_align_t::__ld"][::std::mem::offset_of!(max_align_t, __ld) - 16usize];
|
|
};
|
|
pub type intmax_t = ::std::os::raw::c_long;
|
|
pub type uintmax_t = ::std::os::raw::c_ulong;
|
|
pub type int_fast8_t = i8;
|
|
pub type int_fast64_t = i64;
|
|
pub type int_least8_t = i8;
|
|
pub type int_least16_t = i16;
|
|
pub type int_least32_t = i32;
|
|
pub type int_least64_t = i64;
|
|
pub type uint_fast8_t = u8;
|
|
pub type uint_fast64_t = u64;
|
|
pub type uint_least8_t = u8;
|
|
pub type uint_least16_t = u16;
|
|
pub type uint_least32_t = u32;
|
|
pub type uint_least64_t = u64;
|
|
pub type int_fast16_t = i32;
|
|
pub type int_fast32_t = i32;
|
|
pub type uint_fast16_t = u32;
|
|
pub type uint_fast32_t = u32;
|
|
extern "C" {
|
|
#[doc = " Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with."]
|
|
pub fn mpv_client_api_version() -> ::std::os::raw::c_ulong;
|
|
}
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_handle {
|
|
_unused: [u8; 0],
|
|
}
|
|
#[doc = " No error happened (used to signal successful operation).\n Keep in mind that many API functions returning error codes can also\n return positive values, which also indicate success. API users can\n hardcode the fact that \">= 0\" means success."]
|
|
pub const mpv_error_MPV_ERROR_SUCCESS: mpv_error = 0;
|
|
#[doc = " The event ringbuffer is full. This means the client is choked, and can't\n receive any events. This can happen when too many asynchronous requests\n have been made, but not answered. Probably never happens in practice,\n unless the mpv core is frozen for some reason, and the client keeps\n making asynchronous requests. (Bugs in the client API implementation\n could also trigger this, e.g. if events become \"lost\".)"]
|
|
pub const mpv_error_MPV_ERROR_EVENT_QUEUE_FULL: mpv_error = -1;
|
|
#[doc = " Memory allocation failed."]
|
|
pub const mpv_error_MPV_ERROR_NOMEM: mpv_error = -2;
|
|
#[doc = " The mpv core wasn't configured and initialized yet. See the notes in\n mpv_create()."]
|
|
pub const mpv_error_MPV_ERROR_UNINITIALIZED: mpv_error = -3;
|
|
#[doc = " Generic catch-all error if a parameter is set to an invalid or\n unsupported value. This is used if there is no better error code."]
|
|
pub const mpv_error_MPV_ERROR_INVALID_PARAMETER: mpv_error = -4;
|
|
#[doc = " Trying to set an option that doesn't exist."]
|
|
pub const mpv_error_MPV_ERROR_OPTION_NOT_FOUND: mpv_error = -5;
|
|
#[doc = " Trying to set an option using an unsupported MPV_FORMAT."]
|
|
pub const mpv_error_MPV_ERROR_OPTION_FORMAT: mpv_error = -6;
|
|
#[doc = " Setting the option failed. Typically this happens if the provided option\n value could not be parsed."]
|
|
pub const mpv_error_MPV_ERROR_OPTION_ERROR: mpv_error = -7;
|
|
#[doc = " The accessed property doesn't exist."]
|
|
pub const mpv_error_MPV_ERROR_PROPERTY_NOT_FOUND: mpv_error = -8;
|
|
#[doc = " Trying to set or get a property using an unsupported MPV_FORMAT."]
|
|
pub const mpv_error_MPV_ERROR_PROPERTY_FORMAT: mpv_error = -9;
|
|
#[doc = " The property exists, but is not available. This usually happens when the\n associated subsystem is not active, e.g. querying audio parameters while\n audio is disabled."]
|
|
pub const mpv_error_MPV_ERROR_PROPERTY_UNAVAILABLE: mpv_error = -10;
|
|
#[doc = " Error setting or getting a property."]
|
|
pub const mpv_error_MPV_ERROR_PROPERTY_ERROR: mpv_error = -11;
|
|
#[doc = " General error when running a command with mpv_command and similar."]
|
|
pub const mpv_error_MPV_ERROR_COMMAND: mpv_error = -12;
|
|
#[doc = " Generic error on loading (usually used with mpv_event_end_file.error)."]
|
|
pub const mpv_error_MPV_ERROR_LOADING_FAILED: mpv_error = -13;
|
|
#[doc = " Initializing the audio output failed."]
|
|
pub const mpv_error_MPV_ERROR_AO_INIT_FAILED: mpv_error = -14;
|
|
#[doc = " Initializing the video output failed."]
|
|
pub const mpv_error_MPV_ERROR_VO_INIT_FAILED: mpv_error = -15;
|
|
#[doc = " There was no audio or video data to play. This also happens if the\n file was recognized, but did not contain any audio or video streams,\n or no streams were selected."]
|
|
pub const mpv_error_MPV_ERROR_NOTHING_TO_PLAY: mpv_error = -16;
|
|
#[doc = " When trying to load the file, the file format could not be determined,\n or the file was too broken to open it."]
|
|
pub const mpv_error_MPV_ERROR_UNKNOWN_FORMAT: mpv_error = -17;
|
|
#[doc = " Generic error for signaling that certain system requirements are not\n fulfilled."]
|
|
pub const mpv_error_MPV_ERROR_UNSUPPORTED: mpv_error = -18;
|
|
#[doc = " The API function which was called is a stub only."]
|
|
pub const mpv_error_MPV_ERROR_NOT_IMPLEMENTED: mpv_error = -19;
|
|
#[doc = " Unspecified error."]
|
|
pub const mpv_error_MPV_ERROR_GENERIC: mpv_error = -20;
|
|
#[doc = " List of error codes than can be returned by API functions. 0 and positive\n return values always mean success, negative values are always errors."]
|
|
pub type mpv_error = ::std::os::raw::c_int;
|
|
extern "C" {
|
|
#[doc = " Return a string describing the error. For unknown errors, the string\n \"unknown error\" is returned.\n\n @param error error number, see enum mpv_error\n @return A static string describing the error. The string is completely\n static, i.e. doesn't need to be deallocated, and is valid forever."]
|
|
pub fn mpv_error_string(error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
|
|
}
|
|
extern "C" {
|
|
#[doc = " General function to deallocate memory returned by some of the API functions.\n Call this only if it's explicitly documented as allowed. Calling this on\n mpv memory not owned by the caller will lead to undefined behavior.\n\n @param data A valid pointer returned by the API, or NULL."]
|
|
pub fn mpv_free(data: *mut ::std::os::raw::c_void);
|
|
}
|
|
extern "C" {
|
|
#[doc = " Return the name of this client handle. Every client has its own unique\n name, which is mostly used for user interface purposes.\n\n @return The client name. The string is read-only and is valid until the\n mpv_handle is destroyed."]
|
|
pub fn mpv_client_name(ctx: *mut mpv_handle) -> *const ::std::os::raw::c_char;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Return the ID of this client handle. Every client has its own unique ID. This\n ID is never reused by the core, even if the mpv_handle at hand gets destroyed\n and new handles get allocated.\n\n IDs are never 0 or negative.\n\n Some mpv APIs (not necessarily all) accept a name in the form \"@<id>\" in\n addition of the proper mpv_client_name(), where \"<id>\" is the ID in decimal\n form (e.g. \"@123\"). For example, the \"script-message-to\" command takes the\n client name as first argument, but also accepts the client ID formatted in\n this manner.\n\n @return The client ID."]
|
|
pub fn mpv_client_id(ctx: *mut mpv_handle) -> i64;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Create a new mpv instance and an associated client API handle to control\n the mpv instance. This instance is in a pre-initialized state,\n and needs to be initialized to be actually used with most other API\n functions.\n\n Some API functions will return MPV_ERROR_UNINITIALIZED in the uninitialized\n state. You can call mpv_set_property() (or mpv_set_property_string() and\n other variants, and before mpv 0.21.0 mpv_set_option() etc.) to set initial\n options. After this, call mpv_initialize() to start the player, and then use\n e.g. mpv_command() to start playback of a file.\n\n The point of separating handle creation and actual initialization is that\n you can configure things which can't be changed during runtime.\n\n Unlike the command line player, this will have initial settings suitable\n for embedding in applications. The following settings are different:\n - stdin/stdout/stderr and the terminal will never be accessed. This is\n equivalent to setting the --no-terminal option.\n (Technically, this also suppresses C signal handling.)\n - No config files will be loaded. This is roughly equivalent to using\n --config=no. Since libmpv 1.15, you can actually re-enable this option,\n which will make libmpv load config files during mpv_initialize(). If you\n do this, you are strongly encouraged to set the \"config-dir\" option too.\n (Otherwise it will load the mpv command line player's config.)\n For example:\n mpv_set_option_string(mpv, \"config-dir\", \"/my/path\"); // set config root\n mpv_set_option_string(mpv, \"config\", \"yes\"); // enable config loading\n (call mpv_initialize() _after_ this)\n - Idle mode is enabled, which means the playback core will enter idle mode\n if there are no more files to play on the internal playlist, instead of\n exiting. This is equivalent to the --idle option.\n - Disable parts of input handling.\n - Most of the different settings can be viewed with the command line player\n by running \"mpv --show-profile=libmpv\".\n\n All this assumes that API users want a mpv instance that is strictly\n isolated from the command line player's configuration, user settings, and\n so on. You can re-enable disabled features by setting the appropriate\n options.\n\n The mpv command line parser is not available through this API, but you can\n set individual options with mpv_set_property(). Files for playback must be\n loaded with mpv_command() or others.\n\n Note that you should avoid doing concurrent accesses on the uninitialized\n client handle. (Whether concurrent access is definitely allowed or not has\n yet to be decided.)\n\n @return a new mpv client API handle. Returns NULL on error. Currently, this\n can happen in the following situations:\n - out of memory\n - LC_NUMERIC is not set to \"C\" (see general remarks)"]
|
|
pub fn mpv_create() -> *mut mpv_handle;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Initialize an uninitialized mpv instance. If the mpv instance is already\n running, an error is returned.\n\n This function needs to be called to make full use of the client API if the\n client API handle was created with mpv_create().\n\n Only the following options are required to be set _before_ mpv_initialize():\n - options which are only read at initialization time:\n - config\n - config-dir\n - input-conf\n - load-scripts\n - script\n - player-operation-mode\n - input-app-events (macOS)\n - all encoding mode options\n\n @return error code"]
|
|
pub fn mpv_initialize(ctx: *mut mpv_handle) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Disconnect and destroy the mpv_handle. ctx will be deallocated with this\n API call.\n\n If the last mpv_handle is detached, the core player is destroyed. In\n addition, if there are only weak mpv_handles (such as created by\n mpv_create_weak_client() or internal scripts), these mpv_handles will\n be sent MPV_EVENT_SHUTDOWN. This function may block until these clients\n have responded to the shutdown event, and the core is finally destroyed."]
|
|
pub fn mpv_destroy(ctx: *mut mpv_handle);
|
|
}
|
|
extern "C" {
|
|
#[doc = " Similar to mpv_destroy(), but brings the player and all clients down\n as well, and waits until all of them are destroyed. This function blocks. The\n advantage over mpv_destroy() is that while mpv_destroy() merely\n detaches the client handle from the player, this function quits the player,\n waits until all other clients are destroyed (i.e. all mpv_handles are\n detached), and also waits for the final termination of the player.\n\n Since mpv_destroy() is called somewhere on the way, it's not safe to\n call other functions concurrently on the same context.\n\n Since mpv client API version 1.29:\n The first call on any mpv_handle will block until the core is destroyed.\n This means it will wait until other mpv_handle have been destroyed. If you\n want asynchronous destruction, just run the \"quit\" command, and then react\n to the MPV_EVENT_SHUTDOWN event.\n If another mpv_handle already called mpv_terminate_destroy(), this call will\n not actually block. It will destroy the mpv_handle, and exit immediately,\n while other mpv_handles might still be uninitializing.\n\n Before mpv client API version 1.29:\n If this is called on a mpv_handle that was not created with mpv_create(),\n this function will merely send a quit command and then call\n mpv_destroy(), without waiting for the actual shutdown."]
|
|
pub fn mpv_terminate_destroy(ctx: *mut mpv_handle);
|
|
}
|
|
extern "C" {
|
|
#[doc = " Create a new client handle connected to the same player core as ctx. This\n context has its own event queue, its own mpv_request_event() state, its own\n mpv_request_log_messages() state, its own set of observed properties, and\n its own state for asynchronous operations. Otherwise, everything is shared.\n\n This handle should be destroyed with mpv_destroy() if no longer\n needed. The core will live as long as there is at least 1 handle referencing\n it. Any handle can make the core quit, which will result in every handle\n receiving MPV_EVENT_SHUTDOWN.\n\n This function can not be called before the main handle was initialized with\n mpv_initialize(). The new handle is always initialized, unless ctx=NULL was\n passed.\n\n @param ctx Used to get the reference to the mpv core; handle-specific\n settings and parameters are not used.\n If NULL, this function behaves like mpv_create() (ignores name).\n @param name The client name. This will be returned by mpv_client_name(). If\n the name is already in use, or contains non-alphanumeric\n characters (other than '_'), the name is modified to fit.\n If NULL, an arbitrary name is automatically chosen.\n @return a new handle, or NULL on error"]
|
|
pub fn mpv_create_client(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
) -> *mut mpv_handle;
|
|
}
|
|
extern "C" {
|
|
#[doc = " This is the same as mpv_create_client(), but the created mpv_handle is\n treated as a weak reference. If all mpv_handles referencing a core are\n weak references, the core is automatically destroyed. (This still goes\n through normal uninit of course. Effectively, if the last non-weak mpv_handle\n is destroyed, then the weak mpv_handles receive MPV_EVENT_SHUTDOWN and are\n asked to terminate as well.)\n\n Note if you want to use this like refcounting: you have to be aware that\n mpv_terminate_destroy() _and_ mpv_destroy() for the last non-weak\n mpv_handle will block until all weak mpv_handles are destroyed."]
|
|
pub fn mpv_create_weak_client(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
) -> *mut mpv_handle;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Load a config file. This loads and parses the file, and sets every entry in\n the config file's default section as if mpv_set_option_string() is called.\n\n The filename should be an absolute path. If it isn't, the actual path used\n is unspecified. (Note: an absolute path starts with '/' on UNIX.) If the\n file wasn't found, MPV_ERROR_INVALID_PARAMETER is returned.\n\n If a fatal error happens when parsing a config file, MPV_ERROR_OPTION_ERROR\n is returned. Errors when setting options as well as other types or errors\n are ignored (even if options do not exist). You can still try to capture\n the resulting error messages with mpv_request_log_messages(). Note that it's\n possible that some options were successfully set even if any of these errors\n happen.\n\n @param filename absolute path to the config file on the local filesystem\n @return error code"]
|
|
pub fn mpv_load_config_file(
|
|
ctx: *mut mpv_handle,
|
|
filename: *const ::std::os::raw::c_char,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Return the internal time in nanoseconds. This has an arbitrary start offset,\n but will never wrap or go backwards.\n\n Note that this is always the real time, and doesn't necessarily have to do\n with playback time. For example, playback could go faster or slower due to\n playback speed, or due to playback being paused. Use the \"time-pos\" property\n instead to get the playback status.\n\n Unlike other libmpv APIs, this can be called at absolutely any time (even\n within wakeup callbacks), as long as the context is valid.\n\n Safe to be called from mpv render API threads."]
|
|
pub fn mpv_get_time_ns(ctx: *mut mpv_handle) -> i64;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Same as mpv_get_time_ns but in microseconds."]
|
|
pub fn mpv_get_time_us(ctx: *mut mpv_handle) -> i64;
|
|
}
|
|
#[doc = " Invalid. Sometimes used for empty values. This is always defined to 0,\n so a normal 0-init of mpv_format (or e.g. mpv_node) is guaranteed to set\n this it to MPV_FORMAT_NONE (which makes some things saner as consequence)."]
|
|
pub const mpv_format_MPV_FORMAT_NONE: mpv_format = 0;
|
|
#[doc = " The basic type is char*. It returns the raw property string, like\n using ${=property} in input.conf (see input.rst).\n\n NULL isn't an allowed value.\n\n Warning: although the encoding is usually UTF-8, this is not always the\n case. File tags often store strings in some legacy codepage,\n and even filenames don't necessarily have to be in UTF-8 (at\n least on Linux). If you pass the strings to code that requires\n valid UTF-8, you have to sanitize it in some way.\n On Windows, filenames are always UTF-8, and libmpv converts\n between UTF-8 and UTF-16 when using win32 API functions. See\n the \"Encoding of filenames\" section for details.\n\n Example for reading:\n\n char *result = NULL;\n if (mpv_get_property(ctx, \"property\", MPV_FORMAT_STRING, &result) < 0)\n goto error;\n printf(\"%s\\n\", result);\n mpv_free(result);\n\n Or just use mpv_get_property_string().\n\n Example for writing:\n\n char *value = \"the new value\";\n // yep, you pass the address to the variable\n // (needed for symmetry with other types and mpv_get_property)\n mpv_set_property(ctx, \"property\", MPV_FORMAT_STRING, &value);\n\n Or just use mpv_set_property_string().\n"]
|
|
pub const mpv_format_MPV_FORMAT_STRING: mpv_format = 1;
|
|
#[doc = " The basic type is char*. It returns the OSD property string, like\n using ${property} in input.conf (see input.rst). In many cases, this\n is the same as the raw string, but in other cases it's formatted for\n display on OSD. It's intended to be human readable. Do not attempt to\n parse these strings.\n\n Only valid when doing read access. The rest works like MPV_FORMAT_STRING."]
|
|
pub const mpv_format_MPV_FORMAT_OSD_STRING: mpv_format = 2;
|
|
#[doc = " The basic type is int. The only allowed values are 0 (\"no\")\n and 1 (\"yes\").\n\n Example for reading:\n\n int result;\n if (mpv_get_property(ctx, \"property\", MPV_FORMAT_FLAG, &result) < 0)\n goto error;\n printf(\"%s\\n\", result ? \"true\" : \"false\");\n\n Example for writing:\n\n int flag = 1;\n mpv_set_property(ctx, \"property\", MPV_FORMAT_FLAG, &flag);"]
|
|
pub const mpv_format_MPV_FORMAT_FLAG: mpv_format = 3;
|
|
#[doc = " The basic type is int64_t."]
|
|
pub const mpv_format_MPV_FORMAT_INT64: mpv_format = 4;
|
|
#[doc = " The basic type is double."]
|
|
pub const mpv_format_MPV_FORMAT_DOUBLE: mpv_format = 5;
|
|
#[doc = " The type is mpv_node.\n\n For reading, you usually would pass a pointer to a stack-allocated\n mpv_node value to mpv, and when you're done you call\n mpv_free_node_contents(&node).\n You're expected not to write to the data - if you have to, copy it\n first (which you have to do manually).\n\n For writing, you construct your own mpv_node, and pass a pointer to the\n API. The API will never write to your data (and copy it if needed), so\n you're free to use any form of allocation or memory management you like.\n\n Warning: when reading, always check the mpv_node.format member. For\n example, properties might change their type in future versions\n of mpv, or sometimes even during runtime.\n\n Example for reading:\n\n mpv_node result;\n if (mpv_get_property(ctx, \"property\", MPV_FORMAT_NODE, &result) < 0)\n goto error;\n printf(\"format=%d\\n\", (int)result.format);\n mpv_free_node_contents(&result).\n\n Example for writing:\n\n mpv_node value;\n value.format = MPV_FORMAT_STRING;\n value.u.string = \"hello\";\n mpv_set_property(ctx, \"property\", MPV_FORMAT_NODE, &value);"]
|
|
pub const mpv_format_MPV_FORMAT_NODE: mpv_format = 6;
|
|
#[doc = " Used with mpv_node only. Can usually not be used directly."]
|
|
pub const mpv_format_MPV_FORMAT_NODE_ARRAY: mpv_format = 7;
|
|
#[doc = " See MPV_FORMAT_NODE_ARRAY."]
|
|
pub const mpv_format_MPV_FORMAT_NODE_MAP: mpv_format = 8;
|
|
#[doc = " A raw, untyped byte array. Only used only with mpv_node, and only in\n some very specific situations. (Some commands use it.)"]
|
|
pub const mpv_format_MPV_FORMAT_BYTE_ARRAY: mpv_format = 9;
|
|
#[doc = " Data format for options and properties. The API functions to get/set\n properties and options support multiple formats, and this enum describes\n them."]
|
|
pub type mpv_format = ::std::os::raw::c_uint;
|
|
#[doc = " Generic data storage.\n\n If mpv writes this struct (e.g. via mpv_get_property()), you must not change\n the data. In some cases (mpv_get_property()), you have to free it with\n mpv_free_node_contents(). If you fill this struct yourself, you're also\n responsible for freeing it, and you must not call mpv_free_node_contents()."]
|
|
#[repr(C)]
|
|
#[derive(Copy, Clone)]
|
|
pub struct mpv_node {
|
|
pub u: mpv_node__bindgen_ty_1,
|
|
#[doc = " Type of the data stored in this struct. This value rules what members in\n the given union can be accessed. The following formats are currently\n defined to be allowed in mpv_node:\n\n MPV_FORMAT_STRING (u.string)\n MPV_FORMAT_FLAG (u.flag)\n MPV_FORMAT_INT64 (u.int64)\n MPV_FORMAT_DOUBLE (u.double_)\n MPV_FORMAT_NODE_ARRAY (u.list)\n MPV_FORMAT_NODE_MAP (u.list)\n MPV_FORMAT_BYTE_ARRAY (u.ba)\n MPV_FORMAT_NONE (no member)\n\n If you encounter a value you don't know, you must not make any\n assumptions about the contents of union u."]
|
|
pub format: mpv_format,
|
|
}
|
|
#[repr(C)]
|
|
#[derive(Copy, Clone)]
|
|
pub union mpv_node__bindgen_ty_1 {
|
|
pub string: *mut ::std::os::raw::c_char,
|
|
#[doc = " valid if format==MPV_FORMAT_STRING"]
|
|
pub flag: ::std::os::raw::c_int,
|
|
#[doc = " valid if format==MPV_FORMAT_FLAG"]
|
|
pub int64: i64,
|
|
#[doc = " valid if format==MPV_FORMAT_INT64"]
|
|
pub double_: f64,
|
|
#[doc = " valid if format==MPV_FORMAT_DOUBLE */\n/**\n valid if format==MPV_FORMAT_NODE_ARRAY\n or if format==MPV_FORMAT_NODE_MAP"]
|
|
pub list: *mut mpv_node_list,
|
|
#[doc = " valid if format==MPV_FORMAT_BYTE_ARRAY"]
|
|
pub ba: *mut mpv_byte_array,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_node__bindgen_ty_1"][::std::mem::size_of::<mpv_node__bindgen_ty_1>() - 8usize];
|
|
["Alignment of mpv_node__bindgen_ty_1"]
|
|
[::std::mem::align_of::<mpv_node__bindgen_ty_1>() - 8usize];
|
|
["Offset of field: mpv_node__bindgen_ty_1::string"]
|
|
[::std::mem::offset_of!(mpv_node__bindgen_ty_1, string) - 0usize];
|
|
["Offset of field: mpv_node__bindgen_ty_1::flag"]
|
|
[::std::mem::offset_of!(mpv_node__bindgen_ty_1, flag) - 0usize];
|
|
["Offset of field: mpv_node__bindgen_ty_1::int64"]
|
|
[::std::mem::offset_of!(mpv_node__bindgen_ty_1, int64) - 0usize];
|
|
["Offset of field: mpv_node__bindgen_ty_1::double_"]
|
|
[::std::mem::offset_of!(mpv_node__bindgen_ty_1, double_) - 0usize];
|
|
["Offset of field: mpv_node__bindgen_ty_1::list"]
|
|
[::std::mem::offset_of!(mpv_node__bindgen_ty_1, list) - 0usize];
|
|
["Offset of field: mpv_node__bindgen_ty_1::ba"]
|
|
[::std::mem::offset_of!(mpv_node__bindgen_ty_1, ba) - 0usize];
|
|
};
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_node"][::std::mem::size_of::<mpv_node>() - 16usize];
|
|
["Alignment of mpv_node"][::std::mem::align_of::<mpv_node>() - 8usize];
|
|
["Offset of field: mpv_node::u"][::std::mem::offset_of!(mpv_node, u) - 0usize];
|
|
["Offset of field: mpv_node::format"][::std::mem::offset_of!(mpv_node, format) - 8usize];
|
|
};
|
|
#[doc = " (see mpv_node)"]
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_node_list {
|
|
#[doc = " Number of entries. Negative values are not allowed."]
|
|
pub num: ::std::os::raw::c_int,
|
|
#[doc = " MPV_FORMAT_NODE_ARRAY:\n values[N] refers to value of the Nth item\n\n MPV_FORMAT_NODE_MAP:\n values[N] refers to value of the Nth key/value pair\n\n If num > 0, values[0] to values[num-1] (inclusive) are valid.\n Otherwise, this can be NULL."]
|
|
pub values: *mut mpv_node,
|
|
#[doc = " MPV_FORMAT_NODE_ARRAY:\n unused (typically NULL), access is not allowed\n\n MPV_FORMAT_NODE_MAP:\n keys[N] refers to key of the Nth key/value pair. If num > 0, keys[0] to\n keys[num-1] (inclusive) are valid. Otherwise, this can be NULL.\n The keys are in random order. The only guarantee is that keys[N] belongs\n to the value values[N]. NULL keys are not allowed."]
|
|
pub keys: *mut *mut ::std::os::raw::c_char,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_node_list"][::std::mem::size_of::<mpv_node_list>() - 24usize];
|
|
["Alignment of mpv_node_list"][::std::mem::align_of::<mpv_node_list>() - 8usize];
|
|
["Offset of field: mpv_node_list::num"][::std::mem::offset_of!(mpv_node_list, num) - 0usize];
|
|
["Offset of field: mpv_node_list::values"]
|
|
[::std::mem::offset_of!(mpv_node_list, values) - 8usize];
|
|
["Offset of field: mpv_node_list::keys"][::std::mem::offset_of!(mpv_node_list, keys) - 16usize];
|
|
};
|
|
#[doc = " (see mpv_node)"]
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_byte_array {
|
|
#[doc = " Pointer to the data. In what format the data is stored is up to whatever\n uses MPV_FORMAT_BYTE_ARRAY."]
|
|
pub data: *mut ::std::os::raw::c_void,
|
|
#[doc = " Size of the data pointed to by ptr."]
|
|
pub size: usize,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_byte_array"][::std::mem::size_of::<mpv_byte_array>() - 16usize];
|
|
["Alignment of mpv_byte_array"][::std::mem::align_of::<mpv_byte_array>() - 8usize];
|
|
["Offset of field: mpv_byte_array::data"]
|
|
[::std::mem::offset_of!(mpv_byte_array, data) - 0usize];
|
|
["Offset of field: mpv_byte_array::size"]
|
|
[::std::mem::offset_of!(mpv_byte_array, size) - 8usize];
|
|
};
|
|
extern "C" {
|
|
#[doc = " Frees any data referenced by the node. It doesn't free the node itself.\n Call this only if the mpv client API set the node. If you constructed the\n node yourself (manually), you have to free it yourself.\n\n If node->format is MPV_FORMAT_NONE, this call does nothing. Likewise, if\n the client API sets a node with this format, this function doesn't need to\n be called. (This is just a clarification that there's no danger of anything\n strange happening in these cases.)"]
|
|
pub fn mpv_free_node_contents(node: *mut mpv_node);
|
|
}
|
|
extern "C" {
|
|
#[doc = " Set an option. Note that you can't normally set options during runtime. It\n works in uninitialized state (see mpv_create()), and in some cases in at\n runtime.\n\n Using a format other than MPV_FORMAT_NODE is equivalent to constructing a\n mpv_node with the given format and data, and passing the mpv_node to this\n function.\n\n Note: this is semi-deprecated. For most purposes, this is not needed anymore.\n Starting with mpv version 0.21.0 (version 1.23) most options can be set\n with mpv_set_property() (and related functions), and even before\n mpv_initialize(). In some obscure corner cases, using this function\n to set options might still be required (see\n \"Inconsistencies between options and properties\" in the manpage). Once\n these are resolved, the option setting functions might be fully\n deprecated.\n\n @param name Option name. This is the same as on the mpv command line, but\n without the leading \"--\".\n @param format see enum mpv_format.\n @param[in] data Option value (according to the format).\n @return error code"]
|
|
pub fn mpv_set_option(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
format: mpv_format,
|
|
data: *mut ::std::os::raw::c_void,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Convenience function to set an option to a string value. This is like\n calling mpv_set_option() with MPV_FORMAT_STRING.\n\n @return error code"]
|
|
pub fn mpv_set_option_string(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
data: *const ::std::os::raw::c_char,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Send a command to the player. Commands are the same as those used in\n input.conf, except that this function takes parameters in a pre-split\n form.\n\n The commands and their parameters are documented in input.rst.\n\n Does not use OSD and string expansion by default (unlike mpv_command_string()\n and input.conf).\n\n @param[in] args NULL-terminated list of strings. Usually, the first item\n is the command, and the following items are arguments.\n @return error code"]
|
|
pub fn mpv_command(
|
|
ctx: *mut mpv_handle,
|
|
args: *mut *const ::std::os::raw::c_char,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Same as mpv_command(), but allows passing structured data in any format.\n In particular, calling mpv_command() is exactly like calling\n mpv_command_node() with the format set to MPV_FORMAT_NODE_ARRAY, and\n every arg passed in order as MPV_FORMAT_STRING.\n\n Does not use OSD and string expansion by default.\n\n The args argument can have one of the following formats:\n\n MPV_FORMAT_NODE_ARRAY:\n Positional arguments. Each entry is an argument using an arbitrary\n format (the format must be compatible to the used command). Usually,\n the first item is the command name (as MPV_FORMAT_STRING). The order\n of arguments is as documented in each command description.\n\n MPV_FORMAT_NODE_MAP:\n Named arguments. This requires at least an entry with the key \"name\"\n to be present, which must be a string, and contains the command name.\n The special entry \"_flags\" is optional, and if present, must be an\n array of strings, each being a command prefix to apply. All other\n entries are interpreted as arguments. They must use the argument names\n as documented in each command description. Some commands do not\n support named arguments at all, and must use MPV_FORMAT_NODE_ARRAY.\n\n @param[in] args mpv_node with format set to one of the values documented\n above (see there for details)\n @param[out] result Optional, pass NULL if unused. If not NULL, and if the\n function succeeds, this is set to command-specific return\n data. You must call mpv_free_node_contents() to free it\n (again, only if the command actually succeeds).\n Not many commands actually use this at all.\n @return error code (the result parameter is not set on error)"]
|
|
pub fn mpv_command_node(
|
|
ctx: *mut mpv_handle,
|
|
args: *mut mpv_node,
|
|
result: *mut mpv_node,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " This is essentially identical to mpv_command() but it also returns a result.\n\n Does not use OSD and string expansion by default.\n\n @param[in] args NULL-terminated list of strings. Usually, the first item\n is the command, and the following items are arguments.\n @param[out] result Optional, pass NULL if unused. If not NULL, and if the\n function succeeds, this is set to command-specific return\n data. You must call mpv_free_node_contents() to free it\n (again, only if the command actually succeeds).\n Not many commands actually use this at all.\n @return error code (the result parameter is not set on error)"]
|
|
pub fn mpv_command_ret(
|
|
ctx: *mut mpv_handle,
|
|
args: *mut *const ::std::os::raw::c_char,
|
|
result: *mut mpv_node,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Same as mpv_command, but use input.conf parsing for splitting arguments.\n This is slightly simpler, but also more error prone, since arguments may\n need quoting/escaping.\n\n This also has OSD and string expansion enabled by default."]
|
|
pub fn mpv_command_string(
|
|
ctx: *mut mpv_handle,
|
|
args: *const ::std::os::raw::c_char,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Same as mpv_command, but run the command asynchronously.\n\n Commands are executed asynchronously. You will receive a\n MPV_EVENT_COMMAND_REPLY event. This event will also have an\n error code set if running the command failed. For commands that\n return data, the data is put into mpv_event_command.result.\n\n The only case when you do not receive an event is when the function call\n itself fails. This happens only if parsing the command itself (or otherwise\n validating it) fails, i.e. the return code of the API call is not 0 or\n positive.\n\n Safe to be called from mpv render API threads.\n\n @param reply_userdata the value mpv_event.reply_userdata of the reply will\n be set to (see section about asynchronous calls)\n @param args NULL-terminated list of strings (see mpv_command())\n @return error code (if parsing or queuing the command fails)"]
|
|
pub fn mpv_command_async(
|
|
ctx: *mut mpv_handle,
|
|
reply_userdata: u64,
|
|
args: *mut *const ::std::os::raw::c_char,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Same as mpv_command_node(), but run it asynchronously. Basically, this\n function is to mpv_command_node() what mpv_command_async() is to\n mpv_command().\n\n See mpv_command_async() for details.\n\n Safe to be called from mpv render API threads.\n\n @param reply_userdata the value mpv_event.reply_userdata of the reply will\n be set to (see section about asynchronous calls)\n @param args as in mpv_command_node()\n @return error code (if parsing or queuing the command fails)"]
|
|
pub fn mpv_command_node_async(
|
|
ctx: *mut mpv_handle,
|
|
reply_userdata: u64,
|
|
args: *mut mpv_node,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Signal to all async requests with the matching ID to abort. This affects\n the following API calls:\n\n mpv_command_async\n mpv_command_node_async\n\n All of these functions take a reply_userdata parameter. This API function\n tells all requests with the matching reply_userdata value to try to return\n as soon as possible. If there are multiple requests with matching ID, it\n aborts all of them.\n\n This API function is mostly asynchronous itself. It will not wait until the\n command is aborted. Instead, the command will terminate as usual, but with\n some work not done. How this is signaled depends on the specific command (for\n example, the \"subprocess\" command will indicate it by \"killed_by_us\" set to\n true in the result). How long it takes also depends on the situation. The\n aborting process is completely asynchronous.\n\n Not all commands may support this functionality. In this case, this function\n will have no effect. The same is true if the request using the passed\n reply_userdata has already terminated, has not been started yet, or was\n never in use at all.\n\n You have to be careful of race conditions: the time during which the abort\n request will be effective is _after_ e.g. mpv_command_async() has returned,\n and before the command has signaled completion with MPV_EVENT_COMMAND_REPLY.\n\n @param reply_userdata ID of the request to be aborted (see above)"]
|
|
pub fn mpv_abort_async_command(ctx: *mut mpv_handle, reply_userdata: u64);
|
|
}
|
|
extern "C" {
|
|
#[doc = " Set a property to a given value. Properties are essentially variables which\n can be queried or set at runtime. For example, writing to the pause property\n will actually pause or unpause playback.\n\n If the format doesn't match with the internal format of the property, access\n usually will fail with MPV_ERROR_PROPERTY_FORMAT. In some cases, the data\n is automatically converted and access succeeds. For example, MPV_FORMAT_INT64\n is always converted to MPV_FORMAT_DOUBLE, and access using MPV_FORMAT_STRING\n usually invokes a string parser. The same happens when calling this function\n with MPV_FORMAT_NODE: the underlying format may be converted to another\n type if possible.\n\n Using a format other than MPV_FORMAT_NODE is equivalent to constructing a\n mpv_node with the given format and data, and passing the mpv_node to this\n function. (Before API version 1.21, this was different.)\n\n Note: starting with mpv 0.21.0 (client API version 1.23), this can be used to\n set options in general. It even can be used before mpv_initialize()\n has been called. If called before mpv_initialize(), setting properties\n not backed by options will result in MPV_ERROR_PROPERTY_UNAVAILABLE.\n In some cases, properties and options still conflict. In these cases,\n mpv_set_property() accesses the options before mpv_initialize(), and\n the properties after mpv_initialize(). These conflicts will be removed\n in mpv 0.23.0. See mpv_set_option() for further remarks.\n\n @param name The property name. See input.rst for a list of properties.\n @param format see enum mpv_format.\n @param[in] data Option value.\n @return error code"]
|
|
pub fn mpv_set_property(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
format: mpv_format,
|
|
data: *mut ::std::os::raw::c_void,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Convenience function to set a property to a string value.\n\n This is like calling mpv_set_property() with MPV_FORMAT_STRING."]
|
|
pub fn mpv_set_property_string(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
data: *const ::std::os::raw::c_char,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Convenience function to delete a property.\n\n This is equivalent to running the command \"del [name]\".\n\n @param name The property name. See input.rst for a list of properties.\n @return error code"]
|
|
pub fn mpv_del_property(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Set a property asynchronously. You will receive the result of the operation\n as MPV_EVENT_SET_PROPERTY_REPLY event. The mpv_event.error field will contain\n the result status of the operation. Otherwise, this function is similar to\n mpv_set_property().\n\n Safe to be called from mpv render API threads.\n\n @param reply_userdata see section about asynchronous calls\n @param name The property name.\n @param format see enum mpv_format.\n @param[in] data Option value. The value will be copied by the function. It\n will never be modified by the client API.\n @return error code if sending the request failed"]
|
|
pub fn mpv_set_property_async(
|
|
ctx: *mut mpv_handle,
|
|
reply_userdata: u64,
|
|
name: *const ::std::os::raw::c_char,
|
|
format: mpv_format,
|
|
data: *mut ::std::os::raw::c_void,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Read the value of the given property.\n\n If the format doesn't match with the internal format of the property, access\n usually will fail with MPV_ERROR_PROPERTY_FORMAT. In some cases, the data\n is automatically converted and access succeeds. For example, MPV_FORMAT_INT64\n is always converted to MPV_FORMAT_DOUBLE, and access using MPV_FORMAT_STRING\n usually invokes a string formatter.\n\n @param name The property name.\n @param format see enum mpv_format.\n @param[out] data Pointer to the variable holding the option value. On\n success, the variable will be set to a copy of the option\n value. For formats that require dynamic memory allocation,\n you can free the value with mpv_free() (strings) or\n mpv_free_node_contents() (MPV_FORMAT_NODE).\n @return error code"]
|
|
pub fn mpv_get_property(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
format: mpv_format,
|
|
data: *mut ::std::os::raw::c_void,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Return the value of the property with the given name as string. This is\n equivalent to mpv_get_property() with MPV_FORMAT_STRING.\n\n See MPV_FORMAT_STRING for character encoding issues.\n\n On error, NULL is returned. Use mpv_get_property() if you want fine-grained\n error reporting.\n\n @param name The property name.\n @return Property value, or NULL if the property can't be retrieved. Free\n the string with mpv_free()."]
|
|
pub fn mpv_get_property_string(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
) -> *mut ::std::os::raw::c_char;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Return the property as \"OSD\" formatted string. This is the same as\n mpv_get_property_string, but using MPV_FORMAT_OSD_STRING.\n\n @return Property value, or NULL if the property can't be retrieved. Free\n the string with mpv_free()."]
|
|
pub fn mpv_get_property_osd_string(
|
|
ctx: *mut mpv_handle,
|
|
name: *const ::std::os::raw::c_char,
|
|
) -> *mut ::std::os::raw::c_char;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Get a property asynchronously. You will receive the result of the operation\n as well as the property data with the MPV_EVENT_GET_PROPERTY_REPLY event.\n You should check the mpv_event.error field on the reply event.\n\n Safe to be called from mpv render API threads.\n\n @param reply_userdata see section about asynchronous calls\n @param name The property name.\n @param format see enum mpv_format.\n @return error code if sending the request failed"]
|
|
pub fn mpv_get_property_async(
|
|
ctx: *mut mpv_handle,
|
|
reply_userdata: u64,
|
|
name: *const ::std::os::raw::c_char,
|
|
format: mpv_format,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Get a notification whenever the given property changes. You will receive\n updates as MPV_EVENT_PROPERTY_CHANGE. Note that this is not very precise:\n for some properties, it may not send updates even if the property changed.\n This depends on the property, and it's a valid feature request to ask for\n better update handling of a specific property. (For some properties, like\n ``clock``, which shows the wall clock, this mechanism doesn't make too\n much sense anyway.)\n\n Property changes are coalesced: the change events are returned only once the\n event queue becomes empty (e.g. mpv_wait_event() would block or return\n MPV_EVENT_NONE), and then only one event per changed property is returned.\n\n You always get an initial change notification. This is meant to initialize\n the user's state to the current value of the property.\n\n Normally, change events are sent only if the property value changes according\n to the requested format. mpv_event_property will contain the property value\n as data member.\n\n Warning: if a property is unavailable or retrieving it caused an error,\n MPV_FORMAT_NONE will be set in mpv_event_property, even if the\n format parameter was set to a different value. In this case, the\n mpv_event_property.data field is invalid.\n\n If the property is observed with the format parameter set to MPV_FORMAT_NONE,\n you get low-level notifications whether the property _may_ have changed, and\n the data member in mpv_event_property will be unset. With this mode, you\n will have to determine yourself whether the property really changed. On the\n other hand, this mechanism can be faster and uses less resources.\n\n Observing a property that doesn't exist is allowed. (Although it may still\n cause some sporadic change events.)\n\n Keep in mind that you will get change notifications even if you change a\n property yourself. Try to avoid endless feedback loops, which could happen\n if you react to the change notifications triggered by your own change.\n\n Only the mpv_handle on which this was called will receive the property\n change events, or can unobserve them.\n\n Safe to be called from mpv render API threads.\n\n @param reply_userdata This will be used for the mpv_event.reply_userdata\n field for the received MPV_EVENT_PROPERTY_CHANGE\n events. (Also see section about asynchronous calls,\n although this function is somewhat different from\n actual asynchronous calls.)\n If you have no use for this, pass 0.\n Also see mpv_unobserve_property().\n @param name The property name.\n @param format see enum mpv_format. Can be MPV_FORMAT_NONE to omit values\n from the change events.\n @return error code (usually fails only on OOM or unsupported format)"]
|
|
pub fn mpv_observe_property(
|
|
mpv: *mut mpv_handle,
|
|
reply_userdata: u64,
|
|
name: *const ::std::os::raw::c_char,
|
|
format: mpv_format,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Undo mpv_observe_property(). This will remove all observed properties for\n which the given number was passed as reply_userdata to mpv_observe_property.\n\n Safe to be called from mpv render API threads.\n\n @param registered_reply_userdata ID that was passed to mpv_observe_property\n @return negative value is an error code, >=0 is number of removed properties\n on success (includes the case when 0 were removed)"]
|
|
pub fn mpv_unobserve_property(
|
|
mpv: *mut mpv_handle,
|
|
registered_reply_userdata: u64,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
#[doc = " Nothing happened. Happens on timeouts or sporadic wakeups."]
|
|
pub const mpv_event_id_MPV_EVENT_NONE: mpv_event_id = 0;
|
|
#[doc = " Happens when the player quits. The player enters a state where it tries\n to disconnect all clients. Most requests to the player will fail, and\n the client should react to this and quit with mpv_destroy() as soon as\n possible."]
|
|
pub const mpv_event_id_MPV_EVENT_SHUTDOWN: mpv_event_id = 1;
|
|
#[doc = " See mpv_request_log_messages()."]
|
|
pub const mpv_event_id_MPV_EVENT_LOG_MESSAGE: mpv_event_id = 2;
|
|
#[doc = " Reply to a mpv_get_property_async() request.\n See also mpv_event and mpv_event_property."]
|
|
pub const mpv_event_id_MPV_EVENT_GET_PROPERTY_REPLY: mpv_event_id = 3;
|
|
#[doc = " Reply to a mpv_set_property_async() request.\n (Unlike MPV_EVENT_GET_PROPERTY, mpv_event_property is not used.)"]
|
|
pub const mpv_event_id_MPV_EVENT_SET_PROPERTY_REPLY: mpv_event_id = 4;
|
|
#[doc = " Reply to a mpv_command_async() or mpv_command_node_async() request.\n See also mpv_event and mpv_event_command."]
|
|
pub const mpv_event_id_MPV_EVENT_COMMAND_REPLY: mpv_event_id = 5;
|
|
#[doc = " Notification before playback start of a file (before the file is loaded).\n See also mpv_event and mpv_event_start_file."]
|
|
pub const mpv_event_id_MPV_EVENT_START_FILE: mpv_event_id = 6;
|
|
#[doc = " Notification after playback end (after the file was unloaded).\n See also mpv_event and mpv_event_end_file."]
|
|
pub const mpv_event_id_MPV_EVENT_END_FILE: mpv_event_id = 7;
|
|
#[doc = " Notification when the file has been loaded (headers were read etc.), and\n decoding starts."]
|
|
pub const mpv_event_id_MPV_EVENT_FILE_LOADED: mpv_event_id = 8;
|
|
#[doc = " Idle mode was entered. In this mode, no file is played, and the playback\n core waits for new commands. (The command line player normally quits\n instead of entering idle mode, unless --idle was specified. If mpv\n was started with mpv_create(), idle mode is enabled by default.)\n\n @deprecated This is equivalent to using mpv_observe_property() on the\n \"idle-active\" property. The event is redundant, and might be\n removed in the far future. As a further warning, this event\n is not necessarily sent at the right point anymore (at the\n start of the program), while the property behaves correctly."]
|
|
pub const mpv_event_id_MPV_EVENT_IDLE: mpv_event_id = 11;
|
|
#[doc = " Sent every time after a video frame is displayed. Note that currently,\n this will be sent in lower frequency if there is no video, or playback\n is paused - but that will be removed in the future, and it will be\n restricted to video frames only.\n\n @deprecated Use mpv_observe_property() with relevant properties instead\n (such as \"playback-time\")."]
|
|
pub const mpv_event_id_MPV_EVENT_TICK: mpv_event_id = 14;
|
|
#[doc = " Triggered by the script-message input command. The command uses the\n first argument of the command as client name (see mpv_client_name()) to\n dispatch the message, and passes along all arguments starting from the\n second argument as strings.\n See also mpv_event and mpv_event_client_message."]
|
|
pub const mpv_event_id_MPV_EVENT_CLIENT_MESSAGE: mpv_event_id = 16;
|
|
#[doc = " Happens after video changed in some way. This can happen on resolution\n changes, pixel format changes, or video filter changes. The event is\n sent after the video filters and the VO are reconfigured. Applications\n embedding a mpv window should listen to this event in order to resize\n the window if needed.\n Note that this event can happen sporadically, and you should check\n yourself whether the video parameters really changed before doing\n something expensive."]
|
|
pub const mpv_event_id_MPV_EVENT_VIDEO_RECONFIG: mpv_event_id = 17;
|
|
#[doc = " Similar to MPV_EVENT_VIDEO_RECONFIG. This is relatively uninteresting,\n because there is no such thing as audio output embedding."]
|
|
pub const mpv_event_id_MPV_EVENT_AUDIO_RECONFIG: mpv_event_id = 18;
|
|
#[doc = " Happens when a seek was initiated. Playback stops. Usually it will\n resume with MPV_EVENT_PLAYBACK_RESTART as soon as the seek is finished."]
|
|
pub const mpv_event_id_MPV_EVENT_SEEK: mpv_event_id = 20;
|
|
#[doc = " There was a discontinuity of some sort (like a seek), and playback\n was reinitialized. Usually happens on start of playback and after\n seeking. The main purpose is allowing the client to detect when a seek\n request is finished."]
|
|
pub const mpv_event_id_MPV_EVENT_PLAYBACK_RESTART: mpv_event_id = 21;
|
|
#[doc = " Event sent due to mpv_observe_property().\n See also mpv_event and mpv_event_property."]
|
|
pub const mpv_event_id_MPV_EVENT_PROPERTY_CHANGE: mpv_event_id = 22;
|
|
#[doc = " Happens if the internal per-mpv_handle ringbuffer overflows, and at\n least 1 event had to be dropped. This can happen if the client doesn't\n read the event queue quickly enough with mpv_wait_event(), or if the\n client makes a very large number of asynchronous calls at once.\n\n Event delivery will continue normally once this event was returned\n (this forces the client to empty the queue completely)."]
|
|
pub const mpv_event_id_MPV_EVENT_QUEUE_OVERFLOW: mpv_event_id = 24;
|
|
#[doc = " Triggered if a hook handler was registered with mpv_hook_add(), and the\n hook is invoked. If you receive this, you must handle it, and continue\n the hook with mpv_hook_continue().\n See also mpv_event and mpv_event_hook."]
|
|
pub const mpv_event_id_MPV_EVENT_HOOK: mpv_event_id = 25;
|
|
pub type mpv_event_id = ::std::os::raw::c_uint;
|
|
extern "C" {
|
|
#[doc = " Return a string describing the event. For unknown events, NULL is returned.\n\n Note that all events actually returned by the API will also yield a non-NULL\n string with this function.\n\n @param event event ID, see see enum mpv_event_id\n @return A static string giving a short symbolic name of the event. It\n consists of lower-case alphanumeric characters and can include \"-\"\n characters. This string is suitable for use in e.g. scripting\n interfaces.\n The string is completely static, i.e. doesn't need to be deallocated,\n and is valid forever."]
|
|
pub fn mpv_event_name(event: mpv_event_id) -> *const ::std::os::raw::c_char;
|
|
}
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_event_property {
|
|
#[doc = " Name of the property."]
|
|
pub name: *const ::std::os::raw::c_char,
|
|
#[doc = " Format of the data field in the same struct. See enum mpv_format.\n This is always the same format as the requested format, except when\n the property could not be retrieved (unavailable, or an error happened),\n in which case the format is MPV_FORMAT_NONE."]
|
|
pub format: mpv_format,
|
|
#[doc = " Received property value. Depends on the format. This is like the\n pointer argument passed to mpv_get_property().\n\n For example, for MPV_FORMAT_STRING you get the string with:\n\n char *value = *(char **)(event_property->data);\n\n Note that this is set to NULL if retrieving the property failed (the\n format will be MPV_FORMAT_NONE)."]
|
|
pub data: *mut ::std::os::raw::c_void,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_event_property"][::std::mem::size_of::<mpv_event_property>() - 24usize];
|
|
["Alignment of mpv_event_property"][::std::mem::align_of::<mpv_event_property>() - 8usize];
|
|
["Offset of field: mpv_event_property::name"]
|
|
[::std::mem::offset_of!(mpv_event_property, name) - 0usize];
|
|
["Offset of field: mpv_event_property::format"]
|
|
[::std::mem::offset_of!(mpv_event_property, format) - 8usize];
|
|
["Offset of field: mpv_event_property::data"]
|
|
[::std::mem::offset_of!(mpv_event_property, data) - 16usize];
|
|
};
|
|
pub const mpv_log_level_MPV_LOG_LEVEL_NONE: mpv_log_level = 0;
|
|
#[doc = " \"no\" - disable absolutely all messages"]
|
|
pub const mpv_log_level_MPV_LOG_LEVEL_FATAL: mpv_log_level = 10;
|
|
#[doc = " \"fatal\" - critical/aborting errors"]
|
|
pub const mpv_log_level_MPV_LOG_LEVEL_ERROR: mpv_log_level = 20;
|
|
#[doc = " \"error\" - simple errors"]
|
|
pub const mpv_log_level_MPV_LOG_LEVEL_WARN: mpv_log_level = 30;
|
|
#[doc = " \"warn\" - possible problems"]
|
|
pub const mpv_log_level_MPV_LOG_LEVEL_INFO: mpv_log_level = 40;
|
|
#[doc = " \"info\" - informational message"]
|
|
pub const mpv_log_level_MPV_LOG_LEVEL_V: mpv_log_level = 50;
|
|
#[doc = " \"v\" - noisy informational message"]
|
|
pub const mpv_log_level_MPV_LOG_LEVEL_DEBUG: mpv_log_level = 60;
|
|
#[doc = " \"debug\" - very noisy technical information"]
|
|
pub const mpv_log_level_MPV_LOG_LEVEL_TRACE: mpv_log_level = 70;
|
|
#[doc = " Numeric log levels. The lower the number, the more important the message is.\n MPV_LOG_LEVEL_NONE is never used when receiving messages. The string in\n the comment after the value is the name of the log level as used for the\n mpv_request_log_messages() function.\n Unused numeric values are unused, but reserved for future use."]
|
|
pub type mpv_log_level = ::std::os::raw::c_uint;
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_event_log_message {
|
|
#[doc = " The module prefix, identifies the sender of the message. As a special\n case, if the message buffer overflows, this will be set to the string\n \"overflow\" (which doesn't appear as prefix otherwise), and the text\n field will contain an informative message."]
|
|
pub prefix: *const ::std::os::raw::c_char,
|
|
#[doc = " The log level as string. See mpv_request_log_messages() for possible\n values. The level \"no\" is never used here."]
|
|
pub level: *const ::std::os::raw::c_char,
|
|
#[doc = " The log message. It consists of 1 line of text, and is terminated with\n a newline character. (Before API version 1.6, it could contain multiple\n or partial lines.)"]
|
|
pub text: *const ::std::os::raw::c_char,
|
|
#[doc = " The same contents as the level field, but as a numeric ID.\n Since API version 1.6."]
|
|
pub log_level: mpv_log_level,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_event_log_message"][::std::mem::size_of::<mpv_event_log_message>() - 32usize];
|
|
["Alignment of mpv_event_log_message"]
|
|
[::std::mem::align_of::<mpv_event_log_message>() - 8usize];
|
|
["Offset of field: mpv_event_log_message::prefix"]
|
|
[::std::mem::offset_of!(mpv_event_log_message, prefix) - 0usize];
|
|
["Offset of field: mpv_event_log_message::level"]
|
|
[::std::mem::offset_of!(mpv_event_log_message, level) - 8usize];
|
|
["Offset of field: mpv_event_log_message::text"]
|
|
[::std::mem::offset_of!(mpv_event_log_message, text) - 16usize];
|
|
["Offset of field: mpv_event_log_message::log_level"]
|
|
[::std::mem::offset_of!(mpv_event_log_message, log_level) - 24usize];
|
|
};
|
|
#[doc = " The end of file was reached. Sometimes this may also happen on\n incomplete or corrupted files, or if the network connection was\n interrupted when playing a remote file. It also happens if the\n playback range was restricted with --end or --frames or similar."]
|
|
pub const mpv_end_file_reason_MPV_END_FILE_REASON_EOF: mpv_end_file_reason = 0;
|
|
#[doc = " Playback was stopped by an external action (e.g. playlist controls)."]
|
|
pub const mpv_end_file_reason_MPV_END_FILE_REASON_STOP: mpv_end_file_reason = 2;
|
|
#[doc = " Playback was stopped by the quit command or player shutdown."]
|
|
pub const mpv_end_file_reason_MPV_END_FILE_REASON_QUIT: mpv_end_file_reason = 3;
|
|
#[doc = " Some kind of error happened that lead to playback abort. Does not\n necessarily happen on incomplete or broken files (in these cases, both\n MPV_END_FILE_REASON_ERROR or MPV_END_FILE_REASON_EOF are possible).\n\n mpv_event_end_file.error will be set."]
|
|
pub const mpv_end_file_reason_MPV_END_FILE_REASON_ERROR: mpv_end_file_reason = 4;
|
|
#[doc = " The file was a playlist or similar. When the playlist is read, its\n entries will be appended to the playlist after the entry of the current\n file, the entry of the current file is removed, and a MPV_EVENT_END_FILE\n event is sent with reason set to MPV_END_FILE_REASON_REDIRECT. Then\n playback continues with the playlist contents.\n Since API version 1.18."]
|
|
pub const mpv_end_file_reason_MPV_END_FILE_REASON_REDIRECT: mpv_end_file_reason = 5;
|
|
#[doc = " Since API version 1.9."]
|
|
pub type mpv_end_file_reason = ::std::os::raw::c_uint;
|
|
#[doc = " Since API version 1.108."]
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_event_start_file {
|
|
#[doc = " Playlist entry ID of the file being loaded now."]
|
|
pub playlist_entry_id: i64,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_event_start_file"][::std::mem::size_of::<mpv_event_start_file>() - 8usize];
|
|
["Alignment of mpv_event_start_file"][::std::mem::align_of::<mpv_event_start_file>() - 8usize];
|
|
["Offset of field: mpv_event_start_file::playlist_entry_id"]
|
|
[::std::mem::offset_of!(mpv_event_start_file, playlist_entry_id) - 0usize];
|
|
};
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_event_end_file {
|
|
#[doc = " Corresponds to the values in enum mpv_end_file_reason.\n\n Unknown values should be treated as unknown."]
|
|
pub reason: mpv_end_file_reason,
|
|
#[doc = " If reason==MPV_END_FILE_REASON_ERROR, this contains a mpv error code\n (one of MPV_ERROR_...) giving an approximate reason why playback\n failed. In other cases, this field is 0 (no error).\n Since API version 1.9."]
|
|
pub error: ::std::os::raw::c_int,
|
|
#[doc = " Playlist entry ID of the file that was being played or attempted to be\n played. This has the same value as the playlist_entry_id field in the\n corresponding mpv_event_start_file event.\n Since API version 1.108."]
|
|
pub playlist_entry_id: i64,
|
|
#[doc = " If loading ended, because the playlist entry to be played was for example\n a playlist, and the current playlist entry is replaced with a number of\n other entries. This may happen at least with MPV_END_FILE_REASON_REDIRECT\n (other event types may use this for similar but different purposes in the\n future). In this case, playlist_insert_id will be set to the playlist\n entry ID of the first inserted entry, and playlist_insert_num_entries to\n the total number of inserted playlist entries. Note this in this specific\n case, the ID of the last inserted entry is playlist_insert_id+num-1.\n Beware that depending on circumstances, you may observe the new playlist\n entries before seeing the event (e.g. reading the \"playlist\" property or\n getting a property change notification before receiving the event).\n Since API version 1.108."]
|
|
pub playlist_insert_id: i64,
|
|
#[doc = " See playlist_insert_id. Only non-0 if playlist_insert_id is valid. Never\n negative.\n Since API version 1.108."]
|
|
pub playlist_insert_num_entries: ::std::os::raw::c_int,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_event_end_file"][::std::mem::size_of::<mpv_event_end_file>() - 32usize];
|
|
["Alignment of mpv_event_end_file"][::std::mem::align_of::<mpv_event_end_file>() - 8usize];
|
|
["Offset of field: mpv_event_end_file::reason"]
|
|
[::std::mem::offset_of!(mpv_event_end_file, reason) - 0usize];
|
|
["Offset of field: mpv_event_end_file::error"]
|
|
[::std::mem::offset_of!(mpv_event_end_file, error) - 4usize];
|
|
["Offset of field: mpv_event_end_file::playlist_entry_id"]
|
|
[::std::mem::offset_of!(mpv_event_end_file, playlist_entry_id) - 8usize];
|
|
["Offset of field: mpv_event_end_file::playlist_insert_id"]
|
|
[::std::mem::offset_of!(mpv_event_end_file, playlist_insert_id) - 16usize];
|
|
["Offset of field: mpv_event_end_file::playlist_insert_num_entries"]
|
|
[::std::mem::offset_of!(mpv_event_end_file, playlist_insert_num_entries) - 24usize];
|
|
};
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_event_client_message {
|
|
#[doc = " Arbitrary arguments chosen by the sender of the message. If num_args > 0,\n you can access args[0] through args[num_args - 1] (inclusive). What\n these arguments mean is up to the sender and receiver.\n None of the valid items are NULL."]
|
|
pub num_args: ::std::os::raw::c_int,
|
|
pub args: *mut *const ::std::os::raw::c_char,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_event_client_message"]
|
|
[::std::mem::size_of::<mpv_event_client_message>() - 16usize];
|
|
["Alignment of mpv_event_client_message"]
|
|
[::std::mem::align_of::<mpv_event_client_message>() - 8usize];
|
|
["Offset of field: mpv_event_client_message::num_args"]
|
|
[::std::mem::offset_of!(mpv_event_client_message, num_args) - 0usize];
|
|
["Offset of field: mpv_event_client_message::args"]
|
|
[::std::mem::offset_of!(mpv_event_client_message, args) - 8usize];
|
|
};
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_event_hook {
|
|
#[doc = " The hook name as passed to mpv_hook_add()."]
|
|
pub name: *const ::std::os::raw::c_char,
|
|
#[doc = " Internal ID that must be passed to mpv_hook_continue()."]
|
|
pub id: u64,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_event_hook"][::std::mem::size_of::<mpv_event_hook>() - 16usize];
|
|
["Alignment of mpv_event_hook"][::std::mem::align_of::<mpv_event_hook>() - 8usize];
|
|
["Offset of field: mpv_event_hook::name"]
|
|
[::std::mem::offset_of!(mpv_event_hook, name) - 0usize];
|
|
["Offset of field: mpv_event_hook::id"][::std::mem::offset_of!(mpv_event_hook, id) - 8usize];
|
|
};
|
|
#[repr(C)]
|
|
#[derive(Copy, Clone)]
|
|
pub struct mpv_event_command {
|
|
#[doc = " Result data of the command. Note that success/failure is signaled\n separately via mpv_event.error. This field is only for result data\n in case of success. Most commands leave it at MPV_FORMAT_NONE. Set\n to MPV_FORMAT_NONE on failure."]
|
|
pub result: mpv_node,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_event_command"][::std::mem::size_of::<mpv_event_command>() - 16usize];
|
|
["Alignment of mpv_event_command"][::std::mem::align_of::<mpv_event_command>() - 8usize];
|
|
["Offset of field: mpv_event_command::result"]
|
|
[::std::mem::offset_of!(mpv_event_command, result) - 0usize];
|
|
};
|
|
#[repr(C)]
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub struct mpv_event {
|
|
#[doc = " One of mpv_event. Keep in mind that later ABI compatible releases might\n add new event types. These should be ignored by the API user."]
|
|
pub event_id: mpv_event_id,
|
|
#[doc = " This is mainly used for events that are replies to (asynchronous)\n requests. It contains a status code, which is >= 0 on success, or < 0\n on error (a mpv_error value). Usually, this will be set if an\n asynchronous request fails.\n Used for:\n MPV_EVENT_GET_PROPERTY_REPLY\n MPV_EVENT_SET_PROPERTY_REPLY\n MPV_EVENT_COMMAND_REPLY"]
|
|
pub error: ::std::os::raw::c_int,
|
|
#[doc = " If the event is in reply to a request (made with this API and this\n API handle), this is set to the reply_userdata parameter of the request\n call. Otherwise, this field is 0.\n Used for:\n MPV_EVENT_GET_PROPERTY_REPLY\n MPV_EVENT_SET_PROPERTY_REPLY\n MPV_EVENT_COMMAND_REPLY\n MPV_EVENT_PROPERTY_CHANGE\n MPV_EVENT_HOOK"]
|
|
pub reply_userdata: u64,
|
|
#[doc = " The meaning and contents of the data member depend on the event_id:\n MPV_EVENT_GET_PROPERTY_REPLY: mpv_event_property*\n MPV_EVENT_PROPERTY_CHANGE: mpv_event_property*\n MPV_EVENT_LOG_MESSAGE: mpv_event_log_message*\n MPV_EVENT_CLIENT_MESSAGE: mpv_event_client_message*\n MPV_EVENT_START_FILE: mpv_event_start_file* (since v1.108)\n MPV_EVENT_END_FILE: mpv_event_end_file*\n MPV_EVENT_HOOK: mpv_event_hook*\n MPV_EVENT_COMMAND_REPLY* mpv_event_command*\n other: NULL\n\n Note: future enhancements might add new event structs for existing or new\n event types."]
|
|
pub data: *mut ::std::os::raw::c_void,
|
|
}
|
|
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
|
const _: () = {
|
|
["Size of mpv_event"][::std::mem::size_of::<mpv_event>() - 24usize];
|
|
["Alignment of mpv_event"][::std::mem::align_of::<mpv_event>() - 8usize];
|
|
["Offset of field: mpv_event::event_id"][::std::mem::offset_of!(mpv_event, event_id) - 0usize];
|
|
["Offset of field: mpv_event::error"][::std::mem::offset_of!(mpv_event, error) - 4usize];
|
|
["Offset of field: mpv_event::reply_userdata"]
|
|
[::std::mem::offset_of!(mpv_event, reply_userdata) - 8usize];
|
|
["Offset of field: mpv_event::data"][::std::mem::offset_of!(mpv_event, data) - 16usize];
|
|
};
|
|
extern "C" {
|
|
#[doc = " Convert the given src event to a mpv_node, and set *dst to the result. *dst\n is set to a MPV_FORMAT_NODE_MAP, with fields for corresponding mpv_event and\n mpv_event.data/mpv_event_* fields.\n\n The exact details are not completely documented out of laziness. A start\n is located in the \"Events\" section of the manpage.\n\n *dst may point to newly allocated memory, or pointers in mpv_event. You must\n copy the entire mpv_node if you want to reference it after mpv_event becomes\n invalid (such as making a new mpv_wait_event() call, or destroying the\n mpv_handle from which it was returned). Call mpv_free_node_contents() to free\n any memory allocations made by this API function.\n\n Safe to be called from mpv render API threads.\n\n @param dst Target. This is not read and fully overwritten. Must be released\n with mpv_free_node_contents(). Do not write to pointers returned\n by it. (On error, this may be left as an empty node.)\n @param src The source event. Not modified (it's not const due to the author's\n prejudice of the C version of const).\n @return error code (MPV_ERROR_NOMEM only, if at all)"]
|
|
pub fn mpv_event_to_node(dst: *mut mpv_node, src: *mut mpv_event) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Enable or disable the given event.\n\n Some events are enabled by default. Some events can't be disabled.\n\n (Informational note: currently, all events are enabled by default, except\n MPV_EVENT_TICK.)\n\n Safe to be called from mpv render API threads.\n\n @param event See enum mpv_event_id.\n @param enable 1 to enable receiving this event, 0 to disable it.\n @return error code"]
|
|
pub fn mpv_request_event(
|
|
ctx: *mut mpv_handle,
|
|
event: mpv_event_id,
|
|
enable: ::std::os::raw::c_int,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Enable or disable receiving of log messages. These are the messages the\n command line player prints to the terminal. This call sets the minimum\n required log level for a message to be received with MPV_EVENT_LOG_MESSAGE.\n\n @param min_level Minimal log level as string. Valid log levels:\n no fatal error warn info v debug trace\n The value \"no\" disables all messages. This is the default.\n An exception is the value \"terminal-default\", which uses the\n log level as set by the \"--msg-level\" option. This works\n even if the terminal is disabled. (Since API version 1.19.)\n Also see mpv_log_level.\n @return error code"]
|
|
pub fn mpv_request_log_messages(
|
|
ctx: *mut mpv_handle,
|
|
min_level: *const ::std::os::raw::c_char,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Wait for the next event, or until the timeout expires, or if another thread\n makes a call to mpv_wakeup(). Passing 0 as timeout will never wait, and\n is suitable for polling.\n\n The internal event queue has a limited size (per client handle). If you\n don't empty the event queue quickly enough with mpv_wait_event(), it will\n overflow and silently discard further events. If this happens, making\n asynchronous requests will fail as well (with MPV_ERROR_EVENT_QUEUE_FULL).\n\n Only one thread is allowed to call this on the same mpv_handle at a time.\n The API won't complain if more than one thread calls this, but it will cause\n race conditions in the client when accessing the shared mpv_event struct.\n Note that most other API functions are not restricted by this, and no API\n function internally calls mpv_wait_event(). Additionally, concurrent calls\n to different mpv_handles are always safe.\n\n As long as the timeout is 0, this is safe to be called from mpv render API\n threads.\n\n @param timeout Timeout in seconds, after which the function returns even if\n no event was received. A MPV_EVENT_NONE is returned on\n timeout. A value of 0 will disable waiting. Negative values\n will wait with an infinite timeout.\n @return A struct containing the event ID and other data. The pointer (and\n fields in the struct) stay valid until the next mpv_wait_event()\n call, or until the mpv_handle is destroyed. You must not write to\n the struct, and all memory referenced by it will be automatically\n released by the API on the next mpv_wait_event() call, or when the\n context is destroyed. The return value is never NULL."]
|
|
pub fn mpv_wait_event(ctx: *mut mpv_handle, timeout: f64) -> *mut mpv_event;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Interrupt the current mpv_wait_event() call. This will wake up the thread\n currently waiting in mpv_wait_event(). If no thread is waiting, the next\n mpv_wait_event() call will return immediately (this is to avoid lost\n wakeups).\n\n mpv_wait_event() will receive a MPV_EVENT_NONE if it's woken up due to\n this call. But note that this dummy event might be skipped if there are\n already other events queued. All what counts is that the waiting thread\n is woken up at all.\n\n Safe to be called from mpv render API threads."]
|
|
pub fn mpv_wakeup(ctx: *mut mpv_handle);
|
|
}
|
|
extern "C" {
|
|
#[doc = " Set a custom function that should be called when there are new events. Use\n this if blocking in mpv_wait_event() to wait for new events is not feasible.\n\n Keep in mind that the callback will be called from foreign threads. You\n must not make any assumptions of the environment, and you must return as\n soon as possible (i.e. no long blocking waits). Exiting the callback through\n any other means than a normal return is forbidden (no throwing exceptions,\n no longjmp() calls). You must not change any local thread state (such as\n the C floating point environment).\n\n You are not allowed to call any client API functions inside of the callback.\n In particular, you should not do any processing in the callback, but wake up\n another thread that does all the work. The callback is meant strictly for\n notification only, and is called from arbitrary core parts of the player,\n that make no considerations for reentrant API use or allowing the callee to\n spend a lot of time doing other things. Keep in mind that it's also possible\n that the callback is called from a thread while a mpv API function is called\n (i.e. it can be reentrant).\n\n In general, the client API expects you to call mpv_wait_event() to receive\n notifications, and the wakeup callback is merely a helper utility to make\n this easier in certain situations. Note that it's possible that there's\n only one wakeup callback invocation for multiple events. You should call\n mpv_wait_event() with no timeout until MPV_EVENT_NONE is reached, at which\n point the event queue is empty.\n\n If you actually want to do processing in a callback, spawn a thread that\n does nothing but call mpv_wait_event() in a loop and dispatches the result\n to a callback.\n\n Only one wakeup callback can be set.\n\n @param cb function that should be called if a wakeup is required\n @param d arbitrary userdata passed to cb"]
|
|
pub fn mpv_set_wakeup_callback(
|
|
ctx: *mut mpv_handle,
|
|
cb: ::std::option::Option<unsafe extern "C" fn(d: *mut ::std::os::raw::c_void)>,
|
|
d: *mut ::std::os::raw::c_void,
|
|
);
|
|
}
|
|
extern "C" {
|
|
#[doc = " Block until all asynchronous requests are done. This affects functions like\n mpv_command_async(), which return immediately and return their result as\n events.\n\n This is a helper, and somewhat equivalent to calling mpv_wait_event() in a\n loop until all known asynchronous requests have sent their reply as event,\n except that the event queue is not emptied.\n\n In case you called mpv_suspend() before, this will also forcibly reset the\n suspend counter of the given handle."]
|
|
pub fn mpv_wait_async_requests(ctx: *mut mpv_handle);
|
|
}
|
|
extern "C" {
|
|
#[doc = " A hook is like a synchronous event that blocks the player. You register\n a hook handler with this function. You will get an event, which you need\n to handle, and once things are ready, you can let the player continue with\n mpv_hook_continue().\n\n Currently, hooks can't be removed explicitly. But they will be implicitly\n removed if the mpv_handle it was registered with is destroyed. This also\n continues the hook if it was being handled by the destroyed mpv_handle (but\n this should be avoided, as it might mess up order of hook execution).\n\n Hook handlers are ordered globally by priority and order of registration.\n Handlers for the same hook with same priority are invoked in order of\n registration (the handler registered first is run first). Handlers with\n lower priority are run first (which seems backward).\n\n See the \"Hooks\" section in the manpage to see which hooks are currently\n defined.\n\n Some hooks might be reentrant (so you get multiple MPV_EVENT_HOOK for the\n same hook). If this can happen for a specific hook type, it will be\n explicitly documented in the manpage.\n\n Only the mpv_handle on which this was called will receive the hook events,\n or can \"continue\" them.\n\n @param reply_userdata This will be used for the mpv_event.reply_userdata\n field for the received MPV_EVENT_HOOK events.\n If you have no use for this, pass 0.\n @param name The hook name. This should be one of the documented names. But\n if the name is unknown, the hook event will simply be never\n raised.\n @param priority See remarks above. Use 0 as a neutral default.\n @return error code (usually fails only on OOM)"]
|
|
pub fn mpv_hook_add(
|
|
ctx: *mut mpv_handle,
|
|
reply_userdata: u64,
|
|
name: *const ::std::os::raw::c_char,
|
|
priority: ::std::os::raw::c_int,
|
|
) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Respond to a MPV_EVENT_HOOK event. You must call this after you have handled\n the event. There is no way to \"cancel\" or \"stop\" the hook.\n\n Calling this will will typically unblock the player for whatever the hook\n is responsible for (e.g. for the \"on_load\" hook it lets it continue\n playback).\n\n It is explicitly undefined behavior to call this more than once for each\n MPV_EVENT_HOOK, to pass an incorrect ID, or to call this on a mpv_handle\n different from the one that registered the handler and received the event.\n\n @param id This must be the value of the mpv_event_hook.id field for the\n corresponding MPV_EVENT_HOOK.\n @return error code"]
|
|
pub fn mpv_hook_continue(ctx: *mut mpv_handle, id: u64) -> ::std::os::raw::c_int;
|
|
}
|
|
extern "C" {
|
|
#[doc = " Return a UNIX file descriptor referring to the read end of a pipe. This\n pipe can be used to wake up a poll() based processing loop. The purpose of\n this function is very similar to mpv_set_wakeup_callback(), and provides\n a primitive mechanism to handle coordinating a foreign event loop and the\n libmpv event loop. The pipe is non-blocking. It's closed when the mpv_handle\n is destroyed. This function always returns the same value (on success).\n\n This is in fact implemented using the same underlying code as for\n mpv_set_wakeup_callback() (though they don't conflict), and it is as if each\n callback invocation writes a single 0 byte to the pipe. When the pipe\n becomes readable, the code calling poll() (or select()) on the pipe should\n read all contents of the pipe and then call mpv_wait_event(c, 0) until\n no new events are returned. The pipe contents do not matter and can just\n be discarded. There is not necessarily one byte per readable event in the\n pipe. For example, the pipes are non-blocking, and mpv won't block if the\n pipe is full. Pipes are normally limited to 4096 bytes, so if there are\n more than 4096 events, the number of readable bytes can not equal the number\n of events queued. Also, it's possible that mpv does not write to the pipe\n once it's guaranteed that the client was already signaled. See the example\n below how to do it correctly.\n\n Example:\n\n int pipefd = mpv_get_wakeup_pipe(mpv);\n if (pipefd < 0)\n error();\n while (1) {\n struct pollfd pfds[1] = {\n { .fd = pipefd, .events = POLLIN },\n };\n // Wait until there are possibly new mpv events.\n poll(pfds, 1, -1);\n if (pfds[0].revents & POLLIN) {\n // Empty the pipe. Doing this before calling mpv_wait_event()\n // ensures that no wakeups are missed. It's not so important to\n // make sure the pipe is really empty (it will just cause some\n // additional wakeups in unlikely corner cases).\n char unused[256];\n read(pipefd, unused, sizeof(unused));\n while (1) {\n mpv_event *ev = mpv_wait_event(mpv, 0);\n // If MPV_EVENT_NONE is received, the event queue is empty.\n if (ev->event_id == MPV_EVENT_NONE)\n break;\n // Process the event.\n ...\n }\n }\n }\n\n @deprecated this function will be removed in the future. If you need this\n functionality, use mpv_set_wakeup_callback(), create a pipe\n manually, and call write() on your pipe in the callback.\n\n @return A UNIX FD of the read end of the wakeup pipe, or -1 on error.\n On MS Windows/MinGW, this will always return -1."]
|
|
pub fn mpv_get_wakeup_pipe(ctx: *mut mpv_handle) -> ::std::os::raw::c_int;
|
|
}
|