logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 0e01791187d5a8d1e00eff3f90ba4dd09b7e6535
parent 569b21ba94f76e8d419fbc8375daef73cdb43583
Author: Michael Forney <mforney@mforney.org>
Date:   Tue,  6 Sep 2022 23:31:52 -0700

mpv: Update to 0.34.1

Diffstat:

Mpkg/mpv/config.h28++++++++--------------------
Mpkg/mpv/gen.lua42++++++++++++++++++++++++------------------
Mpkg/mpv/gensources.awk8++++----
Mpkg/mpv/patch/0001-Add-generated-ebml-sources.patch24++++++++++++------------
Mpkg/mpv/patch/0002-Use-memset-to-initialize-large-structures.patch10+++++-----
Mpkg/mpv/patch/0003-video-out-gpu-Prevent-empty-array-when-no-compilers-.patch55+++++++++++++++++++++++++++++++++----------------------
Apkg/mpv/patch/0004-ao_sndio-add-this-audio-output-again.patch413+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dpkg/mpv/patch/0004-ytdl_hook.lua-search-for-yt-dlp-by-default.patch106-------------------------------------------------------------------------------
Apkg/mpv/patch/0005-ao_sndio-bugfix-and-small-refactoring-for-8314.patch199+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/mpv/patch/0006-wayland-include-math.h-for-ceil.patch24++++++++++++++++++++++++
Apkg/mpv/patch/0007-wayland-actually-handle-0x0-resizes-correctly.patch39+++++++++++++++++++++++++++++++++++++++
Mpkg/mpv/sources.txt37++++++++++++++++++++++---------------
Mpkg/mpv/ver2+-
13 files changed, 784 insertions(+), 203 deletions(-)

