MPV_FORMAT_STRING constant

int const MPV_FORMAT_STRING

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

Implementation

static const int MPV_FORMAT_STRING = 1;