From c0d989c83913fb9c990d961c44da4816b8d2de18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Wed, 24 Dec 2025 15:47:12 +0100 Subject: [PATCH] sub/sd_sbr: check runtime version --- meson.build | 2 +- sub/sd_sbr.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b8decc1d82..d4c75a907f 100644 --- a/meson.build +++ b/meson.build @@ -355,7 +355,7 @@ if features['libdl'] dependencies += libdl endif -subrandr = dependency('subrandr', version: '>= 0.1.1', required: get_option('subrandr')) +subrandr = dependency('subrandr', version: '>= 1.0.0', required: get_option('subrandr')) features += {'subrandr': subrandr.found()} if features['subrandr'] sources += files('demux/demux_sbr.c', 'sub/sd_sbr.c') diff --git a/sub/sd_sbr.c b/sub/sd_sbr.c index b3653d2a77..3ddb42a380 100644 --- a/sub/sd_sbr.c +++ b/sub/sd_sbr.c @@ -95,6 +95,21 @@ static int init(struct sd *sd) if (strcmp(sd->codec->codec, "subrandr/srv3")) return -1; + uint32_t major, minor, patch; + sbr_library_version(&major, &minor, &patch); + + MP_VERBOSE(sd, "subrandr version: %u.%u.%u", SUBRANDR_MAJOR, SUBRANDR_MINOR, SUBRANDR_PATCH); + if(SUBRANDR_MAJOR != major || SUBRANDR_MINOR != minor || SUBRANDR_PATCH != patch) + MP_VERBOSE(sd, " (runtime %u.%u.%u)", major, minor, patch); + MP_VERBOSE(sd, "\n"); + + if (major != SUBRANDR_MAJOR || (int32_t)minor < SUBRANDR_MINOR) { + MP_ERR(sd, "build version %u.%u.%u incompatible with runtime version " + "%u.%u.%u, disabling...\n", SUBRANDR_MAJOR, SUBRANDR_MINOR, + SUBRANDR_PATCH, major, minor, patch); + return -1; + } + sbr_library *library = sbr_library_init(); if (!library) { const char *error = sbr_get_last_error_string();