command: expose mpv version as property

A client API user has no other way to know the version.
This commit is contained in:
wm4 2014-11-02 17:44:24 +01:00
parent 12212a1685
commit 3a95a0887c
2 changed files with 12 additions and 0 deletions

View File

@ -1411,6 +1411,10 @@ Property list
How these details are handled may change in the future. How these details are handled may change in the future.
``mpv-version``
Return the mpv version/copyright string. Depending on how the binary was
built, it might contain either a release version, or just a git hash.
``options/<name>`` (RW) ``options/<name>`` (RW)
Read-only access to value of option ``--<name>``. Most options can be Read-only access to value of option ``--<name>``. Most options can be
changed at runtime by writing to this property. Note that many options changed at runtime by writing to this property. Note that many options

View File

@ -2891,6 +2891,12 @@ static int mp_property_af(void *ctx, struct m_property *prop,
return property_filter(prop, action, arg, ctx, STREAM_AUDIO); return property_filter(prop, action, arg, ctx, STREAM_AUDIO);
} }
static int mp_property_version(void *ctx, struct m_property *prop,
int action, void *arg)
{
return m_property_strdup_ro(action, arg, mpv_version);
}
static int mp_property_alias(void *ctx, struct m_property *prop, static int mp_property_alias(void *ctx, struct m_property *prop,
int action, void *arg) int action, void *arg)
{ {
@ -3160,6 +3166,8 @@ static const struct m_property mp_properties[] = {
M_PROPERTY_ALIAS("audio", "aid"), M_PROPERTY_ALIAS("audio", "aid"),
M_PROPERTY_ALIAS("sub", "sid"), M_PROPERTY_ALIAS("sub", "sid"),
{"mpv-version", mp_property_version},
{"options", mp_property_options}, {"options", mp_property_options},
{"file-local-options", mp_property_local_options}, {"file-local-options", mp_property_local_options},
{"property-list", mp_property_list}, {"property-list", mp_property_list},