mpv/player
Kacper Michajłow eab3842d8b cplugin: allow loading mpv_* symbols dynamically
Defining MPV_CPLUGIN_DYNAMIC_SYM during plugin compilation will replace mpv_*
functions with function pointers. Those pointer will be initialized when
loading the plugin.

It is recommended to use this symbol table when targeting Windows. The loader
does not have notion of global symbols. Loading cplugin into mpv process will
not allow this plugin to call any of the symbols that may be available in
other modules. Instead cplugin has to link explicitly to specific PE binary,
libmpv-2.dll/mpv.exe or any other binary that may have linked mpv statically.
This limits portability of cplugin as it would need to be compiled separately
for each of target PE binary that includes mpv's symbols. Which in practice
is unrealictis, as we want one cplugin to be loaded without those restrictions.

Instead of linking to any PE binary, we create function pointer for all mpv's
exported symbols. For convinience names of entrypoints are redefined to those
pointer so no changes are required in cplugin source code, except defining
MPV_CPLUGIN_DYNAMIC_SYM. Those function pointer are exported to make them
available for mpv to init with correct values during runtime, before calling
`mpv_open_cplugin`.

Note that those pointer are decorated with `selectany` attribute, so no need
to worry about multiple definitions, linker will keep only single instance.

This fixes cplugin usability on Windows. Without any API changes, only
recompilation with -DMPV_CPLUGIN_DYNAMIC_SYM is needed.
2023-09-20 02:16:45 +00:00
..
javascript build: remove outdated generated directory 2023-07-31 19:00:06 +00:00
lua osc: add scrolling to audio/sub buttons 2023-09-17 00:03:45 +02:00
audio.c audio: drain ao before setting pause 2023-08-11 22:28:50 +00:00
client.c
client.h
command.c demux: add crop to mp_codec_params 2023-09-17 16:48:42 +00:00
command.h
configfiles.c player: always write redirect entries for resuming playback 2023-08-28 18:31:17 +00:00
core.h player: remove auto choice from sub-forced-only 2023-08-29 16:39:00 +00:00
external_files.c player: make all autoload extensions configurable 2023-08-26 00:33:00 +00:00
external_files.h player: make all autoload extensions configurable 2023-08-26 00:33:00 +00:00
javascript.c build: remove outdated generated directory 2023-07-31 19:00:06 +00:00
loadfile.c player: redo --subs-fallback-forced 2023-09-09 02:48:53 +00:00
lua.c build: remove outdated generated directory 2023-07-31 19:00:06 +00:00
main.c player/main: do not print build time, if it is unknown 2023-08-02 18:51:13 +00:00
meson.build build: remove outdated generated directory 2023-07-31 19:00:06 +00:00
misc.c
osd.c player: add --term-remaining-playtime option 2023-08-13 19:58:20 +00:00
playloop.c player: use audio pts corresponding to playing audio on EOF 2023-08-25 22:38:25 +00:00
screenshot.c screenshot: support crop with --screenshot-sw 2023-09-09 00:49:19 +00:00
screenshot.h
scripting.c cplugin: allow loading mpv_* symbols dynamically 2023-09-20 02:16:45 +00:00
sub.c sub: fix switching tracks while paused 2023-08-11 22:28:50 +00:00
video.c player/video: apply crop for all frames in vo_frame 2023-09-09 00:49:19 +00:00