From aabb06ed526439f1fb04e736afc56c41b2d42a88 Mon Sep 17 00:00:00 2001 From: "deepin-community-bot[bot]" <156989552+deepin-community-bot[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 08:18:08 +0000 Subject: [PATCH] feat: update mpv to 0.40.0-5 --- .editorconfig | 8 + .editorconfig-checker.json | 7 + .lsan_suppressions | 1 + .luacheckrc | 109 + .pre-commit-config.yaml | 22 + .swiftlint.yml | 10 + Copyright | 30 +- DOCS/client-api-changes.rst | 10 +- DOCS/compatibility.rst | 26 +- DOCS/compile-windows.md | 430 ++-- DOCS/contribute.md | 12 +- DOCS/interface-changes.rst | 252 +- DOCS/man/af.rst | 7 +- DOCS/man/ao.rst | 24 + DOCS/man/commands.rst | 52 + DOCS/man/console.rst | 138 +- DOCS/man/encode.rst | 2 +- DOCS/man/input.rst | 1890 +++++++++------ DOCS/man/ipc.rst | 6 +- DOCS/man/javascript.rst | 10 +- DOCS/man/libmpv.rst | 4 +- DOCS/man/lua.rst | 140 +- DOCS/man/mpv.rst | 274 ++- DOCS/man/options.rst | 1078 +++++++-- DOCS/man/osc.rst | 313 ++- DOCS/man/positioning.rst | 60 + DOCS/man/select.rst | 144 ++ DOCS/man/stats.rst | 103 +- DOCS/man/vf.rst | 73 +- DOCS/man/vo.rst | 20 +- DOCS/mplayer-changes.rst | 4 +- DOCS/release-policy.md | 53 +- DOCS/tech-overview.txt | 3 +- LICENSE.GPL | 9 +- LICENSE.LGPL | 27 +- MPV_VERSION | 1 + README.md | 21 +- RELEASE_NOTES | 285 +-- TOOLS/docutils-wrapper.py | 14 +- TOOLS/dylib_unhell.py | 229 +- TOOLS/file2string.py | 17 +- TOOLS/gen-interface-changes.py | 33 +- TOOLS/gen-mpv-desktop.py | 50 + TOOLS/lua/acompressor.lua | 229 +- TOOLS/lua/ao-null-reload.lua | 6 +- TOOLS/lua/audio-hotplug-test.lua | 6 +- TOOLS/lua/autocrop.lua | 103 +- TOOLS/lua/autodeint.lua | 75 +- TOOLS/lua/autoload.lua | 261 +- TOOLS/lua/command-test.lua | 27 +- TOOLS/lua/cycle-deinterlace-pullup.lua | 14 +- TOOLS/lua/gamma-auto.lua | 22 + TOOLS/lua/nan-test.lua | 6 +- TOOLS/lua/observe-all.lua | 10 +- TOOLS/lua/ontop-playback.lua | 2 +- TOOLS/lua/osd-test.lua | 2 +- TOOLS/lua/pause-when-minimize.lua | 2 +- TOOLS/lua/skip-logo.lua | 18 +- TOOLS/lua/status-line.lua | 12 +- TOOLS/lua/test-hooks.lua | 6 +- TOOLS/macos-sdk-version.py | 32 +- TOOLS/macos-swift-lib-directory.py | 8 +- TOOLS/matroska.py | 493 ++-- TOOLS/mpv-osd-symbols.sfdir/README.md | 16 + TOOLS/mpv-osd-symbols.sfdir/font.props | 6 +- TOOLS/mpv-osd-symbols.sfdir/uniE00D.glyph | 15 + TOOLS/mpv-osd-symbols.sfdir/uniE102.glyph | 25 + TOOLS/mpv-osd-symbols.sfdir/uniE10A.glyph | 2 +- TOOLS/mpv_identify.sh | 6 +- TOOLS/osxbundle.py | 35 +- TOOLS/osxbundle/meson.build | 6 +- TOOLS/osxbundle/mpv.app/Contents/Info.plist | 628 +++-- TOOLS/stats-conv.py | 165 +- TOOLS/umpv | 116 +- VERSION | 1 - audio/aframe.c | 36 +- audio/chmap.c | 6 +- audio/chmap_avchannel.h | 4 - audio/chmap_sel.c | 4 +- audio/decode/ad_lavc.c | 40 +- audio/decode/ad_spdif.c | 40 +- audio/filter/af_lavcac3enc.c | 52 +- audio/filter/af_rubberband.c | 10 +- audio/filter/af_scaletempo.c | 246 +- audio/filter/af_scaletempo2.c | 41 +- audio/filter/af_scaletempo2_internals.c | 88 +- audio/filter/af_scaletempo2_internals.h | 1 - audio/out/ao.c | 4 +- audio/out/ao_alsa.c | 10 +- audio/out/ao_audiotrack.c | 41 +- audio/out/ao_audiounit.m | 9 +- audio/out/ao_avfoundation.m | 37 +- audio/out/ao_coreaudio.c | 44 +- audio/out/ao_coreaudio_chmap.c | 34 +- audio/out/ao_coreaudio_chmap.h | 8 +- audio/out/ao_coreaudio_exclusive.c | 14 +- audio/out/ao_coreaudio_properties.c | 10 +- audio/out/ao_coreaudio_properties.h | 5 - audio/out/ao_coreaudio_utils.c | 71 +- audio/out/ao_coreaudio_utils.h | 13 +- audio/out/ao_jack.c | 3 +- audio/out/ao_lavc.c | 27 +- audio/out/ao_openal.c | 5 + audio/out/ao_opensles.c | 2 +- audio/out/ao_oss.c | 3 +- audio/out/ao_pcm.c | 11 +- audio/out/ao_pipewire.c | 40 +- audio/out/ao_pulse.c | 47 +- audio/out/ao_sdl.c | 2 +- audio/out/ao_wasapi.c | 61 +- audio/out/ao_wasapi.h | 3 +- audio/out/ao_wasapi_changenotify.c | 7 +- audio/out/ao_wasapi_utils.c | 94 +- audio/out/buffer.c | 80 +- audio/out/internal.h | 8 +- ci/build-common.sh | 6 + ci/build-freebsd.sh | 36 +- ci/build-linux-old.sh | 11 +- ci/build-macos.sh | 16 +- ci/build-mingw64.sh | 50 +- ci/build-msys2.sh | 37 +- ci/build-openbsd.sh | 40 +- ci/build-tumbleweed.sh | 18 +- ci/build-win32.ps1 | 242 ++ ci/lint-commit-msg.py | 155 +- common/av_common.c | 30 +- common/av_common.h | 1 + common/av_log.c | 22 +- common/common.c | 8 +- common/common.h | 34 +- common/encode_lavc.c | 36 +- common/encode_lavc.h | 2 + common/global.h | 1 + common/meson.build | 30 +- common/msg.c | 208 +- common/msg.h | 5 +- common/playlist.c | 81 +- common/playlist.h | 5 + common/recorder.c | 5 +- common/stats.c | 47 +- common/tags.c | 2 +- common/version.h.in | 4 +- debian/changelog | 57 +- debian/control | 37 +- debian/copyright | 14 +- ...mpilation-after-deprecated-definitio.patch | 34 + ...ssing-folders-for-watch-history-path.patch | 27 + ...the-problem-of-the-full-screen-crash.patch | 293 --- debian/patches/fix-mpv.patch | 25 - debian/patches/fix-vaapi-nullpter-crush.patch | 50 - debian/patches/pgv-flower-screen.patch | 109 - debian/patches/series | 7 +- debian/patches/vdpau-render.patch | 385 --- debian/rules | 10 - debian/watch | 8 +- demux/cache.c | 23 +- demux/cue.c | 2 + demux/demux.c | 321 ++- demux/demux.h | 18 +- demux/demux_cue.c | 8 - demux/demux_disc.c | 50 +- demux/demux_edl.c | 19 +- demux/demux_lavf.c | 221 +- demux/demux_libarchive.c | 1 + demux/demux_mf.c | 19 +- demux/demux_mkv.c | 297 ++- demux/demux_mkv_timeline.c | 5 +- demux/demux_mpv.c | 45 + demux/demux_playlist.c | 188 +- demux/demux_raw.c | 5 +- demux/demux_timeline.c | 8 +- demux/ebml.c | 48 +- demux/ebml.h | 3 + demux/packet.c | 95 +- demux/packet.h | 18 +- demux/packet_pool.c | 130 + demux/packet_pool.h | 88 + demux/stheader.h | 23 +- etc/_mpv.zsh | 8 +- etc/builtin.conf | 18 + etc/input.conf | 90 +- etc/meson.build | 8 +- etc/mplayer-input.conf | 12 +- etc/mpv.bash-completion | 2 - etc/mpv.conf | 4 +- etc/mpv.desktop | 6 +- etc/mpv.fish | 95 + etc/powershell-completion.ps1 | 279 +++ etc/restore-old-bindings.conf | 4 +- etc/restore-osc-bindings.conf | 41 + filters/f_async_queue.c | 18 +- filters/f_auto_filters.c | 12 +- filters/f_autoconvert.h | 2 +- filters/f_decoder_wrapper.c | 103 +- filters/f_decoder_wrapper.h | 4 - filters/f_hwtransfer.c | 138 +- filters/f_lavfi.c | 52 +- filters/f_lavfi.h | 2 + filters/f_output_chain.c | 10 +- filters/f_swresample.c | 25 +- filters/f_utils.c | 4 +- filters/filter.c | 108 +- filters/filter.h | 5 +- filters/frame.c | 4 +- filters/user_filters.c | 16 +- fuzzers/common.h | 73 + fuzzers/fuzzer_json.c | 44 + fuzzers/fuzzer_load.c | 94 + fuzzers/fuzzer_loadfile_direct.c | 61 + fuzzers/fuzzer_options_parser.c | 68 + fuzzers/fuzzer_set_property.c | 114 + fuzzers/meson.build | 80 + {libmpv => include/mpv}/client.h | 2 +- {libmpv => include/mpv}/render.h | 1 + {libmpv => include/mpv}/render_gl.h | 0 {libmpv => include/mpv}/stream_cb.h | 0 input/cmd.c | 55 +- input/cmd.h | 13 +- input/input.c | 583 +++-- input/input.h | 17 +- input/ipc-unix.c | 12 +- input/ipc-win.c | 21 +- input/ipc.c | 4 +- input/keycodes.c | 383 +-- input/keycodes.h | 14 +- input/meson.build | 8 +- meson.build | 386 +-- meson_options.txt => meson.options | 20 +- misc/bstr.c | 43 +- misc/bstr.h | 54 +- misc/charset_conv.c | 4 +- misc/codepoint_width.c | 755 ++++++ misc/codepoint_width.h | 14 + misc/dispatch.c | 36 +- misc/io_utils.c | 8 +- misc/json.c | 6 +- misc/json.h | 7 +- misc/language.c | 625 ++--- misc/language.h | 9 +- misc/lavc_compat.h | 66 + misc/mp_assert.h | 57 + misc/natural_sort.c | 4 +- misc/node.c | 32 +- misc/node.h | 14 +- misc/path_utils.c | 92 +- misc/random.c | 16 + misc/random.h | 2 +- misc/thread_pool.c | 12 +- misc/thread_tools.c | 15 +- misc/uuid.c | 141 -- misc/uuid.h | 146 -- options/m_config_core.c | 131 +- options/m_config_core.h | 4 + options/m_config_frontend.c | 77 +- options/m_config_frontend.h | 7 +- options/m_option.c | 386 ++- options/m_option.h | 101 +- options/m_property.c | 26 +- options/m_property.h | 4 + options/options.c | 330 +-- options/options.h | 80 +- options/parse_commandline.c | 9 +- options/parse_configfile.c | 17 +- options/path.c | 22 +- options/path.h | 5 + osdep/android/strnlen.c | 12 +- osdep/compiler.h | 29 +- osdep/dirent-win.h | 1238 ++++++++++ osdep/endian.h | 4 + osdep/io.c | 168 +- osdep/io.h | 20 +- osdep/language-posix.c | 15 +- osdep/mac/app_bridge.h | 54 + osdep/mac/app_bridge.m | 73 +- osdep/mac/app_bridge_objc.h | 37 +- osdep/mac/app_hub.swift | 19 +- osdep/mac/application.swift | 14 +- osdep/mac/clipboard.swift | 76 + osdep/mac/compat.h | 33 + osdep/mac/dialog.swift | 91 + osdep/mac/event_helper.swift | 35 +- osdep/mac/input_helper.swift | 75 +- osdep/mac/libmpv_helper.swift | 24 +- osdep/mac/log_helper.swift | 17 +- osdep/mac/menu_bar.swift | 111 +- osdep/mac/meson.build | 27 +- osdep/mac/option_helper.swift | 28 +- osdep/mac/precise_timer.swift | 8 +- osdep/mac/remote_command_center.swift | 109 +- osdep/mac/swift_compat.swift | 19 +- osdep/mac/swift_extensions.swift | 48 +- osdep/mac/touch_bar.swift | 33 +- osdep/mac/type_helper.swift | 83 +- osdep/main-fn-win.c | 17 +- osdep/mpv.exe.manifest | 1 + osdep/mpv.rc | 2 +- osdep/path-win.c | 9 +- osdep/semaphore-mac.c | 117 - osdep/semaphore.h | 37 - osdep/subprocess-posix.c | 8 +- osdep/subprocess-win.c | 1 + osdep/subprocess.c | 20 +- osdep/subprocess.h | 9 +- osdep/terminal-dummy.c | 5 + osdep/terminal-unix.c | 72 +- osdep/terminal-win.c | 153 +- osdep/terminal.h | 12 +- osdep/threads-posix.h | 17 +- osdep/threads-win32.h | 22 +- osdep/timer-win32.c | 135 +- osdep/timer.c | 8 +- osdep/timer.h | 4 +- osdep/w32_keyboard.c | 6 +- osdep/win32-console-wrapper.c | 50 +- osdep/win32/meson.build | 8 + osdep/win32/smtc.cpp | 543 +++++ osdep/win32/smtc.h | 29 + osdep/windows_utils.c | 6 +- player/audio.c | 83 +- player/client.c | 51 +- player/client.h | 3 +- player/clipboard/clipboard-mac.m | 59 + player/clipboard/clipboard-vo.c | 97 + player/clipboard/clipboard-wayland.c | 464 ++++ player/clipboard/clipboard-win.c | 104 + player/clipboard/clipboard.c | 170 ++ player/clipboard/clipboard.h | 96 + player/command.c | 1228 +++++++--- player/command.h | 11 +- player/configfiles.c | 82 +- player/core.h | 56 +- player/external_files.c | 101 +- player/external_files.h | 2 +- player/javascript.c | 39 +- player/javascript/defaults.js | 63 +- player/javascript/meson.build | 4 +- player/loadfile.c | 409 ++-- player/lua.c | 37 +- player/lua/auto_profiles.lua | 15 +- player/lua/commands.lua | 608 +++++ player/lua/console.lua | 2129 +++++++++-------- player/lua/defaults.lua | 34 +- player/lua/fzy.lua | 297 +++ player/lua/input.lua | 43 +- player/lua/meson.build | 7 +- player/lua/options.lua | 22 +- player/lua/osc.lua | 1818 +++++++------- player/lua/positioning.lua | 157 ++ player/lua/select.lua | 648 +++++ player/lua/stats.lua | 655 +++-- player/lua/ytdl_hook.lua | 162 +- player/main.c | 57 +- player/meson.build | 11 - player/misc.c | 125 +- player/osd.c | 63 +- player/playloop.c | 120 +- player/screenshot.c | 23 +- player/scripting.c | 37 +- player/sub.c | 50 +- player/video.c | 53 +- pyproject.toml | 13 + stream/cookies.c | 2 - stream/dvb_tune.c | 31 +- stream/dvb_tune.h | 11 +- stream/dvbin.h | 2 +- stream/stream.c | 162 +- stream/stream.h | 42 +- stream/stream_bluray.c | 96 +- stream/stream_cb.c | 4 +- stream/stream_cdda.c | 33 +- stream/stream_concat.c | 5 + stream/stream_dvb.c | 31 +- stream/stream_dvdnav.c | 195 +- stream/stream_edl.c | 1 + stream/stream_file.c | 59 +- stream/stream_lavf.c | 122 +- stream/stream_libarchive.c | 6 +- stream/stream_memory.c | 2 +- stream/stream_mf.c | 4 +- stream/stream_mpv.c | 34 + stream/stream_null.c | 2 +- stream/stream_slice.c | 11 +- sub/ass_mp.c | 15 +- sub/dec_sub.c | 42 +- sub/dec_sub.h | 2 + sub/draw_bmp.c | 54 +- sub/filter_jsre.c | 2 +- sub/filter_regex.c | 2 +- sub/filter_sdh.c | 2 +- sub/lavc_conv.c | 61 +- sub/meson.build | 4 +- sub/osd.c | 103 +- sub/osd.h | 26 +- sub/osd_font.otf | Bin 4460 -> 4616 bytes sub/osd_libass.c | 69 +- sub/osd_state.h | 1 - sub/sd.h | 32 +- sub/sd_ass.c | 367 ++- sub/sd_lavc.c | 55 +- ta/README | 2 +- ta/ta.h | 14 + ta/ta_talloc.h | 3 +- ta/ta_utils.c | 1 + test/chmap.c | 14 +- test/codepoint_width.c | 88 + test/img_format.c | 22 +- test/img_utils.c | 4 +- test/json.c | 2 + test/language.c | 103 + test/libmpv_common.h | 93 + test/libmpv_encode.c | 66 +- test/libmpv_lifetime.c | 133 + test/libmpv_test_file_loading.c | 65 + test/libmpv_test_lavfi_complex.c | 71 + test/{libmpv_test.c => libmpv_test_options.c} | 117 +- test/libmpv_test_track_selection.c | 277 +++ test/meson.build | 78 +- test/paths.c | 110 +- test/repack.c | 33 +- test/samples/meson.build | 71 + test/samples/sub.srt | 6 + test/scale_test.c | 27 +- test/test_utils.c | 72 +- test/test_utils.h | 4 +- test/timer.c | 1 - video/csputils.c | 6 +- video/decode/vd_lavc.c | 153 +- video/filter/refqueue.c | 18 +- video/filter/vf_d3d11vpp.c | 296 ++- video/filter/vf_format.c | 8 +- video/filter/vf_gpu.c | 119 +- video/filter/vf_gpu.h | 36 + video/filter/vf_gpu_egl.c | 107 + video/filter/vf_gpu_vulkan.c | 116 + video/filter/vf_vapoursynth.c | 307 ++- video/filter/vf_vavpp.c | 2 +- video/filter/vf_vdpaupp.c | 2 +- video/hwdec.c | 14 +- video/hwdec.h | 29 +- video/image_writer.c | 60 +- video/img_format.c | 5 +- video/mp_image.c | 129 +- video/mp_image.h | 9 + video/mp_image_pool.c | 18 +- video/out/android_common.c | 5 +- video/out/aspect.c | 5 + video/out/bitmap_packer.c | 4 +- video/out/cocoa_cb_common.swift | 91 +- video/out/d3d11/context.c | 114 +- video/out/d3d11/hwdec_d3d11va.c | 12 +- video/out/d3d11/hwdec_dxva2dxgi.c | 5 +- video/out/d3d11/ra_d3d11.c | 101 +- video/out/dither.c | 5 +- video/out/dr_helper.c | 16 +- video/out/drm_atomic.c | 55 +- video/out/drm_common.c | 190 +- video/out/drm_common.h | 64 +- video/out/drm_prime.c | 51 +- video/out/filter_kernels.c | 130 +- video/out/filter_kernels.h | 58 +- video/out/gpu/context.c | 291 ++- video/out/gpu/context.h | 41 +- video/out/gpu/d3d11_helpers.c | 46 +- video/out/gpu/d3d11_helpers.h | 15 +- video/out/gpu/error_diffusion.c | 4 +- video/out/gpu/hwdec.c | 16 +- video/out/gpu/hwdec.h | 9 + video/out/gpu/lcms.h | 2 + video/out/gpu/libmpv_gpu.c | 8 +- video/out/gpu/osd.c | 6 +- video/out/gpu/ra.c | 6 +- video/out/gpu/ra.h | 8 +- video/out/gpu/shader_cache.c | 22 +- video/out/gpu/user_shaders.c | 2 +- video/out/gpu/utils.c | 18 +- video/out/gpu/utils.h | 4 +- video/out/gpu/video.c | 446 ++-- video/out/gpu/video.h | 9 +- video/out/gpu/video_shaders.c | 46 +- video/out/gpu/video_shaders.h | 2 +- video/out/hwdec/dmabuf_interop_gl.c | 2 +- video/out/hwdec/dmabuf_interop_wl.c | 15 +- video/out/hwdec/hwdec_aimagereader.c | 11 +- video/out/hwdec/hwdec_cuda.c | 48 +- video/out/hwdec/hwdec_cuda.h | 9 +- video/out/hwdec/hwdec_cuda_gl.c | 32 +- video/out/hwdec/hwdec_cuda_vk.c | 50 +- video/out/hwdec/hwdec_drmprime.c | 3 +- video/out/hwdec/hwdec_drmprime_overlay.c | 5 +- video/out/hwdec/hwdec_ios_gl.m | 2 +- video/out/hwdec/hwdec_mac_gl.c | 4 +- video/out/hwdec/hwdec_vaapi.c | 96 +- video/out/hwdec/hwdec_vt.c | 1 + video/out/hwdec/hwdec_vt_pl.m | 2 +- video/out/hwdec/hwdec_vulkan.c | 69 +- video/out/libmpv.h | 2 +- video/out/libmpv_sw.c | 4 +- video/out/mac/common.swift | 144 +- video/out/mac/gl_layer.swift | 30 +- video/out/mac/title_bar.swift | 140 +- video/out/mac/view.swift | 19 +- video/out/mac/window.swift | 74 +- video/out/mac_common.swift | 36 +- video/out/meson.build | 29 +- video/out/opengl/common.c | 5 +- video/out/opengl/context.c | 26 +- video/out/opengl/context.h | 30 +- video/out/opengl/context_android.c | 3 +- video/out/opengl/context_angle.c | 35 +- video/out/opengl/context_drm_egl.c | 160 +- video/out/opengl/context_dxinterop.c | 10 +- video/out/opengl/context_glx.c | 3 +- video/out/opengl/context_wayland.c | 5 +- video/out/opengl/context_win.c | 5 +- video/out/opengl/context_x11egl.c | 4 +- video/out/opengl/egl_helpers.c | 111 +- video/out/opengl/hwdec_d3d11egl.c | 1 + video/out/opengl/hwdec_dxva2egl.c | 1 + video/out/opengl/hwdec_dxva2gldx.c | 1 + video/out/opengl/hwdec_vdpau.c | 3 +- video/out/opengl/libmpv_gl.c | 20 +- video/out/opengl/ra_gl.c | 36 +- video/out/opengl/utils.c | 18 +- video/out/placebo/ra_pl.c | 3 +- video/out/vo.c | 78 +- video/out/vo.h | 38 +- video/out/vo_caca.c | 9 +- video/out/vo_direct3d.c | 15 +- video/out/vo_dmabuf_wayland.c | 87 +- video/out/vo_drm.c | 13 +- video/out/vo_gpu.c | 19 +- video/out/vo_gpu_next.c | 263 +- video/out/vo_image.c | 20 +- video/out/vo_kitty.c | 80 +- video/out/vo_lavc.c | 28 +- video/out/vo_libmpv.c | 11 +- video/out/vo_mediacodec_embed.c | 5 +- video/out/vo_null.c | 3 +- video/out/vo_sdl.c | 16 +- video/out/vo_sixel.c | 16 +- video/out/vo_tct.c | 29 +- video/out/vo_vaapi.c | 25 +- video/out/vo_vdpau.c | 7 +- video/out/vo_wlshm.c | 21 +- video/out/vo_x11.c | 6 +- video/out/vo_xv.c | 28 +- video/out/vulkan/context.c | 101 +- video/out/vulkan/context.h | 21 +- video/out/vulkan/context_android.c | 3 +- video/out/vulkan/context_display.c | 30 +- video/out/vulkan/context_mac.m | 21 +- video/out/vulkan/context_wayland.c | 22 +- video/out/vulkan/context_win.c | 3 +- video/out/vulkan/context_xlib.c | 3 +- video/out/vulkan/utils.c | 2 +- video/out/w32_common.c | 285 ++- video/out/wayland_common.c | 1521 +++++++++--- video/out/wayland_common.h | 91 +- video/out/win32/menu.c | 24 +- video/out/win32/menu.h | 2 +- video/out/win_state.c | 32 +- video/out/win_state.h | 8 +- video/out/wldmabuf/context_wldmabuf.c | 2 +- video/out/wldmabuf/ra_wldmabuf.c | 13 +- video/out/wldmabuf/ra_wldmabuf.h | 2 +- video/out/x11_common.c | 132 +- video/out/x11_common.h | 7 +- video/repack.c | 50 +- video/repack.h | 2 +- video/sws_utils.c | 25 +- video/sws_utils.h | 3 - video/vdpau.c | 20 +- video/vdpau_mixer.c | 2 +- video/zimg.c | 16 +- 574 files changed, 30654 insertions(+), 14440 deletions(-) create mode 100644 .editorconfig-checker.json create mode 100644 .lsan_suppressions create mode 100644 .luacheckrc create mode 100644 .pre-commit-config.yaml create mode 100644 .swiftlint.yml create mode 100644 DOCS/man/commands.rst create mode 100644 DOCS/man/positioning.rst create mode 100644 DOCS/man/select.rst create mode 100644 MPV_VERSION create mode 100755 TOOLS/gen-mpv-desktop.py create mode 100644 TOOLS/lua/gamma-auto.lua create mode 100644 TOOLS/mpv-osd-symbols.sfdir/README.md create mode 100644 TOOLS/mpv-osd-symbols.sfdir/uniE00D.glyph create mode 100644 TOOLS/mpv-osd-symbols.sfdir/uniE102.glyph delete mode 100644 VERSION create mode 100644 ci/build-common.sh create mode 100644 ci/build-win32.ps1 create mode 100644 debian/patches/0001-demux_mkv-fix-compilation-after-deprecated-definitio.patch create mode 100644 debian/patches/0002-player-create-missing-folders-for-watch-history-path.patch delete mode 100644 debian/patches/Fix-the-problem-of-the-full-screen-crash.patch delete mode 100644 debian/patches/fix-mpv.patch delete mode 100644 debian/patches/fix-vaapi-nullpter-crush.patch delete mode 100644 debian/patches/pgv-flower-screen.patch delete mode 100644 debian/patches/vdpau-render.patch create mode 100644 demux/demux_mpv.c create mode 100644 demux/packet_pool.c create mode 100644 demux/packet_pool.h create mode 100644 etc/mpv.fish create mode 100644 etc/powershell-completion.ps1 create mode 100644 etc/restore-osc-bindings.conf create mode 100644 fuzzers/common.h create mode 100644 fuzzers/fuzzer_json.c create mode 100644 fuzzers/fuzzer_load.c create mode 100644 fuzzers/fuzzer_loadfile_direct.c create mode 100644 fuzzers/fuzzer_options_parser.c create mode 100644 fuzzers/fuzzer_set_property.c create mode 100644 fuzzers/meson.build rename {libmpv => include/mpv}/client.h (99%) rename {libmpv => include/mpv}/render.h (99%) rename {libmpv => include/mpv}/render_gl.h (100%) rename {libmpv => include/mpv}/stream_cb.h (100%) rename meson_options.txt => meson.options (88%) create mode 100644 misc/codepoint_width.c create mode 100644 misc/codepoint_width.h create mode 100644 misc/lavc_compat.h create mode 100644 misc/mp_assert.h delete mode 100644 misc/uuid.c delete mode 100644 misc/uuid.h create mode 100644 osdep/dirent-win.h create mode 100644 osdep/mac/clipboard.swift create mode 100644 osdep/mac/compat.h create mode 100644 osdep/mac/dialog.swift delete mode 100644 osdep/semaphore-mac.c delete mode 100644 osdep/semaphore.h create mode 100644 osdep/win32/meson.build create mode 100644 osdep/win32/smtc.cpp create mode 100644 osdep/win32/smtc.h create mode 100644 player/clipboard/clipboard-mac.m create mode 100644 player/clipboard/clipboard-vo.c create mode 100644 player/clipboard/clipboard-wayland.c create mode 100644 player/clipboard/clipboard-win.c create mode 100644 player/clipboard/clipboard.c create mode 100644 player/clipboard/clipboard.h create mode 100644 player/lua/commands.lua create mode 100644 player/lua/fzy.lua create mode 100644 player/lua/positioning.lua create mode 100644 player/lua/select.lua delete mode 100644 player/meson.build create mode 100644 pyproject.toml create mode 100644 stream/stream_mpv.c create mode 100644 test/codepoint_width.c create mode 100644 test/language.c create mode 100644 test/libmpv_common.h create mode 100644 test/libmpv_lifetime.c create mode 100644 test/libmpv_test_file_loading.c create mode 100644 test/libmpv_test_lavfi_complex.c rename test/{libmpv_test.c => libmpv_test_options.c} (64%) create mode 100644 test/libmpv_test_track_selection.c create mode 100644 test/samples/meson.build create mode 100644 test/samples/sub.srt create mode 100644 video/filter/vf_gpu.h create mode 100644 video/filter/vf_gpu_egl.c create mode 100644 video/filter/vf_gpu_vulkan.c diff --git a/.editorconfig b/.editorconfig index 0f4e36d..a4baa4b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,11 @@ trim_trailing_whitespace = true [.git/COMMIT*] max_line_length = 72 + +[{osdep/dirent-win.h,TOOLS/osxbundle/mpv.app/Contents/PkgInfo}] +charset = unset +insert_final_newline = unset +indent_style = unset +indent_size = unset +max_line_length = unset +trim_trailing_whitespace = unset diff --git a/.editorconfig-checker.json b/.editorconfig-checker.json new file mode 100644 index 0000000..1cedd44 --- /dev/null +++ b/.editorconfig-checker.json @@ -0,0 +1,7 @@ +{ + "Format": "github-actions", + "Disable": { + "IndentSize": true, + "MaxLineLength": true + } +} diff --git a/.lsan_suppressions b/.lsan_suppressions new file mode 100644 index 0000000..e2c3594 --- /dev/null +++ b/.lsan_suppressions @@ -0,0 +1 @@ +leak:FcFontSetSort diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..84ae84e --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,109 @@ +local mp_globals = { + mp = { + fields = { + command = {}, + commandv = {}, + command_native = {}, + command_native_async = {}, + add_hook = {}, + abort_async_command = {}, + del_property = {}, + get_property = {}, + get_property_osd = {}, + get_property_bool = {}, + get_property_number = {}, + get_property_native = {}, + set_property = {}, + set_property_bool = {}, + set_property_number = {}, + set_property_native = {}, + get_time = {}, + add_key_binding = {}, + add_forced_key_binding = {}, + remove_key_binding = {}, + register_event = {}, + unregister_event = {}, + observe_property = {}, + unobserve_property = {}, + add_timeout = {}, + add_periodic_timer = {}, + get_opt = {}, + get_script_name = {}, + get_script_directory = {}, + osd_message = {}, + get_wakeup_pipe = {}, + get_next_timeout = {}, + dispatch_events = {}, + register_idle = {}, + unregister_idle = {}, + enable_messages = {}, + register_script_message = {}, + unregister_script_message = {}, + create_osd_overlay = {}, + get_osd_size = {}, + msg = { + fields = { + fatal = {}, + error = {}, + warn = {}, + info = {}, + verbose = {}, + debug = {}, + trace = {}, + } + }, + -- Not documented + -- TODO: Document or remove them + disable_key_bindings = {}, + enable_key_bindings = {}, + find_config_file = {}, + format_time = {}, + get_mouse_pos = {}, + set_key_bindings = {}, + set_mouse_area = {}, + set_osd_ass = {}, + } + }, + exit = {}, + unpack = {}, +} + +local mp_internal = { + mp = { + fields = { + -- Internal + -- TODO: Move to mp_internal module + ARRAY = { fields = { info = {}, type = {} }}, + MAP = { fields = { info = {}, type = {} }}, + UNKNOWN_TYPE = { fields = { info = {}, type = {} }}, + _legacy_overlay = { fields = { res_x = {}, res_y = {}, data = {}, update = {} }}, + cancel_timer = {}, + flush_keybindings = {}, + get_osd_margins = {}, + input_define_section = {}, + input_disable_section = {}, + input_enable_section = {}, + input_set_section_mouse_area = {}, + keep_running = {}, + log = {}, + raw_abort_async_command = {}, + raw_command_native_async = {}, + raw_hook_add = {}, + raw_hook_continue = {}, + raw_observe_property = {}, + raw_unobserve_property = {}, + raw_wait_event = {}, + request_event = {}, + script_name = {}, + use_suspend = {}, + wait_event = {}, + } + } +} + +std = "min+mp" +stds = { mp = { read_globals = mp_globals } } +-- mp_internal seems to be merged with mp for other files too... +files["player/lua/defaults.lua"] = { globals = mp_internal } +files["player/lua/auto_profiles.lua"] = { globals = { "p", "get" } } +max_line_length = 100 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e41ebee --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,22 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-illegal-windows-names + - id: check-json + - id: check-shebang-scripts-are-executable + - id: check-xml + - id: check-yaml + - id: end-of-file-fixer + exclude: ^TOOLS/osxbundle/mpv.app/Contents/PkgInfo$ + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: trailing-whitespace +- repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: ["--ignore-words-list", "datas,DNE,enew,HDA,numer,ontop,optionA,Paeth,pathc,inout"] + exclude: ^misc/language.c$ diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..f059a34 --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,10 @@ +disabled_rules: + - identifier_name + - line_length + - large_tuple + - void_function_in_ternary + - function_body_length + - cyclomatic_complexity + - file_length + - type_body_length +strict: true diff --git a/Copyright b/Copyright index 79f718b..61d3a03 100644 --- a/Copyright +++ b/Copyright @@ -2,9 +2,20 @@ mpv is a fork of mplayer2, which is a fork of MPlayer. mpv as a whole is licensed under the GNU General Public License GPL version 2 or later (called GPLv2+ in this document, see LICENSE.GPL for full license -text) by default, or the GNU Lesser General Public License LGPL version 2 or -later (LGPLv2.1+ in this document, see LICENSE.LGPL for full license text) if -built with the -Dgpl=false configure switch. +text) by default. The mpv program is licensed the GNU Lesser General Public +License LGPL version 2 or later (LGPLv2.1+ in this document, see LICENSE.LGPL +for full license text) if built without using any GPL only files. +The -Dgpl=false configure switch is provided as a convenience for excluding +the GPL only files listed below from the build process. + +However, do note that the build system is provided "as is" and using the +-Dgpl=false configure switch does not in itself create a LGPLv2.1+ license +grant. + +Additionally, some non-program parts, such as the documentation and some config +files listed below, are still built and licensed under their respective licenses +even when -Dgpl=false is used. Please consult GPLv2+ and LGPLv2.1+ license texts +for further details on how to distribute these files. Most source files are LGPLv2.1+ or GPLv2+, but some files are available under more liberal licenses, such as BSD, MIT, ISC, and possibly others. Look at the @@ -26,12 +37,7 @@ See DOCS/contribute.md for binding rules wrt. licensing for contributions. For information about authors and contributors, consult the git log, which contains the complete SVN and CVS history as well. -"v2.1+" in this context means "version 2.1 or later". - -Some libraries are GPLv2+ or GPLv3+ only. Building mpv with Samba support makes -it GPLv3+. - -mpv can be built as LGPLv2.1+ with the -Dgpl=false configure option. To add a +mpv can be built as LGPLv2.1+ without using any GPL only files. To add a LGPL mode to mpv, MPlayer code had to be relicensed from GPLv2+ to LGPLv2.1+ by asking the MPlayer authors for permission. Since permission could not be obtained from everyone, LGPL mode disables the following features, some of them @@ -39,8 +45,7 @@ quite central: - Linux X11 video output - BSD audio output via OSS - NVIDIA/Linux hardware decoding (vdpau, although nvdec usually works) -- Linux TV input -- minor features: jack, DVD, CDDA, SMB, CACA, legacy direct3d VO +- minor features: jack, DVD, CDDA, DVB, CACA, legacy direct3d VO Some of these will be fixed in the future. The intended use for LGPL mode is with libmpv, and currently it's not recommended to build mpv CLI in LGPL mode at all. @@ -64,9 +69,8 @@ The following files are still GPL only (-Dgpl=false disables them): video/vdpau.h unknown video/vdpau_mixer.* actual code must be rewritten DOCS/man/ GPLv2+ - bootstrap.py unknown license, probably GPLv2+ or LGPLv2+ etc/mplayer-input.conf unknown license, probably GPLv2+ - mpv.desktop unknown license, probably GPLv2+ + etc/mpv.desktop unknown license, probably GPLv2+ etc/restore-old-bindings.conf unknown license, probably GPLv2+ None of the cases listed above affect the final binary if it's built as diff --git a/DOCS/client-api-changes.rst b/DOCS/client-api-changes.rst index 7d34881..2a4838e 100644 --- a/DOCS/client-api-changes.rst +++ b/DOCS/client-api-changes.rst @@ -31,6 +31,13 @@ API changes =========== :: + + --- mpv 0.40.0 --- + 2.5 - Deprecate MPV_RENDER_PARAM_AMBIENT_LIGHT. no replacement. + --- mpv 0.39.0 --- + 2.4 - mpv_render_param with the MPV_RENDER_PARAM_ICC_PROFILE argument no + longer has incorrect assumptions about memory allocation and can be + correctly used. --- mpv 0.38.0 --- 2.3 - partially revert the changes from API version 1.27, remove libmpv as the default VO and move it to the bottom of the auto-probing order. @@ -50,7 +57,7 @@ API changes TRACK_SWITCHED, METADATA_UPDATE, CHAPTER_CHANGE events --- mpv 0.33.0 --- 1.109 - add MPV_RENDER_API_TYPE_SW and related (software rendering API) - - inactivate the opengl_cb API (always fails to initialize now) + - deactivate the opengl_cb API (always fails to initialize now) The opengl_cb API was deprecated over 2 years ago. Use the render API instead. 1.108 - Deprecate MPV_EVENT_IDLE @@ -281,4 +288,3 @@ API changes - macOS: the "coreaudio" AO spdif code is split into a separate AO --- mpv 0.4.0 --- 1.0 - the API is declared stable - diff --git a/DOCS/compatibility.rst b/DOCS/compatibility.rst index 3d6ec2c..a79ca09 100644 --- a/DOCS/compatibility.rst +++ b/DOCS/compatibility.rst @@ -29,7 +29,16 @@ All of these are important for interfacing both with end users and API users (which include Lua scripts, libmpv, and the JSON IPC). As such, they constitute a large part of the user interface and APIs. -All incompatible changes to this must be declared in interface-changes.rst. +Certain options and commands may have documented default values. These default +values are considered a part of the API since scripts may already rely on these +documented behaviors. Changing these defaults are considered incompatible +changes and must be documented. Undocumented default values do not subject to +this requirement, and it is recommended to discourage such usage in the related +documentations if there is a need to frequently change such defaults. + +All incompatible changes to this must be declared in interface-changes.rst, +which include the types of changes, the impact of these changes, and suggested +actions to address such impact so that the incompatibility is alleviated. (This may also list compatible additions, but it's not a requirement.) Degrees of importance and compatibility preservation @@ -49,8 +58,17 @@ functionality still works, and a replacement is available (if technically reasonable). For example, a feature deprecated in mpv 0.30.0 may be removed in mpv 0.32.0. Minor releases do not count towards this. +Under extraordinary circumstances, such as missed incompatible changes that are +already included in a release, critical security fixes, or a severe shortage of +developer time to address the known incompatible changes, important/often used +parts may be broken immediately, but the change must be extensively documented: +all of the related documentations (including manpage, interface-changes.rst, +etc., retrospectively modified if applicable) must clearly state the following: +the fact that the change is a breaking change; the version when the breaking +change happened; and the reason, impact, and suggested remedy actions. + Less useful parts can be broken immediately, but must come with some sort of -removal warning- +removal warning. Parts for debugging and testing may be removed any time, potentially even without any sort of documentation. @@ -108,7 +126,7 @@ CLI Things such as default key bindings do not necessarily require compatibility. However, the release notes should be extremely clear on changes to "important" key bindings. Bindings which restore the old behavior should be added to -restore-old-bindings.conf. +restore-old-bindings.conf and restore-osc-bindings.conf. Some option parsing is CLI-only and not available from libmpv or scripting. No compatibility guarantees come with them. However, the rules which mpv uses to @@ -135,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/compile-windows.md b/DOCS/compile-windows.md index 04bc200..4850796 100644 --- a/DOCS/compile-windows.md +++ b/DOCS/compile-windows.md @@ -1,214 +1,262 @@ -Compiling for Windows -===================== - -Compiling for Windows is supported with MinGW-w64. This can be used to produce -both 32-bit and 64-bit executables, and it works for building on Windows and -cross-compiling from Linux and Cygwin. MinGW-w64 is available from: -https://www.mingw-w64.org/ - -While building a complete MinGW-w64 toolchain yourself is possible, there are a -few build environments and scripts to help ease the process, such as MSYS2 and -MXE. Note that MinGW environments included in Linux distributions are often -broken, outdated and useless, and usually don't use MinGW-w64. - -**Warning**: the original MinGW (https://osdn.net/projects/mingw/) is unsupported. - -Cross-compilation -================= - -When cross-compiling, it is recommended to use a meson crossfile to setup -the cross compiling environment. A minimal example is included below: - -```ini -[binaries] -c = 'x86_64-w64-mingw32-gcc' -cpp = 'x86_64-w64-mingw32-g++' -ar = 'x86_64-w64-mingw32-ar' -strip = 'x86_64-w64-mingw32-strip' -exe_wrapper = 'wine64' - -[host_machine] -system = 'windows' -cpu_family = 'x86_64' -cpu = 'x86_64' -endian = 'little' +# Compiling for Windows + +Compiling for Windows is supported using GNU-like compilers (GCC/Clang). Clang +is compatible with both the ``w64-windows-gnu`` [MinGW-w64](https://www.mingw-w64.org/) +and ``pc-windows-msvc`` [Windows SDK](https://developer.microsoft.com/windows/downloads/windows-sdk) +targets. It supports the production of both 32-bit and 64-bit binaries and is +suitable for building on Windows as well as cross-compiling from Linux and Cygwin. + +Although it is possible to build a complete MinGW-w64 toolchain yourself, there +are build environments and scripts available to simplify the process, such as +MSYS2 on Windows or a packaged toolchain provided by your favorite Linux +distribution. Note that MinGW-w64 environments included in Linux distributions +can vary in versions. As a general guideline, mpv only supports the MinGW-w64 +toolchain version included in the latest Ubuntu LTS release. + +mpv employs Meson for building, and the process is the same as any standard Meson +compilation. + +For the most up-to-date reference on build scripts, you can refer to +[build.yml](https://github.com/mpv-player/mpv/blob/master/.github/workflows/build.yml), +which builds and tests all supported configurations: ``MinGW-w64``, ``Windows SDK``, +and ``MSYS2`` builds. + +## Cross-compilation + +When cross-compiling, it is recommended to use a Meson ``--cross-file`` to set up the +cross-compiling environment. For a basic example, please refer to +[Cross-compilation](https://mesonbuild.com/Cross-compilation.html). + +Alternatively, consider using [mpv-winbuild-cmake](https://github.com/shinchiro/mpv-winbuild-cmake), +which bootstraps a MinGW-w64 toolchain and builds mpv along with its dependencies. + +### Example with Meson + +1. Create ``cross-file.txt`` with definitions for your toolchain and target platform. + Refer to [x86_64-w64-mingw32.txt](https://mesonbuild.com/Cross-compilation.html) + as a directly usable example. + - **Important**: Beware of pkg-config usage. By default, it uses build machine + files for dependency detection, even when ``--cross-file`` is used. It must + be configured correctly. Refer to ``pkg_config_libdir`` and ``sys_root`` + in the [documentation](https://mesonbuild.com/Cross-compilation.html#defining-the-environment) + for proper setup. **In this example pkg-config is not used/required.** +2. Initialize subprojects. This step is optional; other methods are also + available to provide the necessary dependencies. + + ``` bash + # Update the subprojects database from Meson's WrapDB. + meson wrap update-db + + # Explicitly download wraps as nested projects may have older versions of them. + meson wrap install expat + meson wrap install harfbuzz + meson wrap install libpng + meson wrap install zlib + + # Add wraps for mpv's required dependencies + mkdir -p subprojects + + cat < subprojects/libplacebo.wrap + [wrap-git] + url = https://github.com/haasn/libplacebo + revision = master + depth = 1 + clone-recursive = true + EOF + + cat < subprojects/libass.wrap + [wrap-git] + revision = master + url = https://github.com/libass/libass + depth = 1 + EOF + + # For FFmpeg, use Meson's build system port; alternatively, you can compile + # the upstream version yourself. See https://trac.ffmpeg.org/wiki/CompilationGuide + cat < subprojects/ffmpeg.wrap + [wrap-git] + url = https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git + revision = meson-7.1 + depth = 1 + [provide] + libavcodec = libavcodec_dep + libavdevice = libavdevice_dep + libavfilter = libavfilter_dep + libavformat = libavformat_dep + libavutil = libavutil_dep + libswresample = libswresample_dep + libswscale = libswscale_dep + EOF + ``` + +3. Build + + ``` bash + meson setup -Ddefault_library=static -Dprefer_static=true \ + -Dc_link_args='-static' -Dcpp_link_args='-static' \ + --cross-file cross-file.txt build + + ninja -C build mpv.exe mpv.com + ``` + + This will produce fully portabiel, statically linked, ``mpv.exe`` and ``mpv.com`` + binaries. + +#### Building libmpv + +- To also build ``libmpv``, execute the following commands: + + ``` bash + # For a static library + meson configure build -Dlibmpv=true -Ddefault_library=static + ninja -C build libmpv.a + + # For a shared library + meson configure build -Dlibmpv=true -Ddefault_library=shared + ninja -C build libmpv-2.dll + ``` + +- Depending on the use case, you might want to use ``-Dgpl=false`` and review + similar options for subprojects. +- If any of Meson's subprojects are not linked statically, you might need to + specify options like the following example for ffmpeg: + ``-Dffmpeg:default_library=static``. + +#### Enabling more mpv features + +The process above produces a basic mpv build. You can enable additional features. +Check the Meson +[WrapDB packages](https://mesonbuild.com/Wrapdb-projects.html) for available +dependencies or by providing them through other means. + +Enhancing mpv with more features is as simple as adding more arguments to the +Meson setup command, for example: + +``` bash +-Dlua=enabled -Djavascript=enabled -Dlcms2=enabled -Dlibplacebo:lcms=enabled ``` -See [meson's documentation](https://mesonbuild.com/Cross-compilation.html) for -more information. +they will be automatically downloaded and built by Meson. + +## Native Compilation with Clang (Windows SDK Build) + +1. Install [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) + or the full [Visual Studio](https://visualstudio.microsoft.com/downloads/#visual-studio-community-2022): + - From the installer, select the necessary components: + - Clang compiler for Windows + - C++ CMake tools for Windows + - Windows SDK + - Activate the developer shell: + ``` + & "\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation | Out-Null + ``` +2. Install Meson, as outlined in [Getting Meson](https://mesonbuild.com/Getting-meson.html): +3. The following build script utilizes the Meson subprojects system to build mpv and its dependencies. + To make sure all dependency versions are up-to-date, update the subprojects database from Meson's WrapDB. + Also explicitly download several wraps as some nested projects may pull older versions of them. + ``` + meson wrap update-db + + meson wrap install expat + meson wrap install harfbuzz + meson wrap install libpng + meson wrap install zlib + ``` +4. Set environment variables or use the `--native-file` option in Meson. + ```powershell + $env:CC = 'clang' + $env:CXX = 'clang++' + $env:CC_LD = 'lld' + $env:CXX_LD = 'lld' + $env:WINDRES = 'llvm-rc' + ``` + Note that some dependencies (e.g. LuaJIT) may require `sed` to configure. Fortunately, it is already bundled in + [Git for Windows](https://www.git-scm.com/download/win): + ```powershell + $env:PATH += ';\usr\bin' + ``` +5. Execute [ci\build-win32.ps1](https://github.com/mpv-player/mpv/blob/master/ci/build-win32.ps1). Refer to the script for more details. + +This process will produce a fully static ``mpv.exe`` and ``mpv.com``, as well as +a static ``libmpv.a``. + +## Native Compilation with MSYS2 + +For Windows developers seeking a quick setup, MSYS2 is an effective tool for +compiling mpv natively on a Windows machine. The MSYS2 repositories provide +binary packages for most of mpv's dependencies, simplifying the process to +primarily involve building mpv itself. + +### Installing MSYS2 + +1. Follow the installation steps from [MSYS2](https://www.msys2.org/). +2. Initiate one of the [Environments](https://www.msys2.org/docs/environments/), + with the CLANG64 (``clang64.exe``) being the recommended option. + **Note:** This environment is distinct from the MSYS2 shell that opens + automatically after the final installation dialog. You must close that + initial shell and open a new one for the appropriate environment. + +### Updating MSYS2 + +For guidance on updating MSYS2, please refer to the official documentation: +[Updating MSYS2](https://www.msys2.org/docs/updating/). + +### Installing mpv Dependencies + +``` bash +# Install pacboy and git +pacman -S pactoys git -[MXE](https://mxe.cc) makes it very easy to bootstrap a complete MingGW-w64 -environment from a Linux machine. See a working example below. - -Alternatively, you can try [mpv-winbuild-cmake](https://github.com/shinchiro/mpv-winbuild-cmake), -which bootstraps a MinGW-w64 environment and builds mpv and dependencies. - -Example with MXE ----------------- - -```bash -# Before starting, make sure you install MXE prerequisites. MXE will download -# and build all target dependencies, but no host dependencies. For example, -# you need a working compiler, or MXE can't build the crosscompiler. -# -# Refer to -# -# https://mxe.cc/#requirements -# -# Scroll down for disto/OS-specific instructions to install them. - -# Download MXE. Note that compiling the required packages requires about 1.4 GB -# or more! - -cd /opt -git clone https://github.com/mxe/mxe mxe -cd mxe - -# Set build options. - -# The JOBS environment variable controls threads to use when building. DO NOT -# use the regular `make -j4` option with MXE as it will slow down the build. -# Alternatively, you can set this in the make command by appending "JOBS=4" -# to the end of command: -echo "JOBS := 4" >> settings.mk - -# The MXE_TARGET environment variable builds MinGW-w64 for 32 bit targets. -# Alternatively, you can specify this in the make command by appending -# "MXE_TARGETS=i686-w64-mingw32" to the end of command: -echo "MXE_TARGETS := i686-w64-mingw32.static" >> settings.mk - -# If you want to build 64 bit version, use this: -# echo "MXE_TARGETS := x86_64-w64-mingw32.static" >> settings.mk - -# Build required packages. The following provide a minimum required to build -# a reasonable mpv binary (though not an absolute minimum). - -make gcc ffmpeg libass jpeg lua luajit - -# Add MXE binaries to $PATH -export PATH=/opt/mxe/usr/bin/:$PATH - -# Build mpv. The target will be used to automatically select the name of the -# build tools involved (e.g. it will use i686-w64-mingw32.static-gcc). - -cd .. -git clone https://github.com/mpv-player/mpv.git -cd mpv -meson setup build --crossfile crossfile -meson compile -C build -``` - -Native compilation with MSYS2 -============================= - -For Windows developers looking to get started quickly, MSYS2 can be used to -compile mpv natively on a Windows machine. The MSYS2 repositories have binary -packages for most of mpv's dependencies, so the process should only involve -building mpv itself. - -To build 64-bit mpv on Windows: - -Installing MSYS2 ----------------- - -1. Download an installer from https://www.msys2.org/ - - Both the i686 and the x86_64 version of MSYS2 can build 32-bit and 64-bit - mpv binaries when running on a 64-bit version of Windows, but the x86_64 - version is preferred since the larger address space makes it less prone to - fork() errors. - -2. Start a MinGW-w64 shell (``mingw64.exe``). **Note:** This is different from - the MSYS2 shell that is started from the final installation dialog. You must - close that shell and open a new one. - - For a 32-bit build, use ``mingw32.exe``. - -Updating MSYS2 --------------- - -To prevent errors during post-install, the MSYS2 core runtime must be updated -separately. - -```bash -# Check for core updates. If instructed, close the shell window and reopen it -# before continuing. -pacman -Syu - -# Update everything else -pacman -Su -``` - -Installing mpv dependencies ---------------------------- - -```bash # Install MSYS2 build dependencies and a MinGW-w64 compiler -pacman -S git $MINGW_PACKAGE_PREFIX-{python,pkgconf,gcc,meson} +pacboy -S python pkgconf cc meson -# Install the most important MinGW-w64 dependencies. libass and lcms2 are also -# pulled in as dependencies of ffmpeg. -pacman -S $MINGW_PACKAGE_PREFIX-{ffmpeg,libjpeg-turbo,luajit} +# Install key dependencies. libass and lcms2 are also included as dependencies +# of ffmpeg. +pacboy -S ffmpeg libjpeg-turbo libplacebo luajit vulkan-headers ``` -Building mpv ------------- - -Finally, compile and install mpv. Binaries will be installed to -``/mingw64/bin`` or ``/mingw32/bin``. - -```bash -meson setup build --prefix=$MSYSTEM_PREFIX -meson compile -C build -``` +### Building mpv -Or, compile and install both libmpv and mpv: +To compile and install mpv, execute the following commands. +The binaries will be installed in the directory ``/$MSYSTEM_PREFIX/bin``. ```bash +# Set up the build directory with the desired configuration meson setup build -Dlibmpv=true --prefix=$MSYSTEM_PREFIX + +# Compile meson compile -C build + +# Optionally, install the compiled binaries meson install -C build ``` -Linking libmpv with MSVC programs ---------------------------------- +## Running mpv -mpv/libmpv cannot be built with Visual Studio (Microsoft is too incompetent to -support C99/C11 properly and/or hates open source and Linux too much to -seriously do it). But you can build C++ programs in Visual Studio and link them -with a libmpv built with MinGW. +Depending on your build configuration, ``mpv.exe`` may rely on external +libraries. To create a portable package, you will need to include these +dependencies as well. The quickest way to determine which libraries are needed +is to run ``mpv.exe`` and note any error messages that list the required ``.dll`` +files. You can find these libraries in the sysroot used for compilation, such as +``/clang64/bin/`` in MSYS2. -To do this, you need a Visual Studio which supports ``stdint.h`` (recent ones do), -and you need to create a import library for the mpv DLL: +## Linking libmpv with MSVC Programs -```bash -lib /name:mpv-1.dll /out:mpv.lib /MACHINE:X64 -``` +Building mpv/libmpv directly with the MSVC compiler (cl.exe) is not supported +due to differences in compiler flags. Our build system is designed specifically +for GNU-like compiler drivers. However, you can still build programs in +Visual Studio and link them with libmpv. -The string in the ``/name:`` parameter must match the filename of the DLL (this -is simply the filename the MSVC linker will use). - -Static linking is not possible. - -Running mpv ------------ - -If you want to run mpv from the MinGW-w64 shell, you will find the experience -much more pleasant if you use the ``winpty`` utility +If the toolchain used generates a ``.lib`` file, it will be ready for use. +Otherwise, you will need to create an import library for the mpv DLL with the +following command: ```bash -pacman -S winpty -winpty mpv.com ToS-4k-1920.mov +lib /name:mpv-2.dll /out:mpv.lib /MACHINE:X64 ``` -If you want to move / copy ``mpv.exe`` and ``mpv.com`` to somewhere other than -``/mingw64/bin/`` for use outside the MinGW-w64 shell, they will still depend on -DLLs in that folder. The simplest solution is to add ``C:\msys64\mingw64\bin`` -to the windows system ``%PATH%``. Beware though that this can cause problems or -confusion in Cygwin if that is also installed on the machine. - -Use of the ANGLE OpenGL backend requires a copy of the D3D compiler DLL that -matches the version of the D3D SDK that ANGLE was built with -(``d3dcompiler_43.dll`` in case of MinGW-built ANGLE) in the path or in the -same folder as mpv. It must be of the same architecture (x86_64 / i686) as the -mpv you compiled. +Ensure that the string in the ``/name:`` parameter matches the filename of the +DLL, as this is the filename that the MSVC linker will reference. + +**Note:** Static linking is only feasible with matching compilers. For instance, +if you build with Clang in Visual Studio, static linking is possible. diff --git a/DOCS/contribute.md b/DOCS/contribute.md index 4d2af4e..a83e74e 100644 --- a/DOCS/contribute.md +++ b/DOCS/contribute.md @@ -42,7 +42,7 @@ Copyright of contributions this. If the license of the code is not LGPLv2.1+, you must mention this. - These license statements are legally binding. - Don't use fake names (something that looks like an actual name, and may be - someone else's name, but is not your legal name). Using a pseudonyms is + someone else's name, but is not your legal name). Using a pseudonym is allowed if it can be used to identify or contact you, even if whatever account you used to submit the patch dies. - Do not add your name to the license header. This convention is not used by @@ -141,7 +141,10 @@ Interface change policy must be documented by making a new text file with a txt extension containing a small note in the DOCS/interface-changes directory. - The name of the file should be brief and related to the commit that makes the - change. + change. The content of the file should begin with the type of the change + (add, remove, deprecate, change, rename, etc.). If the file contains multiple + changes, the change which causes the most serious compatibility issues should + be placed first. - Grouping multiple related changes in the same file is also OK. Just be sure to put each separate change on a different line. - Documenting additions in DOCS/interface-changes is optional but encouraged. @@ -252,6 +255,11 @@ General coding - If you add features that require intrusive changes, discuss them on the dev channel first. There might be a better way to add a feature and it can avoid wasted work. +- Newly added code for any Apple Platform (macOS, iOS, etc), that uses Cocoa or + any other object-oriented Framework or API, should be written in Swift instead + of Objective-C. This also includes complete rewrites/refactors of existing + code. Plain C API usages may stay as C, but can be written in Swift. Existing + Objective-C code can stay as is, though Swift rewrites are welcome. Code of Conduct --------------- diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index b55ef97..e7f9a33 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -17,8 +17,9 @@ a large part of the user interface and APIs. Also see compatibility.rst. -This document lists changes to them. New options/commands/etc. are not always -listed. +Prior to 0.40.0, only changes had to be listed here and not necessarily new +additions. After 0.40.0, all changes and additions to options/commands/etc are +listed here. **Never** write to this file directly except when making releases. New changes are added in the interface-changes directory instead. See contribute.md for more @@ -29,6 +30,237 @@ Interface changes :: + --- mpv 0.41.0 --- + --- mpv 0.40.0 --- + - undeprecate list option suffixes that work with multiple items + - add `-del` to string list and keyvalue list options + - add `-clr` to keyvalue list options + - undeprecate `--gamma-factor` + - the `path` and `track-list/N/external-filename` properties now always + return a full, absolute path + - rename `--vd-lavc-software-fallback` to `--hwdec-software-fallback` + - rename `--sub-ass-line-spacing` to `--sub-line-spacing` + - rename `--sub-ass-shaper` to `--sub-shaper` + - rename `--sub-ass-hinting` to `--sub-hinting` + - rename `--load-osd-console` to `--load-console` + - remove `stats-term_width_limit` script-opt + - add `stats-term_clip` script-opt + - remove `stats-term_height_limit` script-opt + - remove `player` argument form `--media-controls`, it's handled internally + now. + - make `script-binding` command scalable; add `nonscalable` command prefix + to restore the old behavior + - deprecate `osc-message` script message in favor of `show-text` command + - deprecate `osc-chapterlist` script message in favor of `show-text + ${chapter-list}` + - deprecate `osc-playlist` script message in favor of `show-text + ${playlist}` + - deprecate `osc-tracklist` script message in favor of `show-text ${track- + list}` + - add `visibility_modes` script-opt to osc + - deprecate `--wayland-disable-vsync` + - add `--wayland-internal-vsync` as a replacement for `--wayland-disable- + vsync` + - deprecate `--cdda-span-a` and `--cdda-span-b` + - commands.lua is split out of console.lua. commands.lua runs and completes + commands and adds mpv's log entries to the console's log, while + console.lua handles the UI for other scripts + - add `--load-commands` option + - `script-binding console/enable` becomes `script-binding commands/open`, + though the console one is kept as an alias + - `script-message-to console type` becomes `script-message-to commands + type`, though the console one is kept as an alias. This also now + automatically closes the console after running the command. + - change the underlying type of the `aspect`, `par`, and `sar` sub- + properties to double from float + - add `--video-aspect-method=ignore` + - change `--video-aspect-override=no` to respect `--video-aspect-method` + option + - deprecate setting `--video-aspect-override` to `0` and `-1` + - change several OSC mouse bindings to select.lua functions + - add script-opts to configure what OSC buttons do when clicked + - remove `osc-playlist_osd` script-opt and behave as if it was off by + default; `playlist_osd=yes` can be replicated with `osc- + playlist_prev_mbtn_left_command=playlist-prev; show-text ${playlist} 3000` + and `osc-playlist_next_mbtn_left_command=playlist-next; show-text + ${playlist} 3000` + - remove `osc-chapters_osd` script-opt and behave as if it was off by + default; `chapter_osd=yes` can be replicated with `osc- + chapter_prev_mbtn_left_command=no-osd add chapter -1; show-text ${chapter- + list} 3000` and `osc-chapter_next_mbtn_left_command=no-osd add chapter 1; + show-text ${chapter-list} 3000` + - add script-opts to define custom buttons + - change `--prefetch-playlist`'s default to `yes` + - change `--osd-back-color` and `--sub-back-color` defaults to #AF000000 + - change `--geometry` so that it no longer unconditionally moves the window + on platforms where that is possible. Use `--force-window-position` or add + `+50%+50%` to your geometry command to get the old behavior back. + - all options that take filepaths as values are now properly expanded (i.e. + ~/ -> /home/$USER) + - all commands that take filepaths as arguments are now properly expanded + (i.e. ~/ -> /home/$USER) + - add `ytdl_hook-include` script-opt + - add `video-frame-info/gop-timecode`, `video-frame-info/smpte-timecode` and + `video-frame-info/estimated-smpte-timecode` + - add `term-clip-cc` + - add `sub-ass-prune-delay` option to control libass automatic pruning of + past + - events + - add `slimbottombar` and `slimtopbar` OSC layouts optimized for viewing + images + - add `osc-fadein` script-opt + - add `mpv://` protocol + - add `metadata` sub-property for `track-list` + - add `keep_open` flag to `mp.input.get()` and `mp.input.select()` + - `mp.input.get()` now closes automatically on submit, pass `keep_open = + true` to restore the old behavior + - add `autoselect_completion` flag to `mp.input.get()` + - add `history_path` key to `mp.input.get()` + - add `hearing-impaired`, `visual-impaired` and `attached-picture` flags to + track add command + - add `format` argument to `screenshot-raw` command + - add `display-page-n-toggle` script bindings to stats.lua, where n is a + page number + - add `demuxer-mkv-crop-compat` option + - add `current-watch-later-dir` property + - add `console-scale_with_window` script-opt + - add `console-margin-x` and `console-margin-y` script-opts + - add `console-background_alpha` `console-menu_outline_size` `console- + menu_outline_color` `console-corner_radius` `console-selected_color` and + `console-selected_back_color` script-opts + - add `--video-recenter` option + - add `nvidia-true-hdr` mode to vf_d3d11vpp + - add `--sub-scale-signs` to allow `--sub-scale` to also scale events + detected to be signs by libass + - add `--script-opt` alias for `--script-opts-append` + - add `--save-watch-history` and `--watch-history-path` options + - add `--osd-selected-color` and `--osd-selected-outline-color` options + - add `--osd-bar-marker-scale` and `--osd-bar-marker-min-size` options + - add `--osd-bar-marker-style` option + - add `--input-ime` to enable or disable the IME on supported VOs (Windows, + Wayland) + - add `--clipboard-monitor` option + - add `clipboard` property + - add `current-clipboard-backend` property + - add `--clipboard-backends` option + - add `--archive-exts` + - add `archive` to `--directory-filter-types`' default + - add `--playlist-exts` + - add `playlist` to `--directory-filter-types`' default + - add --audio-exclusive option support for ao=audiounit and make non- + exclusive the new default + - `sub-blur` is now applied by `sub-ass-override=force` with new enough + libass + - `stats-font_size`, `stats-border_size`, `stats-shadow_x_offset`, `stats- + shadow_y_offset` and `stats-plot_bg_border_width` script-opt values result + in 2.5 times smaller sizes in order to have the same sizes as the values + of equivalent OSD options like `--osd-font-size`. If you customized these + sizes, multiply them by 2.5 to get the previous sizes. + - ``glsl-shader-opts`` now has predefined parameters that can be used. See + the documentation for available values. + - `--hwdec=auto` now behaves like `--hwdec=auto-safe`; use `--hwdec=auto- + unsafe` to get the old behavior back + - Change auto profiles hook priority from 50 to 5 + - add optional `frames` and `flags` arguments to `frame-step` command + controlling the direction and amount of frames mpv steps through + - add optional `mute` flag to `frame-step` command which mutes the player + during the duration of the frame step + --- mpv 0.39.0 --- + - turn `--cover-art-whitelist` into a list option + - reserve `user-data/osc` and `user-data/mpv` sub-paths for internal use + - remove deprecated `packet-video-bitrate` `packet-audio-bitrate` and + `packet-sub-bitrate` properties + - remove deprecated `--cache-dir` option alias + - remove deprecated `--cache-unlink-files` option alias + - remove deprecated `--demuxer-cue-codepage` option alias + - remove deprecated `--fps` option alias + - remove deprecated `--cdrom-device` option alias + - remove deprecated `--sub-forced-only` option alias + - remove deprecated `--vo-sixel-exit-clear` option alias + - remove deprecated `--cdda-toc-bias` option + - remove deprecated `--drm-atomic` option + - remove `sub-ass-vsfilter-aspect-compat`: use `sub-ass-use-video-data=none` + for disabling aspect compat + - remove `sub-ass-vsfilter-blur-compat`: use `sub-ass-use-video-data=aspect- + ratio` for disabling blur compat + - add `sub-ass-use-video-data` + - add `sub-ass-video-aspect-override` + - change default V keybind to cycle `sub-ass-use-video-data` instead of the + now removed `sub-ass-vsfilter-aspect-compat` + - remove `console-scale` script-opt + - remap numpad `+ - * /` keys to `KP_ADD/KP_SUBTRACT/KP_MULTIPLY/KP_DIVIDE`; + keybinds which require these numpad keys to function need to use the new + names instead + - numerical values of `--loop-file` no longer decrease on each iteration + - add `remaining-file-loops` property as a replacement to get the remaining + loop count + - numerical values of `--ab-loop-count` no longer decrease on each iteration + - add `remaining-ab-loops` property as a replacement to get the remaining + loop count + - move 'scale' above 'force' for `sub-ass-override` in documentation as well + as code. This more accurately reflects destructiveness of these options. + - change `sub-ass-override` default from 'yes' to 'scale'. This should + result in no effective changes because 'yes' used to unintentionally do + what 'scale' should've done. + - change 'u' binding to cycle between 'force' and 'scale', instead of + 'force' and 'yes' + - deprecate `sub-text-ass` property; add `sub-text/ass` sub-property + - change type of `sub-start` and `sub-end` properties to time + - change `vidscale` script option type to string for osc.lua + - change `vidscale` script option type to string for stats.lua + - change `vidscale` default from `yes` to `auto` for osc.lua and stats.lua + - change `mp.add_key_binding` so that by default, the callback is not + invoked if the event is canceled; clients should now use the `complex` + option to detect this situation + - add `canceled` entry to `mp.add_key_binding` callback argument + - add the `normalize-path` command + - add `user-data/mpv/ytdl/path` and `user-data/mpv/ytdl/json-subprocess- + result` properties + - add `track-list/N/dolby-vision-profile` and `track-list/N/dolby-vision- + level` + - add `track-list/N/decoder` + - add `sub-text/ass-full` sub-property + - add `osc-show` script message + - add `nonrepeatable` input command prefix + - add `mp.input.select()` + - add `--wasapi-exclusive-buffer` option + - add `--vf=d3d11vpp=scaling-mode` + - add `--vf=d3d11vpp=scale` + - add `--sub-border-style` and `--osd-border-style` options + - the border style does not depend on `--(sub/osd)-border-color` and + `--(sub/osd)-shadow-color`; now it depends solely on `--(sub/osd)-border- + style` + - make `--(sub/osd)-border-color` an alias of `--(sub/osd)-outline-color` + - make `--(sub/osd)-border-size` an alias of `--(sub/osd)-outline-size` + - make `--(sub/osd)-shadow-color` an alias of `--(sub/osd)-back-color`; they + cannot both be set now + - make `--osd-bar-border-size` an alias of `--osd-bar-outline-size` + - add `--show-in-taskbar` option + - add `--pitch` option + - add `--osd-playlist-entry` option + - remove `osc-playlist_media_title` script-opt + - add `--native-touch` option + - add `--input-touch-emulate-mouse` option + - add `touch-pos` property + - add `--media-controls` option + - add `--input-dragging-deadzone` option + - add `--input-builtin-dragging` option + - add `--egl-config-id` option + - add `--egl-output-format` option + - add `--directory-filter-types` + - By default, opening a directory will create a playlist with only the media + types "video, audio, image". To restore the previous behavior, use + `--directory-filter-types-clr`. + - add `--autocreate-playlist` + - add `--video-exts` + - add `--audio-exts` + - add `--image-exts` + - add `option-info//expects-file` sub-property + - Bump dependency of VapourSynth to utilize its API version 4. New minimum + VapourSynth version for runtime is R56. Some functions and plugins are + changed or removed. For details, refer to VapourSynth documentation + and + --- mpv 0.38.0 --- - add `term-size` property - add the `escape-ass` command @@ -44,7 +276,7 @@ Interface changes - add `current-gpu-context` property - add `--secondary-sub-ass-override` option - add `--input-preprocess-wheel` option - - remove shared-script-properties (user-data is a replacement) + - remove `shared-script-properties` (`user-data` is a replacement) - add `--secondary-sub-delay`, decouple secondary subtitles from `--sub-delay` - add the `--osd-bar-border-size` option @@ -64,7 +296,11 @@ Interface changes - change `--hidpi-window-scale` default to `no` - add `insert-next`, `insert-next-play`, `insert-at`, and `insert-at-play` actions to `loadfile` and `loadlist` commands - - add `index` argument to `loadfile` and `loadlist` commands + - add `index` argument to `loadlist` command + - add `index` argument to `loadfile` command. This breaks all existing + uses of this command which make use of the argument to include the list of + options to be set while the file is playing. To address this problem, the + third argument now needs to be set to -1 if the fourth argument needs to be used. - move the `options` argument of the `loadfile` command from the third parameter to the fourth (after `index`) - add `--drag-and-drop=insert-next` option @@ -212,12 +448,12 @@ Interface changes - `--save-position-on-quit` and its associated commands now store state files in the XDG_STATE_HOME directory by default. This only has an effect on linux/bsd systems. - - mpv now implictly saves cache files in XDG_CACHE_HOME by default. This only has + - mpv now implicitly saves cache files in XDG_CACHE_HOME by default. This only has an effect if the user enables options that would lead to cache being stored and only makes a difference on linux/bsd systems. - - `--cache-on-disk` no longer requires explictly setting the `--cache-dir` option + - `--cache-on-disk` no longer requires explicitly setting the `--cache-dir` option - add `--icc-cache` and `--gpu-shader-cache` options to control whether or not to - save cache files for these features; explictly setting `--icc-cache-dir` and + save cache files for these features; explicitly setting `--icc-cache-dir` and `--gpu-shader-cache` is no longer required - remove the `--tone-mapping-crosstalk` option - add `--gamut-mapping-mode=perceptual|relative|saturation|absolute|linear` @@ -359,7 +595,7 @@ Interface changes - deprecate --input-file (there are no plans to remove this short-term, but it will probably eventually go away <- that was a lie) - deprecate --video-sync=display-adrop (might be removed if it's in the way; - undeprecated or readded if it's not too much of a problem) + undeprecated or re-added if it's not too much of a problem) - deprecate all input section commands (these will be changed/removed, as soon as mpv internals do not require them anymore) - remove deprecated --playlist-pos alias (use --playlist-start) diff --git a/DOCS/man/af.rst b/DOCS/man/af.rst index 98f9a95..c1e937b 100644 --- a/DOCS/man/af.rst +++ b/DOCS/man/af.rst @@ -8,6 +8,8 @@ syntax is: Setup a chain of audio filters. See ``--vf`` (`VIDEO FILTERS`_) for the full syntax. + This is an object settings list option. See `List Options`_ for details. + .. note:: To get a full list of available audio filters, see ``--af=help``. @@ -226,10 +228,7 @@ Available filters are: using the standard ``speed`` property, not ``af-command``. ``multiply-pitch `` - Multiply the current value of ```` dynamically. For - example: 0.5 to go down by an octave, 1.5 to go up by a perfect fifth. - If you want to go up or down by semi-tones, use 1.059463094352953 and - 0.9438743126816935 + Multiply the current value of ```` dynamically. ``lavfi=graph`` Filter audio using FFmpeg's libavfilter. diff --git a/DOCS/man/ao.rst b/DOCS/man/ao.rst index 4ac1cc5..7eb7c97 100644 --- a/DOCS/man/ao.rst +++ b/DOCS/man/ao.rst @@ -10,11 +10,17 @@ syntax is: If the list has a trailing ',', mpv will fall back on drivers not contained in the list. +This is an object settings list option. See `List Options`_ for details. + .. note:: See ``--ao=help`` for a list of compiled-in audio output drivers sorted by autoprobe order. + Note that the default audio output driver is subject to change, and must + not be relied upon. If a certain AO needs to be used, it must be + explicitly specified. + Available audio output drivers are: ``alsa`` @@ -153,6 +159,9 @@ Available audio output drivers are: if mpv is not started out of the bundle, though playback with spatial audio off always works. +``audiounit`` (iOS only) + Native iOS audio output driver using ``AudioUnits`` and AudioToolbox. + ``openal`` OpenAL audio output driver. @@ -297,3 +306,18 @@ Available audio output drivers are: ``wasapi`` Audio output to the Windows Audio Session API. + + The following global options are supported by this audio output: + + ``--wasapi-exclusive-buffer=`` + Set buffer duration in exclusive mode (i.e., with + ``--audio-exclusive=yes``). ``default`` and ``min`` use the default and + minimum device period reported by WASAPI, respectively. You can also + directly specify the buffer duration in microseconds, in which case a + duration shorter than the minimum device period will be rounded up to + the minimum period. + + The default buffer duration should provide robust playback in most + cases, but reportedly on some devices there are glitches following + stream resets under the default setting. In such cases, specifying a + shorter duration might help. diff --git a/DOCS/man/commands.rst b/DOCS/man/commands.rst new file mode 100644 index 0000000..d67c367 --- /dev/null +++ b/DOCS/man/commands.rst @@ -0,0 +1,52 @@ +COMMANDS +======== + +This script allows running and completing input commands in the console +interactively, and also adds mpv's log to the console's log. + +Keybindings +----------- + +\` + Open the console to enter commands. + +Commands +-------- + +``script-binding commands/open`` + + Open the console to enter commands. + +``script-message-to commands type []`` + Show the console and pre-fill it with the provided text, optionally + specifying the initial cursor position as a positive integer starting from + 1. The console is automatically closed after running the command. + + .. admonition:: Examples for input.conf + + ``% script-message-to commands type "seek absolute-percent" 6`` + Enter a percent position to seek to. + + ``Ctrl+o script-message-to console type "loadfile ''" 11`` + Enter a file or URL to play, with autocompletion of paths in the + filesystem. + +Configuration +------------- + +This script can be customized through a config file ``script-opts/commands.conf`` +placed in mpv's user directory and through the ``--script-opts`` command-line +option. The configuration syntax is described in `mp.options functions`_. + +Configurable Options +~~~~~~~~~~~~~~~~~~~~ + +``persist_history`` + Default: no + + Whether to save the command history to a file and load it. + +``history_path`` + Default: ``~~state/command_history.txt`` + + The file path for ``persist_history`` (see `PATHS`_). diff --git a/DOCS/man/console.rst b/DOCS/man/console.rst index b9f169f..aa725b3 100644 --- a/DOCS/man/console.rst +++ b/DOCS/man/console.rst @@ -1,21 +1,23 @@ CONSOLE ======= -The console is a REPL for mpv input commands. It is displayed on the video -window. It also shows log messages. It can be disabled entirely using the -``--load-osd-console=no`` option. +This script provides the ability to process the user's textual input to other +scripts through the ``mp.input`` API. It can be displayed on both the video +window and the terminal. It can be disabled entirely using the +``--load-console=no`` option. -Keybindings ------------ +Console can either process free-form text or select from a predefined list of +items. -\` - Show the console. +Free-form text mode keybindings +------------------------------- ESC and Ctrl+[ Hide the console. ENTER, Ctrl+j and Ctrl+m - Run the typed command. + Select the first completion if one wasn't already manually selected, and run + the typed command. Shift+ENTER Type a literal newline character. @@ -76,6 +78,9 @@ PGUP PGDN Stop navigating the command history. +Ctrl+r + Search the command history. See `SELECT`_ for the key bindings in this mode. + INSERT Toggle insert mode. @@ -86,8 +91,7 @@ Shift+INSERT Paste text (uses the primary selection on X11 and Wayland). TAB and Ctrl+i - Complete the text at the cursor. The first press inserts the longest common - prefix of the completions, and subsequent presses cycle through them. + Cycle through completions. Shift+TAB Cycle through the completions backwards. @@ -95,26 +99,18 @@ Shift+TAB Ctrl+l Clear all log messages from the console. -Commands --------- - -``script-message-to console type []`` - Show the console and pre-fill it with the provided text, optionally - specifying the initial cursor position as a positive integer starting from - 1. - - .. admonition:: Examples for input.conf +MBTN_MID + Paste text (uses the primary selection on X11 and Wayland). - ``% script-message-to console type "seek absolute-percent; keypress ESC" 6`` - Enter a percent position to seek to and close the console. +WHEEL_UP + Move back in the command history. - ``Ctrl+o script-message-to console type "loadfile ''; keypress ESC" 11`` - Enter a file or URL to play. Tab completes paths in the filesystem. +WHEEL_DOWN + Move forward in the command history. Known issues ------------ -- Pasting text is slow on Windows - Non-ASCII keyboard input has restrictions - The cursor keys move between Unicode code-points, not grapheme clusters @@ -123,55 +119,99 @@ Configuration This script can be customized through a config file ``script-opts/console.conf`` placed in mpv's user directory and through the ``--script-opts`` command-line -option. The configuration syntax is described in `ON SCREEN CONTROLLER`_. - -Key bindings can be changed in a standard way, see for example stats.lua -documentation. +option. The configuration syntax is described in `mp.options functions`_. Configurable Options ~~~~~~~~~~~~~~~~~~~~ -``scale`` - Default: 1 - - All drawing is scaled by this value, including the text borders and the - cursor. - - If the VO backend in use has HiDPI scale reporting implemented, the option - value is scaled with the reported HiDPI scale. - ``font`` - Default: unset (picks a hardcoded font depending on detected platform) + The font name. - Set the font used for the REPL and the console. - This has to be a monospaced font for the completion suggestions to be - aligned correctly. + When necessary to align completions in a grid, a monospace font depending on + the platform is the default. When there are no completions, ``--osd-font`` + is the default. ``font_size`` - Default: 16 + Default: 24 - Set the font size used for the REPL and the console. This will be - multiplied by "scale". + The font size. This will be multiplied by ``display-hidpi-scale`` when the + console is not scaled with the window. ``border_size`` - Default: 1 + Default: 1.65 + + The font border size. + +``background_alpha`` + Default: 80 + + The transparency of the menu's background. Ranges from 0 (opaque) to 255 + (fully transparent). + +``padding`` + Default: 10 + + The padding of the menu. + +``menu_outline_size`` + Default: 0 + + The size of the menu's border. + +``menu_outline_color`` + Default: #FFFFFF + + The color of the menu's border. + +``corner_radius`` + Default: 8 + + The radius of the menu's corners. + +``margin_x`` + Default: same as ``--osd-margin-x`` + + The margin from the left of the window. + +``margin_y`` + Default: same as ``--osd-margin-y`` + + The margin from the bottom of the window. + +``scale_with_window`` + Default: ``auto`` + + Whether to scale the console with the window height. Can be ``yes``, ``no``, + or ``auto``, which follows the value of ``--osd-scale-by-window``. + +``selected_color`` + Default: ``#222222`` + + The color of the selected item. + +``selected_back_color`` + Default: ``#FFFFFF`` + + The background color of the selected item. + +``match_color`` + Default: ``#0088FF`` - Set the font border size used for the REPL and the console. + The color of characters that match the searched string. ``case_sensitive`` Default: no on Windows, yes on other platforms. - Whether Tab completion is case sensitive. Only works with ASCII characters. + Whether autocompletion is case sensitive. Only works with ASCII characters. ``history_dedup`` Default: true Remove duplicate entries in history as to only keep the latest one. - multiplied by "scale." ``font_hw_ratio`` Default: auto The ratio of font height to font width. - Adjusts table width of completion suggestions. + Adjusts grid width of completions. Values in the range 1.8..2.5 make sense for common monospace fonts. diff --git a/DOCS/man/encode.rst b/DOCS/man/encode.rst index 26f3d6c..c650d0f 100644 --- a/DOCS/man/encode.rst +++ b/DOCS/man/encode.rst @@ -8,7 +8,7 @@ You can encode files from one format/codec to another using this facility. ``--of=`` Specifies the output format (overrides autodetection by the file name - extension of the file specified by ``-o``). See ``--of=help`` for a full + extension of the file specified by ``--o``). See ``--of=help`` for a full list of supported formats. ``--ofopts=`` diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 6d6b64c..dcf1298 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -84,32 +84,48 @@ Key names --------- All mouse and keyboard input is to converted to mpv-specific key names. Key -names are either special symbolic identifiers representing a physical key, or a -text key names, which are unicode code points encoded as UTF-8. These are what -keyboard input would normally produce, for example ``a`` for the A key. As a -consequence, mpv uses input translated by the current OS keyboard layout, rather -than physical scan codes. +names are either special symbolic identifiers representing a physical key, or +text key names, which are Unicode code points encoded as UTF-8. These are what +keyboard input would normally produce, for example ``a`` for the A key. +These are influenced by keyboard modifiers which affect produced text, such as +shift and caps lock. As a consequence, mpv uses input translated by the current +OS keyboard layout, rather than physical scan codes. Currently there is the hardcoded assumption that every text key can be -represented as a single unicode code point (in NFKC form). +represented as a single Unicode code point (in NFKC form). All key names can be combined with the modifiers ``Shift``, ``Ctrl``, ``Alt``, ``Meta``. They must be prefixed to the actual key name, where each modifier is followed by a ``+`` (for example ``ctrl+q``). -The ``Shift`` modifier requires some attention. For instance ``Shift+2`` should -usually be specified as key-name ``@`` at ``input.conf``, and similarly the -combination ``Alt+Shift+2`` is usually ``Alt+@``, etc. Special key names like -``Shift+LEFT`` work as expected. If in doubt - use ``--input-test`` to check -how a key/combination is seen by mpv. +.. note:: + + The ``Shift`` modifier requires some attention. In general, when the + ``Shift`` modifier is combined with a key which produces text, the actual + produced text key name when shift is pressed should be used. + + For instance, on the US keyboard layout, ``Shift+2`` should usually be + specified as key-name ``@`` at ``input.conf``, and similarly the + combination ``Alt+Shift+2`` is usually ``Alt+@``, etc. + + In general, the ``Shift`` modifier, when specified with text key names, + is ignored: for instance, mpv interprets ``Shift+2`` as ``2``. + The only exceptions are ASCII letters, which are normalized by mpv. + For example, ``Shift+a`` is interpreted as ``A``. + + Special key names like ``Shift+LEFT`` work as expected. + If in doubt - use ``--input-test`` to check how a key/combination is seen + by mpv. Symbolic key names and modifier names are case-insensitive. Unicode key names -are case-sensitive because input bindings typically respect the shift key. +are case-sensitive just like how keyboard text input would produce. -Another type of key names are hexadecimal key names, that serve as fallback -for special keys that are neither unicode, nor have a special mpv defined name. -They will break as soon as mpv adds proper names for them, but can enable you -to use a key at all if that does not happen. +Another type of key names are hexadecimal key names, which start with ``0x``, +followed by the hexadecimal value of the key. The hexadecimal value can be +either a Unicode code point value, or can serve as fallback for special keys +that do not have a special mpv defined name. They will break as soon as mpv +adds proper names for them, but can enable you to use a key at all if that +does not happen. All symbolic names are listed by ``--input-keylist``. ``--input-test`` is a special mode that prints all input on the OSD. @@ -131,7 +147,10 @@ Comments on some symbolic names: ``MBTN*`` are aliases for ``MOUSE_BTN*``. ``WHEEL_*`` - Mouse wheels (typically). + Mouse wheels and touch pads (typically). + + These key are scalable when used with scalable commands if the underlying + device supports high-resolution scrolling (e.g. touch pads). ``AXIS_*`` Deprecated aliases for ``WHEEL_*``. @@ -261,10 +280,8 @@ Don't add those to the actual command. Optional arguments are enclosed in Remember to quote string arguments in input.conf (see `Flat command syntax`_). -``ignore`` - Use this to "block" keys that should be unbound, and do nothing. Useful for - disabling default bindings, without disabling all bindings with - ``--input-default-bindings=no``. +Playback Control +~~~~~~~~~~~~~~~~ ``seek []`` Change the playback position. By default, seeks by a relative amount of @@ -295,6 +312,9 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_). 3rd parameter (essentially using a space instead of ``+``). The 3rd parameter is still parsed, but is considered deprecated. + This is a scalable command. See the documentation of ``nonscalable`` input + command prefix in `Input Command Prefixes`_ for details. + ``revert-seek []`` Undoes the ``seek`` command, and some other commands that seek (but not necessarily all of them). Calling this command once will jump to the @@ -316,21 +336,79 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_). Using it without any arguments gives you the default behavior. -``frame-step`` - Play one frame, then pause. Does nothing with audio-only playback. +``sub-seek []`` + Change video and audio position such that the subtitle event after + ```` subtitle events is displayed. For example, ``sub-seek 1`` skips + to the next subtitle, ``sub-seek -1`` skips to the previous subtitles, and + ``sub-seek 0`` seeks to the beginning of the current subtitle. -``frame-back-step`` - Go back by one frame, then pause. Note that this can be very slow (it tries - to be precise, not fast), and sometimes fails to behave as expected. How - well this works depends on whether precise seeking works correctly (e.g. - see the ``--hr-seek-demuxer-offset`` option). Video filters or other video + This is similar to ``sub-step``, except that it seeks video and audio + instead of adjusting the subtitle delay. + + Secondary argument: + + primary (default) + Seeks through the primary subtitles. + secondary + Seeks through the secondary subtitles. + + For embedded subtitles (like with Matroska), this works only with subtitle + events that have already been displayed, or are within a short prefetch + range. See `Cache`_ for details on how to control the available prefetch range. + + +``frame-step [] []`` + Go forward or backwards by a given amount of frames. If ```` is + omitted, the value is assumed to be ``1``. + + The second argument consists of flags controlling the frameskip mode: + + play (default) + Play the video forward by the desired amount of frames and then pause. + This only works with a positive value (i.e. frame stepping forwards). + seek + Perform a very exact seek that attempts to seek by the desired amount + of frames. If ```` is ``-1``, this will go exactly to the + previous frame. + mute + The same as ``play`` but mutes the audio stream if there is any during + the duration of the frame step. + + Note that the default frameskip mode, play, is more accurate but can be + slow depending on how many frames you are skipping (i.e. skipping forward + 100 frames will play 100 frames of video before stopping). This mode only + works when going forwards. Frame stepping back always performs a seek. + + When using seek mode, this can still be very slow (it tries to be precise, + not fast), and sometimes fails to behave as expected. How well this works + depends on whether precise seeking works correctly (e.g. see the + ``--hr-seek-demuxer-offset`` option). Video filters or other video post-processing that modifies timing of frames (e.g. deinterlacing) should - usually work, but might make backstepping silently behave incorrectly in + usually work, but might make framestepping silently behave incorrectly in corner cases. Using ``--hr-seek-framedrop=no`` should help, although it - might make precise seeking slower. + might make precise seeking slower. Also if the video is VFR, framestepping + using seeks will probably not work correctly except for the ``-1`` case. This does not work with audio-only playback. +``frame-back-step`` + Calls ``frame-step`` with a value of ``-1`` and the ``seek`` flag. + + This does not work with audio-only playback. + +``stop []`` + Stop playback and clear playlist. With default settings, this is + essentially like ``quit``. Useful for the client API: playback can be + stopped without terminating the player. + + The first argument is optional, and supports the following flags: + + keep-playlist + Do not clear the playlist. + +Property Manipulation +~~~~~~~~~~~~~~~~~~~~~ + ``set `` Set the given property or option to the given value. @@ -341,6 +419,17 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_). Add the given value to the property or option. On overflow or underflow, clamp the property to the maximum. If ```` is omitted, assume ``1``. + Whether or not key-repeat is enabled by default depends on the property. + Currently properties with continuous values are repeatable by default (like + ``volume``), while discrete values are not (like ``osd-level``). + + This is a scalable command. See the documentation of ``nonscalable`` input + command prefix in `Input Command Prefixes`_ for details. + +``multiply `` + Similar to ``add``, but multiplies the property or option with the numeric + value. + ``cycle []`` Cycle the given property or option. The second argument can be ``up`` or ``down`` to set the cycle direction. On overflow, set the property back to @@ -351,58 +440,43 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_). Currently properties with continuous values are repeatable by default (like ``volume``), while discrete values are not (like ``osd-level``). -``multiply `` - Similar to ``add``, but multiplies the property or option with the numeric - value. - -``screenshot `` - Take a screenshot. + This is a scalable command. See the documentation of ``nonscalable`` input + command prefix in `Input Command Prefixes`_ for details. - Multiple flags are available (some can be combined with ``+``): +``cycle-values [<"!reverse">] [ [...]]`` + Cycle through a list of values. Each invocation of the command will set the + given property to the next value in the list. The command will use the + current value of the property/option, and use it to determine the current + position in the list of values. Once it has found it, it will set the + next value in the list (wrapping around to the first item if needed). - (default) - Save the video image, in its original resolution, and with subtitles. - Some video outputs may still include the OSD in the output under certain - circumstances. -