From d759e26fd0622a3ab1e322a22a9f784cfb9c661d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sat, 6 Jul 2024 13:32:28 +0200 Subject: [PATCH] libmpv: use correct header directory name libmpv headers are installed to `mpv/`, so why are we pretending it is `libmpv`? Fixes documentation, libmpv meson dependency, tests. --- DOCS/compatibility.rst | 2 +- DOCS/man/libmpv.rst | 4 ++-- DOCS/mplayer-changes.rst | 4 ++-- DOCS/tech-overview.txt | 2 +- common/msg.c | 2 +- common/stats.c | 2 +- fuzzers/common.h | 2 +- fuzzers/meson.build | 14 +++++--------- input/cmd.c | 2 +- input/input.c | 2 +- input/ipc-unix.c | 2 +- input/ipc-win.c | 2 +- input/ipc.c | 2 +- meson.build | 8 ++++---- misc/json.c | 2 +- misc/node.c | 2 +- {libmpv => mpv}/client.h | 0 {libmpv => mpv}/render.h | 0 {libmpv => mpv}/render_gl.h | 0 {libmpv => mpv}/stream_cb.h | 0 options/m_config_frontend.c | 2 +- options/m_option.c | 2 +- options/m_property.c | 2 +- osdep/mac/app_bridge_objc.h | 2 +- player/client.h | 2 +- player/command.h | 2 +- player/javascript.c | 2 +- player/lua.c | 2 +- player/scripting.c | 6 +++--- stream/stream_cb.c | 2 +- test/json.c | 2 +- test/libmpv_common.h | 2 +- test/libmpv_encode.c | 2 +- test/libmpv_lifetime.c | 2 +- test/meson.build | 9 ++++----- test/samples/meson.build | 2 +- video/out/gpu/libmpv_gpu.c | 2 +- video/out/hwdec/hwdec_drmprime.c | 2 +- video/out/hwdec/hwdec_drmprime_overlay.c | 2 +- video/out/hwdec/hwdec_vaapi.c | 2 +- video/out/libmpv.h | 2 +- video/out/libmpv_sw.c | 2 +- video/out/opengl/context_drm_egl.c | 2 +- video/out/opengl/libmpv_gl.c | 2 +- video/out/vulkan/context_display.c | 2 +- video/out/win32/menu.c | 2 +- 46 files changed, 56 insertions(+), 61 deletions(-) rename {libmpv => mpv}/client.h (100%) rename {libmpv => mpv}/render.h (100%) rename {libmpv => mpv}/render_gl.h (100%) rename {libmpv => mpv}/stream_cb.h (100%) diff --git a/DOCS/compatibility.rst b/DOCS/compatibility.rst index 9befbbb2a6..a79ca0997c 100644 --- a/DOCS/compatibility.rst +++ b/DOCS/compatibility.rst @@ -153,7 +153,7 @@ command-interface. libmpv C API ------------ -The libmpv client API (such as ````) mostly gives access to +The libmpv client API (such as ````) mostly gives access to the command interface. The API itself (if looked at as a component separate from the command interface) is intended to be extremely stable. diff --git a/DOCS/man/libmpv.rst b/DOCS/man/libmpv.rst index e00f8b9050..37f12798db 100644 --- a/DOCS/man/libmpv.rst +++ b/DOCS/man/libmpv.rst @@ -2,14 +2,14 @@ EMBEDDING INTO OTHER PROGRAMS (LIBMPV) ====================================== mpv can be embedded into other programs as video/audio playback backend. The -recommended way to do so is using libmpv. See ``libmpv/client.h`` in the mpv +recommended way to do so is using libmpv. See ``mpv/client.h`` in the mpv source code repository. This provides a C API. Bindings for other languages might be available (see wiki). Since libmpv merely allows access to underlying mechanisms that can control mpv, further documentation is spread over a few places: -- https://github.com/mpv-player/mpv/blob/master/libmpv/client.h +- https://github.com/mpv-player/mpv/blob/master/mpv/client.h - https://mpv.io/manual/master/#options - https://mpv.io/manual/master/#list-of-input-commands - https://mpv.io/manual/master/#properties diff --git a/DOCS/mplayer-changes.rst b/DOCS/mplayer-changes.rst index 35bf501607..e3276bbcc5 100644 --- a/DOCS/mplayer-changes.rst +++ b/DOCS/mplayer-changes.rst @@ -37,7 +37,7 @@ Player * ``--keep-open`` option to stop the player from closing the window and exiting after playback ends. * A client API, that allows embedding **mpv** into applications - (see ``libmpv/client.h`` in the sources). + (see ``mpv/client.h`` in the sources). Input ~~~~~ @@ -410,7 +410,7 @@ Slave mode `JSON IPC`_ for more information. * **mpv** also provides a client API, which can be used to embed the player - by loading it as shared library. (See ``libmpv/client.h`` in the sources.) + by loading it as shared library. (See ``mpv/client.h`` in the sources.) It might also be possible to implement a custom slave mode-like protocol using Lua scripting. diff --git a/DOCS/tech-overview.txt b/DOCS/tech-overview.txt index a55dbf4dee..ca4c648004 100644 --- a/DOCS/tech-overview.txt +++ b/DOCS/tech-overview.txt @@ -93,7 +93,7 @@ player/core.h: usually not accessed by other parts of mpv for the sake of modularization. player/client.c: - This implements the client API (libmpv/client.h). For the most part, this + This implements the client API (mpv/client.h). For the most part, this just calls into other parts of the player. This also manages a ringbuffer of events from player to clients. diff --git a/common/msg.c b/common/msg.c index ef949a8dfc..b44b63e389 100644 --- a/common/msg.c +++ b/common/msg.c @@ -35,7 +35,7 @@ #include "osdep/threads.h" #include "osdep/timer.h" -#include "libmpv/client.h" +#include "mpv/client.h" #include "msg.h" #include "msg_control.h" diff --git a/common/stats.c b/common/stats.c index 3bf662d766..473089c0c1 100644 --- a/common/stats.c +++ b/common/stats.c @@ -1,7 +1,7 @@ #include #include -#include +#include #include "common.h" #include "global.h" diff --git a/fuzzers/common.h b/fuzzers/common.h index 90328d04f0..e7c29966a4 100644 --- a/fuzzers/common.h +++ b/fuzzers/common.h @@ -23,7 +23,7 @@ #include #include -#include +#include int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); diff --git a/fuzzers/meson.build b/fuzzers/meson.build index 2b9c1731be..3a2b3631eb 100644 --- a/fuzzers/meson.build +++ b/fuzzers/meson.build @@ -5,7 +5,7 @@ add_languages('cpp', native: false) fuzzers = [] fuzzers += executable('fuzzer_loadfile_direct', 'fuzzer_loadfile_direct.c', - link_language: 'cpp', include_directories: incdir, link_with: libmpv) + link_language: 'cpp', dependencies: libmpv_dep) protocols = ['edl', 'file', 'lavf', 'memory'] demuxers = ['mkv'] @@ -34,8 +34,7 @@ foreach p : protocols 'fuzzer_loadfile_direct.c', link_language: 'cpp', c_args: ['-DMPV_PROTO=' + p, '-DMPV_PROTO_' + p.to_upper()], - include_directories: incdir, - link_with: libmpv) + dependencies: libmpv_dep) endforeach foreach demuxer : demuxers @@ -47,8 +46,7 @@ foreach demuxer : demuxers link_language: 'cpp', c_args: ['-DMPV_LOAD="' + cmd + '"', '-DMPV_LOAD' + cmd_.to_upper(), '-DMPV_DEMUXER="' + demuxer + '"', '-DMPV_DEMUXER' + demuxer_.to_upper()], - include_directories: incdir, - link_with: libmpv) + dependencies: libmpv_dep) endforeach foreach f : ['MPV_FORMAT_STRING', 'MPV_FORMAT_FLAG', 'MPV_FORMAT_INT64', 'MPV_FORMAT_DOUBLE'] @@ -57,8 +55,7 @@ foreach f : ['MPV_FORMAT_STRING', 'MPV_FORMAT_FLAG', 'MPV_FORMAT_INT64', 'MPV_FO 'fuzzer_set_property.c', link_language: 'cpp', c_args: ['-DMPV_FORMAT=' + f, '-DMPV_RUN=' + i], - include_directories: incdir, - link_with: libmpv) + dependencies: libmpv_dep) endforeach endforeach @@ -67,8 +64,7 @@ foreach cmd : ['file', '-config-file', '-input-conf'] 'fuzzer_load.c', link_language: 'cpp', c_args: ['-DMPV_LOAD="' + cmd + '"', '-DMPV_LOAD' + cmd.underscorify().to_upper()], - include_directories: incdir, - link_with: libmpv) + dependencies: libmpv_dep) endforeach fuzzers += executable('fuzzer_options_parser', 'fuzzer_options_parser.c', diff --git a/input/cmd.c b/input/cmd.c index 5831edc5e0..498c767b6d 100644 --- a/input/cmd.c +++ b/input/cmd.c @@ -27,7 +27,7 @@ #include "input.h" #include "misc/json.h" -#include "libmpv/client.h" +#include "mpv/client.h" static void destroy_cmd(void *ptr) { diff --git a/input/input.c b/input/input.c index 49fa7dbf63..65e6944bae 100644 --- a/input/input.c +++ b/input/input.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include "osdep/io.h" #include "misc/rendezvous.h" diff --git a/input/ipc-unix.c b/input/ipc-unix.c index 11468e48bd..3eab683506 100644 --- a/input/ipc-unix.c +++ b/input/ipc-unix.c @@ -32,7 +32,7 @@ #include "common/global.h" #include "common/msg.h" #include "input/input.h" -#include "libmpv/client.h" +#include "mpv/client.h" #include "options/m_config.h" #include "options/options.h" #include "options/path.h" diff --git a/input/ipc-win.c b/input/ipc-win.c index b7e54669ab..9e0883c81e 100644 --- a/input/ipc-win.c +++ b/input/ipc-win.c @@ -26,7 +26,7 @@ #include "common/global.h" #include "common/msg.h" #include "input/input.h" -#include "libmpv/client.h" +#include "mpv/client.h" #include "options/m_config.h" #include "options/options.h" #include "player/client.h" diff --git a/input/ipc.c b/input/ipc.c index d1347f586e..9a3633a17a 100644 --- a/input/ipc.c +++ b/input/ipc.c @@ -15,7 +15,7 @@ * License along with mpv. If not, see . */ -#include +#include #include "common/msg.h" #include "input/input.h" diff --git a/meson.build b/meson.build index 06324ef1a8..57b9c5bccf 100644 --- a/meson.build +++ b/meson.build @@ -1755,7 +1755,7 @@ if win32 endif -client_h_define = cc.get_define('MPV_CLIENT_API_VERSION', prefix: '#include "libmpv/client.h"', +client_h_define = cc.get_define('MPV_CLIENT_API_VERSION', prefix: '#include "mpv/client.h"', include_directories: include_directories('.')) major = client_h_define.split('|')[0].split('<<')[0].strip('() ') minor = client_h_define.split('|')[1].strip('() ') @@ -1772,12 +1772,12 @@ if get_option('libmpv') pkg.generate(libmpv, version: client_api_version, description: 'mpv media player client library') - headers = ['libmpv/client.h', 'libmpv/render.h', - 'libmpv/render_gl.h', 'libmpv/stream_cb.h'] + headers = ['mpv/client.h', 'mpv/render.h', + 'mpv/render_gl.h', 'mpv/stream_cb.h'] install_headers(headers, subdir: 'mpv') # Allow projects to build with libmpv by cloning into ./subprojects/mpv - libmpv_dep = declare_dependency(link_with: libmpv) + libmpv_dep = declare_dependency(include_directories: '.', link_with: libmpv) meson.override_dependency('mpv', libmpv_dep) endif diff --git a/misc/json.c b/misc/json.c index 71587004ca..9e7894c7e3 100644 --- a/misc/json.c +++ b/misc/json.c @@ -48,7 +48,7 @@ #include #include -#include +#include #include "common/common.h" #include "misc/bstr.h" diff --git a/misc/node.c b/misc/node.c index 52183381b3..8915e2038a 100644 --- a/misc/node.c +++ b/misc/node.c @@ -1,6 +1,6 @@ #include "node.h" -#include +#include #include "common/common.h" #include "bstr.h" diff --git a/libmpv/client.h b/mpv/client.h similarity index 100% rename from libmpv/client.h rename to mpv/client.h diff --git a/libmpv/render.h b/mpv/render.h similarity index 100% rename from libmpv/render.h rename to mpv/render.h diff --git a/libmpv/render_gl.h b/mpv/render_gl.h similarity index 100% rename from libmpv/render_gl.h rename to mpv/render_gl.h diff --git a/libmpv/stream_cb.h b/mpv/stream_cb.h similarity index 100% rename from libmpv/stream_cb.h rename to mpv/stream_cb.h diff --git a/options/m_config_frontend.c b/options/m_config_frontend.c index 134afa2e80..3fb29a20f7 100644 --- a/options/m_config_frontend.c +++ b/options/m_config_frontend.c @@ -24,7 +24,7 @@ #include #include -#include "libmpv/client.h" +#include "mpv/client.h" #include "common/common.h" #include "common/msg_control.h" diff --git a/options/m_option.c b/options/m_option.c index 4e1b57db07..6771840f09 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -32,7 +32,7 @@ #include -#include "libmpv/client.h" +#include "mpv/client.h" #include "player/client.h" #include "mpv_talloc.h" diff --git a/options/m_property.c b/options/m_property.c index 1e964492d0..85686d8d0a 100644 --- a/options/m_property.c +++ b/options/m_property.c @@ -26,7 +26,7 @@ #include -#include "libmpv/client.h" +#include "mpv/client.h" #include "mpv_talloc.h" #include "m_option.h" diff --git a/osdep/mac/app_bridge_objc.h b/osdep/mac/app_bridge_objc.h index 09ff845471..bcde2caf8a 100644 --- a/osdep/mac/app_bridge_objc.h +++ b/osdep/mac/app_bridge_objc.h @@ -20,7 +20,7 @@ #include "player/client.h" #include "video/out/libmpv.h" -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #include "options/m_config.h" #include "player/core.h" diff --git a/player/client.h b/player/client.h index a46bc451b6..eed1a1cc8a 100644 --- a/player/client.h +++ b/player/client.h @@ -4,7 +4,7 @@ #include #include -#include "libmpv/stream_cb.h" +#include "mpv/stream_cb.h" #include "misc/bstr.h" struct MPContext; diff --git a/player/command.h b/player/command.h index edfedeaf72..cebd56b392 100644 --- a/player/command.h +++ b/player/command.h @@ -20,7 +20,7 @@ #include -#include "libmpv/client.h" +#include "mpv/client.h" #include "osdep/compiler.h" struct MPContext; diff --git a/player/javascript.c b/player/javascript.c index 447890456c..b435c14882 100644 --- a/player/javascript.c +++ b/player/javascript.c @@ -42,7 +42,7 @@ #include "core.h" #include "command.h" #include "client.h" -#include "libmpv/client.h" +#include "mpv/client.h" // List of builtin modules and their contents as strings. // All these are generated from player/javascript/*.js diff --git a/player/lua.c b/player/lua.c index 9ccd1f4d44..c8dd5b007f 100644 --- a/player/lua.c +++ b/player/lua.c @@ -47,7 +47,7 @@ #include "core.h" #include "command.h" #include "client.h" -#include "libmpv/client.h" +#include "mpv/client.h" // List of builtin modules and their contents as strings. // All these are generated from player/lua/*.lua diff --git a/player/scripting.c b/player/scripting.c index a33b618056..5af9e1f359 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -35,9 +35,9 @@ #include "misc/bstr.h" #include "core.h" #include "client.h" -#include "libmpv/client.h" -#include "libmpv/render.h" -#include "libmpv/stream_cb.h" +#include "mpv/client.h" +#include "mpv/render.h" +#include "mpv/stream_cb.h" extern const struct mp_scripting mp_scripting_lua; extern const struct mp_scripting mp_scripting_cplugin; diff --git a/stream/stream_cb.c b/stream/stream_cb.c index 70128cb476..27e04a90b7 100644 --- a/stream/stream_cb.c +++ b/stream/stream_cb.c @@ -12,7 +12,7 @@ #include "options/m_option.h" #include "options/path.h" #include "player/client.h" -#include "libmpv/stream_cb.h" +#include "mpv/stream_cb.h" #include "misc/thread_tools.h" struct priv { diff --git a/test/json.c b/test/json.c index 3ee1b9d8b5..38a1a11eb7 100644 --- a/test/json.c +++ b/test/json.c @@ -1,4 +1,4 @@ -#include +#include #include "misc/json.h" #include "misc/node.h" diff --git a/test/libmpv_common.h b/test/libmpv_common.h index bfc86204e9..eb525f986d 100644 --- a/test/libmpv_common.h +++ b/test/libmpv_common.h @@ -22,7 +22,7 @@ #include #include -#include +#include // Stolen from osdep/compiler.h #ifdef __GNUC__ diff --git a/test/libmpv_encode.c b/test/libmpv_encode.c index b44f7d8d47..8a15a5ef34 100644 --- a/test/libmpv_encode.c +++ b/test/libmpv_encode.c @@ -28,7 +28,7 @@ #include #endif -#include +#include // Stolen from osdep/compiler.h #ifdef __GNUC__ diff --git a/test/libmpv_lifetime.c b/test/libmpv_lifetime.c index 67fc5dc429..3cc42771ea 100644 --- a/test/libmpv_lifetime.c +++ b/test/libmpv_lifetime.c @@ -3,7 +3,7 @@ #include #include -#include +#include // detect enabled ASAN on gcc & clang #ifndef __SANITIZE_ADDRESS__ diff --git a/test/meson.build b/test/meson.build index 763e77c7d0..3eeaaa0b6f 100644 --- a/test/meson.build +++ b/test/meson.build @@ -119,15 +119,15 @@ if get_option('libmpv') file = join_paths(source_root, 'etc', 'mpv-icon-8bit-16x16.png') exe = executable('libmpv-test-file-loading', 'libmpv_test_file_loading.c', - include_directories: incdir, link_with: libmpv) + dependencies: libmpv_dep) test('libmpv-test-file-loading', exe, args: file, suite: 'libmpv') exe = executable('libmpv-test-lavfi-complex', 'libmpv_test_lavfi_complex.c', - include_directories: incdir, link_with: libmpv) + dependencies: libmpv_dep) test('libmpv-test-lavfi-complex', exe, args: file, suite: 'libmpv') exe = executable('libmpv-test-options', 'libmpv_test_options.c', - include_directories: incdir, link_with: libmpv) + dependencies: libmpv_dep) test('libmpv-test-options', exe, suite: 'libmpv') # Old versions of ffmpeg are bugged when setting forced tracks and older @@ -139,8 +139,7 @@ if get_option('libmpv') endif endif - exe = executable('libmpv-encode', 'libmpv_encode.c', - include_directories: incdir, link_with: libmpv) + exe = executable('libmpv-encode', 'libmpv_encode.c', dependencies: libmpv_dep) test('libmpv-encode', exe, suite: 'libmpv') mpvlib = libmpv diff --git a/test/samples/meson.build b/test/samples/meson.build index 3842c22c52..642a26dcaa 100644 --- a/test/samples/meson.build +++ b/test/samples/meson.build @@ -65,7 +65,7 @@ foreach name, cmd: samples env = name == 'locale.mkv' ? 'LANG=C' : [] testname = 'libmpv-test-' + name exe = executable(testname, '../libmpv_test_track_selection.c', - include_directories: incdir, link_with: libmpv) + dependencies: libmpv_dep) test(testname, exe, args: [name, target.full_path()], depends: target, env: env, suite: 'libmpv') endforeach diff --git a/video/out/gpu/libmpv_gpu.c b/video/out/gpu/libmpv_gpu.c index e43e66b481..6c812f90b3 100644 --- a/video/out/gpu/libmpv_gpu.c +++ b/video/out/gpu/libmpv_gpu.c @@ -1,7 +1,7 @@ #include "config.h" #include "hwdec.h" #include "libmpv_gpu.h" -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #include "video.h" #include "video/out/libmpv.h" diff --git a/video/out/hwdec/hwdec_drmprime.c b/video/out/hwdec/hwdec_drmprime.c index b4f9b9ff89..7869eb124a 100644 --- a/video/out/hwdec/hwdec_drmprime.c +++ b/video/out/hwdec/hwdec_drmprime.c @@ -28,7 +28,7 @@ #include "config.h" -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #include "options/m_config.h" #include "video/fmt-conversion.h" #include "video/out/drm_common.h" diff --git a/video/out/hwdec/hwdec_drmprime_overlay.c b/video/out/hwdec/hwdec_drmprime_overlay.c index 31cf3dd342..61514f8e89 100644 --- a/video/out/hwdec/hwdec_drmprime_overlay.c +++ b/video/out/hwdec/hwdec_drmprime_overlay.c @@ -29,7 +29,7 @@ #include "video/hwdec.h" #include "common/msg.h" #include "options/m_config.h" -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #include "video/out/drm_atomic.h" #include "video/out/drm_common.h" #include "video/out/drm_prime.h" diff --git a/video/out/hwdec/hwdec_vaapi.c b/video/out/hwdec/hwdec_vaapi.c index 79ffd1c5b5..45ecd53883 100644 --- a/video/out/hwdec/hwdec_vaapi.c +++ b/video/out/hwdec/hwdec_vaapi.c @@ -33,7 +33,7 @@ #include "video/vaapi.h" #if HAVE_VAAPI_DRM -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #endif #if HAVE_VAAPI_X11 diff --git a/video/out/libmpv.h b/video/out/libmpv.h index a697eaf45f..02efefb101 100644 --- a/video/out/libmpv.h +++ b/video/out/libmpv.h @@ -2,7 +2,7 @@ #include #include -#include "libmpv/render.h" +#include "mpv/render.h" #include "vo.h" // Helper for finding a parameter value. It returns the direct pointer to the diff --git a/video/out/libmpv_sw.c b/video/out/libmpv_sw.c index f1b08f055d..0001b40fe8 100644 --- a/video/out/libmpv_sw.c +++ b/video/out/libmpv_sw.c @@ -1,4 +1,4 @@ -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #include "libmpv.h" #include "sub/osd.h" #include "video/sws_utils.h" diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c index ee30ce6d4e..fe5dad222f 100644 --- a/video/out/opengl/context_drm_egl.c +++ b/video/out/opengl/context_drm_egl.c @@ -28,7 +28,7 @@ #include #include -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #include "common/common.h" #include "osdep/timer.h" #include "video/out/drm_atomic.h" diff --git a/video/out/opengl/libmpv_gl.c b/video/out/opengl/libmpv_gl.c index c297c138bb..4714d5fe04 100644 --- a/video/out/opengl/libmpv_gl.c +++ b/video/out/opengl/libmpv_gl.c @@ -2,7 +2,7 @@ #include "context.h" #include "ra_gl.h" #include "options/m_config.h" -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #include "video/out/gpu/libmpv_gpu.h" #include "video/out/gpu/ra.h" diff --git a/video/out/vulkan/context_display.c b/video/out/vulkan/context_display.c index b58eb005bc..d4ebaddaa0 100644 --- a/video/out/vulkan/context_display.c +++ b/video/out/vulkan/context_display.c @@ -26,7 +26,7 @@ #include #include -#include "libmpv/render_gl.h" +#include "mpv/render_gl.h" #include "video/out/drm_common.h" #endif diff --git a/video/out/win32/menu.c b/video/out/win32/menu.c index 11c2729fe0..bbbcafe53c 100644 --- a/video/out/win32/menu.c +++ b/video/out/win32/menu.c @@ -18,7 +18,7 @@ #include #include -#include "libmpv/client.h" +#include "mpv/client.h" #include "osdep/io.h" #include "mpv_talloc.h"