Value | Meaning |
---|---|
MPV_FORMAT_NONE0 | Invalid. Sometimes used for empty values. |
MPV_FORMAT_STRING1 | The basic type is char*. It returns the raw property string, like using ${=property} in input.conf (see input.rst). NULL isn't an allowed value. Warning: although the encoding is usually UTF-8, this is not always the case. File tags often store strings in some legacy codepage, and even filenames don't necessarily have to be in UTF-8 (at least on Linux). If you pass the strings to code that requires valid UTF-8, you have to sanitize it in some way. On Windows, filenames are always UTF-8, and libmpv converts between UTF-8 and UTF-16 when using win32 API functions. See the "Encoding of filenames" section for details. Example for reading: char *result = NULL; if (mpv_get_property(ctx, "property", MPV_FORMAT_STRING, &result) < 0) goto error; printf("%s\n", result); mpv_free(result); Or just use mpv_get_property_string(). Example for writing: char *value = "the new value"; // yep, you pass the address to the variable // (needed for symmetry with other types and mpv_get_property) mpv_set_property(ctx, "property", MPV_FORMAT_STRING, &value); Or just use mpv_set_property_string(). |
MPV_FORMAT_OSD_STRING2 | 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. Only valid when doing read access. The rest works like MPV_FORMAT_STRING. |
MPV_FORMAT_FLAG3 | The basic type is int. The only allowed values are 0 ("no") and 1 ("yes"). Example for reading: int result; if (mpv_get_property(ctx, "property", MPV_FORMAT_FLAG, &result) < 0) goto error; printf("%s\n", result ? "true" : "false"); Example for writing: int flag = 1; mpv_set_property(ctx, "property", MPV_FORMAT_FLAG, &flag); |
MPV_FORMAT_INT644 | The basic type is int64_t. |
MPV_FORMAT_DOUBLE5 | The basic type is double. |
MPV_FORMAT_NODE6 | The type is mpv_node. For reading, you usually would pass a pointer to a stack-allocated mpv_node value to mpv, and when you're done you call mpv_free_node_contents(&node). You're expected not to write to the data - if you have to, copy it first (which you have to do manually). For writing, you construct your own mpv_node, and pass a pointer to the API. The API will never write to your data (and copy it if needed), so you're free to use any form of allocation or memory management you like. Warning: when reading, always check the mpv_node.format member. For example, properties might change their type in future versions of mpv, or sometimes even during runtime. Example for reading: mpv_node result; if (mpv_get_property(ctx, "property", MPV_FORMAT_NODE, &result) < 0) goto error; printf("format=%d\n", (int)result.format); mpv_free_node_contents(&result). Example for writing: mpv_node value; value.format = MPV_FORMAT_STRING; value.u.string = "hello"; mpv_set_property(ctx, "property", MPV_FORMAT_NODE, &value); |
MPV_FORMAT_NODE_ARRAY7 | Used with mpv_node only. Can usually not be used directly. |
MPV_FORMAT_NODE_MAP8 | See MPV_FORMAT_NODE_ARRAY. |
MPV_FORMAT_BYTE_ARRAY9 | A raw, untyped byte array. Only used only with mpv_node, and only in some very special situations. (Currently, only for the screenshot-raw command.) |
Data format for options and properties. The API functions to get/set properties and options support multiple formats, and this enum describes them.