summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-08 19:08:41 +0100
committerwm4 <wm4@nowhere>2020-03-08 19:38:10 +0100
commit048334c396f5fed17d3b608af0495cdf95c38499 (patch)
tree980aff126d71b12b6f611a918f7a3d19155a6beb
parent6bf086fc15c3fc9ed81b0215161056ff6a36623c (diff)
downloadmpv-048334c396f5fed17d3b608af0495cdf95c38499.tar.bz2
mpv-048334c396f5fed17d3b608af0495cdf95c38499.tar.xz
command: add libass-version property
A bit of a mess with that ifdeffery, but fuck it.
-rw-r--r--DOCS/man/input.rst5
-rw-r--r--player/command.c15
2 files changed, 20 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 082776f66d..7c7a6b3d44 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2749,6 +2749,11 @@ Property list
still named the same.) This property is unavailable if mpv is linked against
older FFmpeg and Libav versions.
+``libass-version``
+ Return the value of ``ass_library_version()``. This is an integer, encoded
+ in a somewhat weird form (apparently "hex BCD"), indicating the release
+ version of the libass library linked to mpv.
+
``options/<name>`` (RW)
Read-only access to value of option ``--<name>``. Most options can be
changed at runtime by writing to this property. Note that many options
diff --git a/player/command.c b/player/command.c
index ec4b35e137..93fd640d52 100644
--- a/player/command.c
+++ b/player/command.c
@@ -74,6 +74,10 @@
#include <windows.h>
#endif
+#if HAVE_LIBASS
+#include <ass/ass.h>
+#endif
+
struct command_ctx {
// All properties, terminated with a {0} item.
struct m_property *properties;
@@ -3008,6 +3012,16 @@ static int mp_property_ffmpeg(void *ctx, struct m_property *prop,
return m_property_strdup_ro(action, arg, av_version_info());
}
+static int mp_property_libass_version(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+#if HAVE_LIBASS
+ return m_property_int64_ro(action, arg, ass_library_version());
+#else
+ return M_PROPERTY_UNAVAILABLE;
+#endif
+}
+
static int mp_property_alias(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -3449,6 +3463,7 @@ static const struct m_property mp_properties_base[] = {
{"mpv-version", mp_property_version},
{"mpv-configuration", mp_property_configuration},
{"ffmpeg-version", mp_property_ffmpeg},
+ {"libass-version", mp_property_libass_version},
{"options", mp_property_options},
{"file-local-options", mp_property_local_options},