diff --git a/pkg/mpv/config.h b/pkg/mpv/config.h @@ -20,6 +20,7 @@ #define HAVE_LIBDL 1 #define HAVE_CPLUGINS 0 #define HAVE_ASM 1 +#define HAVE_VECTOR 1 #define HAVE_CLANG_DATABASE 0 #define HAVE_SWIFT_STATIC 0 #define HAVE_NOEXECSTACK 0 @@ -35,35 +36,26 @@ #define HAVE_WIN32_DESKTOP 0 #define HAVE_WIN32_INTERNAL_PTHREADS 0 #define HAVE_PTHREADS 1 -#define HAVE_GNUC 1 +#define HAVE_PTHREAD_DEBUG 0 #define HAVE_STDATOMIC 1 -#define HAVE_ALIGNED_ALLOC 1 -#define HAVE_ATOMICS 1 #define HAVE_LIBRT 1 #define HAVE_ICONV 1 #define HAVE_DOS_PATHS 0 -#define HAVE_POSIX_SPAWN_NATIVE 1 -#define HAVE_POSIX_SPAWN_ANDROID 0 -#define HAVE_POSIX_SPAWN 1 -#define HAVE_WIN32_PIPES 0 #define HAVE_GLOB_POSIX 1 #define HAVE_GLOB_WIN32 0 #define HAVE_GLOB 1 -#define HAVE_FCHMOD 1 #define HAVE_VT_H 1 +#define HAVE_CONSIO_H 0 #define HAVE_GBM_H 0 #define HAVE_GLIBC_THREAD_NAME 1 #define HAVE_OSX_THREAD_NAME 0 #define HAVE_BSD_THREAD_NAME 0 #define HAVE_BSD_FSTATFS 0 #define HAVE_LINUX_FSTATFS 1 -#define HAVE_MEMFD_CREATE 1 -#define HAVE_LIBSMBCLIENT 0 +#define HAVE_LINUX_INPUT_EVENT_CODES 1 #define HAVE_LUA 1 #define HAVE_JAVASCRIPT 0 #define HAVE_LIBASS 1 -#define HAVE_LIBASS_OSD 1 -#define HAVE_DUMMY_OSD 0 #define HAVE_ZLIB 1 #define HAVE_LIBBLURAY 0 #define HAVE_DVDNAV 0 @@ -77,16 +69,11 @@ #define HAVE_DVBIN 0 #define HAVE_SDL2 0 #define HAVE_SDL2_GAMEPAD 0 -#define HAVE_LIBAVCODEC 1 -#define HAVE_LIBAVUTIL 1 #define HAVE_FFMPEG 1 -#define HAVE_LIBAV 0 -#define HAVE_LIBAV_ANY 1 #define HAVE_LIBAVDEVICE 1 -#define HAVE_FFMPEG_STRICT_ABI 0 +#define HAVE_FFMPEG_AVIOCONTEXT_BYTES_READ 1 #define HAVE_SDL2_AUDIO 0 #define HAVE_OSS_AUDIO 0 -#define HAVE_RSOUND 0 #define HAVE_SNDIO 0 #define HAVE_PULSE 0 #define HAVE_JACK 0 @@ -99,15 +86,16 @@ #define HAVE_SDL2_VIDEO 0 #define HAVE_COCOA 0 #define HAVE_DRM 1 -#define HAVE_DRMPRIME 0 #define HAVE_GBM 0 #define HAVE_WAYLAND_SCANNER 1 #define HAVE_WAYLAND_PROTOCOLS 1 #define HAVE_WAYLAND 1 +#define HAVE_MEMFD_CREATE 1 #define HAVE_X11 0 #define HAVE_XV 0 #define HAVE_GL_COCOA 0 #define HAVE_GL_X11 0 +#define HAVE_RPI 0 #define HAVE_EGL 0 #define HAVE_EGL_X11 0 #define HAVE_EGL_DRM 0 @@ -135,7 +123,6 @@ #define HAVE_SPIRV_CROSS_STATIC 0 #define HAVE_SPIRV_CROSS 0 #define HAVE_D3D11 0 -#define HAVE_RPI 0 #define HAVE_IOS_GL 0 #define HAVE_PLAIN_GL 0 #define HAVE_GL 0 @@ -143,6 +130,7 @@ #define HAVE_VULKAN 0 #define HAVE_VAAPI_VULKAN 0 #define HAVE_EGL_HELPERS 0 +#define HAVE_SIXEL 0 #define HAVE_VIDEOTOOLBOX_HWACCEL 0 #define HAVE_VIDEOTOOLBOX_GL 0 #define HAVE_D3D_HWACCEL 0 diff --git a/pkg/mpv/gen.lua b/pkg/mpv/gen.lua @@ -1,4 +1,4 @@ -build('awk', '$outdir/version.h', {'$srcdir/VERSION', '|', '$dir/version.awk'}, { +build('awk', '$outdir/generated/version.h', {'$srcdir/VERSION', '|', '$dir/version.awk'}, { expr='-f $dir/version.awk', }) @@ -30,29 +30,35 @@ local libs = { 'zlib/libz.a', } pkg.deps = { - '$outdir/version.h', + '$outdir/generated/version.h', 'pkg/ffmpeg/headers', 'pkg/ffmpeg/fetch', 'pkg/linux-headers/headers', 'pkg/zlib/headers', } -build('copy', '$outdir/video/out/wayland/idle-inhibit-v1.h', '$builddir/pkg/wayland-protocols/include/idle-inhibit-unstable-v1-client-protocol.h') -build('copy', '$outdir/video/out/wayland/presentation-time.h', '$builddir/pkg/wayland-protocols/include/presentation-time-client-protocol.h') -build('copy', '$outdir/video/out/wayland/xdg-decoration-v1.h', '$builddir/pkg/wayland-protocols/include/xdg-decoration-unstable-v1-client-protocol.h') -build('copy', '$outdir/video/out/wayland/xdg-shell.h', '$builddir/pkg/wayland-protocols/include/xdg-shell-client-protocol.h') +build('copy', '$outdir/generated/wayland/idle-inhibit-unstable-v1.h', '$builddir/pkg/wayland-protocols/include/idle-inhibit-unstable-v1-client-protocol.h') +build('copy', '$outdir/generated/wayland/presentation-time.h', '$builddir/pkg/wayland-protocols/include/presentation-time-client-protocol.h') +build('copy', '$outdir/generated/wayland/xdg-decoration-unstable-v1.h', '$builddir/pkg/wayland-protocols/include/xdg-decoration-unstable-v1-client-protocol.h') +build('copy', '$outdir/generated/wayland/xdg-shell.h', '$builddir/pkg/wayland-protocols/include/xdg-shell-client-protocol.h') rule('file2string', '$outdir/file2string $in >$out') -local function file2string(out, inp) - build('file2string', '$outdir/'..out, {'$srcdir/'..inp, '|', '$outdir/file2string'}) - table.insert(pkg.deps, '$outdir/'..out) +local function file2string(src) + local out = '$outdir/generated/'..src..'.inc' + build('file2string', out, {'$srcdir/'..src, '|', '$outdir/file2string'}) + table.insert(pkg.deps, out) end -file2string('input/input_conf.h', 'etc/input.conf') -file2string('player/builtin_conf.inc', 'etc/builtin.conf') -file2string('sub/osd_font.h', 'sub/osd_font.otf') -for _, f in ipairs{'defaults', 'assdraw', 'options', 'osc', 'ytdl_hook', 'stats', 'console'} do - file2string('player/lua/'..f..'.inc', 'player/lua/'..f..'.lua') +file2string('etc/input.conf') +file2string('etc/builtin.conf') +file2string('sub/osd_font.otf') +local lua = { + 'defaults.lua', 'assdraw.lua', 'options.lua', 'osc.lua', + 'ytdl_hook.lua', 'stats.lua', 'console.lua', + 'auto_profiles.lua', +} +for _, f in ipairs(lua) do + file2string('player/lua/'..f) end local options = {} @@ -160,10 +166,10 @@ if options.HAVE_WAYLAND then 'libxkbcommon/libxkbcommon.a', }) table.insert(pkg.deps, { - '$outdir/video/out/wayland/idle-inhibit-v1.h', - '$outdir/video/out/wayland/presentation-time.h', - '$outdir/video/out/wayland/xdg-decoration-v1.h', - '$outdir/video/out/wayland/xdg-shell.h', + '$outdir/generated/wayland/idle-inhibit-unstable-v1.h', + '$outdir/generated/wayland/presentation-time.h', + '$outdir/generated/wayland/xdg-decoration-unstable-v1.h', + '$outdir/generated/wayland/xdg-shell.h', 'pkg/libxkbcommon/headers', 'pkg/wayland/headers', }) diff --git a/pkg/mpv/gensources.awk b/pkg/mpv/gensources.awk @@ -2,10 +2,10 @@ BEGIN { FS = "\"" - external["video/out/wayland/idle-inhibit-v1.c"] = "$builddir/pkg/wayland-protocols/idle-inhibit-unstable-v1-protocol.c.o" - external["video/out/wayland/presentation-time.c"] = "$builddir/pkg/wayland-protocols/presentation-time-protocol.c.o" - external["video/out/wayland/xdg-decoration-v1.c"] = "$builddir/pkg/wayland-protocols/xdg-decoration-unstable-v1-protocol.c.o" - external["video/out/wayland/xdg-shell.c"] = "$builddir/pkg/wayland-protocols/xdg-shell-protocol.c.o" + external["generated/wayland/idle-inhibit-unstable-v1.c"] = "$builddir/pkg/wayland-protocols/idle-inhibit-unstable-v1-protocol.c.o" + external["generated/wayland/presentation-time.c"] = "$builddir/pkg/wayland-protocols/presentation-time-protocol.c.o" + external["generated/wayland/xdg-decoration-unstable-v1.c"] = "$builddir/pkg/wayland-protocols/xdg-decoration-unstable-v1-protocol.c.o" + external["generated/wayland/xdg-shell.c"] = "$builddir/pkg/wayland-protocols/xdg-shell-protocol.c.o" } /sources = \[/ { insources = 1 } diff --git a/pkg/mpv/patch/0001-Add-generated-ebml-sources.patch b/pkg/mpv/patch/0001-Add-generated-ebml-sources.patch @@ -1,24 +1,24 @@ -From 4769ec9ec67b9f0b9d2afa0d0a0d1775877414e1 Mon Sep 17 00:00:00 2001 +From d1e11f91a28e4095ae11af36e9ed6d4bdadf6c3f Mon Sep 17 00:00:00 2001 From: Michael Forney <mforney@mforney.org> Date: Sat, 2 Jul 2016 17:32:27 -0700 Subject: [PATCH] Add generated ebml sources These require python to generate. -$ python TOOLS/matroska.py --generate-header > demux/ebml_types.h -$ python TOOLS/matroska.py --generate-definitions > demux/ebml_defs.c +$ python TOOLS/matroska.py --generate-header > demux/generated/ebml_types.h +$ python TOOLS/matroska.py --generate-definitions > demux/generated/ebml_defs.c --- - demux/ebml_defs.c | 574 ++++++++++++++++++++++++++++++++++++++++ - demux/ebml_types.h | 637 +++++++++++++++++++++++++++++++++++++++++++++ + demux/generated/ebml_defs.c | 574 +++++++++++++++++++++++++++++++ + demux/generated/ebml_types.h | 637 +++++++++++++++++++++++++++++++++++ 2 files changed, 1211 insertions(+) - create mode 100644 demux/ebml_defs.c - create mode 100644 demux/ebml_types.h + create mode 100644 demux/generated/ebml_defs.c + create mode 100644 demux/generated/ebml_types.h -diff --git a/demux/ebml_defs.c b/demux/ebml_defs.c +diff --git a/demux/generated/ebml_defs.c b/demux/generated/ebml_defs.c new file mode 100644 index 0000000000..db4eb9c2a7 --- /dev/null -+++ b/demux/ebml_defs.c ++++ b/demux/generated/ebml_defs.c @@ -0,0 +1,574 @@ +// Generated by TOOLS/matroska.py, do not edit manually + @@ -594,11 +594,11 @@ index 0000000000..db4eb9c2a7 +F(EBML_ID_DOCTYPEREADVERSION, doc_type_read_version, 0) +}}; +#undef N -diff --git a/demux/ebml_types.h b/demux/ebml_types.h +diff --git a/demux/generated/ebml_types.h b/demux/generated/ebml_types.h new file mode 100644 index 0000000000..d32af2d6c1 --- /dev/null -+++ b/demux/ebml_types.h ++++ b/demux/generated/ebml_types.h @@ -0,0 +1,637 @@ +// Generated by TOOLS/matroska.py, do not edit manually + @@ -1238,5 +1238,5 @@ index 0000000000..d32af2d6c1 + +#define MAX_EBML_SUBELEMENTS 23 -- -2.18.0 +2.35.1 diff --git a/pkg/mpv/patch/0002-Use-memset-to-initialize-large-structures.patch b/pkg/mpv/patch/0002-Use-memset-to-initialize-large-structures.patch @@ -1,4 +1,4 @@ -From c9c69a95d8724efdcd634d352234382e5c7dbd30 Mon Sep 17 00:00:00 2001 +From 5c6190de25762e04b4ee2b265760fd5b8afd115e Mon Sep 17 00:00:00 2001 From: Michael Forney <mforney@mforney.org> Date: Tue, 2 Jul 2019 17:41:43 -0700 Subject: [PATCH] Use memset to initialize large structures @@ -9,10 +9,10 @@ These are over 256 KiB in size. 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c -index 88a8557cc2..1264769a9a 100644 +index e4c4ee9290..0e15837d5e 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c -@@ -3496,7 +3496,7 @@ static void frame_perf_data(struct pass_info pass[], struct mp_frame_perf *out) +@@ -3514,7 +3514,7 @@ static void frame_perf_data(struct pass_info pass[], struct mp_frame_perf *out) void gl_video_perfdata(struct gl_video *p, struct voctrl_performance_data *out) { @@ -21,7 +21,7 @@ index 88a8557cc2..1264769a9a 100644 frame_perf_data(p->pass_fresh, &out->fresh); frame_perf_data(p->pass_redraw, &out->redraw); } -@@ -3927,14 +3927,13 @@ struct gl_video *gl_video_init(struct ra *ra, struct mp_log *log, +@@ -3955,14 +3955,13 @@ struct gl_video *gl_video_init(struct ra *ra, struct mp_log *log, struct mpv_global *g) { struct gl_video *p = talloc_ptrtype(NULL, p); @@ -44,5 +44,5 @@ index 88a8557cc2..1264769a9a 100644 p->pass = p->pass_fresh; struct gl_video_opts *opts = p->opts_cache->opts; -- -2.25.0 +2.35.1 diff --git a/pkg/mpv/patch/0003-video-out-gpu-Prevent-empty-array-when-no-compilers-.patch b/pkg/mpv/patch/0003-video-out-gpu-Prevent-empty-array-when-no-compilers-.patch @@ -1,28 +1,37 @@ -From 30a85ce789cd15dedd7abd60ed36f74212068a31 Mon Sep 17 00:00:00 2001 +From 25a7c939446a456b258e889013a1f3136199f09b Mon Sep 17 00:00:00 2001 From: Michael Forney <mforney@mforney.org> Date: Wed, 3 Jul 2019 02:21:16 -0700 Subject: [PATCH] video/out/gpu: Prevent empty array when no compilers or contexts are enabled --- - video/out/gpu/context.c | 9 +++++---- - video/out/gpu/spirv.c | 1 + - 2 files changed, 6 insertions(+), 4 deletions(-) + video/out/gpu/context.c | 11 ++++++----- + video/out/gpu/spirv.c | 1 + + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/video/out/gpu/context.c b/video/out/gpu/context.c -index 9561b534d8..f73d0674be 100644 +index 6e58cce485..0e68c45b91 100644 --- a/video/out/gpu/context.c +++ b/video/out/gpu/context.c -@@ -108,6 +108,7 @@ static const struct ra_ctx_fns *contexts[] = { - #endif +@@ -110,6 +110,7 @@ static const struct ra_ctx_fns *contexts[] = { + &ra_ctx_vulkan_display, #endif + NULL }; - int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt, -@@ -122,7 +123,7 @@ int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt, - } + int ra_ctx_api_help(struct mp_log *log, const struct m_option *opt, +@@ -117,7 +118,7 @@ int ra_ctx_api_help(struct mp_log *log, const struct m_option *opt, + { + mp_info(log, "GPU APIs (contexts):\n"); + mp_info(log, " auto (autodetect)\n"); +- for (int n = 0; n < MP_ARRAY_SIZE(contexts); n++) ++ for (int n = 0; n < MP_ARRAY_SIZE(contexts) - 1; n++) + mp_info(log, " %s (%s)\n", contexts[n]->type, contexts[n]->name); + return M_OPT_EXIT; + } +@@ -128,7 +129,7 @@ int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt, + struct bstr param = bstr0(*value); if (bstr_equals0(param, "auto")) return 1; - for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) { @@ -30,15 +39,17 @@ index 9561b534d8..f73d0674be 100644 if (bstr_equals0(param, contexts[i]->type)) return 1; } -@@ -135,13 +136,13 @@ int ra_ctx_validate_context(struct mp_log *log, const struct m_option *opt, - if (bstr_equals0(param, "help")) { - mp_info(log, "GPU contexts (APIs):\n"); - mp_info(log, " auto (autodetect)\n"); -- for (int n = 0; n < MP_ARRAY_SIZE(contexts); n++) -+ for (int n = 0; n < MP_ARRAY_SIZE(contexts) - 1; n++) - mp_info(log, " %s (%s)\n", contexts[n]->name, contexts[n]->type); - return M_OPT_EXIT; - } +@@ -140,7 +141,7 @@ int ra_ctx_context_help(struct mp_log *log, const struct m_option *opt, + { + mp_info(log, "GPU contexts (APIs):\n"); + mp_info(log, " auto (autodetect)\n"); +- for (int n = 0; n < MP_ARRAY_SIZE(contexts); n++) ++ for (int n = 0; n < MP_ARRAY_SIZE(contexts) - 1; n++) + mp_info(log, " %s (%s)\n", contexts[n]->name, contexts[n]->type); + return M_OPT_EXIT; + } +@@ -151,7 +152,7 @@ int ra_ctx_validate_context(struct mp_log *log, const struct m_option *opt, + struct bstr param = bstr0(*value); if (bstr_equals0(param, "auto")) return 1; - for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) { @@ -46,7 +57,7 @@ index 9561b534d8..f73d0674be 100644 if (bstr_equals0(param, contexts[i]->name)) return 1; } -@@ -166,7 +167,7 @@ struct ra_ctx *ra_ctx_create(struct vo *vo, const char *context_type, +@@ -176,7 +177,7 @@ struct ra_ctx *ra_ctx_create(struct vo *vo, const char *context_type, bool old_probing = vo->probing; vo->probing = opts.probing; @@ -56,7 +67,7 @@ index 9561b534d8..f73d0674be 100644 continue; if (!api_auto && strcmp(contexts[i]->type, context_type) != 0) diff --git a/video/out/gpu/spirv.c b/video/out/gpu/spirv.c -index ee11d601a3..87596ba5e3 100644 +index 67088bc7df..69100497eb 100644 --- a/video/out/gpu/spirv.c +++ b/video/out/gpu/spirv.c @@ -16,6 +16,7 @@ static const struct spirv_compiler_fns *compilers[] = { @@ -68,5 +79,5 @@ index ee11d601a3..87596ba5e3 100644 static const struct m_opt_choice_alternatives compiler_choices[] = { -- -2.23.0 +2.35.1 diff --git a/pkg/mpv/patch/0004-ao_sndio-add-this-audio-output-again.patch b/pkg/mpv/patch/0004-ao_sndio-add-this-audio-output-again.patch @@ -0,0 +1,413 @@ +From eb7c5d6fc8de657776c736458f426beb274b5523 Mon Sep 17 00:00:00 2001 +From: rim <rozhuk.im@gmail.com> +Date: Wed, 25 Nov 2020 06:10:19 +0300 +Subject: [PATCH] ao_sndio: add this audio output again + +Changes: +- rewrite to use new internal MPV API; +- code refactoring; +- fix buffers size calculations; +- buffer set to auto; +- reset() - clean/reinit device only after errors; +--- + DOCS/man/ao.rst | 6 + + audio/out/ao.c | 4 + + audio/out/ao_sndio.c | 317 +++++++++++++++++++++++++++++++++++++++++++ + wscript | 6 + + wscript_build.py | 1 + + 5 files changed, 334 insertions(+) + create mode 100644 audio/out/ao_sndio.c + +diff --git a/DOCS/man/ao.rst b/DOCS/man/ao.rst +index 1c0b9e146b..97c213a5dd 100644 +--- a/DOCS/man/ao.rst ++++ b/DOCS/man/ao.rst +@@ -219,5 +219,11 @@ Available audio output drivers are: + ``no-waveheader`` option - with ``waveheader`` it's broken, because + it will write a WAVE header every time the file is opened. + ++``sndio`` ++ Audio output to the OpenBSD sndio sound system ++ ++ (Note: only supports mono, stereo, 4.0, 5.1 and 7.1 channel ++ layouts.) ++ + ``wasapi`` + Audio output to the Windows Audio Session API. +diff --git a/audio/out/ao.c b/audio/out/ao.c +index 7c347cb138..950f935c81 100644 +--- a/audio/out/ao.c ++++ b/audio/out/ao.c +@@ -41,6 +41,7 @@ extern const struct ao_driver audio_out_audiounit; + extern const struct ao_driver audio_out_coreaudio; + extern const struct ao_driver audio_out_coreaudio_exclusive; + extern const struct ao_driver audio_out_rsound; ++extern const struct ao_driver audio_out_sndio; + extern const struct ao_driver audio_out_pulse; + extern const struct ao_driver audio_out_jack; + extern const struct ao_driver audio_out_openal; +@@ -87,6 +88,9 @@ static const struct ao_driver * const audio_out_drivers[] = { + #endif + #if HAVE_SDL2_AUDIO + &audio_out_sdl, ++#endif ++#if HAVE_SNDIO ++ &audio_out_sndio, + #endif + &audio_out_null, + #if HAVE_COREAUDIO +diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c +new file mode 100644 +index 0000000000..4a6f49ee58 +--- /dev/null ++++ b/audio/out/ao_sndio.c +@@ -0,0 +1,317 @@ ++/* ++ * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> ++ * Copyright (c) 2013 Christian Neukirchen <chneukirchen@gmail.com> ++ * Copyright (c) 2020 Rozhuk Ivan <rozhuk.im@gmail.com> ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ */ ++ ++#include "config.h" ++ ++#include <sys/types.h> ++#include <poll.h> ++#include <errno.h> ++#include <sndio.h> ++ ++#include "options/m_option.h" ++#include "common/msg.h" ++ ++#include "audio/format.h" ++#include "ao.h" ++#include "internal.h" ++ ++struct priv { ++ struct sio_hdl *hdl; ++ struct sio_par par; ++ int delay; ++ bool playing; ++ int vol; ++ int havevol; ++ struct pollfd *pfd; ++}; ++ ++ ++static const struct mp_chmap sndio_layouts[MP_NUM_CHANNELS + 1] = { ++ {0}, /* empty */ ++ {1, {MP_SPEAKER_ID_FL}}, /* mono */ ++ MP_CHMAP2(FL, FR), /* stereo */ ++ {0}, /* 2.1 */ ++ MP_CHMAP4(FL, FR, BL, BR), /* 4.0 */ ++ {0}, /* 5.0 */ ++ MP_CHMAP6(FL, FR, BL, BR, FC, LFE), /* 5.1 */ ++ {0}, /* 6.1 */ ++ MP_CHMAP8(FL, FR, BL, BR, FC, LFE, SL, SR), /* 7.1 */ ++ /* Above is the fixed channel assignment for sndio, since we need to ++ * fill all channels and cannot insert silence, not all layouts are ++ * supported. ++ * NOTE: MP_SPEAKER_ID_NA could be used to add padding channels. */ ++}; ++ ++static void uninit(struct ao *ao); ++ ++ ++/* Make libsndio call movecb(). */ ++static void process_events(struct ao *ao) ++{ ++ struct priv *p = ao->priv; ++ ++ if (!p->playing) ++ return; ++ int n = sio_pollfd(p->hdl, p->pfd, POLLOUT); ++ while (poll(p->pfd, n, 0) < 0 && errno == EINTR) {} ++ ++ sio_revents(p->hdl, p->pfd); ++} ++ ++/* Call-back invoked to notify of the hardware position. */ ++static void movecb(void *addr, int delta) ++{ ++ struct ao *ao = addr; ++ struct priv *p = ao->priv; ++ ++ p->delay -= delta; ++} ++ ++/* Call-back invoked to notify about volume changes. */ ++static void volcb(void *addr, unsigned newvol) ++{ ++ struct ao *ao = addr; ++ struct priv *p = ao->priv; ++ ++ p->vol = newvol; ++} ++ ++static int init(struct ao *ao) ++{ ++ struct priv *p = ao->priv; ++ struct mp_chmap_sel sel = {0}; ++ size_t i; ++ struct af_to_par { ++ int format, bits, sig; ++ }; ++ static const struct af_to_par af_to_par[] = { ++ {AF_FORMAT_U8, 8, 0}, ++ {AF_FORMAT_S16, 16, 1}, ++ {AF_FORMAT_S32, 32, 1}, ++ }; ++ const struct af_to_par *ap; ++ const char *device = ((ao->device) ? ao->device : SIO_DEVANY); ++ ++ /* Opening device. */ ++ MP_VERBOSE(ao, "Using '%s' audio device.\n", device); ++ p->hdl = sio_open(device, SIO_PLAY, 0); ++ if (p->hdl == NULL) { ++ MP_ERR(ao, "Can't open audio device %s.\n", device); ++ goto err_out; ++ } ++ ++ sio_initpar(&p->par); ++ ++ /* Selecting sound format. */ ++ ao->format = af_fmt_from_planar(ao->format); ++ for (i = 0, ap = af_to_par;; i++, ap++) { ++ if (i == MP_ARRAY_SIZE(af_to_par)) { ++ MP_VERBOSE(ao, "unsupported format\n"); ++ p->par.bits = 16; ++ p->par.sig = 1; ++ p->par.le = SIO_LE_NATIVE; ++ break; ++ } ++ if (ap->format == ao->format) { ++ p->par.bits = ap->bits; ++ p->par.sig = ap->sig; ++ if (ap->bits > 8) ++ p->par.le = SIO_LE_NATIVE; ++ if (ap->bits != SIO_BPS(ap->bits)) ++ p->par.bps = ap->bits / 8; ++ break; ++ } ++ } ++ ++ p->par.rate = ao->samplerate; ++ ++ /* Channels count. */ ++ for (i = 0; i < MP_ARRAY_SIZE(sndio_layouts); i++) { ++ mp_chmap_sel_add_map(&sel, &sndio_layouts[i]); ++ } ++ if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels)) ++ goto err_out; ++ ++ p->par.pchan = ao->channels.num; ++#ifdef __FreeBSD__ ++ /* OSS wrapper have bad defaults, overwrite it. */ ++ p->par.appbufsz = ((p->par.rate * 25) / 1000); /* 25 ms. */ ++#endif ++ if (!sio_setpar(p->hdl, &p->par)) { ++ MP_ERR(ao, "couldn't set params\n"); ++ goto err_out; ++ } ++ ++ /* Get current sound params. */ ++ if (!sio_getpar(p->hdl, &p->par)) { ++ MP_ERR(ao, "couldn't get params\n"); ++ goto err_out; ++ } ++ if (p->par.bps > 1 && p->par.le != SIO_LE_NATIVE) { ++ MP_ERR(ao, "swapped endian output not supported\n"); ++ goto err_out; ++ } ++ ++ /* Update sound params. */ ++ if (p->par.bits == 8 && p->par.bps == 1 && !p->par.sig) { ++ ao->format = AF_FORMAT_U8; ++ } else if (p->par.bits == 16 && p->par.bps == 2 && p->par.sig) { ++ ao->format = AF_FORMAT_S16; ++ } else if ((p->par.bits == 32 || p->par.msb) && p->par.bps == 4 && p->par.sig) { ++ ao->format = AF_FORMAT_S32; ++ } else { ++ MP_ERR(ao, "couldn't set format\n"); ++ goto err_out; ++ } ++ ++ p->havevol = sio_onvol(p->hdl, volcb, ao); ++ sio_onmove(p->hdl, movecb, ao); ++ ++ p->pfd = calloc(sio_nfds(p->hdl), sizeof(struct pollfd)); ++ if (!p->pfd) ++ goto err_out; ++ ++ ao->device_buffer = p->par.bufsz; ++ MP_VERBOSE(ao, "bufsz = %i, appbufsz = %i, round = %i\n", ++ p->par.bufsz, p->par.appbufsz, p->par.round); ++ ++ p->delay = 0; ++ p->playing = false; ++ if (!sio_start(p->hdl)) { ++ MP_ERR(ao, "start: sio_start() fail.\n"); ++ goto err_out; ++ } ++ ++ return 0; ++ ++err_out: ++ uninit(ao); ++ return -1; ++} ++ ++static void uninit(struct ao *ao) ++{ ++ struct priv *p = ao->priv; ++ ++ if (p->hdl) { ++ sio_close(p->hdl); ++ p->hdl = NULL; ++ } ++ free(p->pfd); ++ p->pfd = NULL; ++ p->playing = false; ++} ++ ++static int control(struct ao *ao, enum aocontrol cmd, void *arg) ++{ ++ struct priv *p = ao->priv; ++ ao_control_vol_t *vol = arg; ++ ++ switch (cmd) { ++ case AOCONTROL_GET_VOLUME: ++ if (!p->havevol) ++ return CONTROL_FALSE; ++ vol->left = vol->right = p->vol * 100 / SIO_MAXVOL; ++ break; ++ case AOCONTROL_SET_VOLUME: ++ if (!p->havevol) ++ return CONTROL_FALSE; ++ sio_setvol(p->hdl, vol->left * SIO_MAXVOL / 100); ++ break; ++ default: ++ return CONTROL_UNKNOWN; ++ } ++ return CONTROL_OK; ++} ++ ++static void reset(struct ao *ao) ++{ ++ struct priv *p = ao->priv; ++ ++ process_events(ao); ++ p->delay = 0; ++ p->playing = false; ++ ++ /* XXX: some times may block here then sndiod used. */ ++ if (!sio_stop(p->hdl)) { ++ MP_ERR(ao, "reset: couldn't sio_stop()\n"); ++reinit: ++ /* Without this device will never work again. */ ++ MP_WARN(ao, "Force reinitialize audio device.\n"); ++ uninit(ao); ++ init(ao); ++ return; ++ } ++ if (!sio_start(p->hdl)) { ++ MP_ERR(ao, "reset: sio_start() fail.\n"); ++ goto reinit; ++ } ++} ++ ++static void start(struct ao *ao) ++{ ++ struct priv *p = ao->priv; ++ ++ p->playing = true; ++ process_events(ao); ++} ++ ++static bool audio_write(struct ao *ao, void **data, int samples) ++{ ++ struct priv *p = ao->priv; ++ const size_t size = (samples * ao->sstride); ++ size_t rc; ++ ++ rc = sio_write(p->hdl, data[0], size); ++ if (rc != size) { ++ MP_WARN(ao, "audio_write: unexpected partial write: required: %zu, written: %zu.\n", ++ size, rc); ++ reset(ao); ++ p->playing = false; ++ return false; ++ } ++ p->delay += samples; ++ process_events(ao); ++ ++ return true; ++} ++ ++static void get_state(struct ao *ao, struct mp_pcm_state *state) ++{ ++ struct priv *p = ao->priv; ++ ++ process_events(ao); ++ ++ state->free_samples = (ao->device_buffer - p->delay); ++ state->queued_samples = p->delay; ++ state->delay = (p->delay / (double)p->par.rate); ++ state->playing = p->playing; ++} ++ ++const struct ao_driver audio_out_sndio = { ++ .name = "sndio", ++ .description = "sndio audio output", ++ .init = init, ++ .uninit = uninit, ++ .control = control, ++ .reset = reset, ++ .start = start, ++ .write = audio_write, ++ .get_state = get_state, ++ .priv_size = sizeof(struct priv), ++}; +diff --git a/wscript b/wscript +index b44adc2ad4..eeb38f127f 100644 +--- a/wscript ++++ b/wscript +@@ -434,6 +434,12 @@ audio_output_features = [ + 'desc': 'OSSv4 audio output', + 'func': check_statement(['sys/soundcard.h'], 'int x = SNDCTL_DSP_SETPLAYVOL'), + 'deps': 'posix && gpl', ++ }, { ++ 'name': '--sndio', ++ 'desc': 'sndio audio input/output', ++ 'func': check_statement('sndio.h', ++ 'struct sio_par par; sio_initpar(&par); const char *s = SIO_DEVANY', lib='sndio'), ++ 'default': 'disable' + }, { + 'name': '--pulse', + 'desc': 'PulseAudio audio output', +diff --git a/wscript_build.py b/wscript_build.py +index 384bb50d2e..8244dbe3d3 100644 +--- a/wscript_build.py ++++ b/wscript_build.py +@@ -248,6 +248,7 @@ def build(ctx): + ( "audio/out/ao_pcm.c" ), + ( "audio/out/ao_pulse.c", "pulse" ), + ( "audio/out/ao_sdl.c", "sdl2-audio" ), ++ ( "audio/out/ao_sndio.c", "sndio" ), + ( "audio/out/ao_wasapi.c", "wasapi" ), + ( "audio/out/ao_wasapi_changenotify.c", "wasapi" ), + ( "audio/out/ao_wasapi_utils.c", "wasapi" ), +-- +2.35.1 + diff --git a/pkg/mpv/patch/0004-ytdl_hook.lua-search-for-yt-dlp-by-default.patch b/pkg/mpv/patch/0004-ytdl_hook.lua-search-for-yt-dlp-by-default.patch @@ -1,106 +0,0 @@ -From 050f86d1aafff0059d7254f356275fa33e123d60 Mon Sep 17 00:00:00 2001 -From: Guido Cella <guido@guidocella.xyz> -Date: Fri, 17 Sep 2021 09:37:09 +0200 -Subject: [PATCH] ytdl_hook.lua: search for yt-dlp by default - -Because youtube-dl is inactive and the yt-dlp fork is becoming more -popular, make mpv use yt-dlp without any extra configuration. - -yt-dlp is ordered before youtube-dl because it's more obscure, so users -who have yt-dlp installed are more likely to want to use it rather than -youtube-dl. - -Fixes #9208. ---- - player/lua/ytdl_hook.lua | 53 +++++++++++++++++++++++++++++----------- - 1 file changed, 39 insertions(+), 14 deletions(-) - -diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua -index 7e77eb01ba..8d841f24d5 100644 ---- a/player/lua/ytdl_hook.lua -+++ b/player/lua/ytdl_hook.lua -@@ -10,7 +10,8 @@ local o = { - options.read_options(o) - - local ytdl = { -- path = "youtube-dl", -+ path = "", -+ paths_to_search = {"yt-dlp", "yt-dlp_x86", "youtube-dl"}, - searched = false, - blacklisted = {} - } -@@ -29,7 +30,13 @@ local safe_protos = Set { - "data" - } - -+local function platform_is_windows() -+ return package.config:sub(1,1) == "\\" -+end -+ - local function exec(args) -+ msg.debug("Running: " .. table.concat(args, " ")) -+ - local ret = mp.command_native({name = "subprocess", - args = args, - capture_stdout = true, -@@ -472,17 +479,6 @@ end - function run_ytdl_hook(url) - local start_time = os.clock() - -- -- check for youtube-dl in mpv's config dir -- if not (ytdl.searched) then -- local exesuf = (package.config:sub(1,1) == '\\') and '.exe' or '' -- local ytdl_mcd = mp.find_config_file("youtube-dl" .. exesuf) -- if not (ytdl_mcd == nil) then -- msg.verbose("found youtube-dl at: " .. ytdl_mcd) -- ytdl.path = ytdl_mcd -- end -- ytdl.searched = true -- end -- - -- strip ytdl:// - if (url:find("ytdl://") == 1) then - url = url:sub(8) -@@ -534,8 +530,37 @@ function run_ytdl_hook(url) - end - table.insert(command, "--") - table.insert(command, url) -- msg.debug("Running: " .. table.concat(command,' ')) -- local es, json, result, aborted = exec(command) -+ -+ local es, json, result, aborted -+ if ytdl.searched then -+ es, json, result, aborted = exec(command) -+ else -+ for _, path in pairs(ytdl.paths_to_search) do -+ -- search for youtube-dl in mpv's config dir -+ local exesuf = platform_is_windows() and ".exe" or "" -+ local ytdl_cmd = mp.find_config_file(path .. exesuf) -+ if ytdl_cmd then -+ msg.verbose("Found youtube-dl at: " .. ytdl_cmd) -+ ytdl.path = ytdl_cmd -+ command[1] = ytdl.path -+ es, json, result, aborted = exec(command) -+ break -+ else -+ msg.verbose("No youtube-dl found with path " .. path .. exesuf .. " in config directories") -+ command[1] = path -+ es, json, result, aborted = exec(command) -+ if result.error_string == "init" then -+ msg.verbose("youtube-dl with path " .. path .. exesuf .. " not found in PATH or not enough permissions") -+ else -+ msg.verbose("Found youtube-dl with path " .. path .. exesuf .. " in PATH") -+ ytdl.path = path -+ break -+ end -+ end -+ end -+ -+ ytdl.searched = true -+ end - - if aborted then - return --- -2.34.0 - diff --git a/pkg/mpv/patch/0005-ao_sndio-bugfix-and-small-refactoring-for-8314.patch b/pkg/mpv/patch/0005-ao_sndio-bugfix-and-small-refactoring-for-8314.patch @@ -0,0 +1,199 @@ +From d3e06b98678b5cde1330476b92def52df31ed344 Mon Sep 17 00:00:00 2001 +From: Andrew Krasavin <noiseless-ak@yandex.ru> +Date: Tue, 11 Jan 2022 19:23:52 +0300 +Subject: [PATCH] ao_sndio: bugfix and small refactoring for #8314 + +Changes: + * fixed hangups in the loop function and in some other cases + * refactoring according to @michaelforney's recommendations in #8314 + * a few minor and/or cosmetic changes + * ability to build ao_sndio using meson +--- + audio/out/ao_sndio.c | 87 ++++++++++++++++++++++---------------------- + wscript | 3 +- + 2 files changed, 45 insertions(+), 45 deletions(-) + +diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c +index 4a6f49ee58..6dc1d5ca9e 100644 +--- a/audio/out/ao_sndio.c ++++ b/audio/out/ao_sndio.c +@@ -2,6 +2,7 @@ + * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> + * Copyright (c) 2013 Christian Neukirchen <chneukirchen@gmail.com> + * Copyright (c) 2020 Rozhuk Ivan <rozhuk.im@gmail.com> ++ * Copyright (c) 2021 Andrew Krasavin <noiseless-ak@yandex.ru> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above +@@ -41,7 +42,7 @@ struct priv { + }; + + +-static const struct mp_chmap sndio_layouts[MP_NUM_CHANNELS + 1] = { ++static const struct mp_chmap sndio_layouts[] = { + {0}, /* empty */ + {1, {MP_SPEAKER_ID_FL}}, /* mono */ + MP_CHMAP2(FL, FR), /* stereo */ +@@ -64,11 +65,9 @@ static void uninit(struct ao *ao); + static void process_events(struct ao *ao) + { + struct priv *p = ao->priv; +- +- if (!p->playing) +- return; ++ + int n = sio_pollfd(p->hdl, p->pfd, POLLOUT); +- while (poll(p->pfd, n, 0) < 0 && errno == EINTR) {} ++ while (poll(p->pfd, n, 0) < 0 && errno == EINTR); + + sio_revents(p->hdl, p->pfd); + } +@@ -119,21 +118,15 @@ static int init(struct ao *ao) + + /* Selecting sound format. */ + ao->format = af_fmt_from_planar(ao->format); +- for (i = 0, ap = af_to_par;; i++, ap++) { +- if (i == MP_ARRAY_SIZE(af_to_par)) { +- MP_VERBOSE(ao, "unsupported format\n"); +- p->par.bits = 16; +- p->par.sig = 1; +- p->par.le = SIO_LE_NATIVE; +- break; +- } ++ ++ p->par.bits = 16; ++ p->par.sig = 1; ++ p->par.le = SIO_LE_NATIVE; ++ for (i = 0; i < MP_ARRAY_SIZE(af_to_par); i++) { ++ ap = &af_to_par[i]; + if (ap->format == ao->format) { + p->par.bits = ap->bits; + p->par.sig = ap->sig; +- if (ap->bits > 8) +- p->par.le = SIO_LE_NATIVE; +- if (ap->bits != SIO_BPS(ap->bits)) +- p->par.bps = ap->bits / 8; + break; + } + } +@@ -148,10 +141,9 @@ static int init(struct ao *ao) + goto err_out; + + p->par.pchan = ao->channels.num; +-#ifdef __FreeBSD__ +- /* OSS wrapper have bad defaults, overwrite it. */ +- p->par.appbufsz = ((p->par.rate * 25) / 1000); /* 25 ms. */ +-#endif ++ p->par.appbufsz = p->par.rate * 250 / 1000; /* 250ms buffer */ ++ p->par.round = p->par.rate * 10 / 1000; /* 10ms block size */ ++ + if (!sio_setpar(p->hdl, &p->par)) { + MP_ERR(ao, "couldn't set params\n"); + goto err_out; +@@ -182,7 +174,7 @@ static int init(struct ao *ao) + p->havevol = sio_onvol(p->hdl, volcb, ao); + sio_onmove(p->hdl, movecb, ao); + +- p->pfd = calloc(sio_nfds(p->hdl), sizeof(struct pollfd)); ++ p->pfd = talloc_array_ptrtype(p, p->pfd, sio_nfds(p->hdl)); + if (!p->pfd) + goto err_out; + +@@ -212,7 +204,6 @@ static void uninit(struct ao *ao) + sio_close(p->hdl); + p->hdl = NULL; + } +- free(p->pfd); + p->pfd = NULL; + p->playing = false; + } +@@ -243,23 +234,16 @@ static void reset(struct ao *ao) + { + struct priv *p = ao->priv; + +- process_events(ao); +- p->delay = 0; +- p->playing = false; ++ if (p->playing) { ++ p->playing = false; + +- /* XXX: some times may block here then sndiod used. */ +- if (!sio_stop(p->hdl)) { +- MP_ERR(ao, "reset: couldn't sio_stop()\n"); +-reinit: +- /* Without this device will never work again. */ +- MP_WARN(ao, "Force reinitialize audio device.\n"); +- uninit(ao); +- init(ao); +- return; +- } +- if (!sio_start(p->hdl)) { +- MP_ERR(ao, "reset: sio_start() fail.\n"); +- goto reinit; ++ if (!sio_stop(p->hdl)) { ++ MP_ERR(ao, "reset: couldn't sio_stop()\n"); ++ } ++ p->delay = 0; ++ if (!sio_start(p->hdl)) { ++ MP_ERR(ao, "reset: sio_start() fail.\n"); ++ } + } + } + +@@ -286,7 +270,6 @@ static bool audio_write(struct ao *ao, void **data, int samples) + return false; + } + p->delay += samples; +- process_events(ao); + + return true; + } +@@ -297,10 +280,28 @@ static void get_state(struct ao *ao, struct mp_pcm_state *state) + + process_events(ao); + +- state->free_samples = (ao->device_buffer - p->delay); ++ /* how many samples we can play without blocking */ ++ state->free_samples = ao->device_buffer - p->delay; ++ state->free_samples = state->free_samples / p->par.round * p->par.round; ++ /* how many samples are already in the buffer to be played */ + state->queued_samples = p->delay; +- state->delay = (p->delay / (double)p->par.rate); +- state->playing = p->playing; ++ /* delay in seconds between first and last sample in buffer */ ++ state->delay = p->delay / (double)p->par.rate; ++ ++ /* report unexpected EOF / underrun */ ++ if (state->queued_samples && state->queued_samples && ++ state->queued_samples < state->free_samples && ++ p->playing || sio_eof(p->hdl)) ++ { ++ MP_VERBOSE(ao, "get_state: EOF/underrun detected.\n"); ++ MP_VERBOSE(ao, "get_state: free: %d, queued: %d, delay: %lf\n", \ ++ state->free_samples, state->queued_samples, state->delay); ++ p->playing = false; ++ state->playing = p->playing; ++ ao_wakeup_playthread(ao); ++ } else { ++ state->playing = p->playing; ++ } + } + + const struct ao_driver audio_out_sndio = { +diff --git a/wscript b/wscript +index eeb38f127f..1651187b34 100644 +--- a/wscript ++++ b/wscript +@@ -437,8 +437,7 @@ audio_output_features = [ + }, { + 'name': '--sndio', + 'desc': 'sndio audio input/output', +- 'func': check_statement('sndio.h', +- 'struct sio_par par; sio_initpar(&par); const char *s = SIO_DEVANY', lib='sndio'), ++ 'func': check_pkg_config('sndio'), + 'default': 'disable' + }, { + 'name': '--pulse', +-- +2.35.1 + diff --git a/pkg/mpv/patch/0006-wayland-include-math.h-for-ceil.patch b/pkg/mpv/patch/0006-wayland-include-math.h-for-ceil.patch @@ -0,0 +1,24 @@ +From 1c8ae213f7d683c69298f131d424c9006a9650d3 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 21 Jul 2022 14:00:02 -0700 +Subject: [PATCH] wayland: include <math.h> for ceil + +--- + video/out/wayland_common.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c +index 3cebab9e99..4ec5c148e7 100644 +--- a/video/out/wayland_common.c ++++ b/video/out/wayland_common.c +@@ -18,6 +18,7 @@ + #include <errno.h> + #include <limits.h> + #include <linux/input-event-codes.h> ++#include <math.h> + #include <poll.h> + #include <time.h> + #include <unistd.h> +-- +2.35.1 + diff --git a/pkg/mpv/patch/0007-wayland-actually-handle-0x0-resizes-correctly.patch b/pkg/mpv/patch/0007-wayland-actually-handle-0x0-resizes-correctly.patch @@ -0,0 +1,39 @@ +From 386d92e1ac1c22dbed0d2ab0e77ba1038baba966 Mon Sep 17 00:00:00 2001 +From: Dudemanguy <random342@airmail.cc> +Date: Tue, 25 Jan 2022 11:56:37 -0600 +Subject: [PATCH] wayland: actually handle 0x0 resizes correctly + +According to the xdg-shell protocol spec, a 0x0 size from the compositor +means that "the client should decide its own window dimension". We were +not doing this correctly. What should happen is that mpv should simply +reuse the old window size if it is not maximized or fullscreened. This +should work on all (reasonably recent) versions of mutter and an +compositor that follows the spec. + +https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/stable/xdg-shell/xdg-shell.xml#L1050 +--- + video/out/wayland_common.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c +index 4ec5c148e7..61964c46e5 100644 +--- a/video/out/wayland_common.c ++++ b/video/out/wayland_common.c +@@ -856,6 +856,14 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, + } + } + ++ /* Reuse old size if either of these are 0. */ ++ if (width == 0 || height == 0) { ++ if (!is_fullscreen && !is_maximized) { ++ wl->geometry = wl->window_size; ++ } ++ goto resize; ++ } ++ + if (old_toplevel_width == wl->toplevel_width && + old_toplevel_height == wl->toplevel_height) + return; +-- +2.35.1 + diff --git a/pkg/mpv/sources.txt b/pkg/mpv/sources.txt @@ -1,13 +1,15 @@ audio/aframe.c -audio/audio_buffer.c audio/chmap.c audio/chmap_sel.c audio/decode/ad_lavc.c audio/decode/ad_spdif.c +audio/filter/af_drop.c audio/filter/af_format.c audio/filter/af_lavcac3enc.c audio/filter/af_rubberband.c rubberband audio/filter/af_scaletempo.c +audio/filter/af_scaletempo2.c +audio/filter/af_scaletempo2_internals.c audio/fmt-conversion.c audio/format.c audio/out/ao.c @@ -27,14 +29,12 @@ audio/out/ao_opensles.c opensles audio/out/ao_oss.c oss-audio audio/out/ao_pcm.c audio/out/ao_pulse.c pulse -audio/out/ao_rsound.c rsound audio/out/ao_sdl.c sdl2-audio audio/out/ao_sndio.c sndio audio/out/ao_wasapi.c wasapi audio/out/ao_wasapi_changenotify.c wasapi audio/out/ao_wasapi_utils.c wasapi -audio/out/pull.c -audio/out/push.c +audio/out/buffer.c common/av_common.c common/av_log.c common/codecs.c @@ -43,6 +43,7 @@ common/encode_lavc.c common/msg.c common/playlist.c common/recorder.c +common/stats.c common/tags.c common/version.c demux/codec_tags.c @@ -64,6 +65,7 @@ demux/demux_timeline.c demux/ebml.c demux/packet.c demux/timeline.c +filters/f_async_queue.c filters/f_autoconvert.c filters/f_auto_filters.c filters/f_decoder_wrapper.c @@ -82,7 +84,6 @@ input/event.c input/input.c input/ipc.c input/keycodes.c -input/pipe-win32.c win32-pipes input/sdl_gamepad.c sdl2-gamepad misc/bstr.c misc/charset_conv.c @@ -92,10 +93,10 @@ misc/json.c misc/natural_sort.c misc/node.c misc/rendezvous.c -misc/ring.c misc/thread_pool.c misc/thread_tools.c -options/m_config.c +options/m_config_core.c +options/m_config_frontend.c options/m_option.c options/m_property.c options/options.c @@ -126,6 +127,7 @@ stream/stream_bluray.c libbluray stream/stream_cb.c stream/stream_cdda.c cdda stream/stream_concat.c +stream/stream_slice.c stream/stream_dvb.c dvbin stream/stream_dvdnav.c dvdnav stream/stream_edl.c @@ -135,23 +137,25 @@ stream/stream_libarchive.c libarchive stream/stream_memory.c stream/stream_mf.c stream/stream_null.c -stream/stream_smb.c libsmbclient -sub/ass_mp.c libass +sub/ass_mp.c sub/dec_sub.c sub/draw_bmp.c +sub/filter_regex.c posix +sub/filter_jsre.c javascript sub/filter_sdh.c sub/img_convert.c sub/lavc_conv.c sub/osd.c -sub/osd_dummy.c dummy-osd -sub/osd_libass.c libass-osd -sub/sd_ass.c libass +sub/osd_libass.c +sub/sd_ass.c sub/sd_lavc.c test/chmap.c tests test/gl_video.c tests test/img_format.c tests test/json.c tests test/linked_list.c tests +test/paths.c tests +test/repack.c tests && zimg test/scale_sws.c tests test/scale_test.c tests test/scale_zimg.c tests && zimg @@ -191,7 +195,7 @@ video/out/dither.c video/out/dr_helper.c video/out/drm_atomic.c drm video/out/drm_common.c drm -video/out/drm_prime.c drm && drmprime +video/out/drm_prime.c drm video/out/filter_kernels.c video/out/gpu/context.c video/out/gpu/d3d11_helpers.c d3d11 || egl-angle-win32 @@ -214,6 +218,7 @@ video/out/hwdec/hwdec_cuda_vk.c cuda-interop && vulkan video/out/hwdec/hwdec_vaapi.c vaapi-egl || vaapi-vulkan video/out/hwdec/hwdec_vaapi_gl.c vaapi-egl video/out/hwdec/hwdec_vaapi_vk.c vaapi-vulkan +video/out/libmpv_sw.c video/out/placebo/ra_pl.c libplacebo video/out/placebo/utils.c libplacebo video/out/opengl/angle_dynamic.c egl-angle @@ -232,7 +237,7 @@ video/out/opengl/context_x11egl.c egl-x11 video/out/opengl/egl_helpers.c egl-helpers video/out/opengl/formats.c gl video/out/opengl/hwdec_d3d11egl.c d3d-hwaccel && egl-angle -video/out/opengl/hwdec_drmprime_drm.c drmprime && drm +video/out/opengl/hwdec_drmprime_drm.c drm video/out/opengl/hwdec_dxva2egl.c d3d9-hwaccel && egl-angle video/out/opengl/hwdec_dxva2gldx.c gl-dxinterop-d3d9 video/out/opengl/hwdec_ios.m ios-gl @@ -255,6 +260,7 @@ video/out/vo_mediacodec_embed.c android video/out/vo_null.c video/out/vo_rpi.c rpi-mmal video/out/vo_sdl.c sdl2-video +video/out/vo_sixel.c sixel video/out/vo_tct.c video/out/vo_vaapi.c vaapi-x11 && gpl video/out/vo_vdpau.c vdpau @@ -262,6 +268,7 @@ video/out/vo_wlshm.c wayland && memfd_create video/out/vo_x11.c x11 video/out/vo_xv.c xv video/out/vulkan/context.c vulkan +video/out/vulkan/context_display.c vulkan video/out/vulkan/context_android.c vulkan && android video/out/vulkan/context_wayland.c vulkan && wayland video/out/vulkan/context_win.c vulkan && win32-desktop @@ -277,6 +284,7 @@ video/out/win32/displayconfig.c win32-desktop video/out/win32/droptarget.c win32-desktop video/out/win_state.c video/out/x11_common.c x11 +video/repack.c video/sws_utils.c video/zimg.c zimg video/vaapi.c vaapi @@ -286,7 +294,6 @@ osdep/io.c osdep/threads.c osdep/timer.c osdep/polldev.c posix -osdep/android/posix-spawn.c android osdep/android/strnlen.c android osdep/glob-win.c glob-win32 osdep/macosx_application.m cocoa diff --git a/pkg/mpv/ver b/pkg/mpv/ver @@ -1 +1 @@ -0.32.0 r2 +0.34.1 r0