public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Simone Caronni <negativo17@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/mpv] rawhide: Add patches for VapourSynth R74+
Date: Mon, 10 Aug 2026 13:51:53 GMT	[thread overview]
Message-ID: <178636991390.1.10170555898167627298.rpms-mpv-3bb8c5698f0a@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/mpv
Branch : rawhide
Commit : 3bb8c5698f0a51f5e661a3b8269a13d3cc294db1
Author : Simone Caronni <negativo17@gmail.com>
Date   : 2026-08-10T15:50:53+02:00
Stats  : +228/-1 in 4 file(s)
URL    : https://src.fedoraproject.org/rpms/mpv/c/3bb8c5698f0a51f5e661a3b8269a13d3cc294db1?branch=rawhide

Log:
Add patches for VapourSynth R74+

---
diff --git a/mpv-vapoursynth-r74.patch b/mpv-vapoursynth-r74.patch
new file mode 100644
index 0000000..d464022
--- /dev/null
+++ b/mpv-vapoursynth-r74.patch
@@ -0,0 +1,140 @@
+From 75b2ccfeb1ce4ed5a40ac9860fa74f3d1265e13f Mon Sep 17 00:00:00 2001
+From: Crend King <975235+CrendKing@users.noreply.github.com>
+Date: Thu, 9 Apr 2026 21:53:16 -0700
+Subject: [PATCH] vf_vapoursynth: update for VapourSynth R74
+
+VapourSynth R74 changed two things relevant to mpv build process:
+
+1) VSScript no longer has static library to link to, and only support runtime loading.
+This is reflected on the new VSScript example in VapourSynth SDK.
+2) The VSScript library name is changed from libvapoursynth-script to libvsscript for Linux
+and MacOS.
+
+The new VSScript initialization code is modified from their SDK example to utilize
+mpv's mechanisms. Build dependency is also updated accordingly.
+---
+ meson.build                   |  6 ++---
+ osdep/io.h                    |  5 ++--
+ video/filter/vf_vapoursynth.c | 49 ++++++++++++++++++++++++++++++++---
+ 3 files changed, 51 insertions(+), 9 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index a40e4f1aec520..d7bfd5f3a3311 100644
+--- a/meson.build
++++ b/meson.build
+@@ -772,11 +772,9 @@ if features['uchardet']
+ endif
+ 
+ vapoursynth = dependency('vapoursynth', version: '>= 56', required: get_option('vapoursynth'))
+-vapoursynth_script = dependency('vapoursynth-script', version: '>= 56',
+-                                required: get_option('vapoursynth'))
+-features += {'vapoursynth': vapoursynth.found() and vapoursynth_script.found()}
++features += {'vapoursynth': vapoursynth.found()}
+ if features['vapoursynth']
+-    dependencies += [vapoursynth, vapoursynth_script]
++    dependencies += vapoursynth.partial_dependency(compile_args: true, includes: true)
+     sources += files('video/filter/vf_vapoursynth.c')
+ endif
+ 
+diff --git a/osdep/io.h b/osdep/io.h
+index cc72e22473a54..bf672224e78a7 100644
+--- a/osdep/io.h
++++ b/osdep/io.h
+@@ -247,12 +247,13 @@ locale_t newlocale(int, const char *, locale_t);
+ locale_t uselocale(locale_t);
+ void freelocale(locale_t);
+ 
+-#else /* __MINGW32__ */
++#else /* _WIN32 */
+ 
++#include <dlfcn.h>
+ #include <sys/mman.h>
+ 
+ extern char **environ;
+ 
+-#endif /* __MINGW32__ */
++#endif /* _WIN32 */
+ 
+ #endif
+diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
+index d2ab916220edf..22bfa646581e9 100644
+--- a/video/filter/vf_vapoursynth.c
++++ b/video/filter/vf_vapoursynth.c
+@@ -22,7 +22,6 @@
+ #include <limits.h>
+ #include <assert.h>
+ 
+-#include <VapourSynth4.h>
+ #include <VSScript4.h>
+ 
+ #include <libavutil/rational.h>
+@@ -37,11 +36,24 @@
+ #include "filters/user_filters.h"
+ #include "options/m_option.h"
+ #include "options/path.h"
++#include "osdep/io.h"
+ #include "osdep/threads.h"
+ #include "video/img_format.h"
+ #include "video/mp_image.h"
+ #include "video/sws_utils.h"
+ 
++static const char *const vsscript_lib_names[] = {
++#ifdef _WIN32
++    "VSScript.dll",
++#elif defined(__APPLE__)
++    "libvsscript.dylib",
++    "libvapoursynth-script.dylib",
++#else
++    "libvsscript.so",
++    "libvapoursynth-script.so",
++#endif
++};
++
+ struct vapoursynth_opts {
+     char *file;
+     int maxbuffer;
+@@ -804,11 +816,42 @@ static const m_option_t vf_opts_fields[] = {
+ 
+ static int drv_vss_init(struct priv *p)
+ {
+-    p->vs_script_api = getVSScriptAPI(VSSCRIPT_API_VERSION);
++    const char *vsscript_path = getenv("VSSCRIPT_PATH");
++    const int dl_mode = RTLD_NOW | RTLD_LOCAL;
++    void *vsscript_lib = NULL;
++
++    if (vsscript_path) {
++        vsscript_lib = dlopen(vsscript_path, dl_mode);
++    } else {
++        for (size_t i = 0; i < MP_ARRAY_SIZE(vsscript_lib_names) && !vsscript_lib; ++i) {
++            vsscript_lib = dlopen(vsscript_lib_names[i], dl_mode);
++        }
++    }
++
++    VS_CC const VSSCRIPTAPI *(*getVSScriptAPI_func)(int) = NULL;
++    VS_CC const char *(*getVSScriptAPILastError_func)(void) = NULL;
++    const char *unknown_error_msg = "Last error unknown";
++
++    if (vsscript_lib) {
++        getVSScriptAPI_func = (void *) dlsym(vsscript_lib, "getVSScriptAPI");
++        getVSScriptAPILastError_func = (void *) dlsym(vsscript_lib, "getVSScriptAPILastError");
++    }
++
++    if (!getVSScriptAPI_func) {
++        const char *dl_error_msg = dlerror();
++        const char *last_error_msg = dl_error_msg ? dl_error_msg : unknown_error_msg;
++        MP_FATAL(p, "Failed to load VapourSynth VSScript library: %s\n", last_error_msg);
++        return -1;
++    }
++
++    p->vs_script_api = getVSScriptAPI_func(VSSCRIPT_API_VERSION);
+     if (!p->vs_script_api) {
+-        MP_FATAL(p, "Could not initialize VapourSynth scripting.\n");
++        const char *vs_error_msg = getVSScriptAPILastError_func ? getVSScriptAPILastError_func() : NULL;
++        const char *last_error_msg = vs_error_msg ? vs_error_msg : unknown_error_msg;
++        MP_FATAL(p, "Failed to initialize VapourSynth VSScript library: %s\n", last_error_msg);
+         return -1;
+     }
++
+     return 0;
+ }
+ 

diff --git a/mpv-vapoursynth-rtld-global.patch b/mpv-vapoursynth-rtld-global.patch
new file mode 100644
index 0000000..7957164
--- /dev/null
+++ b/mpv-vapoursynth-rtld-global.patch
@@ -0,0 +1,38 @@
+From 44a9b03f244f24e0ea443370cf2cfae0da5767f9 Mon Sep 17 00:00:00 2001
+From: Chainik <chainik.dn@gmail.com>
+Date: Sun, 31 May 2026 14:51:37 +0300
+Subject: [PATCH] vf_vapoursynth: improve backward compatibility
+
+The previous commit to dynamically load VapourSynth R74 would fail to work
+for VapourSynth R73 and before on Linux due to load mode RTLD_LOCAL. To
+make it work on all VapourSynth version, switch to use RTLD_GLOBAL mode.
+---
+ osdep/io.h                    | 1 +
+ video/filter/vf_vapoursynth.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/osdep/io.h b/osdep/io.h
+index bf672224e78a7..1ab7a7f248020 100644
+--- a/osdep/io.h
++++ b/osdep/io.h
+@@ -207,6 +207,7 @@ void mp_globfree(mp_glob_t *pglob);
+ 
+ #define RTLD_NOW 0
+ #define RTLD_LOCAL 0
++#define RTLD_GLOBAL 0
+ #define dlopen(fn,fg) mp_dlopen((fn), (fg))
+ #define dlsym(h,s) mp_dlsym((h), (s))
+ #define dlerror mp_dlerror
+diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
+index 22bfa646581e9..79b52dbc4baa1 100644
+--- a/video/filter/vf_vapoursynth.c
++++ b/video/filter/vf_vapoursynth.c
+@@ -817,7 +817,7 @@ static const m_option_t vf_opts_fields[] = {
+ static int drv_vss_init(struct priv *p)
+ {
+     const char *vsscript_path = getenv("VSSCRIPT_PATH");
+-    const int dl_mode = RTLD_NOW | RTLD_LOCAL;
++    const int dl_mode = RTLD_NOW | RTLD_GLOBAL;
+     void *vsscript_lib = NULL;
+ 
+     if (vsscript_path) {

diff --git a/mpv-vapoursynth-soname.patch b/mpv-vapoursynth-soname.patch
new file mode 100644
index 0000000..bca58e9
--- /dev/null
+++ b/mpv-vapoursynth-soname.patch
@@ -0,0 +1,34 @@
+From 3f76586228d6acdd76f912b8f3926beec6a0318a Mon Sep 17 00:00:00 2001
+From: rpm-build <rpm-build>
+Date: Mon, 10 Aug 2026 15:39:32 +0200
+Subject: [PATCH] vf_vapoursynth: dlopen the versioned soname
+
+The unversioned libvsscript.so is the linker name. Distributions ship it in
+their development package, so dlopen()ing it only succeeds where that package
+happens to be installed and the filter fails at first use otherwise. The
+runtime package is the one carrying the soname, so ask for that instead.
+
+The legacy libvapoursynth-script name, kept for VapourSynth R73 and older, is
+split the same way and gets the same treatment.
+---
+ video/filter/vf_vapoursynth.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
+index 79b52db..672aa7a 100644
+--- a/video/filter/vf_vapoursynth.c
++++ b/video/filter/vf_vapoursynth.c
+@@ -49,8 +49,8 @@ static const char *const vsscript_lib_names[] = {
+     "libvsscript.dylib",
+     "libvapoursynth-script.dylib",
+ #else
+-    "libvsscript.so",
+-    "libvapoursynth-script.so",
++    "libvsscript.so.0",
++    "libvapoursynth-script.so.0",
+ #endif
+ };
+ 
+-- 
+2.55.0
+

diff --git a/mpv.spec b/mpv.spec
index e52e8de..d742e3a 100644
--- a/mpv.spec
+++ b/mpv.spec
@@ -37,6 +37,15 @@ Summary:        Movie player playing most video formats and DVDs
 URL:            https://%{name}.io/
 Source0:        https://github.com/%{name}-player/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
 
+# Switch to runtime loading of libvsscript with VapourSynth R74+
+# https://github.com/mpv-player/mpv/commit/75b2ccfeb1ce4ed5a40ac9860fa74f3d1265e13f
+Patch1:         mpv-vapoursynth-r74.patch
+# Fix build with VapourSynth < R74
+# https://github.com/mpv-player/mpv/commit/44a9b03f244f24e0ea443370cf2cfae0da5767f9
+Patch2:         mpv-vapoursynth-rtld-global.patch
+# Load versioned libvsscript.so
+Patch3:         mpv-vapoursynth-soname.patch
+
 BuildRequires:  desktop-file-utils
 BuildRequires:  gcc
 BuildRequires:  libappstream-glib
@@ -82,7 +91,9 @@ BuildRequires:  pkgconfig(openal)
 BuildRequires:  pkgconfig(rubberband)
 BuildRequires:  pkgconfig(sdl2)
 BuildRequires:  pkgconfig(uchardet)
-BuildRequires:  pkgconfig(vapoursynth)
+# Only the headers are used; the library itself is loaded at runtime. The
+# vapoursynth-script module this used to need as well is gone since R79.
+BuildRequires:  pkgconfig(vapoursynth) >= 56
 BuildRequires:  pkgconfig(vulkan)
 BuildRequires:  pkgconfig(wayland-client)
 BuildRequires:  pkgconfig(wayland-cursor)
@@ -105,6 +116,8 @@ BuildRequires:  pkgconfig(xv)
 %endif
 
 Requires:       hicolor-icon-theme
+# Loading VapourSynth at runtime leaves no linkage for RPM to pick up on.
+Requires:       vapoursynth-libs%{?_isa}
 Provides:       mplayer-backend
 Recommends:     (yt-dlp or youtube-dl)
 Suggests:       yt-dlp
@@ -134,6 +147,8 @@ a library and facilitate easy integration into other applications.
 
 %package libs
 Summary: Dynamic library for Mpv frontends
+# Loading VapourSynth at runtime leaves no linkage for RPM to pick up on.
+Requires: vapoursynth-libs%{?_isa}
 Recommends: (yt-dlp or youtube-dl)
 Suggests: yt-dlp
 

                 reply	other threads:[~2026-08-10 13:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178636991390.1.10170555898167627298.rpms-mpv-3bb8c5698f0a@fedoraproject.org \
    --to=negativo17@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox