[][src]Function libmpv_sys::mpv_set_property

pub unsafe extern "C" fn mpv_set_property(
    ctx: *mut mpv_handle,
    name: *const c_char,
    format: mpv_format,
    data: *mut c_void
) -> c_int

Set a property to a given value. Properties are essentially variables which can be queried or set at runtime. For example, writing to the pause property will actually pause or unpause playback.

If the format doesn't match with the internal format of the property, access usually will fail with MPV_ERROR_PROPERTY_FORMAT. In some cases, the data is automatically converted and access succeeds. For example, MPV_FORMAT_INT64 is always converted to MPV_FORMAT_DOUBLE, and access using MPV_FORMAT_STRING usually invokes a string parser. The same happens when calling this function with MPV_FORMAT_NODE: the underlying format may be converted to another type if possible.

Using a format other than MPV_FORMAT_NODE is equivalent to constructing a mpv_node with the given format and data, and passing the mpv_node to this function. (Before API version 1.21, this was different.)

Note: starting with mpv 0.21.0 (client API version 1.23), this can be used to set options in general. It even can be used before mpv_initialize() has been called. If called before mpv_initialize(), setting properties not backed by options will result in MPV_ERROR_PROPERTY_UNAVAILABLE. In some cases, properties and options still conflict. In these cases, mpv_set_property() accesses the options before mpv_initialize(), and the properties after mpv_initialize(). These conflicts will be removed in mpv 0.23.0. See mpv_set_option() for further remarks.

@param name The property name. See input.rst for a list of properties. @param format see enum mpv_format. @param[in] data Option value. @return error code