1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-04 14:11:53 +00:00

command: add libass-version property

A bit of a mess with that ifdeffery, but fuck it.
This commit is contained in:
wm4 2020-03-08 19:08:41 +01:00
parent 6bf086fc15
commit 048334c396
2 changed files with 20 additions and 0 deletions

View File

@ -2749,6 +2749,11 @@ Property list
still named the same.) This property is unavailable if mpv is linked against still named the same.) This property is unavailable if mpv is linked against
older FFmpeg and Libav versions. 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) ``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

@ -74,6 +74,10 @@
#include <windows.h> #include <windows.h>
#endif #endif
#if HAVE_LIBASS
#include <ass/ass.h>
#endif
struct command_ctx { struct command_ctx {
// All properties, terminated with a {0} item. // All properties, terminated with a {0} item.
struct m_property *properties; 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()); 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, static int mp_property_alias(void *ctx, struct m_property *prop,
int action, void *arg) int action, void *arg)
{ {
@ -3449,6 +3463,7 @@ static const struct m_property mp_properties_base[] = {
{"mpv-version", mp_property_version}, {"mpv-version", mp_property_version},
{"mpv-configuration", mp_property_configuration}, {"mpv-configuration", mp_property_configuration},
{"ffmpeg-version", mp_property_ffmpeg}, {"ffmpeg-version", mp_property_ffmpeg},
{"libass-version", mp_property_libass_version},
{"options", mp_property_options}, {"options", mp_property_options},
{"file-local-options", mp_property_local_options}, {"file-local-options", mp_property_local_options},