From: Paul B Mahol <onemda@gmail.com>
To: FFmpeg development discussions and patches
<ffmpeg-devel@ffmpeg.org>,
Stefan Oltmanns <stefan-oltmanns@gmx.net>
Subject: Re: [FFmpeg-devel] [PATCH] libavformat/vapoursynth: Update to API version 4, load library at runtime
Date: Tue, 25 Jun 2024 11:17:59 +0200
Message-ID: <CAPYw7P5VTeWGLQr0kmgAo+WgvArj1qO3d51sbsYWnVQ+cvj_TQ@mail.gmail.com> (raw)
In-Reply-To: <171930662207.21847.17158610043019227483@lain.khirnov.net>
On Tue, Jun 25, 2024 at 11:10 AM Anton Khirnov <anton@khirnov.net> wrote:
> Quoting Stefan Oltmanns via ffmpeg-devel (2024-06-22 03:37:03)
> > Hello,
> >
> > this is my first patch, I hope I got all the formalities correct.
> >
> > The current VapourSynth implementation is rarely used, as it links the
> > VapourSynth library at build time, making the resulting build unable to
> > run when VapourSynth is not installed. Therefore barely anyone compiles
> > with VapourSynth activated.
> >
> > I changed it, so that it loads the library at runtime when a VapourSynth
> > script should be opened, just like AviSynth does.
> > On Windows the DLL from VapourSynth is not installed in the system
> > directory, but the location is stored in the Registry. Therefore I added
> > some code to read that information from the registry.
> >
> > As the V4 API is designed with dynamic loading in mind (only a single
> > import), I updated the implementation to V4 (changes are mostly
> > superficial, no structural changes). The V4 API is already several years
> > old, fully supported since R55 released in 2021.
> >
> > I copied the two needed header files directly in a vapoursynth.h,
> > removing the need to install VapourSynth on the build machine
> > (VapourSynth is also LGPL 2.1 or later, so no license issue). I updated
> > the configure so that it checks for the ability to load libraries at
> > runtime for VapourSynth, just like AviSynth and activate it if not
> disabled.
> >
> > make fate runs without any issue. I tested VapourSynth input scripts
> > with various color formats on different platforms:
> >
> > Ubuntu 22.04
> > macOS 13 (x86_64)
> > macOS 13 (arm64)
> > Windows 10 (msys2/gcc)
> >
> > It compiles on these platforms without any warning and runs without any
> > issues.
>
> Sorry, this is entirely unacceptable.
> Especially the part instaling atexit handlers and bundling downstream
> headers, but overall we prefer to avoid dlopen.
>
Dunno what 'we' means here.
$ grep dlopen */*.c
libavcodec/amfenc.c: ctx->library = dlopen(AMF_DLL_NAMEA, RTLD_NOW |
RTLD_LOCAL);
libavcodec/mediacodec_wrapper.c: format->libmedia =
dlopen("libmediandk.so", RTLD_NOW);
libavcodec/mediacodec_wrapper.c: codec->libmedia = dlopen(lib_name,
RTLD_NOW);
libavcodec/mfenc.c: c->library = dlopen("mfplat.dll", 0);
libavcodec/omx.c: s->lib2 = dlopen(libname2, RTLD_NOW | RTLD_GLOBAL);
libavcodec/omx.c: s->lib = dlopen(libname, RTLD_NOW | RTLD_GLOBAL);
libavfilter/af_ladspa.c: ret = dlopen(path, RTLD_LOCAL|RTLD_NOW);
libavfilter/af_ladspa.c: s->dl_handle = dlopen(s->dl_name,
RTLD_LOCAL|RTLD_NOW);
libavfilter/vf_frei0r.c: *handle_ptr = dlopen(path, RTLD_NOW|RTLD_LOCAL);
libavfilter/vf_telecine.c: * @file telecine filter, heavily based from
mpv-player:TOOLS/vf_dlopen/telecine.c by
libavfilter/vsrc_ddagrab.c: user32_module = dlopen("user32.dll", 0);
libavformat/avisynth.c: avs_library.library = dlopen(AVISYNTH_LIB,
RTLD_NOW | RTLD_LOCAL);
libavutil/hwcontext_d3d11va.c: d3dlib = dlopen("d3d11.dll", 0);
libavutil/hwcontext_d3d11va.c: dxgilib = dlopen("dxgi.dll", 0);
libavutil/hwcontext_d3d12va.c: priv->d3d12lib = dlopen("d3d12.dll", 0);
libavutil/hwcontext_d3d12va.c: priv->dxgilib = dlopen("dxgi.dll", 0);
libavutil/hwcontext_dxva2.c: priv->d3dlib = dlopen("d3d9.dll", 0);
libavutil/hwcontext_dxva2.c: priv->dxva2lib = dlopen("dxva2.dll", 0);
libavutil/hwcontext_mediacodec.c: s->libmedia = dlopen("libmediandk.so",
RTLD_NOW);
libavutil/hwcontext_vaapi.c: HANDLE dxgi = dlopen("dxgi.dll", 0);
libavutil/hwcontext_vulkan.c: p->libvulkan = dlopen(lib_names[i],
RTLD_NOW | RTLD_LOCAL);
libavutil/macos_kperf.c: av_assert0(kperf =
dlopen("/System/Library/PrivateFrameworks/kperf.framework/Versions/A/kperf",
RTLD_LAZY));
>
> --
> Anton Khirnov
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2024-06-25 9:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-22 1:37 Stefan Oltmanns via ffmpeg-devel
2024-06-22 6:27 ` Stephen Hutchinson
2024-06-22 10:02 ` Stefan Oltmanns via ffmpeg-devel
2024-06-22 18:23 ` Stephen Hutchinson
2024-06-22 19:22 ` Stefan Oltmanns via ffmpeg-devel
2024-06-25 9:10 ` Anton Khirnov
2024-06-25 9:17 ` Paul B Mahol [this message]
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=CAPYw7P5VTeWGLQr0kmgAo+WgvArj1qO3d51sbsYWnVQ+cvj_TQ@mail.gmail.com \
--to=onemda@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=stefan-oltmanns@gmx.net \
/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
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git