|
25 | 25 | #include <math.h>
|
26 | 26 | #include <sys/types.h>
|
27 | 27 |
|
| 28 | +#include "config.h" // for HAVE_SUBRANDR |
| 29 | + |
28 | 30 | #include <ass/ass.h>
|
| 31 | +#if HAVE_SUBRANDR |
| 32 | +#include <subrandr/subrandr.h> |
| 33 | +#endif |
29 | 34 | #include <libavutil/avstring.h>
|
30 | 35 | #include <libavutil/common.h>
|
31 | 36 | #include <libavutil/timecode.h>
|
@@ -3665,6 +3670,32 @@ static int mp_property_libass_version(void *ctx, struct m_property *prop,
|
3665 | 3670 | return m_property_int64_ro(action, arg, ass_library_version());
|
3666 | 3671 | }
|
3667 | 3672 |
|
| 3673 | +static int mp_property_subrandr_version(void *ctx, struct m_property *prop, |
| 3674 | + int action, void *arg) |
| 3675 | +{ |
| 3676 | +#if HAVE_SUBRANDR |
| 3677 | + switch (action) { |
| 3678 | + case M_PROPERTY_GET: { |
| 3679 | + struct bstr result = (bstr) {NULL, 0}; |
| 3680 | + uint32_t major, minor, patch; |
| 3681 | + sbr_library_version(&major, &minor, &patch); |
| 3682 | + if(bstr_xappend_asprintf(NULL, &result, "%" PRIu32 ".%" PRIu32 ".%" PRIu32, |
| 3683 | + major, minor, patch) < 0) |
| 3684 | + return M_PROPERTY_ERROR; |
| 3685 | + |
| 3686 | + *(char **)arg = result.start; |
| 3687 | + return M_PROPERTY_OK; |
| 3688 | + } |
| 3689 | + case M_PROPERTY_GET_TYPE: |
| 3690 | + *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING}; |
| 3691 | + return M_PROPERTY_OK; |
| 3692 | + } |
| 3693 | + return M_PROPERTY_NOT_IMPLEMENTED; |
| 3694 | +#else |
| 3695 | + return M_PROPERTY_UNAVAILABLE; |
| 3696 | +#endif |
| 3697 | +} |
| 3698 | + |
3668 | 3699 | static int mp_property_platform(void *ctx, struct m_property *prop,
|
3669 | 3700 | int action, void *arg)
|
3670 | 3701 | {
|
@@ -4446,6 +4477,7 @@ static const struct m_property mp_properties_base[] = {
|
4446 | 4477 | {"mpv-configuration", mp_property_configuration},
|
4447 | 4478 | {"ffmpeg-version", mp_property_ffmpeg},
|
4448 | 4479 | {"libass-version", mp_property_libass_version},
|
| 4480 | + {"subrandr-version", mp_property_subrandr_version}, |
4449 | 4481 | {"platform", mp_property_platform},
|
4450 | 4482 |
|
4451 | 4483 | {"options", mp_property_options},
|
|
0 commit comments