Compare commits

..
40 Commits
Author SHA1 Message Date
sfan5 140ec21c89 Release 0.35.1 2023-01-28 17:49:47 +01:00
Sultan Alsawaf db524988b1 x11: remove PresentNotifyMSC from egl/glx/vulkan to fix xpresent timing
PresentNotifyMSC turns out to be not only redundant, but also harmful with
mesa-backed egl/glx/vulkan VOs because for all of them, mesa uses
PresentPixmap behind the scenes when DRI3 is available, which already
spawns a PresentCompleteNotify event when the buffer swap actually
finishes. This is important because without using the timing information
from these PresentCompleteKindPixmap events, there's no way for mpv to know
exactly when a frame becomes visible on the display.

By using PresentNotifyMSC in conjunction with DRI3-enabled mesa, two
problems are created:
1. mpv assumes that a vblank won't elapse (i.e., it assumes the current MSC
   won't change) between the time when mesa enqueues the buffer swap and
   the time when mpv calls PresentNotifyMSC to ask xorg for a notification
   at the next MSC, relative to the current MSC at the time that xorg reads
   it for the PresentNotifyMSC call. This means that mpv could get a
   notification one or more vblanks later than it expects, since the
   intention here is for mpv to get a notification at the MSC that the
   buffer swap completes.
2. mpv assumes that a buffer swap always takes one vblank to complete,
   which isn't always true. A buffer swap (i.e., a page flip) could take
   longer than that depending on hardware conditions (if the GPU is running
   slowly or needs to exit a low-power state), scheduling delays (under
   heavy system or GPU load), or unfortunate timing (if the raster scan
   line happens to be at one of the last few rows of pixels and a vblank
   elapses just before the buffer swap is enqueued).

This causes mpv to have a faulty assumption of when frames become visible.

Since mpv already receives the PresentCompleteNotify events generated by
mesa's buffer swaps under the hood, the PresentNotifyMSC usage is unneeded
and just throws a wrench in mpv's vsync timing when xpresent is enabled.

Simply removing the PresentNotifyMSC usage from the egl, glx, and vulkan
VOs fixes the xpresent vsync timing.
2023-01-28 17:42:34 +01:00
8e2dc8b02b vo_gpu: implement VO_DR_FLAG_HOST_CACHED
For OpenGL, this is based on simply comparing GL_VENDOR strings against
a list of allowed vendors.

Co-authored-by: Nicolas F. <[email protected]>
Co-authored-by: Niklas Haas <[email protected]>
2023-01-24 16:40:38 +01:00
Niklas Haas 16c0ac226a vo_gpu_next: implement VO_DR_FLAG_HOST_CACHED
For sufficiently new versions of libplacebo.
2023-01-24 16:40:37 +01:00
01374b6830 vd_lavc: add "auto" choice for vd-lavc-dr
--vd-lavc-dr defaulted to "yes", which caused issues on certain
hardware. Instead of disabling it, add a new "auto" value and
make it the default.

The "auto" choice will enable DR only when we can request host-cached
buffers (as signalled by the new VO_DR_FLAG_HOST_CACHED).

Co-authored-by: Nicolas F. <[email protected]>
Co-authored-by: Niklas Haas <[email protected]>
2023-01-24 16:40:37 +01:00
Niklas Haas fc115bce2c vo: add int flags to the get_image signature
This is a huge disgusting mess to thread through everywhere. Maybe I'm
stupid for attempting to solve the problem this way.
2023-01-24 16:40:37 +01:00
Niklas Haas b64f9fe646 mp_image: fix XYZ primaries default
This was incorrectly set to BT.2020, when it should be DCI-P3 for pretty
much all real-world XYZ content (which is digital cinema content).
2023-01-24 16:40:37 +01:00
Dudemanguy 3813cc4a14 wayland: store presentation feedbacks in a pool
Officially, the most cursed part of the wayland code in mpv (third or
fourth try now?) This time, let's allocate a pool during init
(arbitrarily set to the maximum swapchain length mpv allows, 8; don't
even know if this actually works in wayland). Then we add/remove
feedbacks from the pool during the lifecycle of the VO, and clean it up
all at the end. Hopefully, this does the trick for good this time.
2023-01-24 16:40:37 +01:00
Dudemanguy 8ddc0e8888 audio: fix crash during uninit on ao_lavc
The buffer state can be null when using --ao=lavc, so just check it
first. Fixes #10175.
2023-01-24 16:39:33 +01:00
Ionen Wolkens 46cd82a68d meson: also search for rst2html with .py extension
This allows using rst2html.py from docutils if present, this
was already done for rst2man.py (unneeded for rst2pdf).
2023-01-24 16:39:33 +01:00
sfan5 222f9c5635 ra_d3d11: fix incorrect type
As it happens, `SIZE_T` and `size_t` are not the same length on 32-bit Windows
2023-01-24 16:39:33 +01:00
Dudemanguy c5e4d65e71 vo_wlshm: cleanup on failure
If failure occurs during preinit, vo_wlshm should goto an error and
cleaup itself like the other VOs.
2023-01-24 16:39:33 +01:00
Christoph Reiter 9f6e1b3ba1 vulkan: fix build error for 32bit builds with clang
vk->surface is a handle and not a pointer, so assign VK_NULL_HANDLE.
This fixes the following build error on 32bit Windows when using clang for example,
which errors out when assigning a 32bit pointer to a 64bit integer:

  ../mpv-0.35.0/video/out/vulkan/utils.c:37:21:
    error: incompatible pointer to integer conversion assigning to 'VkSurfaceKHR' (aka 'unsigned long long') from 'void *' [-Wint-conversion]
          vk->surface = NULL;
                      ^ ~~~~
2023-01-24 16:39:33 +01:00
Dudemanguy 688a321dbb version.py/version.sh: bump copyright year 2023-01-24 16:39:33 +01:00
Simon Ruderich 46d3dc2a42 demux: boost read EBU R128 gain values to ReplayGain's reference level
Without this change the same track encoded as Opus - which requires R128
tagging - and e.g. Vorbis with ReplayGain tagging have different volumes.
This is caused by ReplayGain 2 having a higher reference level of -18 dB
LUFS, while EBU R128 has a lower reference level of -23 dB LUFS.

For the results of gain application to match, the read EBU R128
values need to be boosted according to the difference in reference
levels.

Patch inspired by mpd's source code.
2023-01-24 16:39:33 +01:00
Dudemanguy 5436852bf5 wayland: initalize display_fd as -1
In the event of a failed wayland initalization, the display_fd is
actually 0 instead of -1 which would correctly indicate it doesn't
exist. Also move the fd check inside vo_wayland_dispatch_events since
that function shouldn't ever do anything if we don't actually have a
display fd.
2023-01-24 15:56:57 +01:00
Dudemanguy 6076691b94 draw_bmp: ensure last slice width is less than total width
e97819f88e corrected a special case
condition that lead to an out of bounds access if the total width
happened to be an integer multiple of SLICE_W (256) which could cause a
crash in software VOs. However, it turns out that the functions in this
file evaluate quite differently when using encoding mode (and presumably
libmpv as well according to reports although I could not independently
verify it).

The logic here gets complicated but what ends up happening is that, in
blend_overlay_with_video, the value of x + w can be greater than p->w in
certain cases in encoding mode. The x is the positional value of the
slice which remained unchanged from before, but w can take the full
value of SLICE_W (256) which is not necessarily correct. The width of
the final slice here should be the total remaining width. We can handle
this in mark_rect by simply always adjusting x1 of the last slice to be
equal to total width - SLICE_W * x so it can never extend beyond where
it should be. In practice, this value should be the maximum allowed
here. I'm not sure if the existing x1 value can possibly already be
lower than SLICE_W, but just MPMIN it to be on the safe side.
Fixes #10908.
2023-01-24 15:56:57 +01:00
repojohnray b963113c00 vo: hwdec: fix drmGetDeviceNameFromFd2() related memory leak
This commit fixes a minor memory leak related to drmGetDeviceNameFromFd2().
This function returns a string allocated with strdup().
2023-01-24 15:56:57 +01:00
repojohnray fd279c9a2a hwdec_drmprime: fix memory leak 2023-01-24 15:56:56 +01:00
Li Chang ec2a9d4332 ao_coreaudio: use AudioUnitReset as ao_driver.reset to prevent long restart
[motivation]
Seeking on MacOS appears to be lagged when users connect
to wireless audio output (airpods for example).

This commit attempts to fix mpv-player/mpv#10270

[observation]
1. When using other media player (VLC to be exact) simultaneously,
the lagging on seek disappear. We could guess that the AudioDevice
is on some sort of "warm-up" state.

See mpv-player/mpv#9243 for detailed description.

2. `AudioOutputUnitStart` takes significant longer time after each seek
or pause/play when using wireless output devices compares to wired devices.

[rationale]
After investigate codes in ao_coreaudio.c, it appears that the the `stop`
function was used as `ao_driver.reset` function. Therefore every seek
and pause would call `AudioOutputUnitStop`.

It turns out that `ao_driver.reset` function is used in `ao_reset`.
And `ao_reset` function is used to clean up the state of current `ao`
so I think `AudioUnitReset` is more proper than `AudioOutputUnitStop`
under this semantics.

Since ao_coreaudio use pull base mechanism, audio playback behaviors
upon pause/seek could be handled by callback function
(streaming silence when paused) so there is no need to stop AudioUnit when resetting.
Therefore using `AudioUnitReset` as `ao_driver.reset` looks proper.

Additionally, after using proper reset, the AudioUnit that represents
hardware I/O devices doesn't need to be restart everytime seek/pause actions happen.
Restarting wireless devices simply takes longer in MacOS which is
the root cause of lagging observed by users when they seek or pause/play media.

[method]
Use `AudioUnitReset` for ao_driver.reset.
2023-01-24 15:56:56 +01:00
Kacper Michajłow 666201d716 vo_opengl: do not blindly reject all Microsoft's OpenGL implementations
This change enables mpv to work in the WSL2 (WSLg) environment where
OpenGL is implemented on top of D3D12.

This reverts commit 149d98d244.

Mentioned OpenGL implementation (GDI Generic) in the original change
will be rejected by version check, so there is no need to handle it
manually.

Signed-off-by: Kacper Michajłow <[email protected]>
2023-01-24 15:56:56 +01:00
Nicolas F daf9a3c971 external_files: set log level for potential files to trace
We ask users to freely share log files with us, which is usually
okay, unless a user has some unrelated and potentially embarrassing
files in their working directory. These would show up in the debug
level message output that --log-file enables.

Change the listing of potential external files to trace log level,
to save the users and the developers the embarrassment.
2023-01-24 15:56:56 +01:00
chen70 b960de5fe3 hwdec/d3d11va: fix a possible memory leak 2023-01-24 15:56:56 +01:00
garamond13 c0fa12c958 filter_kernels: fix kaiser
Seems to me that params[1] is set to NAN and here should be the same value as in params[0].
2023-01-24 15:56:56 +01:00
Thomas Weißschuh 7753a73a17 ao_pipewire: clean up when hotplug_init fails 2023-01-24 15:56:56 +01:00
Thomas Weißschuh dadcb2e614 ao_pipewire: destroy context on connection failure 2023-01-24 15:56:56 +01:00
Thomas Weißschuh f8b7170871 ao_pipewire: free properties on failure 2023-01-24 15:56:56 +01:00
rcombs 71346393e2 ao_coreaudio: use device's nominal sample rate for latency properties
Fixes sync issues when using high-latency devices at non-native sample rates

Closes #10984
2023-01-24 15:56:56 +01:00
Dudemanguy ae7ee7417f wayland: check for resize/move in touch event first
8300830951 rearranged/simplified some of
the wayland touch code mainly because what was there before was
completely broken on my machine in those days (dragging was unreliable,
resizing was really buggy, etc.). However, one user said that touch
input no longer worked for him after that change. I could not ever
reproduce it, but it seems the issue was putting down the key before
testing for resize/move in the code. Now who knows why this actually
matters, but apparently it works for the user in question and I don't
observe any unexpected behavior on my end when swapping the order. Like
the mouse/pointer code, we also now do a test for dragging before
actually trying a resize/move which is a little more consistent than
before. Fixes #9771.
2023-01-24 15:56:56 +01:00
Dudemanguy 74baedffec osc: don't spam window-controls bindings on every render
Not sure when this actually started happening, but it's probably been
like this for years. Currently, the logic for the window-controls works
by simply checking if the osc is visible and then either enabling or
disabling the associated keybindings. The problem is that this can just
constantly spam mp.enable_keybindings/disable_key_bindings on every
single render call if the user disables the border at any point in time.
This does a lot of pointless work and also results in the logs being
spammed with lines like "disable-section". Clearly, this should just
work like the code for checking the input keybindings just above it.
Keep track of an internal state variable and check when it doesn't match
the osc visibility. In that case, we can then either enable or disable
the key bindings and just update the variable.
2023-01-24 15:56:56 +01:00
Thomas Weißschuh 495206dd41 ao_pipewire: log sample queueing
This allows us to more easily see the datapath from mpv to pipewire.

We know how often the callbacks are triggered, how big the buffers are
and how much data mpv provides to pipewire.
2023-01-24 15:56:56 +01:00
Dudemanguy 37869fbcd7 meson: fix stdatomic detection on bsd
BSDs use compiler-rt instead of libatomic for atomic types. In this
case, we can handle it similar to how dl is detected. Check for the
library (allowing for it to fail), and then check for a header symbol
while linking latomic. Fixes #10906.
2023-01-24 15:56:56 +01:00
Niklas Haas 954d53612c lcms: fix validate_3dlut_size_opt
Not only was this function needlessly convoluted, it was also broken -
since it returned a bool value where an error code was expected.
2023-01-24 15:56:56 +01:00
Niklas Haas 6860343a25 lcms: always parse lcms2-related options
Currently, the lcms-related options are only defined when lcms2 is
enabled at build time. However, this causes issues (e.g. segfault) for
vo_gpu_next, which relies on the presence of these options (to forward
them to libplacebo).

(That libplacebo internally depends on lcms2 as well is an
implementation detail - compiling mpv *without* lcms against libplacebo
*with* lcms should be possible in principle)

Fixes: #10891
Closes: #10856
2023-01-24 15:56:56 +01:00
Dudemanguy f5ce1fbf44 meson: unbreak dl check on BSDs without libdl
Regression from 1835dfc05c. The actual
libdl dependency is not always required for the function symbol check.
Fixes #10901.
2023-01-24 15:56:56 +01:00
Dudemanguy 214e47854a meson: prepend MPV_CONFDIR path with prefix
Meson uses the sysconfdir option for setting the global config
directory. This conveniently defaults to /etc if the prefix is set to
/usr which is nice for linux distros. BSDs tend to use /usr/local which
causes this value to become 'etc' by default which is not an absolute
path so you would need to set something like -Dsysconfdir=/usr/local/etc
as well in the configuration step. It turns out we can have our cake and
eat it too by just joining the paths of prefix and sysconfdir together.
In the case where -Dprefix=/usr, this still results in /etc/mpv as the
path since the path joining logic just drops the leading '/usr/'. For
the /usr/local case, it ends up as /usr/local/etc/mpv as expected. This
fixes #10882.
2023-01-24 15:56:56 +01:00
Niklas Haas 5fb7a23d37 vo_gpu_next: fix undefined behavior on alpha-first formats
When the alpha channel is the first component, this code block gets
skipped by the continue, meaning the check for c==0 never passes.

Fix it by explicitly keeping track of whether bits have been set.
2023-01-24 15:56:56 +01:00
Dudemanguy f593186e7d wayland: also log refresh rate on surface entrance
Never bothered to log this for some reason, but it's pretty convenient
when debugging.
2023-01-24 15:56:56 +01:00
Dudemanguy 5149805f6b wayland: error out if essential protocol support is missing
Related issue: #10868. While most protocols are in theory optional, a
small amount of them are absolutely essential and nothing will work
without them. We should make sure to error out in those cases and not
try to actually do anything. For wayland support in general,
wl_compositor support is obviously required. If there is no wl_surface,
you can't do anything. Additionally, vo_wlshm quite obviously requires
wl_shm so mark that one as well. vo_dmabuf_wayland needs linux_dmabuf,
viewporter, wl_shm, and wl_subcompositor. In practice, these are all
very standard protocols and shouldn't be missing but the linked issue
above is at least one example where a compositor was stuck on an ancient
version of a wayland interface.
2023-01-24 15:56:56 +01:00
Thomas Weißschuh af1e00b2ce ao_pipewire: log version information and metadata 2023-01-24 15:56:56 +01:00
809 changed files with 39962 additions and 72136 deletions

No files matched your search

-13
View File
@@ -8,16 +8,3 @@ charset = utf-8
insert_final_newline = true
indent_style = space
indent_size = 4
max_line_length = 80
trim_trailing_whitespace = true
[.git/COMMIT*]
max_line_length = 72
[{osdep/dirent-win.h,TOOLS/osxbundle/mpv.app/Contents/PkgInfo,TOOLS/osxbundle/mpv.app/Contents/Resources/Assets.car}]
charset = unset
insert_final_newline = unset
indent_style = unset
indent_size = unset
max_line_length = unset
trim_trailing_whitespace = unset
-7
View File
@@ -1,7 +0,0 @@
{
"Format": "github-actions",
"Disable": {
"IndentSize": true,
"MaxLineLength": true
}
}
+16
View File
@@ -0,0 +1,16 @@
---
name: 'README: DO NOT IGNORE OR DELETE THE ISSUE TEMPLATE'
about: 'Chose and fill out one of the following templates!'
title: ''
labels: priority:ignored-issue-template
assignees: ''
---
We ask you to not ignore the issue template. Fill it out as good and correct as
possible. Issues that don't adhere to our request will be closed for ignoring
the issue template. This is because analyzing a bug without a log file is harder
than necessary. Low quality bug reports are noise.
Please go back and chose the proper issue template. Opening issues with this
template will be closed immediately.
@@ -0,0 +1,49 @@
---
name: 'Report a Linux Issue'
about: 'Create a report for a runtime related Linux Issue'
title: ''
labels: 'os:linux'
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- Linux Distribution and Version
- Source of the mpv binary
- If known which version of mpv introduced the problem
- Window Manager and version
- GPU driver and version
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v -v or --log-file=output.txt, paste it to
https://0x0.st/ or attach it to the github issue, and replace this text with a
link to it.
The issue will be closed for ignoring the issue template.
### Sample files
Sample files needed to reproduce this issue can be uploaded to https://0x0.st/
or similar sites. (Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
@@ -1,151 +0,0 @@
name: "Report a Linux Issue"
description: "Create a report for a runtime related Linux Issue"
labels: ["os:linux"]
type: Bug
body:
- type: textarea
attributes:
label: "mpv Information"
placeholder: |
mpv v0.38.0-96-gf776be6af5 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on May 5 2024 18:37:43
libplacebo version: v7.349.0 (v6.338.0-120-g7b294350)
FFmpeg version: 6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
description: |
Provide the output of `mpv --version`.
render: bash
validations:
required: false
- type: textarea
attributes:
label: "Other Information"
description: >
Provide following information if applicable.
- Linux Version: `cat /etc/os-release | grep "NAME"`
- Kernel Version: `uname -a`
- GPU Model: `lspci -nn | grep VGA` or `lshw -C display -numeric`
- Mesa/GPU Driver Version: `glxinfo -B | grep "OpenGL version string"` or `vulkaninfo | grep driverInfo`
- Window Manager and Version
- Source of the mpv binary
- Latest version of mpv you know without the problem
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- Linux version:
- Kernel Version:
- GPU Model:
- Mesa/GPU Driver Version:
- Window Manager and Version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:
render: text
validations:
required: true
- type: textarea
attributes:
label: "Reproduction Steps"
description: >
Try to reproduce your issue with `--no-config` first. If it isn't reproducible
with `--no-config` try to find out which option or script causes your issue.
If the issue is render performance-related, try to reproduce it with `--no-config
--profile=fast`, which is designed to work on lower-end mobile devices.
For decoding performance-related issues, additionally try to enable hardware
decoding with `--hwdec=yes` or the `Ctrl+h` shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Make a log file with `--gpu-debug --log-file=output.txt`, which is our preferred way, and
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
In the case of a crash, please provide a [backtrace](https://wiki.archlinux.org/title/Debugging/Getting_traces).
Without the log file, this issue will be closed for ignoring the issue template.
Disclaimer: The log file may contain identifiable information, such as your username.
Review the log file before sharing and redact any sensitive data if necessary.
validations:
required: true
- type: textarea
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files for a minimal reproduction case, if the issue can't be
reproduced without it or it is helpful to demonstrate the issue.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of files, parameters, and conditions
used in "Reproduction Steps", with the addition of `--log-file=output.txt`.
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
- label: "I attached the backtrace in the case of a crash."
required: true
@@ -0,0 +1,51 @@
---
name: 'Report a macOS Issue'
about: 'Create a report for a runtime related macOS Issue'
title: ''
labels: 'os:mac'
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- macOS Version
- Source of the mpv binary or bundle
- If known which version of mpv introduced the problem
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v -v or --log-file=output.txt. If you use the Bundle
from a version later than 0.32 a default log is created for your last run at
~/Library/Logs/mpv.log. You can jump to that file via the Help > Show log File…
menu. Paste the log to https://0x0.st/ or attach it to the github issue, and
replace this text with a link to it.
In the case of a crash please provide the macOS Crash Report (Backtrace).
The issue will be closed for ignoring the issue template.
### Sample files
Sample files needed to reproduce this issue can be uploaded to https://0x0.st/
or similar sites. (Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
@@ -1,146 +0,0 @@
name: "Report a macOS Issue"
description: "Create a report for a runtime related macOS Issue"
labels: ["os:mac"]
type: Bug
body:
- type: textarea
attributes:
label: "mpv Information"
placeholder: |
mpv v0.38.0-96-gf776be6af5 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on May 5 2024 18:37:43
libplacebo version: v7.349.0 (v6.338.0-120-g7b294350)
FFmpeg version: 6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
description: |
Provide the output of `mpv --version`.
render: bash
validations:
required: false
- type: textarea
attributes:
label: "Other Information"
description: >
- macOS Version: `system_profiler SPSoftwareDataType | sed -rn 's/^ *System Version: (.*$)/\1/p'`
- Source of the mpv binary or bundle
- Latest version of mpv you know without the problem
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Nightly builds from master can be found [here](https://github.com/mpv-player/mpv/actions/workflows/build.yml?query=branch%3Amaster+event%3Apush),
click on the latest workflow run, scroll down to the Artifacts section and download the
appropriate build. Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- macOS version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:
render: text
validations:
required: true
- type: textarea
attributes:
label: "Reproduction Steps"
description: >
Try to reproduce your issue with `--no-config` first. If it isn't reproducible
with `--no-config` try to find out which option or script causes your issue.
If the issue is render performance-related, try to reproduce it with `--no-config
--profile=fast`, which is designed to work on lower-end mobile devices.
For decoding performance-related issues, additionally try to enable hardware
decoding with `--hwdec=yes` or the `Ctrl+h` shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Make a log file with `--gpu-debug --log-file=output.txt`, which is our preferred way, and
attach it to the issue. If you use the Bundle, a default log is created for your last run
at `~/Library/Logs/mpv.log`. You can jump to that file via the `Help > Show log File…` menu.
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
In the case of a crash, please provide the macOS Crash Report or create a [backtrace](https://developer.apple.com/library/archive/documentation/General/Conceptual/lldb-guide/chapters/C5-Examining-The-Call-Stack.html)
yourself.
Without the log file, this issue will be closed for ignoring the issue template.
Disclaimer: The log file may contain identifiable information, such as your username.
Review the log file before sharing and redact any sensitive data if necessary.
validations:
required: true
- type: textarea
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files for a minimal reproduction case, if the issue can't be
reproduced without it or it is helpful to demonstrate the issue.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of files, parameters, and conditions
used in "Reproduction Steps", with the addition of `--log-file=output.txt`.
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
- label: "I attached the backtrace in the case of a crash."
required: true
@@ -0,0 +1,47 @@
---
name: 'Report a Windows Issue'
about: 'Create a report for a runtime related Windows Issue'
title: ''
labels: 'os:win'
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- Windows Version
- Source of the mpv binary
- If known which version of mpv introduced the problem
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v -v or --log-file=output.txt, paste it to
https://0x0.st/ or attach it to the github issue, and replace this text with a
link to it.
The issue will be closed for ignoring the issue template.
### Sample files
Sample files needed to reproduce this issue can be uploaded to https://0x0.st/
or similar sites. (Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
@@ -1,147 +0,0 @@
name: "Report a Windows Issue"
description: "Create a report for a runtime related Windows Issue"
labels: ["os:win"]
type: Bug
body:
- type: textarea
attributes:
label: "mpv Information"
placeholder: |
mpv v0.38.0-96-gf776be6af5 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on May 5 2024 18:37:43
libplacebo version: v7.349.0 (v6.338.0-120-g7b294350)
FFmpeg version: 6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
description: |
Provide the output of `mpv --version`.
render: bash
validations:
required: false
- type: textarea
attributes:
label: "Other Information"
description: >
- Windows Version: `cmd /c ver`
- GPU model, driver and version
- Source of the mpv binary
- Latest version of mpv you know without the problem
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Nightly builds from master can be found [here](https://github.com/mpv-player/mpv/actions/workflows/build.yml?query=branch%3Amaster+event%3Apush),
click on the latest workflow run, scroll down to the Artifacts section and download the
appropriate build. Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- Windows version:
- GPU model, driver and version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:
render: text
validations:
required: true
- type: textarea
attributes:
label: "Reproduction Steps"
description: >
Try to reproduce your issue with `--no-config` first. If it isn't reproducible
with `--no-config` try to find out which option or script causes your issue.
If the issue is render performance-related, try to reproduce it with `--no-config
--profile=fast`, which is designed to work on lower-end mobile devices.
For decoding performance-related issues, additionally try to enable hardware
decoding with `--hwdec=yes` or the `Ctrl+h` shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Make a log file with `--gpu-debug --log-file=output.txt`, which is our preferred way, and
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
In the case of a crash, please provide a backtrace, attach the appropriate `.dmp` file
from `%LOCALAPPDATA%\CrashDumps`.
Without the log file, this issue will be closed for ignoring the issue template.
Disclaimer: The log file may contain identifiable information, such as your username.
Review the log file before sharing and redact any sensitive data if necessary.
validations:
required: true
- type: textarea
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files for a minimal reproduction case, if the issue can't be
reproduced without it or it is helpful to demonstrate the issue.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of files, parameters, and conditions
used in "Reproduction Steps", with the addition of `--log-file=output.txt`.
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
- label: "I attached the backtrace in the case of a crash."
required: true
+43
View File
@@ -0,0 +1,43 @@
---
name: 'Report a different Issue'
about: 'Create a report for a runtime related Issue'
title: ''
labels: ''
assignees: ''
---
### Important Information
Provide following Information:
- mpv version
- Platform and Version
- Source of the mpv binary
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v -v or --log-file=output.txt, paste it to
https://0x0.st/ or attach it to the github issue, and replace this text with a
link to it.
### Sample files
Sample files needed to reproduce this issue can be uploaded to https://0x0.st/
or similar sites. (Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
-144
View File
@@ -1,144 +0,0 @@
name: "Report an Issue on other platforms"
description: "Create a report for a runtime related Issue on other platforms"
labels: []
type: Bug
body:
- type: textarea
attributes:
label: "mpv Information"
placeholder: |
mpv v0.38.0-96-gf776be6af5 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on May 5 2024 18:37:43
libplacebo version: v7.349.0 (v6.338.0-120-g7b294350)
FFmpeg version: 6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
description: |
Provide the output of `mpv --version`.
render: bash
validations:
required: false
- type: textarea
attributes:
label: "Important Information"
description: >
- Platform and Version
- GPU model, driver and version
- Source of the mpv binary
- Latest version of mpv you know without the problem
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- Platform version:
- GPU model, driver and version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:
render: text
validations:
required: true
- type: textarea
attributes:
label: "Reproduction Steps"
description: >
Try to reproduce your issue with `--no-config` first. If it isn't reproducible
with `--no-config` try to find out which option or script causes your issue.
If the issue is render performance-related, try to reproduce it with `--no-config
--profile=fast`, which is designed to work on lower-end mobile devices.
For decoding performance-related issues, additionally try to enable hardware
decoding with `--hwdec=yes` or the `Ctrl+h` shortcut.
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Make a log file with `--gpu-debug --log-file=output.txt`, which is our preferred way, and
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
In the case of a crash, please provide a backtrace.
Without the log file, this issue will be closed for ignoring the issue template.
Disclaimer: The log file may contain identifiable information, such as your username.
Review the log file before sharing and redact any sensitive data if necessary.
validations:
required: true
- type: textarea
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files for a minimal reproduction case, if the issue can't be
reproduced without it or it is helpful to demonstrate the issue.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of files, parameters, and conditions
used in "Reproduction Steps", with the addition of `--log-file=output.txt`.
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
- label: "I attached the backtrace in the case of a crash."
required: true
@@ -0,0 +1,30 @@
---
name: 'Report a build Problem'
about: 'Create a report for a build related Issue'
title: ''
labels: 'core:waf'
assignees: ''
---
### mpv version and platform versions
If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases
### Reproduction steps
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
### Expected behavior
### Actual behavior
### Log file
Upload build/config.log or ./waf configure output to https://0x0.st/ or attach
it to the github issue, and replace this text with a link to it.
The issue will be closed for ignoring the issue template.
@@ -1,71 +0,0 @@
name: "Report a build Problem"
description: "Create a report for a build related Issue"
labels: ["core:meson"]
type: Bug
body:
- type: textarea
attributes:
label: "Important Information"
description: >
- mpv version
- Platform and Version
- Meson version
If you're not using git master or the latest release, update.
Releases are listed [here](https://github.com/mpv-player/mpv/releases).
value: |-
- mpv version:
- Platform version:
- Meson version:
render: text
validations:
required: true
- type: textarea
attributes:
label: "Reproduction Steps"
description: >
Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.
validations:
required: true
- type: textarea
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
description: >
Attach meson-logs/meson-log.txt or meson setup build output to the issue.
Without the log file, this issue will be closed for ignoring the issue template.
validations:
required: true
- type: checkboxes
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
required: true
- label: "I provided all required information including system and mpv version."
required: true
- label: >-
I produced the log file with the exact same set of parameters, and conditions used in
"Reproduction Steps".
required: true
- label: >-
I produced the log file while the behaviors described in "Actual Behavior" were
actively observed.
required: true
- label: "I attached the full, untruncated log file."
required: true
@@ -0,0 +1,22 @@
---
name: 'Request a new Feature'
about: 'Create a request for a new feature'
title: ''
labels: 'meta:feature-request'
assignees: ''
---
Before requesting a new feature make sure it hasn't been requested yet.
https://github.com/mpv-player/mpv/labels/meta%3Afeature-request
### Expected behavior of the wanted feature
### Alternative behavior of the wanted feature
### Log file
Even if you think it's not necessary at first, it might help us later to find
possible issues. Make a log file made with -v -v or --log-file=output.txt, paste
it to https://0x0.st/ or attach it to the github issue, and replace this text
with a link to it.
@@ -1,56 +0,0 @@
name: "Request a new Feature"
description: "Create a request for a new feature"
labels: ["meta:feature-request"]
type: Feature
body:
- type: textarea
attributes:
label: "Expected behavior of the wanted feature"
description: >
Before requesting a new feature, make sure it hasn't been
[requested yet](https://github.com/mpv-player/mpv/labels/meta%3Afeature-request),
and isn't already supported by [mpv](https://mpv.io/manual/master/),
[ffmpeg](https://ffmpeg.org/documentation.html), or existing
[mpv scripts](https://github.com/mpv-player/mpv/wiki/User-Scripts).
If you are not sure about this, ask on
[mpv Discussions](https://github.com/mpv-player/mpv/discussions) and
[mpv IRC channel](https://mpv.io/community/) first before opening a feature request.
validations:
required: true
- type: textarea
attributes:
label: "Alternative behavior of the wanted feature"
- type: textarea
attributes:
label: "Log File"
description: >
Even if you think it's not necessary at first, it might help us later to find
possible issues. Make a log file with `--log-file=output.txt`, which is our preferred way,
and attach it to the issue.
If you have trouble producing a log file, you can alternatively use `-v -v`, save the
terminal output to a file, and attach it to the issue.
- type: textarea
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
description: >
Please provide sample files in the case you request a format/codec/container dependent
feature, and it could help us test and implement it.
Preferably files should be attached directly within the text field below. Due to GitHub's
upload restriction, you may need to archive the sample file first and upload it as `.zip`
file. If the sample file is too big to attach directly, use a solution that is easy to
access with possible long-term retention. Possible services include, but are not limited
to, the following:
- [0x0.st](https://0x0.st/) (no long-term retention)
- [Dropbox](https://www.dropbox.com)
- [Google Drive](https://www.google.com/drive/)
- [iCLoud Drive](https://www.icloud.com/iclouddrive/)
- [MediaFire](https://www.mediafire.com/)
- [OneDrive](https://onedrive.live.com/)
+25
View File
@@ -0,0 +1,25 @@
---
name: 'Ask a Question'
about: 'Ask a question about mpv'
title: ''
labels: 'meta:question'
assignees: ''
---
Don't ask questions about issues, errors or problems you have and instead open
a proper issue with the right template from the previous selection.
This template is meant for questions about the workings of mpv, to clarify about
unspecified behaviour of options or command, or anything else that is not well
described and needs clarification.
Before asking a question make sure it hasn't been asked or answered yet.
https://github.com/mpv-player/mpv/labels/meta%3Aquestion
### Log file
Even if you think it's not necessary at first, it might help us later to find
possible issues. Make a log file made with -v -v or --log-file=output.txt, paste
it to https://0x0.st/ or attach it to the github issue, and replace this text
with a link to it.
-3
View File
@@ -1,8 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: mpv Discussions
url: https://github.com/mpv-player/mpv/discussions
about: If you have questions or want to discuss things use our GitHub Discussions
- name: mpv IRC channel
url: https://mpv.io/community/
about: Feel free to ask questions here irc://irc.libera.chat/mpv
+1 -1
View File
@@ -2,4 +2,4 @@ Read this before you submit this pull request:
https://github.com/mpv-player/mpv/blob/master/DOCS/contribute.md
Reading this link and following the rules will get your pull request reviewed
and merged faster. Nobody wants lazy pull requests.
and merged faster. Nobody wants lazy pull requests.
+94 -488
View File
@@ -6,596 +6,202 @@ on:
- master
- ci
- 'release/**'
paths-ignore:
- 'DOCS/**'
- 'TOOLS/lua/**'
- '.editorconfig'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE'
- '.gitignore'
- 'Copyright'
- 'README.md'
- 'RELEASE_NOTES'
pull_request:
branches: [master]
paths-ignore:
- 'DOCS/**'
- 'TOOLS/lua/**'
- '.editorconfig'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE'
- '.gitignore'
- 'Copyright'
- 'README.md'
- 'RELEASE_NOTES'
jobs:
mingw:
runs-on: ubuntu-24.04
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
TARGET: ${{ matrix.arch }}-w64-mingw32
RUST_TARGET: ${{ matrix.arch }}-pc-windows-gnu
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- arch: i686
wine: wine32
- arch: x86_64
wine: wine64
target: [i686-w64-mingw32, x86_64-w64-mingw32]
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v3
- name: Get time
id: get_time
run: echo "timestamp=`date +%s%N`" >> $GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache/restore@v4
# Increase -N suffix here to force full rebuild after changes
- uses: actions/cache@v3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ env.TARGET }}-
path: mingw_prefix/
key: "${{ matrix.target }}-6"
- name: Install dependencies
run: |
rustup target add ${{ env.RUST_TARGET }}
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends -y ccache g++-mingw-w64 gcc-multilib python3-pip nasm ninja-build pkgconf ${{ matrix.wine }} wine
python -m pip install meson
- name: Install Meson Wraps
run: |
mkdir subprojects -p
meson wrap install mujs
meson subprojects download
sudo apt-get install -y autoconf automake pkg-config g++-mingw-w64 gcc-multilib meson nasm
./bootstrap.py
- name: Build libraries
run: |
./ci/build-mingw64.sh
env:
TARGET: ${{ matrix.target }}
- name: Build with meson
id: build
run: |
./ci/build-mingw64.sh meson pack
./ci/build-mingw64.sh meson
env:
TARGET: ${{ matrix.target }}
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./mingw_build/meson-logs/meson-log.txt
- name: Functional test
run: |
cd artifact && wine ./mpv.com -v --no-config
env:
WINEDEBUG: '+loaddll'
- name: Run meson tests
id: tests
run: |
meson test -C mingw_build
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./mingw_build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v5
with:
name: mpv-${{ env.TARGET }}
path: mpv-git-*.zip
- name: Save Cache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
win32:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
arch: "x64"
os: "windows-latest"
- target: aarch64-pc-windows-msvc
arch: "arm64"
os: "windows-11-arm"
env:
VS: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
CC: "ccache clang"
CXX: "ccache clang++"
CC_LD: "lld-link"
CXX_LD: "lld-link"
WINDRES: "llvm-rc"
RUST_LD: "lld-link"
RUSTC: "rustc --target ${{ matrix.target }}"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: "${{ github.workspace }}\\.ccache"
CCACHE_MAXSIZE: 500M
steps:
- name: Disable autocrlf
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v6
- name: Get time
id: get_time
run: |
"timestamp=$((Get-Date).Ticks)" >> $env:GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
- name: Install dependencies
run: |
python -m pip install meson==1.9.2
choco install ccache nasm
./ci/install-cmake.ps1 -arch ${{ matrix.arch }}
- name: Update Meson WrapDB
run: |
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
- name: Build
id: build
run: |
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' -and `
$_ -ne 'C:\Program Files\CMake\bin' -and `
$_ -ne 'C:\Strawberry\c\bin' }) -join ';'
$env:PATH = "$pwd\cmake\bin;" + $env:PATH + ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }}"
./ci/build-win32.ps1
- name: Print build log
if: ${{ failure() && steps.build.outcome == 'failure' }}
if: ${{ failure() }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
- name: Build with waf
run: |
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' -and `
$_ -ne 'C:\Program Files\CMake\bin' -and `
$_ -ne 'C:\Strawberry\c\bin' }) -join ';'
$env:PATH = "$pwd\cmake\bin;" + $env:PATH + ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }}"
meson test -C build -t 2
./ci/build-mingw64.sh waf pack
env:
TARGET: ${{ matrix.target }}
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
- name: Print waf log
if: ${{ failure() }}
run: |
cat ./build/meson-logs/testlog.txt
cat ./build/config.log
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v3
with:
name: mpv-${{ matrix.target }}
path: |
build/mpv.???
build/mpv-*.bat
build/vulkan-*.dll
!build/mpv.lib
- name: Save Cache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
path: mpv-git-*.zip
macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: "macos-14"
arch: "arm"
xcode: "Xcode_15.0"
- os: "macos-15"
arch: "arm"
- os: "macos-15-intel"
- os: "macos-26"
arch: "arm"
- os: "macos-26"
arch: "test"
swift: "-target arm64-apple-macosx10.15"
target: "10.15"
cc:
- "clang"
os:
- "macos-11"
- "macos-12"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v3
- name: Remove stray upstream python binary symlinks under /usr/local
run: |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete -print
brew unlink python && brew link --overwrite python
- name: Unlink pkg-config if the CI runner happens to have it already installed
run: |
find "$(brew config | grep HOMEBREW_PREFIX | cut -f 2- -d ' ')/bin" -lname '*/pkg-config@0*/*' -print -exec brew unlink [email protected] \; -quit
- name: Change Xcode version
if: ${{ matrix.xcode != '' }}
run: |
sudo xcode-select -s /Applications/${{ matrix.xcode }}.app
- name: Install dependencies
run: |
if [[ -n "${{ matrix.homebrew }}" ]]; then
export HOMEBREW_NO_AUTO_UPDATE=1
cd "$(brew --repo homebrew/core)"
git checkout --force ${{ matrix.homebrew }}
else
brew update
fi
brew install -q autoconf automake pkgconf libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg meson rust uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
brew update
brew install autoconf automake pkg-config libtool python freetype fribidi little-cms2 [email protected] libass ffmpeg meson
- name: Build with meson
id: build
run: |
./ci/build-macos.sh
./ci/build-macos.sh meson
env:
CC: "${{ matrix.cc }}"
TRAVIS_OS_NAME: "${{ matrix.os }}"
SWIFT_FLAGS: "${{ matrix.swift }}"
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.target }}"
- name: Create App Bundle
if: ${{ matrix.arch != 'test' }}
run: |
meson compile -C build macos-bundle
tar -czvf mpv.tar.gz -C build mpv.app
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
if: ${{ failure() }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
- name: Build with waf
run: |
meson test -C build
./ci/build-macos.sh waf
env:
CC: "${{ matrix.cc }}"
TRAVIS_OS_NAME: "${{ matrix.os }}"
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
- name: Print waf log
if: ${{ failure() }}
run: |
cat ./build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v5
if: ${{ matrix.arch != 'test' }}
with:
name: mpv-${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}
path: mpv.tar.gz
cat ./build/config.log
linux:
runs-on: ubuntu-latest
runs-on: "ubuntu-22.04"
container:
image: "registry.opensuse.org/home/mia/images/images/mpv-ci:stable-deps"
env:
CC: "${{ matrix.config.cc }}"
CXX: "${{ matrix.config.cxx }}"
CC_LD: "${{ matrix.config.ld }}"
CXX_LD: "${{ matrix.config.ld }}"
CC: "${{ matrix.cc }}"
strategy:
matrix:
config:
- cc: "gcc"
cxx: "g++"
args: "-Db_ndebug=true"
- cc: "clang"
cxx: "clang++"
ld: "lld"
args: "-Db_lto=true -Db_lto_mode=thin"
cc:
- "gcc"
- "clang"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v3
- name: Build with meson
id: build
run: |
./ci/build-tumbleweed.sh ${{ matrix.config.args }}
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
run: |
meson test -C build
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
linux-fuzz:
runs-on: ubuntu-latest
container:
image: "registry.opensuse.org/home/mia/images/images/mpv-ci:stable-deps"
env:
CC: "clang"
CXX: "clang++"
steps:
- uses: actions/checkout@v6
- name: Build with meson
id: build
run: |
meson setup build \
--werror \
-Dfuzzers=true -Dlibmpv=true -Dcplayer=false
meson compile -C build fuzzers
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
linux-ffmpeg-6-1:
runs-on: ubuntu-latest
container:
# We want to test ffmpeg 6.1.1 which alpine 3.19 has exactly.
# Furthermore, this is a very minimal build of mpv without commonly
# used features to test build compatibility. Musl is a nice bonus as well
image: alpine:3.19
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: |
apk update
apk add \
binutils \
ffmpeg-dev \
gcc \
git \
g++ \
libass-dev \
lua5.2-dev \
pulseaudio-dev \
libx11-dev \
libxfixes-dev \
libxkbcommon-dev \
libxrandr-dev \
libxpresent-dev \
libxscrnsaver-dev \
meson \
musl-dev \
rust \
samurai
./bootstrap.py
# workaround to avoid "fatal: unsafe repository" error
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build with meson
id: build
run: |
./ci/build-linux-old.sh
./ci/build-tumbleweed.sh meson
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
if: ${{ failure() }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
- name: Build with waf
run: |
meson test -C build
./ci/build-tumbleweed.sh waf
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
- name: Print waf log
if: ${{ failure() }}
run: |
cat ./build/meson-logs/testlog.txt
openbsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 15 # avoid any weirdness with the VM
steps:
- uses: actions/checkout@v6
- name: Test in OpenBSD VM
uses: cross-platform-actions/[email protected]
with:
operating_system: openbsd
version: '7.8'
run: |
sudo pkg_add -U \
cmake \
ffmpeg \
git \
libarchive \
libbluray \
libcaca \
libcdio-paranoia \
libdvdnav \
libiconv \
libplacebo \
libv4l \
libxkbcommon \
luajit \
meson \
openal \
pkgconf \
pulseaudio \
python3 \
rubberband \
rust \
sdl2 \
shaderc \
spirv-cross \
spirv-headers \
uchardet \
vulkan-loader \
vulkan-headers \
zimg
./ci/build-openbsd.sh
if ! meson test -C build; then
cat ./build/meson-logs/testlog.txt
exit 1
fi
cat ./build/config.log
freebsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 15 # avoid any weirdness with the VM
runs-on: macos-12 # until https://github.com/actions/runner/issues/385
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v3
- name: Test in FreeBSD VM
uses: cross-platform-actions/[email protected].0
uses: vmactions/freebsd-vm@v0
with:
operating_system: freebsd
version: '14.3'
run: |
sudo pkg update
sudo pkg install -y \
alsa-lib \
usesh: true
prepare: |
# Requested in ci/build-freebsd.sh
pkg install -y \
cmake \
evdev-proto \
ffmpeg \
git \
iconv \
libplacebo \
libxkbcommon \
libXinerama \
libxpresent \
luajit \
meson \
openal-soft \
pkgconf \
python3 \
sdl2 \
sndio \
vulkan-headers \
wayland-protocols \
#
# Optionally auto-enabled
pkg install -y \
alsa-lib \
jackit \
libXv \
libarchive \
libbluray \
libcaca \
libcdio-paranoia \
libdvdnav \
libdisplay-info \
libplacebo \
libXinerama \
libxkbcommon \
libXpresent \
libXv \
luajit \
meson \
mujs \
openal-soft \
pipewire \
pkgconf \
pulseaudio \
python3 \
rubberband \
rust \
sekrit-twc-zimg \
sdl2 \
sndio \
uchardet \
v4l_compat \
vulkan-headers \
wayland-protocols
./ci/build-freebsd.sh
if ! meson test -C build; then
cat ./build/meson-logs/testlog.txt
exit 1
fi
msys2:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- sys: "clang64"
os: "windows-latest"
- sys: "mingw64"
os: "windows-latest"
- sys: "ucrt64"
os: "windows-latest"
- sys: "clangarm64"
os: "windows-11-arm"
defaults:
run:
shell: msys2 {0}
steps:
- name: Disable autocrlf
shell: pwsh
#
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v6
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: git
pacboy: >-
angleproject:p
ca-certificates:p
cc:p
cppwinrt:p
ffmpeg:p
lcms2:p
libarchive:p
libass:p
libcdio-paranoia:p
libdvdnav:p
libjpeg-turbo:p
libplacebo:p
lua51:p
meson:p
ninja:p
pkgconf:p
python:p
rst2pdf:p
rubberband:p
rust:p
shaderc:p
spirv-cross:p
uchardet:p
vapoursynth:p
vulkan-devel:p
./ci/build-freebsd.sh
- name: Build with meson
id: build
run: |
./ci/build-msys2.sh meson
env:
SYS: ${{ matrix.sys }}
- name: Print meson log
if: ${{ failure() }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
run: |
meson test -C build
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
- name: Print waf log
if: ${{ failure() }}
run: |
cat ./build/config.log
-41
View File
@@ -1,41 +0,0 @@
name: Cleanup caches
on:
workflow_run:
workflows: [build]
types: [completed]
jobs:
cache:
runs-on: ubuntu-latest
steps:
- run: |
gh cache list -L 100 --json id,key,ref -S last_accessed_at -O desc --jq '
map(select(.key | startswith("x86_64-w64-mingw32-") or
startswith("i686-w64-mingw32-") or
startswith("aarch64-pc-windows-msvc-") or
startswith("x86_64-pc-windows-msvc-"))) |
group_by(.ref) |
map({
ref: .[0].ref,
caches: map({
key: .key,
prefix: (.key | capture("^(?<prefix>[\\w_-]+-)\\d+$").prefix)
}) | group_by(.prefix) | map({keys: map(.key)})
}) |
.[]
' |
while read -r group; do
pr=$(echo "$group" | jq -r '.ref | capture("refs/pull/(?<num>[0-9]+)/merge").num')
if [[ -n "$pr" ]] && [ "$(gh pr view $pr --json state --jq '.state')" != "OPEN" ]; then
keys=$(echo "$group" | jq -c '.caches | map(.keys) | .[]')
else
keys=$(echo "$group" | jq -c '.caches | map(.keys[1:]) | .[]')
fi
for key in $(echo "$keys" | jq -r '.[]'); do
gh cache delete "$key"
done
done
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-46
View File
@@ -1,46 +0,0 @@
name: comment
on:
workflow_run:
workflows: [build]
types: [completed]
jobs:
pr_comment:
if: github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr=$(gh pr list --state open --json headRefOid,number \
--jq '.[] | select(.headRefOid == "${{ github.event.workflow_run.head_sha }}") | .number')
if [ -z "$pr" ]; then
echo "No matching open pull request found"
exit 0
fi
artifacts=$(gh api repos/{owner}/{repo}/actions/runs/${{ github.event.workflow_run.id }}/artifacts --jq '.artifacts')
if [ "$(echo "$artifacts" | jq 'length')" -eq 0 ]; then
echo "No artifacts found"
exit 0
fi
body=$(echo "$artifacts" | jq -r '
def link: "https://nightly.link/${{ github.repository }}/actions/artifacts/\(.id).zip";
def entry: "* [\(.name)](\(link))";
"Download the artifacts for this pull request:\n<details><summary>Windows</summary>\n\n" +
(sort_by(.name) | map(select(.name | test("w64|msvc")) | entry) | join("\n")) +
"\n</details>\n<details><summary>macOS</summary>\n\n" +
(sort_by(.name) | map(select(.name | test("macos")) | entry) | join("\n")) +
"\n</details>"
')
comment_id=$(gh issue view $pr --json comments \
--jq '.comments[] | select(.author.login == "github-actions") | .id')
if [ -n "$comment_id" ]; then
edit=--edit-last
fi
gh pr comment $pr --body "$body" $edit
-26
View File
@@ -1,26 +0,0 @@
name: docs
on:
push:
branches:
- master
- ci
- 'release/**'
paths:
- 'DOCS/**'
pull_request:
branches: [master]
paths:
- 'DOCS/**'
jobs:
check-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Docs
run: |
sudo apt-get install --no-install-recommends -y python3-docutils rst2pdf
./TOOLS/docutils-wrapper.py rst2man --strip-elements-with-class=contents --halt=2 ./DOCS/man/mpv.rst mpv.1
./TOOLS/docutils-wrapper.py rst2html --halt=2 ./DOCS/man/mpv.rst mpv.html
./TOOLS/docutils-wrapper.py rst2pdf -c -b 1 --repeat-table-rows ./DOCS/man/mpv.rst -o mpv.pdf
-54
View File
@@ -1,54 +0,0 @@
name: Pull Request Fuzzing
on:
pull_request:
branches: [master]
paths-ignore:
- 'DOCS/**'
- 'TOOLS/lua/**'
- '.editorconfig'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE'
- '.gitignore'
- 'Copyright'
- 'README.md'
- 'RELEASE_NOTES'
permissions: {}
jobs:
Fuzzing:
runs-on: ubuntu-latest
permissions:
security-events: write
strategy:
fail-fast: false
matrix:
sanitizer: [address, undefined, memory]
steps:
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'mpv'
language: c
sanitizer: ${{ matrix.sanitizer }}
- name: Run Fuzzers (${{ matrix.sanitizer }})
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'mpv'
language: c
fuzz-seconds: 1200
sanitizer: ${{ matrix.sanitizer }}
report-ooms: true
report-timeouts: true
output-sarif: true
- name: Upload Crash
uses: actions/upload-artifact@v5
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
path: ./out/artifacts
- name: Upload Sarif
if: always() && steps.build.outcome == 'success'
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: cifuzz-sarif/results.sarif
checkout_path: cifuzz-sarif
-71
View File
@@ -1,71 +0,0 @@
name: lint
on:
push:
branches:
- master
- ci
- 'release/**'
pull_request:
branches: [master]
jobs:
commit-msg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 50
- name: Lint
run: |
./ci/lint-commit-msg.py
swift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: norio-nomura/[email protected]
lua:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: lunarmodules/luacheck@v1
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check
id: check
uses: astral-sh/ruff-action@v3
with:
src: ". TOOLS/umpv"
- name: Suggested changes
if: ${{ failure() && steps.check.outcome == 'failure' }}
run: ruff check . TOOLS/umpv --diff
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: python/mypy@master
with:
install_project_dependencies: no
options: '--check-untyped-defs'
paths: ". TOOLS/umpv"
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker -config .editorconfig-checker.json
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pre-commit/[email protected]
+40 -3
View File
@@ -1,3 +1,40 @@
/subprojects/*
!/subprojects/packagefiles
!/subprojects/*.wrap
*.o
*.a
*.d
*.exe
*.pyc
.depend
/config.h
/config.mak
/config.log
/mpv
/mpv.app
/version.h
/input/input_conf.h
/tags
/TAGS
/video/out/x11_icon.inc
/demux/ebml_defs.c
/demux/ebml_types.h
/sub/osd_font.h
/player/lua/*.inc
/player/builtin_conf.inc
/DOCS/man/mpv.1
/DOCS/man/mpv.aux
/DOCS/man/mpv.log
/DOCS/man/mpv.out
/DOCS/man/mpv.pdf
/DOCS/man/mpv.toc
/waf
/waf-*
/waf3-*
/build
/.waf*
/.lock-waf_*
/old_build
/Makefile
/subprojects
-109
View File
@@ -1,109 +0,0 @@
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
-23
View File
@@ -1,23 +0,0 @@
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
exclude: ^TOOLS/mpv-osd-symbols.sfdir/font.props$
- 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", "ALS,als,datas,DNE,enew,HDA,numer,ontop,optionA,Paeth,pathc,inout,requestor"]
exclude: ^misc/language.c$
-10
View File
@@ -1,10 +0,0 @@
disabled_rules:
- identifier_name
- line_length
- large_tuple
- void_function_in_ternary
- function_body_length
- cyclomatic_complexity
- file_length
- type_body_length
strict: true
+18 -22
View File
@@ -2,20 +2,9 @@ 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. 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.
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 --enable-lgpl configure switch.
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
@@ -37,20 +26,26 @@ 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.
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
quite central:
"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 --enable-lgpl configure option. 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 quite central:
- Linux X11 video output
- BSD audio output via OSS
- NVIDIA/Linux hardware decoding (vdpau, although nvdec usually works)
- minor features: jack, DVD, CDDA, DVB, CACA, legacy direct3d VO
- Linux TV input
- minor features: jack, DVD, CDDA, SMB, 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.
The following files are still GPL only (-Dgpl=false disables them):
The following files are still GPL only (--enable-lgpl disables them):
audio/out/ao_jack.c will stay GPL
audio/out/ao_oss.c will stay GPL
@@ -69,8 +64,9 @@ 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+
etc/mpv.desktop unknown license, probably GPLv2+
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
+70
View File
@@ -0,0 +1,70 @@
# Differences Between Meson and Waf
mpv currently supports two different build systems: waf and meson. In general,
option names between both build systems are mostly the same. In most cases,
``--enable-foo`` in waf becomes ``-Dfoo=enabled`` in meson. Likewise,
``--disable-foo`` becomes ``-Dfoo=disabled``. For the rest of this document,
Waf options will be noted as ``--foo`` while meson options are noted as
``foo``.
## Universal Options
Meson has several [universal options](https://mesonbuild.com/Builtin-options.html#universal-options)
that you get for free. In some cases, these overlapped with custom waf options.
* ``--libmpv-static`` and ``--libmpv-shared`` were combined into one option:
``libmpv``. Use ``default_library`` to control if you want to build static or
shared libraries.
* Waf had a boolean ``--optimize`` option. In meson, this is a universal option,
``optimization``, which can take several different values. In mpv's meson
build, the default is ``2``.
* Instead of ``--debug-build``, meson simply calls it ``debug``. It is enabled
by default.
## Changed Options
* The legacy lua names (``52``, ``52deb``, etc.) for ``--lua`` are not
supported in the meson build. Instead, pass the generic pkg-config values
such as ``lua52``, ``lua5.2``, etc.
* ``--lgpl`` was changed to ``gpl``. If ``gpl`` is false, the build is LGPL2.1+.
### Boolean Options
The following options are all booleans that accept ``true`` or ``false``
instead of ``enabled`` or ``disabled``.
* ``build-date``
* ``cplayer``
* ``gpl``
* ``libmpv``
* ``ta-leak-report``
* ``tests``
## Removed Options
There are options removed with no equivalent in the meson build.
* ``--asm`` was removed since it doesn't do anything.
* ``--android`` was removed since meson knows if the machine is android.
* ``--clang-compilation-database`` was removed. Meson can do this on its own
by invoking ninja (``ninja -t compdb``).
* ``--tvos`` was removed since it doesn't do anything.
* ``--static-build`` was removed. Use ``default_library``.
* ``--swift-static`` was removed. The swift library always dynamically links.
## Renamed Options
These are some other options that were renamed.
* ``--gl-wayland`` was renamed to ``egl-wayland``.
* ``--swift`` was renamed to ``swift-build``.
## Other
* The meson build supports passing the ``SOURCE_DATE_EPOCH`` environment variable
during the compilation step for those who want reproducibility without having to
disable the build date.
* The ``Configuration`` line shown by ``mpv -v`` does not show everything passed on
cli since meson does not have any easy way to access a user's argv. Instead, it
simply shows whatever the value of ``prefix`` is regardless if it was specified
or not.
+3 -18
View File
@@ -32,22 +32,6 @@ 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.
This restores the prior behavior on all platforms other than macOS,
but still auto selects libmpv/cocoa-cb on macOS if it was built with
support for cocoa-cb.
--- mpv 0.37.0 ---
2.2 - add mpv_time_ns()
--- mpv 0.36.0 ---
2.1 - add mpv_del_property()
--- mpv 0.35.0 ---
2.0 - remove headers/functions of the obsolete opengl_cb API
- remove mpv_opengl_init_params.extra_exts field
@@ -57,7 +41,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)
- deactivate the opengl_cb API (always fails to initialize now)
- inactivate 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
@@ -285,6 +269,7 @@ API changes
- extend the "--start" option; a leading "+", which was previously
insignificant is now significant
- add "cache-free" and "cache-used" properties
- macOS: the "coreaudio" AO spdif code is split into a separate AO
- OSX: the "coreaudio" AO spdif code is split into a separate AO
--- mpv 0.4.0 ---
1.0 - the API is declared stable
+4 -22
View File
@@ -29,16 +29,7 @@ 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.
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.
All incompatible changes to this must be declared in interface-changes.rst.
(This may also list compatible additions, but it's not a requirement.)
Degrees of importance and compatibility preservation
@@ -58,17 +49,8 @@ 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.
@@ -126,7 +108,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 and restore-osc-bindings.conf.
restore-old-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
@@ -153,7 +135,7 @@ command-interface.
libmpv C API
------------
The libmpv client API (such as ``<mpv/client.h>``) mostly gives access to
The libmpv client API (such as ``<libmpv/client.h>``) 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.
+178 -227
View File
@@ -1,262 +1,213 @@
# Compiling for Windows
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.
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:
http://mingw-w64.sourceforge.net.
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.
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.
mpv employs Meson for building, and the process is the same as any standard Meson
compilation.
**Warning**: the original MinGW (http://www.mingw.org) is unsupported.
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
=================
## Cross-compilation
When cross-compiling, you have to run mpv's configure with these arguments:
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 <<EOF > subprojects/libplacebo.wrap
[wrap-git]
url = https://github.com/haasn/libplacebo
revision = master
depth = 1
clone-recursive = true
EOF
cat <<EOF > 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 <<EOF > subprojects/ffmpeg.wrap
[wrap-git]
url = https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git
revision = meson-8.0
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
```bash
DEST_OS=win32 TARGET=i686-w64-mingw32 ./waf configure
```
they will be automatically downloaded and built by Meson.
[MXE](https://mxe.cc) makes it very easy to bootstrap a complete MingGW-w64
environment from a Linux machine. See a working example below.
## Native Compilation with Clang (Windows SDK Build)
Alternatively, you can try [mingw-w64-cmake](https://github.com/lachs0r/mingw-w64-cmake),
which bootstraps a MinGW-w64 environment and builds mpv and dependencies.
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:
```
& "<Visual Studio Path>\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
Example with MXE
----------------
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 += ';<Git 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.
```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.
This process will produce a fully static ``mpv.exe`` and ``mpv.com``, as well as
a static ``libmpv.a``.
# Download MXE. Note that compiling the required packages requires about 1.4 GB
# or more!
## Native Compilation with MSYS2
cd /opt
git clone https://github.com/mxe/mxe mxe
cd mxe
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.
# Set build options.
### Installing MSYS2
# 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
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.
# 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
### Updating MSYS2
# If you want to build 64 bit version, use this:
# echo "MXE_TARGETS := x86_64-w64-mingw32.static" >> settings.mk
For guidance on updating MSYS2, please refer to the official documentation:
[Updating MSYS2](https://www.msys2.org/docs/updating/).
# Build required packages. The following provide a minimum required to build
# a reasonable mpv binary (though not an absolute minimum).
### Installing mpv Dependencies
make gcc ffmpeg libass jpeg lua luajit
``` bash
# Install pacboy and git
pacman -S pactoys git
# 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
python ./bootstrap.py
DEST_OS=win32 TARGET=i686-w64-mingw32.static ./waf configure
# Or, if 64 bit version,
# DEST_OS=win32 TARGET=x86_64-w64-mingw32.static ./waf configure
./waf 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://msys2.github.io/
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
pacboy -S python pkgconf cc meson
pacman -S git python $MINGW_PACKAGE_PREFIX-{pkg-config,gcc}
# Install key dependencies. libass and lcms2 are also included as dependencies
# of ffmpeg.
pacboy -S ffmpeg libjpeg-turbo libplacebo luajit vulkan-headers
# 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,lua51}
```
### Building mpv
Building mpv
------------
To compile and install mpv, execute the following commands.
The binaries will be installed in the directory ``/$MSYSTEM_PREFIX/bin``.
Clone the latest mpv from git and install waf. **Note:** ``/usr/bin/python3``
is invoked directly here, since an MSYS2 version of Python is required.
```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
git clone https://github.com/mpv-player/mpv.git && cd mpv
/usr/bin/python3 bootstrap.py
```
## Running mpv
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.
## Linking libmpv with MSVC Programs
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.
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:
Finally, compile and install mpv. Binaries will be installed to
``/mingw64/bin`` or ``/mingw32/bin``.
```bash
lib /name:mpv-2.dll /out:mpv.lib /MACHINE:X64
/usr/bin/python3 waf configure CC=gcc.exe --check-c-compiler=gcc --prefix=$MSYSTEM_PREFIX
/usr/bin/python3 waf install
```
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.
Or, compile and install both libmpv and mpv:
**Note:** Static linking is only feasible with matching compilers. For instance,
if you build with Clang in Visual Studio, static linking is possible.
```bash
/usr/bin/python3 waf configure CC=gcc.exe --check-c-compiler=gcc --enable-libmpv-shared --prefix=$MSYSTEM_PREFIX
/usr/bin/python3 waf install
```
Linking libmpv with MSVC programs
---------------------------------
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.
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:
```bash
lib /def:mpv.def /name:mpv-1.dll /out:mpv.lib /MACHINE:X64
```
The string in the ``/name:`` parameter must match the filename of the DLL (this
is simply the filename the MSVC linker will use). The ``mpv.def`` can be
retrieved from the mpv build directory, or can be produced by MingGW's
gendef.exe helper from the mpv DLL.
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
```bash
pacman -S winpty
winpty mpv.com ToS-4k-1920.mov
```
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. You can find copies here:
https://mpv.srsfckn.biz/d3dcompiler.7z
+16 -37
View File
@@ -5,13 +5,13 @@ General
-------
The main contact for mpv development is IRC, specifically #mpv
and #mpv-devel on Libera.chat. GitHub is used for code review and
and #mpv-devel on Libera.chat. Github is used for code review and
long term discussions.
Sending patches
---------------
- Make a GitHub pull request, or send a link to a plaintext patch created with
- Make a github pull request, or send a link to a plaintext patch created with
``git format-patch``.
- Plain diffs posted as pastebins are not acceptable! (Especially if the http
link returns HTML.) They only cause extra work for everyone, because they lack
@@ -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 pseudonym is
someone else's name, but is not your legal name). Using a pseudonyms 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
@@ -111,13 +111,13 @@ Always squash fixup commits when making changes to pull requests
- If you make fixup commits to your pull request, you should generally squash
them with "git rebase -i". We prefer to have pull requests in a merge
ready state.
- We don't squash-merge (nor do we use GitHub's feature that does this) because
- We don't squash-merge (nor do we use github's feature that does this) because
pull requests with multiple commits are perfectly legitimate, and the only
thing that makes sense in non-trivial cases.
- With complex pull requests, it *may* make sense to keep them separate, but
they should be clearly marked as such. Reviewing commits is generally easier
with fixups squashed.
- Reviewers are encouraged to look at individual commits instead of GitHub's
- Reviewers are encouraged to look at individual commits instead of github's
"changes from all commits" view (which just encourages bad git and review
practices).
@@ -131,31 +131,16 @@ Touching user-visible parts may require updating the mpv docs
- Changes to command line options (addition/modification/removal) must be
documented in options.rst.
- Changes to input properties or input commands must be documented in input.rst.
- All incompatible changes to the user interface (options, properties, commands)
must be documented with a small note in interface-changes.rst. (Additions may
be documented there as well, but this isn't required.)
- Changes to the libmpv API must be reflected in the libmpv's headers doxygen,
and in client-api-changes.rst.
Interface change policy
-----------------------
- All incompatible changes to the user interface (options, properties, commands)
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. 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.
- interface-changes.rst is never directly updated except when making new major
releases.
- See DOCS/interface-changes/example.txt for an example.
Code formatting
---------------
mpv uses C11 with K&R formatting, with some exceptions.
mpv uses C99 with K&R formatting, with some exceptions.
- Use the K&R indent style.
- Use 4 spaces of indentation, never use tabs (except in Makefiles).
@@ -168,9 +153,9 @@ mpv uses C11 with K&R formatting, with some exceptions.
some_function(a, b, c);
}
```
- Break lines on 80 columns. There is a hard limit of 100 columns. You may ignore
- Break lines on 80 columns. There is a hard limit of 85 columns. You may ignore
this limit if there's a strong case that not breaking the line will increase
readability. Going over 100 columns might provoke endless discussions about
readability. Going over 85 columns might provoke endless discussions about
whether such a limit is needed or not, so avoid it.
- If the body of an if/for/while statement has more than 1 physical lines, then
always add braces, even if they're technically redundant.
@@ -239,27 +224,21 @@ New code must follow the following conventions:
General coding
--------------
- Use C11. Also freely make use of C11 features if it's appropriate, but do not
use VLA and complex number types.
- Use C99. Also freely make use of C99 features if it's appropriate, such as
stdbool.h. (Except VLA and complex number types.)
- Don't use non-standard language (such as GNU C-only features). In some cases
they may be warranted, if they are optional (such as attributes enabling
printf-like format string checks). "#pragma once" is allowed as an exception.
But in general, standard C11 must be used.
But in general, standard C99 must be used.
- The same applies to libc functions. We have to be Windows-compatible too. Use
functions guaranteed by C11 or POSIX only, unless your use is guarded by a
configure check. Be mindful of MinGW-specifics since C11 support is not always
guaranteed.
functions guaranteed by C99 or POSIX only, unless your use is guarded by a
configure check. There is some restricted use of C11 (ask on IRC for details).
- Prefer fusing declaration and initialization, rather than putting declarations
on the top of a block. Obvious data flow is more important than avoiding
mixing declarations and statements, which is just a C90 artifact.
- 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
---------------
+6 -3
View File
@@ -97,9 +97,12 @@ Device targets
As the options for various devices can get complex, profiles can be used.
An example profile file for encoding is provided in
etc/encoding-profiles.conf in the source tree. mpv will read any file
named ``encoding-profiles.conf`` in either the local or system
configuration directories.
etc/encoding-profiles.conf in the source tree. This file is installed and loaded
by default. If you want to modify it, you can replace and it with your own copy
by doing::
mkdir -p ~/.mpv
cp /etc/mpv/encoding-profiles.conf ~/.mpv/encoding-profiles.conf
Keep in mind that the default profile is the playback one. If you want to add
options that apply only in encoding mode, put them into a ``[encoding]``
+7 -512
View File
@@ -17,523 +17,18 @@ a large part of the user interface and APIs.
Also see compatibility.rst.
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
details.
This document lists changes to them. New changes are added to the top. Usually,
only incompatible or important changes are mentioned. New options/commands/etc.
are not always listed.
Interface changes
=================
::
--- mpv 0.42.0 ---
--- mpv 0.41.0 ---
- the value of `--tls-ca-file` is now expanded as a path
- the value of `--tls-cert-file` is now expanded as a path
- the value of `--tls-key-file` is now expanded as a path
- the `--sub-sdh-enclosures` option is now a string list option
- rename `console-selected_color` script-opt to `console-focused_color`
- rename `console-selected_back_color` script-opt to `console-
focused_back_color`
- mediacodec_embed is no longer the default `vo` on Android. Set the option
explicitly if you want to use it and are aware of the limitations.
- change `--target-colorspace-hint` to `auto` by default. Auto mode will
also enable hint for SDR formats if target metadata is reported by current
output context.
- change `--prefetch-playlist` default to `no`
- add `--clipboard-xwayland` option
- add `video-params/prim-*` properties
- add `stats-plot_cache` script-opt
- disable `stats-plot_{perfdata,vsync_ratio,vsync_jitter}` by default
- add `scaled` and `osd` flags to screenshot commands
- add `forced` flag to track add commands
- add `default` flag to track add commands
- add `console-monospace_font` script-opt
- remove `console-font` script-opt
- add `console-gap` script-opt
- add `console-exact_match` script-opt
- make `console-case_sensitive` only affect exact searches and change the to
default to no on platforms other than Windows
- add `commands-remember_input` script-opt
- add `--wid=0` support for win32
- add `--vo-kitty-auto-multiplexer-passthrough=<yes|no>`
- add `--vf=format=transfer` alias
- add `--vf=format=min-luma`
- add `--vf=format=max-luma`
- add `--vf=format=max-cll`
- add `--vf=format=max-fall`
- add `--treat-srgb-as-power22`
- add `--sdr-adjust-gamma`
- add `--target-colorspace-hint-strict` option
- add `--target-colorspace-hint-mode` option
- add `--sub-hdr-peak` option
- add `--sub-fix-timing-threshold`
- add `--sub-fix-timing-keep`
- add `--register` and `--unregister`
- add `--osd-prune-delay`
- add `--osd-glyph-limit`
- add `--osd-bitmap-max-size`
- add `--sub-glyph-limit`
- add `--sub-bitmap-max-size`
- add `--osd-shaper`
- add `--input-tablet-emulate-mouse` option
- add `--image-subs-hdr-peak` option
- add `--hwdec-threads`
- add `--hdr-reference-white`
- add `--d3d11-output-mode` enable use specific output mode for creating the
D3D11 swapchain
- add `--d3d11-composition-size=<WxH>` support for d3d11 composition mode
- add `--border-background=blur`
- add `--background-blur-radius`
- add `--bluray-angle`
- add `--background-tile-size` option
- add `--background-tile-color-0` and `--background-tile-color-1` options
- add --audio-set-media-role, disabled by default. This effectively changes
the behavior for ao_pipewire
- `encoding-profiles.conf` is no longer installed by default into the system
configuration directory and is instead installed in the data directory
--- 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/<name>/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
<http://www.vapoursynth.com/2021/09/r55-audio-support-and-improved-performance/> and
<https://github.com/vapoursynth/vapoursynth/blob/R68/APIV4%20changes.txt>
--- mpv 0.38.0 ---
- add `term-size` property
- add the `escape-ass` command
- add `>` for fixed precision floating-point property expansion
- add `--input-comands` option
- change `--pulse-latency-hacks` default to `yes`
- add `context-menu` command
- add `menu-data` property
- add `--vo-tct-buffering` option
- add `begin-vo-dragging` command
- add `--deinterlace-field-parity` option
- add `--volume-gain`, `--volume-gain-min`, and `--volume-gain-max` options
- 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)
- add `--secondary-sub-delay`, decouple secondary subtitles from
`--sub-delay`
- add the `--osd-bar-border-size` option
- `--screenshot-avif-pixfmt` no longer defaults to yuv420p
- `--screenshot-avif-opts` defaults to lossless screenshot
- rename key `MP_KEY_BACK` to `MP_KEY_GO_BACK`
- add `--sub-filter-sdh-enclosures` option
- added the `mp.input` scripting API to query the user for textual input
- add `forced` choice to `subs-with-matching-audio`
- remove `--term-remaining-playtime` option
- change fallback deinterlace to bwdif
- add the command `load-config-file`
- add the command `load-input-conf`
- remove `--vo=rpi`, `--gpu-context=rpi`, and `--hwdec=mmal`
- add `auto` choice to `--deinterlace`
- change `--teletext-page` default from 100 to 0 ("subtitle" in lavc)
- 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 `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
- rename `--background` to `--background-color`
- remove `--alpha` and reintroduce `--background` option for better control
over blending alpha components into specific background types
- add `--border-background` option
- add `video-target-params` property
- add `hdr10plus` sub-parameter to `format` video filter
- remove `--focus-on-open` and add replacement `--focus-on`
- remove debanding from the high-quality profile
--- mpv 0.37.0 ---
- `--save-position-on-quit` and its associated commands now store state files
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
- change `--subs-with-matching-audio` default from `no` to `yes`
- change `--subs-fallback` default from `no` to `default`
- add the `--hdr-peak-percentile` option
- include `--hdr-peak-percentile` in the `gpu-hq` profile
- change `--audiotrack-pcm-float` default from `no` to `yes`
- add video-params/aspect-name
- change type of `--sub-pos` to float
- The remaining time printed in the terminal is now adjusted for speed by default.
You can disable this with `--no-term-remaining-playtime`.
- add `playlist-path` and `playlist/N/playlist-path` properties
- add `--x11-wid-title` option
- add `--libplacebo-opts` option
- add `--audio-file-exts`, `--cover-art-auto-exts`, and `--sub-auto-exts`
- change `slang` default back to NULL
- remove special handling of the `auto` value from `--alang/slang/vlang` options
- add `--subs-match-os-language` as a replacement for `--slang=auto`
- add `always` option to `--subs-fallback-forced`
- remove `auto` choice from `--sub-forced-only`
- remove `auto-forced-only` property
- rename `--sub-forced-only` to `--sub-forced-events-only`
- remove `sub-forced-only-cur` property (`--sub-forced-events-only` is a replacement)
- remove deprecated `video-aspect` property
- add `--video-crop`
- add `video-params/crop-[w,h,x,y]`
- remove `--tone-mapping-mode`
- change `--subs-fallback-forced` so that it works alongside `--slang`
- add `--icc-3dlut-size=auto` and make it the default
- add `--scale=ewa_lanczos4sharpest`
- remove `--scale-wblur`, `--cscale-wblur`, `--dscale-wblur`, `--tscale-wblur`
- remove `bcspline` filter (`bicubic` is now the same as `bcspline`)
- rename `--cache-dir` and `--cache-unlink-files` to `--demuxer-cache-dir` and
`--demuxer-cache-unlink-files`
- enable `--correct-downscaling`, `--linear-downscaling`, `--sigmoid-upscaling`
- `--cscale` defaults to `--scale` if not defined
- change `--tscale` default to `oversample`
- change `--dither-depth` to `auto`
- deprecate `--profile=gpu-hq`, add `--profile=<fast|high-quality>`
- change `--dscale` default to `hermite`
- update defaults to `--hdr-peak-decay-rate=20`, `--hdr-scene-threshold-low=1.0`,
`--hdr-scene-threshold-high=3.0`
- update defaults to `--deband-threshold=48`, `--deband-grain=32`
- add `--directory-mode=auto` and make it the default
- remove deprecated `--profile=opengl-hq`
- remove several legacy fallbacks for old deprecated options (now they will just
error out like normal)
- remove deprecated `drop-frame-count` and `vo-drop-frame-count` property aliases
- remove the ability to write to the `display-fps` property (use `override-display-fps`
instead)
- writing the current value to playlist-pos will no longer restart playback (use
`playlist-play-index` instead)
- remove deprecated `--oaoffset`, `--oafirst`, `--ovoffset`, `--ovfirst`,
`--demuxer-force-retry-on-eof`, `--fit-border` options
- remove deprecated `--record-file` option
- remove deprecated `--vf-defaults` and `--af-defaults` options
- `--drm-connector` no longer allows selecting the card number (use `--drm-device`
instead)
- add `--title-bar` option
- add `--window-corners` option
- rename `--cdrom-device` to `--cdda-device`
- remove `--scale-cutoff`, `--cscale-cutoff`, `--dscale-cutoff`, `--tscale-cutoff`
- remove `--scaler-lut-size`
- deprecate shared-script-properties (user-data is a replacement)
- add `--backdrop-type` option
- add `--window-affinity` option
- `--config-dir` no longer forces cache and state files to also reside in there
- deprecate `--demuxer-cue-codepage` in favor of `--metadata-codepage`
- change the default of `metadata-codepage` to `auto`
- add `playlist-next-playlist` and `playlist-prev-playlist` commands
- change `video-codec` to show description or name, not both
- deprecate `--cdda-toc-bias` option, offsets are always checked now
- disable `--allow-delayed-peak-detect` by default
- rename `--fps` to `--container-fps-override`
- rename `--override-display-fps` to `--display-fps-override`
- rename `--sub-ass-force-style` to `--sub-ass-style-overrides`
- alias `--screenshot-directory` to `--screenshot-dir`
- alias `--watch-later-directory` to `--watch-later-dir`
- rename `--play-dir` to `--play-direction`
- `--js-memory-report` is now used for enabling memory reporting for javascript
scripts
- drop support for `-del` syntax for list options
- `--demuxer-hysteresis-secs` now respects `--cache-secs` and/or
`--demuxer-readahead-secs` as well
- add hdr metadata to `video-params` property
- add `--target-gamut`
- change the way display names are retrieved on macOS, usage of options and properties
`--fs-screen-name`, `--screen-name` and `display-names` needs to be adjusted
- remove OpenGL cocoa backend that was deprecated in 0.29
- remove `border`, `fullscreen`, `ontop`, `osd-level` and `pause`
from default `--watch-later-options`
- add `video-*` and `secondary-sub-visibility` to default `--watch-later-options`
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.
`--icc-use-luma` has been added to use ICC profile luminance value.
If target luminance and ICC luminance is not used, old behavior apply,
defaulting to 203 nits. (Only applies for `--vo=gpu-next`)
- `playlist/N/title` gets set upon opening the file if it wasn't already set
and a title is available.
- add the `--vo=kitty` video output driver, as well as the options
`--vo-kitty-cols`, `--vo-kitty-rows`, `--vo-kitty-width`,
`--vo-kitty-height`, `--vo-kitty-left`, `--vo-kitty-top`,
`--vo-kitty-config-clear`, `--vo-kitty-alt-screen` and
`--vo-kitty-use-shm`
- add `--force-render`
- add `--vo-sixel-config-clear`, `--vo-sixel-alt-screen` and
`--vo-sixel-buffered`
- add `--wayland-content-type`
- deprecate `--vo-sixel-exit-clear` and alias it to
`--vo-sixel-alt-screen`
- deprecate `--drm-atomic`
- add `--demuxer-hysteresis-secs`
- add `--video-sync=display-tempo`
- the `start` option is no longer unconditionally written by
watch-later. It is still written by default but you may
need to explicitly add `start` depending on how you have
`--watch-later-options` configured.
=======
--- mpv 0.35.1 --- (feature backport due to special circumstances)
- add `--vd-lavc-dr=auto` and make it the default
- add support for the fractional scale protocol in wayland
- in wayland, hidpi window scaling now scales the window by the compositor's
dpi scale factor by default (can be disabled with --no-hidpi-window-scale
if fractional scaling support exists).
- change --screenshot-tag-colorspace default value from `no` to `yes`
- undeprecate vf_sub
- add `--tone-mapping=st2094-40` and `--tone-mapping=st2094-10`
- change `--screenshot-jxl-effort` default from `3` to `4`.
- add `--tone-mapping-visualize`
- change type of `--brightness`, `--saturation`, `--contrast`, `--hue` and
`--gamma` to float.
- add `platform` property
- add `--auto-window-resize`
- `--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 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 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; 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`
- add `--corner-rounding` option
- change `--subs-with-matching-audio` default from `yes` to `no`
- change `--slang` default from blank to `auto`
- add `--input-cursor-passthrough` option to allow pointer events to completely
passthrough the mpv window
- icc and gpu-shader cache are now saved by default (use --no-icc-shader-cache and
--no-gpu-shader-cache to disable)
- add `--directory-mode=recursive|lazy|ignore`
- `--hwdec=yes` is now mapped to `auto-safe` rather than `auto` (also used
by ctrl+h keybind)
- add `--hdr-contrast-recovery` and `--hdr-contrast-smoothness`
- include `--hdr-contrast-recovery` in the `gpu-hq` profile
--- mpv 0.35.0 ---
- add the `--vo=gpu-next` video output driver, as well as the options
`--allow-delayed-peak-detect`, `--builtin-scalers`,
@@ -590,7 +85,7 @@ Interface changes
- names starting with "." in ~/.mpv/scripts/ (or equivalent) are now ignored
- js modules: ~~/scripts/modules.js/ is no longer used, global paths can be
set with custom init (see docs), dir-scripts first look at <dir>/modules/
- the macOS bundle now logs to "~/Library/Logs/mpv.log" by default
- the OSX bundle now logs to "~/Library/Logs/mpv.log" by default
- deprecate the --cache-secs option (once removed, the cache cannot be
limited by time anymore)
- remove deprecated legacy hook API ("hook-add", "hook-ack"). Use either the
@@ -660,7 +155,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 re-added if it's not too much of a problem)
undeprecated or readded 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)
-1
View File
@@ -1 +0,0 @@
deprecate `--foo`, instead use `--bar=foo` as a replacement
+17 -32
View File
@@ -8,8 +8,6 @@ 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``.
@@ -21,8 +19,8 @@ syntax is:
The ``--vf`` description describes how libavfilter can be used and how to
workaround deprecated mpv filters.
See ``--vf`` group of options for info on how ``--af-add``, ``--af-pre``,
``--af-clr``, and possibly others work.
See ``--vf`` group of options for info on how ``--af-defaults``, ``--af-add``,
``--af-pre``, ``--af-del``, ``--af-clr``, and possibly others work.
Available filters are:
@@ -102,7 +100,7 @@ Available filters are:
``scaletempo[=option1:option2:...]``
Scales audio tempo without altering pitch, optionally synced to playback
speed.
speed (default).
This works by playing 'stride' ms of audio at normal speed then consuming
'stride*scale' ms of input audio. It pieces the strides together by
@@ -118,8 +116,8 @@ Available filters are:
cause noticeable skips at high scale amounts and an echo at low scale
amounts. Very low values will alter pitch. Increasing improves
performance. (default: 60)
``overlap=<factor>``
Factor of stride to overlap. Decreasing improves performance.
``overlap=<percent>``
Percentage of stride to overlap. Decreasing improves performance.
(default: .20)
``search=<amount>``
Length in milliseconds to search for best overlap position. Decreasing
@@ -168,10 +166,7 @@ Available filters are:
Scales audio tempo without altering pitch.
The algorithm is ported from chromium and uses the
Waveform Similarity Overlap-and-add (WSOLA) method.
It seems to achieves higher audio quality than scaletempo, and rubberband R2
engine, or ``engine=faster``. This filter is inserted automatically if
``audio-pitch-correction`` option is used (on by default) when the playback
speed is changed.
It seems to achieve a higher audio quality than scaletempo and rubberband.
By default, the ``search-interval`` and ``window-size`` parameters
have the same values as in chromium.
@@ -181,33 +176,22 @@ Available filters are:
``max-speed=<speed>``
Mute audio if the playback speed is above ``<speed>``
and ``<speed> != 0``. (default: 8.0)
and ``<speed> != 0``. (default: 4.0)
``search-interval=<amount>``
Length in milliseconds to search for best overlap position. (default: 40)
Length in milliseconds to search for best overlap position. (default: 30)
``window-size=<amount>``
Length in milliseconds of the overlap-and-add window. (default: 12)
Length in milliseconds of the overlap-and-add window. (default: 20)
``rubberband``
High quality pitch correction with librubberband. This can be used in place
of ``scaletempo`` and ``scaletempo2``, and will be used to adjust audio pitch
when playing at speed different from normal. It can also be used to adjust
audio pitch without changing playback speed.
of ``scaletempo``, and will be used to adjust audio pitch when playing
at speed different from normal. It can also be used to adjust audio pitch
without changing playback speed.
``pitch-scale=<amount>``
``<pitch-scale>``
Sets the pitch scaling factor. Frequencies are multiplied by this value.
(default: 1.0)
``engine=<faster|finer>``
Select the core Rubberband engine to be used. There are two available:
:Faster: This is the Rubberband R2 engine. It uses significantly less
CPU than the Finer (R3) engine.
:Finer: This is the Rubberband R3 engine. This engine is only available
with librubberband version 3 or newer. This produces significantly
higher quality output, at the cost of higher CPU usage. (Default
if available)
This filter has a number of additional sub-options. You can list them with
``mpv --af=rubberband=help``. This will also show the default values
@@ -215,8 +199,6 @@ Available filters are:
merely passed to librubberband. Look at the librubberband documentation
to learn what each option does:
https://breakfastquay.com/rubberband/code-doc/classRubberBand_1_1RubberBandStretcher.html
Do note that certain options are only applicable to one of R2 (faster) and
R3 (finer) engines.
(The mapping of the mpv rubberband filter sub-option names and values to
those of librubberband follows a simple pattern: ``"Option" + Name + Value``.)
@@ -228,7 +210,10 @@ Available filters are:
using the standard ``speed`` property, not ``af-command``.
``multiply-pitch <factor>``
Multiply the current value of ``<pitch-scale>`` dynamically.
Multiply the current value of ``<pitch-scale>`` 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
``lavfi=graph``
Filter audio using FFmpeg's libavfilter.
+16 -95
View File
@@ -10,67 +10,18 @@ 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.
See ``--ao=help`` for a list of compiled-in audio output drivers. The
driver ``--ao=alsa`` is preferred. ``--ao=pulse`` is preferred on systems
where PulseAudio is used. On BSD systems, ``--ao=oss`` is preferred.
Available audio output drivers are:
``alsa``
ALSA audio output driver.
``alsa`` (Linux only)
ALSA audio output driver
The following global options are supported by this audio output:
``--alsa-resample=yes``
Enable ALSA resampling plugin. (This is disabled by default, because
some drivers report incorrect audio delay in some cases.)
``--alsa-mixer-device=<device>``
Set the mixer device used with ``ao-volume`` (default: ``default``).
``--alsa-mixer-name=<name>``
Set the name of the mixer element (default: ``Master``). This is for
example ``PCM`` or ``Master``.
``--alsa-mixer-index=<number>``
Set the index of the mixer channel (default: 0). Consider the output of
"``amixer scontrols``", then the index is the number that follows the
name of the element.
``--alsa-non-interleaved``
Allow output of non-interleaved formats (if the audio decoder uses
this format). Currently disabled by default, because some popular
ALSA plugins are utterly broken with non-interleaved formats.
``--alsa-ignore-chmap``
Don't read or set the channel map of the ALSA device - only request the
required number of channels, and then pass the audio as-is to it. This
option most likely should not be used. It can be useful for debugging,
or for static setups with a specially engineered ALSA configuration (in
this case you should always force the same layout with ``--audio-channels``,
or it will work only for files which use the layout implicit to your
ALSA device).
``--alsa-buffer-time=<microseconds>``
Set the requested buffer time in microseconds. A value of 0 skips requesting
anything from the ALSA API. This and the ``--alsa-periods`` option uses the
ALSA ``near`` functions to set the requested parameters. If doing so results
in an empty configuration set, setting these parameters is skipped.
Both options control the buffer size. A low buffer size can lead to higher
CPU usage and audio dropouts, while a high buffer size can lead to higher
latency in volume changes and other filtering.
``--alsa-periods=<number>``
Number of periods requested from the ALSA API. See ``--alsa-buffer-time``
for further remarks.
See `ALSA audio output options`_ for options specific to this AO.
.. warning::
@@ -144,24 +95,11 @@ Available audio output drivers are:
passthrough (even if the device reports it as supported). Use with
extreme care.
``coreaudio_exclusive`` (macOS only)
Native macOS audio output driver using direct device access and
exclusive mode (bypasses the sound server).
``avfoundation`` (macOS only)
Native macOS audio output driver using ``AVSampleBufferAudioRenderer``
in AVFoundation, which supports `spatial audio
<https://support.apple.com/en-us/HT211775>`_.
.. warning::
Turning on spatial audio may hang the playback
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.
@@ -190,15 +128,18 @@ Available audio output drivers are:
Set the audio buffer size in milliseconds. A higher value buffers
more data, and has a lower probability of buffer underruns. A smaller
value makes the audio stream react faster, e.g. to playback speed
changes. "native" lets the sound server determine buffers.
changes.
``--pulse-latency-hacks=<yes|no>``
Enable hacks to workaround PulseAudio timing bugs (default: yes). If
Enable hacks to workaround PulseAudio timing bugs (default: no). If
enabled, mpv will do elaborate latency calculations on its own. If
disabled, it will use PulseAudio automatically updated timing
information. Disabling this might help with e.g. networked audio or
some plugins, while enabling it might help in some unknown situations
(it is currently enabled due to known bugs with PulseAudio 16.0).
(it used to be required to get good behavior on old PulseAudio versions).
If you have stuttering video when using pulse, try to enable this
option. (Or try to update PulseAudio.)
``--pulse-allow-suspended=<yes|no>``
Allow mpv to use PulseAudio even if the sink is suspended (default: no).
@@ -213,21 +154,16 @@ Available audio output drivers are:
Set the audio buffer size in milliseconds. A higher value buffers
more data, and has a lower probability of buffer underruns. A smaller
value makes the audio stream react faster, e.g. to playback speed
changes. "native" lets the sound server determine buffers.
changes.
``--pipewire-remote=<remote>``
Specify the PipeWire remote daemon name to connect to via local UNIX
sockets.
An empty <remote> string uses the default remote named ``pipewire-0``.
``--pipewire-volume-mode=<channel|global>``
Specify if the ``ao-volume`` property should apply to the channel
volumes or the global volume.
By default the channel volumes are used.
``sdl``
SDL 2.0+ audio output driver. Should work on any platform supported by SDL
2.0, but may require the ``SDL_AUDIODRIVER`` environment variable to be set
SDL 1.2+ audio output driver. Should work on any platform supported by SDL
1.2, but may require the ``SDL_AUDIODRIVER`` environment variable to be set
appropriately for your system.
.. note:: This driver is for compatibility with extremely foreign
@@ -306,18 +242,3 @@ 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=<default|min|1-2000000>``
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.
+2 -1
View File
@@ -10,7 +10,8 @@ There is no real changelog, but you can look at the following things:
* The git log, which is the "real" changelog
* The file https://github.com/mpv-player/mpv/blob/master/DOCS/interface-changes.rst
documents changes to the command and user interface, such as options and
properties.
properties. (It usually documents breaking changes only, additions and
enhancements are often not listed.)
* C API changes are listed in
https://github.com/mpv-player/mpv/blob/master/DOCS/client-api-changes.rst
* The file ``mplayer-changes.rst`` in the ``DOCS`` sub directory on the git
-58
View File
@@ -1,58 +0,0 @@
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 <text> [<cursor_pos>]``
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 `FILES`_).
``remember_input``
Default: yes
Whether to remember the input line and cursor position when closing the
console, and prefill it the next time it is opened.
+58 -139
View File
@@ -1,75 +1,73 @@
CONSOLE
=======
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.
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.
Console can either process free-form text or select from a predefined list of
items.
Keybindings
-----------
Free-form text mode keybindings
-------------------------------
\`
Show the console.
ESC and Ctrl+[
ESC
Hide the console.
ENTER, Ctrl+j and Ctrl+m
Select the first completion if one wasn't already manually selected, and run
the typed command.
ENTER, Ctrl+J and Ctrl+M
Run the typed command.
Shift+ENTER
Type a literal newline character.
LEFT and Ctrl+b
LEFT and Ctrl+B
Move the cursor to the previous character.
RIGHT and Ctrl+f
RIGHT and Ctrl+F
Move the cursor to the next character.
Ctrl+LEFT and Alt+b
Ctrl+LEFT and Alt+B
Move the cursor to the beginning of the current word, or if between words,
to the beginning of the previous word.
Ctrl+RIGHT and Alt+f
Ctrl+RIGHT and Alt+F
Move the cursor to the end of the current word, or if between words, to the
end of the next word.
HOME and Ctrl+a
HOME and Ctrl+A
Move the cursor to the start of the current line.
END and Ctrl+e
END and Ctrl+E
Move the cursor to the end of the current line.
BACKSPACE and Ctrl+h
BACKSPACE and Ctrl+H
Delete the previous character.
Ctrl+d
Ctrl+D
Hide the console if the current line is empty, otherwise delete the next
character.
Ctrl+BACKSPACE and Ctrl+w
Ctrl+BACKSPACE and Ctrl+W
Delete text from the cursor to the beginning of the current word, or if
between words, to the beginning of the previous word.
Ctrl+DEL and Alt+d
Ctrl+DEL and Alt+D
Delete text from the cursor to the end of the current word, or if between
words, to the end of the next word.
Ctrl+u
Ctrl+U
Delete text from the cursor to the beginning of the current line.
Ctrl+k
Ctrl+K
Delete text from the cursor to the end of the current line.
Ctrl+c
Ctrl+C
Clear the current line.
UP and Ctrl+p
UP and Ctrl+P
Move back in the command history.
DOWN and Ctrl+n
DOWN and Ctrl+N
Move forward in the command history.
PGUP
@@ -78,42 +76,37 @@ 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.
Ctrl+v
Ctrl+V
Paste text (uses the clipboard on X11 and Wayland).
Shift+INSERT
Paste text (uses the primary selection on X11 and Wayland).
Ctrl+y
Copy the current line to the clipboard.
TAB and Ctrl+I
Complete the command or property name at the cursor.
TAB and Ctrl+i
Cycle through completions.
Shift+TAB
Cycle through the completions backwards.
Ctrl+l
Ctrl+L
Clear all log messages from the console.
MBTN_MID
Paste text (uses the primary selection on X11 and Wayland).
Commands
--------
WHEEL_UP
Move back in the command history.
``script-message-to console type <text> [<cursor_pos>]``
Show the console and pre-fill it with the provided text, optionally
specifying the initial cursor position as a positive integer starting from
1.
WHEEL_DOWN
Move forward in the command history.
.. admonition:: Example for input.conf
``% script-message-to console type "seek absolute-percent" 6``
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
@@ -122,110 +115,36 @@ 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 `mp.options functions`_.
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.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
``monospace_font``
Default: platform dependent
``scale``
Default: 1
The monospace font used when there are completions to align in a grid.
All drawing is scaled by this value, including the text borders and the
cursor.
When there are no completions, ``--osd-font`` is used.
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)
Set the font used for the REPL and the console. This probably doesn't
have to be a monospaced font.
``font_size``
Default: 24
Default: 16
The font size. This will be multiplied by ``display-hidpi-scale`` when the
console is not scaled with the window.
``border_size``
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).
``gap``
Default: 0.2
The gap between menu items, specified as a percentage the font size.
``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``.
``focused_color``
Default: ``#222222``
The color of the focused item.
``focused_back_color``
Default: ``#FFFFFF``
The background color of the focused item.
``match_color``
Default: ``#0088FF``
The color of characters that match the searched string.
``exact_match``
Default: no
Whether to match menu search queries exactly instead of fuzzily. Without
this option, prefixing queries with ``'`` enables exact matching.
``case_sensitive``
Default: no
Whether exact searches are case sensitive. Only works with ASCII characters.
Set the font size used for the REPL and the console. This will be
multiplied by "scale".
``history_dedup``
Default: true
Remove duplicate entries in history as to only keep the latest one.
``font_hw_ratio``
Default: auto
The ratio of font height to font width.
Adjusts grid width of completions.
Values in the range 1.8..2.5 make sense for common monospace fonts.
-98
View File
@@ -1,98 +0,0 @@
CONTEXT MENU SCRIPT
===================
This script provides a context menu for platforms without integration with a
native context menu. On these platforms, it can be disabled entirely using the
``--load-context-menu=no`` option. On platforms where the integration is
implemented, it is already disabled by default.
Script messages
---------------
``open``
Show the context menu.
``select``
Select the focused item when there is one.
Configuration
-------------
This script can be customized through a config file
``script-opts/context_menu.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
~~~~~~~~~~~~~~~~~~~~
``font_size``
Default: 14
The font size.
``gap``
Default: 0.2
The gap between menu items, specified as a percentage the font size.
``padding_x``
Default: 8
The horizontal padding of the menu.
``padding_y``
Default: 4
The vertical 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: 5
The radius of the menu's corners.
``scale_with_window``
Default: auto
Whether to scale sizes with the window height. Can be ``yes``, ``no``, or
``auto``, which follows the value of ``--osd-scale-by-window``.
When sizes aren't scaled with the window, they are scaled by
``display-hidpi-scale``.
``focused_color``
Default: ``#222222``
The color of the focused item.
``focused_back_color``
Default: ``#FFFFFF``
The background color of the focused item.
``disabled_color``
Default: ``#555555``
The color of disabled items.
``seconds_to_open_submenus``
Default: 0.2
The number of seconds to open submenus after the cursor enters items
associated with one.
``seconds_to_close_submenus``
Default: 0.2
The number of seconds to close submenus after the cursor enters a parent
menu.
+20 -3
View File
@@ -8,7 +8,7 @@ You can encode files from one format/codec to another using this facility.
``--of=<format>``
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=<options>``
@@ -28,6 +28,10 @@ You can encode files from one format/codec to another using this facility.
Specifies the output audio codec. See ``--oac=help`` for a full list of
supported codecs.
``--oaoffset=<value>``
Shifts audio data by the given time (in seconds) by adding/removing
samples at the start. Deprecated.
``--oacopts=<options>``
Specifies the output audio codec options for libavcodec.
See ``--oacopts=help`` for a full list of supported options.
@@ -46,10 +50,18 @@ You can encode files from one format/codec to another using this facility.
``--oacopts=""``
Completely empties the options list.
``--oafirst``
Force the audio stream to become the first stream in the output.
By default, the order is unspecified. Deprecated.
``--ovc=<codec>``
Specifies the output video codec. See ``--ovc=help`` for a full list of
supported codecs.
``--ovoffset=<value>``
Shifts video data by the given time (in seconds) by shifting the pts
values. Deprecated.
``--ovcopts=<options>``
Specifies the output video codec options for libavcodec.
See --ovcopts=help for a full list of supported options.
@@ -71,14 +83,19 @@ You can encode files from one format/codec to another using this facility.
``--ovcopts=""``
Completely empties the options list.
``--ovfirst``
Force the video stream to become the first stream in the output.
By default, the order is unspecified. Deprecated.
``--orawts``
Copies input pts to the output video (not supported by some output
container formats, e.g. AVI). In this mode, discontinuities are not fixed
and all pts are passed through as-is. Never seek backwards or use multiple
input files in this mode!
``--ocopy-metadata=<yes|no>``
Copy metadata from input files to output files when encoding (default: yes).
``--no-ocopy-metadata``
Turns off copying of metadata from input files to output files when
encoding (which is enabled by default).
``--oset-metadata=<metadata-tag[,metadata-tag,...]>``
Specifies metadata to include in the output file.
+731 -1446
View File
File diff suppressed because it is too large. Load diff
+4 -6
View File
@@ -3,10 +3,8 @@ JSON IPC
mpv can be controlled by external programs using the JSON-based IPC protocol.
It can be enabled by specifying the path to a unix socket or a named pipe using
the option ``--input-ipc-server``, or the file descriptor number of a unix socket
or a named pipe using ``--input-ipc-client``.
Clients can connect to this socket and send commands to the player or receive
events from it.
the option ``--input-ipc-server``. Clients can connect to this socket and send
commands to the player or receive events from it.
.. warning::
@@ -195,8 +193,8 @@ And this is the completion:
{"request_id":123,"error":"success","data":null}
By design, you will not get a confirmation that the command was started. If a
command is long running, sending the message will not lead to any reply until
much later when the command finishes.
command is long running, sending the message will lead to any reply until much
later when the command finishes.
Some commands execute synchronously, but these will behave like asynchronous
commands that finished execution immediately.
+10 -23
View File
@@ -27,17 +27,16 @@ otherwise, the documented Lua options, script directories, loading, etc apply to
JavaScript files too.
Script initialization and lifecycle is the same as with Lua, and most of the Lua
functions in the modules ``mp``, ``mp.utils``, ``mp.msg``, ``mp.options`` and
``mp.input`` are available to JavaScript with identical APIs - including running
commands, getting/setting properties, registering events/key-bindings/hooks,
etc.
functions at the modules ``mp``, ``mp.utils``, ``mp.msg`` and ``mp.options`` are
available to JavaScript with identical APIs - including running commands,
getting/setting properties, registering events/key-bindings/hooks, etc.
Differences from Lua
--------------------
No need to load modules. ``mp``, ``mp.utils``, ``mp.msg``, ``mp.options`` and
``mp.input`` are preloaded, and you can use e.g. ``var cwd =
mp.utils.getcwd();`` without prior setup.
No need to load modules. ``mp``, ``mp.utils``, ``mp.msg`` and ``mp.options``
are preloaded, and you can use e.g. ``var cwd = mp.utils.getcwd();`` without
prior setup.
Errors are slightly different. Where the Lua APIs return ``nil`` for error,
the JavaScript ones return ``undefined``. Where Lua returns ``something, error``
@@ -96,8 +95,6 @@ success, ``error`` is empty string on success.
``mp.abort_async_command(id)``
``mp.del_property(name)`` (LE)
``mp.get_property(name [,def])`` (LE)
``mp.get_property_osd(name [,def])`` (LE)
@@ -196,20 +193,6 @@ meta-paths like ``~~/foo`` (other JS file functions do expand meta paths).
``mp.options.read_options(obj [, identifier [, on_update]])`` (types:
string/boolean/number)
``mp.input.get(obj)``
``mp.input.select(obj)``
``mp.input.terminate()``
``mp.input.log(message, style)``
``mp.input.log_error(message)``
``mp.input.set_log(log)``
``exit()`` (global)
Additional utilities
--------------------
@@ -258,6 +241,10 @@ text content only.
``mp.get_script_file()``
Returns the file name of the current script.
``exit()`` (global)
Make the script exit at the end of the current event loop iteration.
Note: please remove added key bindings before calling ``exit()``.
``mp.utils.compile_js(fname, content_str)``
Compiles the JS code ``content_str`` as file name ``fname`` (without loading
anything from the filesystem), and returns it as a function. Very similar
+8 -13
View File
@@ -2,14 +2,14 @@ EMBEDDING INTO OTHER PROGRAMS (LIBMPV)
======================================
mpv can be embedded into other programs as video/audio playback backend. The
recommended way to do so is using libmpv. See ``include/mpv/client.h`` in the mpv
recommended way to do so is using libmpv. See ``libmpv/client.h`` in the mpv
source code repository. This provides a C API. Bindings for other languages
might be available (see wiki).
Since libmpv merely allows access to underlying mechanisms that can control
mpv, further documentation is spread over a few places:
- https://github.com/mpv-player/mpv/blob/master/include/mpv/client.h
- https://github.com/mpv-player/mpv/blob/master/libmpv/client.h
- https://mpv.io/manual/master/#options
- https://mpv.io/manual/master/#list-of-input-commands
- https://mpv.io/manual/master/#properties
@@ -21,15 +21,15 @@ C PLUGINS
You can write C plugins for mpv. These use the libmpv API, although they do not
use the libmpv library itself.
They are enabled by default if compiler supports linking with the ``-rdynamic``
flag on Linux/BSD platforms. On Windows the are always enabled.
They are available on Linux/BSD platforms only and enabled by default if the
compiler supports linking with the ``-rdynamic`` flag.
C plugins location
------------------
C plugins are put into the mpv scripts directory in its config directory
(see the `FILES`_ section for details). They must have a ``.so`` or ``.dll``
file extension. They can also be explicitly loaded with the ``--script`` option.
(see the `FILES`_ section for details). They must have a ``.so`` file extension.
They can also be explicitly loaded with the ``--script`` option.
API
---
@@ -38,7 +38,7 @@ A C plugin must export the following function::
int mpv_open_cplugin(mpv_handle *handle)
The plugin function will be called on loading time. This function must not
The plugin function will be called on loading time. This function does not
return as long as your plugin is loaded (it runs in its own thread). The
``handle`` will be deallocated as soon as the plugin function returns.
@@ -52,8 +52,7 @@ behavior.
Within the plugin function, you can call libmpv API functions. The ``handle``
is created by ``mpv_create_client()`` (or actually an internal equivalent),
and belongs to you. You can call ``mpv_wait_event()`` to wait for things
happening, and so on. However do not call ``mpv_destroy()`` or
``mpv_terminate_destroy()`` on this handle.
happening, and so on.
Note that the player might block until your plugin calls ``mpv_wait_event()``
for the first time. This gives you a chance to install initial hooks etc.
@@ -68,10 +67,6 @@ The current implementation requires that your plugins are **not** linked against
libmpv. What your plugins use are not symbols from a libmpv binary, but
symbols from the mpv host binary.
On Windows to make symbols from the host binary available, you have to define
MPV_CPLUGIN_DYNAMIC_SYM when compiling cplugin. This will load symbols
dynamically, before calling ``mpv_open_cplugin()``.
Examples
--------
+23 -212
View File
@@ -7,6 +7,7 @@ mpv provides the built-in module ``mp``, which contains functions to send
commands to the mpv core and to retrieve information about playback state, user
settings, file information, and so on.
These scripts can be used to control mpv in a similar way to slave mode.
Technically, the Lua code uses the client API internally.
Example
@@ -61,15 +62,15 @@ that uses the ``.foo`` file extension.
mpv also appends the top level directory of the script to the start of Lua's
package path so you can import scripts from there too. Be aware that this will
shadow Lua libraries that use the same package path. (Single file scripts do not
include mpv specific directories in the Lua package path. This was silently
changed in mpv 0.32.0.)
include mpv specific directory the Lua package path. This was silently changed
in mpv 0.32.0.)
Using a script directory is the recommended way to package a script that
consists of multiple source files, or requires other files (you can use
``mp.get_script_directory()`` to get the location and e.g. load data files).
Making a script a git repository, basically a repository which contains a
``main.lua`` file in the root directory, makes scripts easily updateable
``main.lua``` file in the root directory, makes scripts easily updateable
(without the dangers of auto-updates). Another suggestion is to use git
submodules to share common files or libraries.
@@ -85,8 +86,7 @@ own event handlers which you have registered with ``mp.register_event``, or
timers added with ``mp.add_timeout`` or similar. Note that since the
script starts execution concurrently with player initialization, some properties
may not be populated with meaningful values until the relevant subsystems have
initialized. Rather than retrieving these properties at the top of scripts, you
should use ``mp.observe_property`` or read them within event handlers.
initialized.
When the player quits, all scripts will be asked to terminate. This happens via
a ``shutdown`` event, which by default will make the event loop return. If your
@@ -174,7 +174,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
as possible), and upon completion, fn is called. fn has three arguments:
``fn(success, result, error)``:
``success``
``success``
Always a Boolean and is true if the command was successful,
otherwise false.
@@ -199,12 +199,6 @@ The ``mp`` module is preloaded, although it can be loaded manually with
Whether this works and how long it takes depends on the command and the
situation. The abort call itself is asynchronous. Does not return anything.
``mp.del_property(name)``
Delete the given property. See ``mp.get_property`` and `Properties`_ for more
information about properties. Most properties cannot be deleted.
Returns true on success, or ``nil, error`` on error.
``mp.get_property(name [,def])``
Return the value of the given property as string. These are the same
properties as used in input.conf. See `Properties`_ for a list of
@@ -292,18 +286,6 @@ The ``mp`` module is preloaded, although it can be loaded manually with
After calling this function, key presses will cause the function ``fn`` to
be called (unless the user remapped the key with another binding).
However, if the key binding is canceled , the function will not be called,
unless ``complex`` flag is set to ``true``, where the function will be
called with the ``canceled`` entry set to ``true``.
For example, a canceled key binding can happen in the following situations:
- If key A is pressed while key B is being held down, key B is logically
released ("canceled" by key A), which stops the current autorepeat
action key B has.
- If key A is pressed while a mouse button is being held down, the mouse
button is logically released, but the mouse button's action will not be
called, unless ``complex`` flag is set to ``true``.
The ``name`` argument should be a short symbolic string. It allows the user
to remap the key binding via input.conf using the ``script-message``
@@ -315,36 +297,24 @@ The ``mp`` module is preloaded, although it can be loaded manually with
or pass the ``fn`` argument in place of the name. The latter is not
recommended and is handled for compatibility only.)
The ``flags`` argument is used for optional parameters. This is a table,
which can have the following entries:
The last argument is used for optional flags. This is a table, which can
have the following entries:
``repeatable``
If set to ``true``, enables key repeat for this specific binding.
This option only makes sense when ``complex`` is not set to ``true``.
``scalable``
If set to ``true``, enables key scaling for this specific binding.
This option only makes sense when ``complex`` is set to ``true``.
Note that this has no effect if the key binding is invoked by
``script-binding`` command, where the scalability of the command
takes precedence.
``complex``
If set to ``true``, then ``fn`` is called on key down, repeat and up
events, with the first argument being a table. This table has the
following entries (and may contain undocumented ones):
If set to ``true``, then ``fn`` is called on both key up and down
events (as well as key repeat, if enabled), with the first
argument being a table. This table has the following entries (and
may contain undocumented ones):
``event``
Set to one of the strings ``down``, ``repeat``, ``up`` or
``press`` (the latter if key up/down/repeat can't be
tracked), which indicates the key's logical state.
``press`` (the latter if key up/down can't be tracked).
``is_mouse``
Boolean: Whether the event was caused by a mouse button.
``canceled``
Boolean: Whether the event was canceled.
Not all types of cancellations set this flag.
Boolean Whether the event was caused by a mouse button.
``key_name``
The name of they key that triggered this, or ``nil`` if
@@ -356,15 +326,6 @@ The ``mp`` module is preloaded, although it can be loaded manually with
description of ``script-binding`` command for details (this
field is equivalent to the 5th argument).
``scale``
The scale of the key, such as the ones produced by ``WHEEL_*``
keys. The scale is 1 if the key is nonscalable.
``arg``
User-provided string in the ``arg`` argument in the
``script-binding`` command if the key binding is invoked
by that command.
Internally, key bindings are dispatched via the ``script-message-to`` or
``script-binding`` input commands and ``mp.register_script_message``.
@@ -445,7 +406,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
the property will be passed as second argument to ``fn``, using
``mp.get_property_<type>`` to retrieve it. This means if ``type`` is for
example ``string``, ``fn`` is roughly called as in
``fn(name, mp.get_property(name))``.
``fn(name, mp.get_property_string(name))``.
If possible, change events are coalesced. If a property is changed a bunch
of times in a row, only the last change triggers the change function. (The
@@ -459,9 +420,9 @@ The ``mp`` module is preloaded, although it can be loaded manually with
This depends on the property, and it's a valid feature request to ask for
better update handling of a specific property.
If the ``type`` is ``none`` or ``nil``, the change function ``fn`` will be
called sporadically even if the property doesn't actually change. You should
therefore avoid using these types.
If the ``type`` is ``none`` or ``nil``, sporadic property change events are
possible. This means the change function ``fn`` can be called even if the
property doesn't actually change.
You always get an initial change notification. This is meant to initialize
the user's state to the current value of the property.
@@ -471,26 +432,21 @@ The ``mp`` module is preloaded, although it can be loaded manually with
that are equal to the ``fn`` parameter. This uses normal Lua ``==``
comparison, so be careful when dealing with closures.
``mp.add_timeout(seconds, fn [, disabled])``
``mp.add_timeout(seconds, fn)``
Call the given function fn when the given number of seconds has elapsed.
Note that the number of seconds can be fractional. For now, the timer's
resolution may be as low as 50 ms, although this will be improved in the
future.
If the ``disabled`` argument is set to ``true`` or a truthy value, the
timer will wait to be manually started with a call to its ``resume()``
method.
This is a one-shot timer: it will be removed when it's fired.
Returns a timer object. See ``mp.add_periodic_timer`` for details.
``mp.add_periodic_timer(seconds, fn [, disabled])``
``mp.add_periodic_timer(seconds, fn)``
Call the given function periodically. This is like ``mp.add_timeout``, but
the timer is re-added after the function fn is run.
Returns a timer object. The timer object provides the following methods:
``stop()``
Disable the timer. Does nothing if the timer is already disabled.
This will remember the current elapsed time when stopping, so that
@@ -535,7 +491,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
seconds = 0
timer = mp.add_periodic_timer(1, function()
print("called every second")
-- stop it after 10 seconds
# stop it after 10 seconds
seconds = seconds + 1
if seconds >= 10 then
timer:kill()
@@ -663,20 +619,6 @@ are useful only in special situations.
May return invalid/nonsense values if OSD is not initialized yet.
``exit()`` (global)
Make the script exit at the end of the current event loop iteration. This
does not terminate mpv itself or other scripts.
This can be polyfilled to support mpv versions older than 0.40 with:
::
if not _G.exit then
function exit()
mp.keep_running = false
end
end
mp.msg functions
----------------
@@ -732,13 +674,13 @@ with values found in the config-file and the command-line (in that order).
Example implementation::
require 'mp.options'
local options = {
optionA = "defaultvalueA",
optionB = -0.5,
optionC = true,
}
require "mp.options".read_options(options, "myscript")
read_options(options, "myscript")
print(options.optionA)
@@ -910,137 +852,6 @@ strictly part of the guaranteed API.
Turn the given value into a string. Formats tables and their contents. This
doesn't do anything special; it is only needed because Lua is terrible.
mp.input functions
--------------------
This module lets scripts get textual input from the user using the console
REPL.
``input.get(table)``
Show the console to let the user enter text.
The following entries of ``table`` are read:
``prompt``
The string to be displayed before the input field.
``submit``
A callback invoked when the user presses Enter. The first argument is
the text in the console.
``keep_open``
Whether to keep the console open on submit. Defaults to ``false``.
``opened``
A callback invoked when the console is shown. This can be used to
present a list of options with ``input.set_log()``.
``edited``
A callback invoked when the text changes. The first argument is the text
in the console.
``complete``
A callback invoked when the user edits the text or moves the cursor. The
first argument is the text before the cursor. The callback should return
a table of the string candidate completion values and the 1-based cursor
position from which the completion starts. console will show the
completions that fuzzily match the text between this position and the
cursor and allow selecting them.
The third and optional return value is a string that will be appended to
the input line without displaying it in the completions.
``autoselect_completion``
Whether to automatically select the first completion on submit if one
wasn't already manually selected. Defaults to ``false``.
``closed``
A callback invoked when the console is hidden, either because
``input.terminate()`` was invoked from the other callbacks, or because
the user closed it with a key binding. The first argument is the text in
the console, and the second argument is the cursor position.
``default_text``
A string to pre-fill the input field with.
``cursor_position``
The initial cursor position, starting from 1.
``history_path``
If specified, the path to save and load the history of the entered
lines.
``id``
An identifier that determines which input history and log buffer to use
among the ones stored for ``input.get()`` calls. Defaults to the calling
script name with ``prompt`` appended.
``input.terminate()``
Close the console.
``input.log(message, style, terminal_style)``
Add a line to the log buffer. ``style`` can contain additional ASS tags to
apply to ``message``, and ``terminal_style`` can contain escape sequences
that are used when the console is displayed in the terminal.
``input.log_error(message)``
Helper to add a line to the log buffer with the same color as the one used
for commands that error. Useful when the user submits invalid input.
``input.set_log(log)``
Replace the entire log buffer.
``log`` is a table of strings, or tables with ``text``, ``style`` and
``terminal_style`` keys.
Example:
::
input.set_log({
"regular text",
{
text = "error text",
style = "{\\c&H7a77f2&}",
terminal_style = "\027[31m",
}
})
``input.select(table)``
Specify a list of items that are presented to the user for selection.
The following entries of ``table`` are read:
``prompt``
The string to be displayed before the input field.
``items``
The table of the entries to choose from.
``default_item``
The 1-based integer index of the preselected item.
``submit``
The callback invoked when the user presses Enter. The first argument is
the 1-based index of the selected item.
``keep_open``
Whether to keep the console open on submit. Defaults to ``false``.
Example:
::
input.select({
items = {
"First playlist entry",
"Second playlist entry",
},
submit = function (id)
mp.commandv("playlist-play-index", id - 1)
end,
})
Events
------
+173 -380
View File
@@ -47,8 +47,7 @@ See `COMMAND INTERFACE`_ and `Key names`_ sections for more details on
configuring keybindings.
See also ``--input-test`` for interactive binding details by key, and the
`stats`_ built-in script for key bindings list (including print to terminal). By
default, the ? key toggles the display of this list.
`stats`_ built-in script for key bindings list (including print to terminal).
Keyboard Control
----------------
@@ -65,8 +64,8 @@ Ctrl+LEFT and Ctrl+RIGHT
Seek to the previous/next subtitle. Subject to some restrictions and
might not always work; see ``sub-seek`` command.
Ctrl+Shift+LEFT and Ctrl+Shift+RIGHT
Adjust subtitle delay so that the previous or next subtitle is displayed
Ctrl+Shift+Left and Ctrl+Shift+Right
Adjust subtitle delay so that the next or previous subtitle is displayed
now. This is especially useful to sync subtitles to audio.
[ and ]
@@ -95,10 +94,7 @@ Shift+Ctrl+BACKSPACE
ENTER
Go forward in the playlist.
Shift+HOME and Shift+END
Go to the first/last playlist entry.
p and SPACE
p / SPACE
Pause (pressing again unpauses).
\.
@@ -120,9 +116,6 @@ Q
/ and *
Decrease/increase volume.
KP_DIVIDE and KP_MULTIPLY
Decrease/increase volume.
9 and 0
Decrease/increase volume.
@@ -149,10 +142,9 @@ T
w and W
Decrease/increase pan-and-scan range. The ``e`` key does the same as
``W`` currently, but use is discouraged. See ``--panscan`` for more
information.
``W`` currently, but use is discouraged.
o and P
o (also P)
Show progression bar, elapsed time and total duration on the OSD.
O
@@ -161,14 +153,11 @@ O
v
Toggle subtitle visibility.
Alt+v
Toggle secondary subtitle visibility.
j and J
Cycle through the available subtitles.
z and Z
Adjust subtitle delay by -/+ 0.1 seconds. The ``x`` key does the same as
Adjust subtitle delay by +/- 0.1 seconds. The ``x`` key does the same as
``Z`` currently, but use is discouraged.
l
@@ -177,23 +166,20 @@ l
L
Toggle infinite looping.
Ctrl++ and Ctrl+-
Ctrl + and Ctrl -
Adjust audio delay (A/V sync) by +/- 0.1 seconds.
Ctrl+KP_ADD and Ctrl+KP_SUBTRACT
Adjust audio delay (A/V sync) by +/- 0.1 seconds.
G and F
Shift+g and Shift+f
Adjust subtitle font size by +/- 10%.
u
Switch between applying only ``--sub-ass-*`` overrides (default) to SSA/ASS
subtitles, and overriding them almost completely with the normal subtitle
style. See ``--sub-ass-override`` for more info.
Switch between applying no style overrides to SSA/ASS subtitles, and
overriding them almost completely with the normal subtitle style. See
``--sub-ass-override`` for more info.
V
Cycle through which video data gets used for ASS rendering.
See ``--sub-ass-use-video-data`` for more info.
Toggle subtitle VSFilter aspect compatibility mode. See
``--sub-ass-vsfilter-aspect-compat`` for more info.
r and R
Move subtitles up/down. The ``t`` key does the same as ``R`` currently, but
@@ -206,13 +192,10 @@ S
Take a screenshot, without subtitles. (Whether this works depends on VO
driver support.)
Ctrl+s
Ctrl s
Take a screenshot, as the window shows it (with subtitles, OSD, and scaled
video).
HOME
Seek to the beginning of the file.
PGUP and PGDWN
Seek to the beginning of the previous/next chapter. In most cases,
"previous" will actually go to the beginning of the current chapter; see
@@ -222,51 +205,38 @@ Shift+PGUP and Shift+PGDWN
Seek backward or forward by 10 minutes. (This used to be mapped to
PGUP/PGDWN without Shift.)
b
Activate/deactivate debanding.
d
Cycle the deinterlacing filter.
Activate/deactivate deinterlacer.
A
Cycle aspect ratio override.
Ctrl+h
Ctrl h
Toggle hardware video decoding on/off.
Alt+LEFT, Alt+RIGHT, Alt+UP, Alt+DOWN
Move the video rectangle (panning).
Alt++ and Alt+-
Change video zoom.
Alt+KP_ADD and Alt+KP_SUBTRACT
Change video zoom.
Alt + and Alt -
Combining ``Alt`` with the ``+`` or ``-`` keys changes video zoom.
Alt+BACKSPACE
Reset the pan/zoom settings.
F8
Show the playlist and the current position in it.
Show the playlist and the current position in it (useful only if a UI window
is used, broken on the terminal).
F9
Show the list of audio and subtitle streams.
Ctrl+v
Append the file or URL in the clipboard to the playlist. If nothing is
currently playing, it is played immediately. Only works on platforms that
support the ``clipboard`` property.
Show the list of audio and subtitle streams (useful only if a UI window is
used, broken on the terminal).
i and I
Show/toggle an overlay displaying statistics about the currently playing
file such as codec, framerate, number of dropped frames and so on. See
`STATS`_ for more information.
?
Toggle an overlay displaying the active key bindings. See `STATS`_ for more
information.
DEL
del
Cycle OSC visibility between never / auto (mouse-move) / always
\`
@@ -287,75 +257,18 @@ corresponding adjustment.)
7 and 8
Adjust saturation.
Alt+0 (and Command+0 on macOS)
Alt+0 (and command+0 on macOS)
Resize video window to half its original size.
Alt+1 (and Command+1 on macOS)
Alt+1 (and command+1 on macOS)
Resize video window to its original size.
Alt+2 (and Command+2 on macOS)
Alt+2 (and command+2 on macOS)
Resize video window to double its original size.
Command + f (macOS only)
command + f (macOS only)
Toggle fullscreen (see also ``--fs``).
(The following keybindings open a menu in the console that lets you choose from
a list of items by typing part of the desired item, by clicking the desired
item, or by navigating them with keybindings: ``Down`` and ``Ctrl+n`` go down,
``Up`` and ``Ctrl+p`` go up, ``Page down`` and ``Ctrl+f`` scroll down one page,
and ``Page up`` and ``Ctrl+b`` scroll up one page.)
In track menus, selecting the current tracks disables it.
g-p
Select a playlist entry.
g-s
Select a subtitle track.
g-S
Select a secondary subtitle track.
g-a
Select an audio track.
g-v
Select a video track.
g-t
Select a track of any type.
g-c
Select a chapter.
g-e
Select an MKV edition or DVD/Blu-ray title.
g-l
Select a subtitle line to seek to. This currently requires ``ffmpeg`` in
``PATH``, or in the same folder as mpv on Windows.
g-d
Select an audio device.
g-h
Select a file from the watch history. Requires ``--save-watch-history``.
g-w
Select a file from watch later config files (see `RESUMING PLAYBACK`_) to
resume playing. Requires ``--write-filename-in-watch-later-config``.
g-b
Select a defined input binding.
g-r
Show the values of all properties.
g-m, MENU, Ctrl+p
Show a menu with miscellaneous entries.
See `SELECT`_ for more information.
(The following keys are valid if you have a keyboard with multimedia keys.)
PAUSE
@@ -367,8 +280,6 @@ STOP
PREVIOUS and NEXT
Seek backward/forward 1 minute.
ZOOMIN and ZOOMOUT
Change video zoom.
If you miss some older key bindings, look at ``etc/restore-old-bindings.conf``
in the mpv git repository.
@@ -376,10 +287,6 @@ in the mpv git repository.
Mouse Control
-------------
Ctrl+left click
Pan while holding the button, keeping the clicked part of the video under
the cursor.
Left double click
Toggle fullscreen on/off.
@@ -390,24 +297,11 @@ Forward/Back button
Skip to next/previous entry in playlist.
Wheel up/down
Decrease/increase volume.
Wheel left/right
Seek forward/backward 10 seconds.
Ctrl+Wheel up/down
Change video zoom keeping the part of the video hovered by the cursor under
it.
Wheel left/right
Decrease/increase volume.
Context Menu
-------------
Context Menu is a menu that pops up on the video window on user interaction
(mouse right click, etc.).
To use this feature, you need to fill the ``menu-data`` property with menu
definition data, and add a keybinding to run the ``context-menu`` command,
which can be done with a user script.
USAGE
=====
@@ -537,62 +431,37 @@ console controls. (Which makes it suitable for playing data piped to stdin.)
The special argument ``--`` can be used to stop mpv from interpreting the
following arguments as options.
For paths passed to mpv suboptions (options that have multiple `:` and
`,`-separated values), the situation is further complicated by the need to
escape special characters. To work around this, the path can instead be wrapped
in the "fixed-length" syntax, e.g. ``%n%string_of_length_n`` (see above).
When using the libmpv API, you should strictly avoid using ``mpv_command_string``
When using the client API, you should strictly avoid using ``mpv_command_string``
for invoking the ``loadfile`` command, and instead prefer e.g. ``mpv_command``
to avoid the need for filename escaping.
The same applies when you're using the scripting API, where you should avoid using
``mp.command``, and instead prefer using "separate parameter" APIs, such as
``mp.commandv`` and ``mp.command_native``.
For paths passed to suboptions, the situation is further complicated by the
need to escape special characters. To work this around, the path can be
additionally wrapped in the fixed-length syntax, e.g. ``%n%string_of_length_n``
(see above).
Some mpv options will interpret special meanings for paths starting with ``~``,
making it easy to dynamically find special directories, such as referring to the
current user's home directory or the mpv configuration directory.
When using the special ``~`` prefix, there must always be a trailing ``/`` after
the special path prefix. In other words, ``~`` doesn't work, but ``~/`` will work.
The following special paths/keywords are currently recognized:
.. warning::
Beware that if ``--no-config`` is used, all of the "config directory"-based
paths (``~~/``, ``~~home/`` and ``~~global/``) will be empty strings.
This means that ``~~home/`` would expand to an empty string, and that
sub-paths such as ``~~home/foo/bar"`` would expand to a relative path
(``foo/bar``), which may not be what you expected.
Furthermore, any commands that search in config directories will fail
to find anything, since there won't be any directories to search in.
Be sure that your scripts can handle these "no config" scenarios.
Some mpv options interpret paths starting with ``~``.
Currently, the prefix ``~~home/`` expands to the mpv configuration directory
(usually ``~/.config/mpv/``).
``~/`` expands to the user's home directory. (The trailing ``/`` is always
required.) The following paths are currently recognized:
================ ===============================================================
Name Meaning
================ ===============================================================
``~/`` The current user's home directory (equivalent to ``~/`` and
``$HOME/`` in terminal environments).
``~~/`` If the sub-path exists in any of mpv's config directories, then
``~~/`` If the subpath exists in any of the mpv's config directories
the path of the existing file/dir is returned. Otherwise this
is equivalent to ``~~home/``.
``~~home/`` mpv's config dir (for example ``~/.config/mpv/``).
``~~global/`` The global config path (such as ``/etc/mpv``), if available
(not on win32).
``~~osxbundle/`` The macOS bundle resource path (macOS only).
``~~desktop/`` The path to the desktop.
``~~exe_dir/`` The path to the directory containing ``mpv.exe`` (for config
file purposes, ``$MPV_HOME`` will override this) (win32 only).
``~~cache/`` The path to application cache data (``~/.cache/mpv/``).
On some platforms, this will be the same as ``~~home/``.
``~~state/`` The path to application state data (``~/.local/state/mpv/``).
On some platforms, this will be the same as ``~~home/``.
``~~old_home/`` Do not use.
Note that if --no-config is used ``~~/foobar`` will resolve to
``foobar`` which can be unexpected.
``~/`` user home directory root (similar to shell, ``$HOME``)
``~~home/`` mpv config dir (for example ``~/.config/mpv/``)
``~~global/`` the global config path, if available (not on win32)
``~~osxbundle/`` the macOS bundle resource path (macOS only)
``~~desktop/`` the path to the desktop (win32, macOS)
``~~exe_dir/`` win32 only: the path to the directory containing the exe (for
config file purposes; ``$MPV_HOME`` overrides it)
``~~old_home/`` do not use
================ ===============================================================
@@ -650,8 +519,10 @@ String list and path list options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
String lists are separated by ``,``. The strings are not parsed or interpreted
by the option system itself. However, most path or file list options use ``:``
(Unix) or ``;`` (Windows) as separator, instead of ``,``.
by the option system itself. However, most
Path or file list options use ``:`` (Unix) or ``;`` (Windows) as separator,
instead of ``,``.
They support the following operations:
@@ -663,9 +534,9 @@ Suffix Meaning
-add Append 1 or more items (same syntax as -set)
-pre Prepend 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-del Delete 1 or more items if present (same syntax as -set)
-remove Delete item if present (does not interpret escapes)
-toggle Append an item, or remove it if it already exists (no escapes)
-del Delete 1 or more items by integer index (deprecated)
-toggle Append an item, or remove if if it already exists (no escapes)
============= ===============================================
``-append`` is meant as a simple way to append a single item without having
@@ -686,8 +557,6 @@ Suffix Meaning
-set Set a list of items (using ``,`` as separator)
-append Append a single item (escapes for the key, no escapes for the value)
-add Append 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-del Delete 1 or more keys if present (same syntax as -set)
-remove Delete item by key if present (does not interpret escapes)
============= ===============================================
@@ -695,30 +564,30 @@ Keys are unique within the list. If an already present key is set, the existing
key is removed before the new value is appended.
If you want to pass a value without interpreting it for escapes or ``,``, it is
recommended to use the ``-append`` variant. When using libmpv, prefer using
recommended to use the ``-add`` variant. When using libmpv, prefer using
``MPV_FORMAT_NODE_MAP``; when using a scripting backend or the JSON IPC, use an
appropriate structured data type.
Prior to mpv 0.33, ``:`` was also recognized as separator by ``-set``.
Object settings list options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Filter options
~~~~~~~~~~~~~~
This is a very complex option type for some options, such as ``--af`` and ``--vf``.
They often require complicated escaping. See `VIDEO FILTERS`_ for details.
They support the following operations:
This is a very complex option type for the ``--af`` and ``--vf`` options only.
They often require complicated escaping. See `VIDEO FILTERS`_ for details. They
support the following operations:
============= ===============================================
Suffix Meaning
============= ===============================================
-set Set a list of items (using ``,`` as separator)
-append Append single item
-add Append 1 or more items (same syntax as -set)
-pre Prepend 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-remove Delete 1 or items if present (same syntax as -set)
-toggle Append an item, or remove it if it already exists
-set Set a list of filters (using ``,`` as separator)
-append Append single filter
-add Append 1 or more filters (same syntax as -set)
-pre Prepend 1 or more filters (same syntax as -set)
-clr Clear the option (remove all filters)
-remove Delete filter if present
-del Delete 1 or more filters by integer index or filter label (deprecated)
-toggle Append a filter, or remove if if it already exists
-help Pseudo operation that prints a help text to the terminal
============= ===============================================
@@ -727,9 +596,10 @@ General
Without suffix, the operation used is normally ``-set``.
Some operations like ``-add`` and ``-pre`` specify multiple items, but be
aware that you may need to escape the arguments. ``-append`` accepts a single,
unescaped item only (so the ``,`` separator will not be interpreted and
Although some operations allow specifying multiple items, using this is strongly
discouraged and deprecated, except for ``-set``. There is a chance that
operations like ``-add`` and ``-pre`` will work like ``-append`` and accept a
single, unescaped item only (so the ``,`` separator will not be interpreted and
is passed on as part of the value).
Some options (like ``--sub-file``, ``--audio-file``, ``--glsl-shader``) are
@@ -740,8 +610,6 @@ Options of this type can be changed at runtime using the ``change-list``
command, which takes the suffix (without the ``-``) as separate operation
parameter.
An object settings list can hold up to 100 elements.
CONFIGURATION FILES
===================
@@ -755,35 +623,30 @@ user-specific one is ``~/.config/mpv/mpv.conf``. For details and platform
specifics (in particular Windows paths) see the `FILES`_ section.
User-specific options override system-wide options and options given on the
command line override both. The syntax of the configuration files is
``option=value``. Everything after a *#* is considered a comment. Options that
work without values can be enabled by setting them to *yes* and disabled by
setting them to *no*, and if the value is omitted, *yes* is implied. Even
suboptions can be specified in this way.
command line override either. The syntax of the configuration files is
``option=value``. Everything after a *#* is considered a comment. Options
that work without values can be enabled by setting them to *yes* and disabled by
setting them to *no*. Even suboptions can be specified in this way.
.. admonition:: Example configuration file
::
# Don't allow new windows to be larger than the screen.
autofit-larger=100%x100%
# Enable hardware decoding if available, =yes is implied.
hwdec
# Spaces don't have to be escaped.
osd-playing-msg=File: ${filename}
# Use GPU-accelerated video output by default.
vo=gpu
# Use quotes for text that can contain spaces:
term-status-msg="Time: ${time-pos}"
Escaping special characters
Escaping spaces and special characters
--------------------------------------
This is done like with command line options. A config entry can be quoted with
``"``, ``'``, as well as with the fixed-length syntax (``%n%``) mentioned
before. This is like passing the exact contents of the quoted string as a
command line option. C-style escapes are currently _not_ interpreted on this
level, although some options do this manually (this is a mess and should
probably be changed at some point). The shell is not involved here, so option
values only need to be quoted to escape ``#`` anywhere in the value, ``"``,
``'`` or ``%`` at the beginning of the value, and leading and trailing
whitespace.
This is done like with command line options. The shell is not involved here,
but option values still need to be quoted as a whole if it contains certain
characters like spaces. A config entry can be quoted with ``"``,
as well as with the fixed-length syntax (``%n%``) mentioned before. This is like
passing the exact contents of the quoted string as command line option. C-style
escapes are currently _not_ interpreted on this level, although some options do
this manually. (This is a mess and should probably be changed at some point.)
Putting Command Line Options into the Configuration File
--------------------------------------------------------
@@ -797,7 +660,7 @@ Option Configuration file entry
``--flag`` ``flag``
``-opt val`` ``opt=val``
``--opt=val`` ``opt=val``
``-opt "has spaces"`` ``opt=has spaces``
``-opt "has spaces"`` ``opt="has spaces"``
======================= ========================
File-specific Configuration Files
@@ -841,24 +704,22 @@ or at runtime with the ``apply-profile <name>`` command.
# a profile that can be enabled with --profile=big-cache
[big-cache]
cache=yes
demuxer-max-bytes=512MiB
demuxer-max-bytes=123400KiB
demuxer-readahead-secs=20
[network]
profile-desc="profile for content over network"
force-window=immediate
# you can also include other profiles
profile=big-cache
[slow]
profile-desc="some profile name"
# reference a builtin profile
profile=gpu-hq
[reduce-judder]
video-sync=display-resample
interpolation=yes
[fast]
vo=vdpau
# using a profile again extends it
[network]
demuxer-max-back-bytes=512MiB
# reference a builtin profile
profile=fast
[slow]
framedrop=no
# you can also include other profiles
profile=big-cache
Runtime profiles
----------------
@@ -932,10 +793,9 @@ Conditional auto profiles
Profiles which have the ``profile-cond`` option set are applied automatically
if the associated condition matches (unless auto profiles are disabled). The
option takes a string, which is interpreted as Lua expression. If the
expression evaluates as truthy, the profile is applied. If the expression
errors or evaluates as falsy, the profile is not applied. This Lua code
execution is not sandboxed.
option takes a string, which is interpreted as Lua condition. If evaluating the
expression returns true, the profile is applied, if it returns false, it is
ignored. This Lua code execution is not sandboxed.
Any variables in condition expressions can reference properties. If an
identifier is not already defined by Lua or mpv, it is interpreted as property.
@@ -956,13 +816,13 @@ cause errors if used in expressions. These are logged in verbose mode, and the
expression is considered to be false.
Whenever a property referenced by a profile condition changes, the condition
is re-evaluated. If the return value of the condition changes from falsy or
error to truthy, the profile is applied.
is re-evaluated. If the return value of the condition changes from false or
error to true, the profile is applied.
This mechanism tries to "unapply" profiles once the condition changes from
truthy to falsy or error. If you want to use this, you need to set
``profile-restore`` for the profile. Another possibility it to create another
profile with an inverse condition to undo the other profile.
This mechanism tries to "unapply" profiles once the condition changes from true
to false. If you want to use this, you need to set ``profile-restore`` for the
profile. Another possibility it to create another profile with an inverse
condition to undo the other profile.
Recursive profiles can be used. But it is discouraged to reference other
conditional profiles in a conditional profile, since this can lead to tricky
@@ -979,14 +839,6 @@ and unintuitive behavior.
profile-cond=width >= 1280
hue=-50
Make only videos containing "youtube" or "youtu.be" in their path brighter:
::
[youtube]
profile-cond=path:find('youtu%.?be')
gamma=20
If you want the profile to be reverted if the condition goes to false again,
you can set ``profile-restore``:
@@ -1101,19 +953,19 @@ There are three choices for using mpv from other programs or scripts:
addition, terminal behavior itself may change any time. Compatibility
cannot be guaranteed.
Your code should work even if you pass ``--terminal=no``. Do not attempt
Your code should work even if you pass ``--no-terminal``. Do not attempt
to simulate user input by sending terminal control codes to mpv's stdin.
If you need interactive control, using ``--input-ipc-server`` or
``--input-ipc-client`` is recommended. This gives you access to the
`JSON IPC`_ over unix domain sockets (or named pipes on Windows).
If you need interactive control, using ``--input-ipc-server`` is
recommended. This gives you access to the `JSON IPC`_ over unix domain
sockets (or named pipes on Windows).
Depending on what you do, passing ``--no-config`` or ``--config-dir`` may
be a good idea to avoid conflicts with the normal mpv user configuration
intended for CLI playback.
Using ``--input-ipc-server`` or ``--input-ipc-client`` is also suitable for
purposes like remote control (however, the IPC protocol itself is not
"secure" and not intended to be so).
Using ``--input-ipc-server`` is also suitable for purposes like remote
control (however, the IPC protocol itself is not "secure" and not
intended to be so).
2. Using libmpv. This is generally recommended when mpv is used as playback
backend for a completely different application. The provided C API is
@@ -1225,8 +1077,7 @@ this with ``--untimed``, but it will likely break, unless the stream has no
audio, and the input feeds data to the player at a constant rate.
Another common problem is with MJPEG streams. These do not signal the correct
framerate. Using ``--untimed`` or ``--correct-pts=no --container-fps-override=60``
might help.
framerate. Using ``--untimed`` or ``--no-correct-pts --fps=60`` might help.
For livestreams, data can build up due to pausing the stream, due to slightly
lower playback rate, or "buffering" pauses. If the demuxer cache is enabled,
@@ -1254,13 +1105,13 @@ commands ``quit-watch-later`` (bound to Shift+Q by default) and
The difference between always quitting with a key bound to ``quit-watch-later``
and using ``--save-position-on-quit`` is that the latter will save the playback
position even when mpv is closed with a method other than a keybinding, such as
clicking the close button in the window title bar. However if mpv is terminated
abruptly and doesn't have the time to save, then the position will not be saved.
For example, if you shutdown your system without closing mpv beforehand.
position even when mpv is closed with a method other than a keybinding, for
example if you shutdown your system without closing mpv beforehand, unless of
course mpv is terminated abruptly and doesn't have the time to save (e.g. with
the KILL Unix signal).
mpv also stores options other than the playback position when they have been
modified after playback began, for example the volume and selected audio/subtitles,
modified after playback began, for example the volume and the fullscreen state,
and restores their values the next time the file is played. Which options are
saved can be configured with the ``--watch-later-options`` option.
@@ -1275,12 +1126,6 @@ More options to configure this functionality are listed in `Watch Later`_.
PROTOCOLS
=========
``mpv://...``
mpv protocol. This is used for starting mpv from URL handler. The protocol
is stripped and the rest is passed to the player as a normal open argument.
Only safe network protocols are allowed to be opened this way.
``http://...``, ``https://``, ...
Many network protocols are supported, but the protocol prefix must always
@@ -1291,8 +1136,8 @@ PROTOCOLS
either aliases to documented protocols, or are just redirections to
protocols implemented and documented in FFmpeg.
``data:`` is supported, but needs to be in the format ``data://``.
This is done to avoid ambiguity with filenames. You
``data:`` is supported in FFmpeg (not in Libav), but needs to be in the
format ``data://``. This is done to avoid ambiguity with filenames. You
can also prefix it with ``lavf://`` or ``ffmpeg://``.
``ytdl://...``
@@ -1338,39 +1183,17 @@ PROTOCOLS
Digital TV via DVB. (Linux only.)
``mf://[@listfile|filemask|glob|printf-format]`` ``--mf-...``
``mf://[filemask|@listfile]`` ``--mf-...``
Play a series of images as video.
If the URL path begins with ``@``, it is interpreted as the path to a file
containing a list of image paths separated by newlines. If the URL path
contains ``,``, it is interpreted as a list of image paths separated by
``,``. If the URL path does not contain ``%`` and if on POSIX platforms, is
interpreted as a glob, and ``*`` is automatically appended if it was not
specified. Otherwise, the printf sequences ``%[.][NUM]d``, where ``NUM`` is
one, two, or three decimal digits, and ``%%`` and are interpreted. For
example, ``mf://image-%d.jpg`` plays files like ``image-1.jpg``,
``image-2.jpg`` and ``image-10.jpg``, provided that there are no big gaps
between the files.
``cdda://[device]`` ``--cdrom-device=PATH`` ``--cdda-...``
``cdda://[device]`` ``--cdda-device=PATH``
Play CD. You can select a specific range of tracks to play by using the
``--start`` and ``--end`` options and specifying chapters. Navigating
forwards and backwards through tracks can also be done by navigating through
chapters (``PGUP`` and ``PGDOWN`` in the default keybinds).
.. admonition:: Example
::
mpv cdda:// --start=#4 --end=#6
This will start from track 4, play track 5, and then end.
Play CD.
``lavf://...``
Access any FFmpeg libavformat protocol. Basically, this passed the
Access any FFmpeg/Libav libavformat protocol. Basically, this passed the
string after the ``//`` directly to libavformat.
``av://type:options``
@@ -1518,6 +1341,30 @@ works like in older mpv releases:
change, and not apply your additional settings, and/or use a different
profile name.
Linux desktop issues
====================
This subsection describes common problems on the Linux desktop. None of these
problems exist on systems like Windows or macOS.
Disabling Screensaver
---------------------
By default, mpv tries to disable the OS screensaver during playback (only if
a VO using the OS GUI API is active). ``--stop-screensaver=no`` disables this.
A common problem is that Linux desktop environments ignore the standard
screensaver APIs on which mpv relies. In particular, mpv uses the Screen Saver
extension (XSS) on X11, and the idle-inhibit protocol on Wayland.
GNOME in particular still ignores the idle-inhibit protocol, and has its own
D-Bus interfaces for display power management, which mpv does not support.
Before mpv 0.33.0, the X11 backend ran ``xdg-screensaver reset`` in 10 second
intervals when not paused in order to support screensaver inhibition in these
environments. This functionality was removed in 0.33.0, but it is possible to
call the ``xdg-screensaver`` command line program from a user script instead.
.. include:: options.rst
@@ -1539,14 +1386,6 @@ works like in older mpv releases:
.. include:: console.rst
.. include:: commands.rst
.. include:: select.rst
.. include:: context_menu.rst
.. include:: positioning.rst
.. include:: lua.rst
.. include:: javascript.rst
@@ -1581,7 +1420,10 @@ behavior of mpv.
``MPV_LEAK_REPORT``
If set to ``1``, enable internal talloc leak reporting. If set to another
value, disable leak reporting.
value, disable leak reporting. If unset, use the default, which normally is
``0``. If mpv was built with ``--enable-ta-leak-report``, the default is
``1``. If leak reporting was disabled at compile time (``NDEBUG`` in
custom ``CFLAGS``), this environment variable is ignored.
``LADSPA_PATH``
Specifies the search path for LADSPA plugins. If it is unset, fully
@@ -1590,7 +1432,7 @@ behavior of mpv.
``DISPLAY``
Standard X11 display name to use.
FFmpeg:
FFmpeg/Libav:
This library accesses various environment variables. However, they are not
centrally documented, and documenting them is not our job. Therefore, this
list is incomplete.
@@ -1681,47 +1523,16 @@ Note that quitting the player manually will always lead to exit code 0,
overriding the exit code that would be returned normally. Also, the ``quit``
input command can take an exit code: in this case, that exit code is returned.
OPTICAL DRIVES
==============
Depending on the OS, mpv will choose a different disc device by default.
This applies for all optical disc playback (CDDA, DVD, and BD).
======= =============
OS Default Drive
======= =============
Linux /dev/sr0
Windows D:
macOS /dev/disk1
FreeBSD /dev/cd0
OpenBSD /dev/rcd0c
======= =============
FILES
=====
Note that this section assumes Linux/BSD. On other platforms the paths may be different.
For Windows-specifics, see `FILES ON WINDOWS`_ section.
All configuration files should be encoded in UTF-8.
``/usr/local/etc/mpv/mpv.conf``
mpv system-wide settings (depends on ``--prefix`` passed to configure - mpv
in default configuration will use ``/usr/local/etc/mpv/`` as config
directory, while most Linux distributions will set it to ``/etc/mpv/``).
``~/.cache/mpv``
The standard cache directory. Certain options within mpv may cause it to write
cache files to disk. This can be overridden by environment variables, in
ascending order:
:1: If ``$XDG_CACHE_HOME`` is set, then the derived cache directory
will be ``$XDG_CACHE_HOME/mpv``.
:2: If ``$MPV_HOME`` is set, then the derived cache directory will be
``$MPV_HOME``.
If the directory does not exist, mpv will try to create it automatically.
``~/.config/mpv``
The standard configuration directory. This can be overridden by environment
variables, in ascending order:
@@ -1736,9 +1547,7 @@ All configuration files should be encoded in UTF-8.
``~/.mpv/``
The original (pre 0.5.0) configuration directory. It will continue to be
read if present. If this directory is present and the standard configuration
directory is not present, then cache files and watch later config files will
also be written to this directory.
read if present.
If both this directory and the standard configuration directory are
present, configuration will be read from both with the standard
@@ -1763,8 +1572,11 @@ All configuration files should be encoded in UTF-8.
fallback subtitle font
``~/.config/mpv/fonts/``
Default location for ``--sub-fonts-dir`` (see `Subtitles`_) and
``--osd-fonts-dir`` (see `OSD`_).
Font files in this directory are used by mpv/libass for subtitles. Useful
if you do not want to install fonts to your system. Note that files in this
directory are loaded into memory before being used by mpv. If you have a
lot of fonts, consider using fonts.conf (see above) to include additional
fonts, which is more memory-efficient.
``~/.config/mpv/scripts/``
All files in this directory are loaded as if they were passed to the
@@ -1774,18 +1586,11 @@ All configuration files should be encoded in UTF-8.
See `Script location`_ for details.
``~/.local/state/mpv/watch_later/``
``~/.config/mpv/watch_later/``
Contains temporary config files needed for resuming playback of files with
the watch later feature. See for example the ``Q`` key binding, or the
``quit-watch-later`` input command.
This can be overridden by environment variables, in ascending order:
:1: If ``$XDG_STATE_HOME`` is set, then the derived watch later directory
will be ``$XDG_STATE_HOME/mpv/watch_later``.
:2: If ``$MPV_HOME`` is set, then the derived watch later directory will be
``$MPV_HOME/watch_later``.
Each file is a small config file which is loaded if the corresponding media
file is loaded. It contains the playback position and some (not necessarily
all) settings that were changed during playback. The filenames are hashed
@@ -1816,20 +1621,16 @@ You can find the exact path by running ``echo %APPDATA%\mpv\mpv.conf`` in cmd.ex
Other config files (such as ``input.conf``) are in the same directory. See the
`FILES`_ section above.
The cache directory is located at ``%LOCALAPPDATA%/mpv/cache``.
The watch_later directory is located at ``%LOCALAPPDATA%/mpv/watch_later``.
The environment variable ``$MPV_HOME`` completely overrides these, like on
UNIX.
If a directory named ``portable_config`` next to the mpv.exe exists, all
config will be loaded from this directory only. Watch later config files and
cache files are written to this directory as well. (This exists on Windows
only and is redundant with ``$MPV_HOME``. However, since Windows is very
scripting unfriendly, a wrapper script just setting ``$MPV_HOME``, like you
could do it on other systems, won't work. ``portable_config`` is provided for
convenience to get around this restriction.)
config will be loaded from this directory only. Watch later config files are
written to this directory as well. (This exists on Windows only and is redundant
with ``$MPV_HOME``. However, since Windows is very scripting unfriendly, a
wrapper script just setting ``$MPV_HOME``, like you could do it on other
systems, won't work. ``portable_config`` is provided for convenience to get
around this restriction.)
Config files located in the same directory as ``mpv.exe`` are loaded with
lower priority. Some config files are loaded only once, which means that
@@ -1843,11 +1644,3 @@ future.
Note that mpv likes to mix ``/`` and ``\`` path separators for simplicity.
kernel32.dll accepts this, but cmd.exe does not.
FILES ON MACOS
==============
On macOS the watch later directory is located at ``~/.config/mpv/watch_later/``
and the cache directory is set to ``~/Library/Caches/io.mpv/``. These directories
can't be overwritten by environment variables.
Everything else is the same as `FILES`_.
+840 -2144
View File
File diff suppressed because it is too large. Load diff
+70 -274
View File
@@ -20,44 +20,35 @@ The Interface
::
+------+---------+---------+-----------------------------------------------+
| menu | pl prev | pl next | title cache |
+------+------+------+---------+-----------+------+-------+-----+-----+----+
+---------+----------+------------------------------------------+----------+
| pl prev | pl next | title | cache |
+------+--+---+------+---------+-----------+------+-------+-----+-----+----+
| play | skip | skip | time | seekbar | time | audio | sub | vol | fs |
| | back | frwd | elapsed | | left | | | | |
+------+------+------+---------+-----------+------+-------+-----+-----+----+
menu
============= ================================================
left-click open the menu
============= ================================================
pl prev
============= ================================================
left-click play previous file in playlist
shift+L-click show the playlist
middle-click show the playlist
right-click open the playlist menu
right-click show playlist
shift+L-click show playlist
============= ================================================
pl next
============= ================================================
left-click play next file in playlist
shift+L-click show the playlist
middle-click show the playlist
right-click open the playlist menu
right-click show playlist
shift+L-click show playlist
============= ================================================
title
| Displays the current playlist position and media-title, filename or custom
title, or the target chapter name while hovering the seekbar.
| Displays current media-title, filename, custom title, or target chapter
name while hovering the seekbar.
============= ================================================
left-click show file and track info
shift+L-click show the path
middle-click show the path
right-click open the history menu
left-click show playlist position and length and full title
right-click show filename
============= ================================================
cache
@@ -66,25 +57,20 @@ cache
play
============= ================================================
left-click toggle play/pause
shift+L-click toggle infinite looping of the playlist
middle-click toggle infinite looping of the playlist
right-click toggle infinite looping of the current file
============= ================================================
skip back
============= ================================================
left-click go to beginning of chapter / previous chapter
right-click show chapters
shift+L-click show chapters
middle-click show chapters
right-click open the chapter menu
============= ================================================
skip frwd
============= ================================================
left-click go to next chapter
right-click show chapters
shift+L-click show chapters
middle-click show chapters
right-click open the chapter menu
============= ================================================
time elapsed
@@ -99,8 +85,6 @@ seekbar
============= ================================================
left-click seek to position
right-click seek to the nearest chapter
mouse wheel seek forward/backward
============= ================================================
time left
@@ -115,30 +99,21 @@ audio and sub
============= ================================================
left-click cycle audio/sub tracks forward
shift+L-click cycle audio/sub tracks backwards
middle-click cycle audio/sub tracks backwards
right-click open the audio/sub track menu
mouse wheel cycle audio/sub tracks forward/backwards
right-click cycle audio/sub tracks backwards
shift+L-click show available audio/sub tracks
============= ================================================
vol
============= ================================================
left-click toggle mute
right-click open the audio device menu
mouse wheel volume up/down
============= ================================================
fs
============= ================================================
left-click toggle fullscreen
right-click toggle whether the window is maximized
============= ================================================
Since mpv 0.40.0, it is possible to configure the commands to run with mouse
actions on some interface elements, and the default behaviors of several
elements were changed. If you miss some older behaviors, look at
``etc/restore-osc-bindings.conf`` in the mpv git repository.
Key Bindings
~~~~~~~~~~~~
@@ -153,9 +128,22 @@ del Cycles visibility between never / auto (mouse-move) / always
Configuration
-------------
This script can be customized through a config file ``script-opts/osc.conf``
placed in mpv's user directory and through the ``--script-opts`` command-line
option. The configuration syntax is described in `mp.options functions`_.
The OSC offers limited configuration through a config file
``script-opts/osc.conf`` placed in mpv's user dir and through the
``--script-opts`` command-line option. Options provided through the command-line
will override those from the config file.
Config Syntax
~~~~~~~~~~~~~
The config file must exactly follow the following syntax::
# this is a comment
optionA=value1
optionB=value2
``#`` can only be used at the beginning of a line and there may be no
spaces around the ``=`` or anywhere else.
Command-line Syntax
~~~~~~~~~~~~~~~~~~~
@@ -175,8 +163,7 @@ Configurable Options
Default: bottombar
The layout for the OSC. Currently available are: box, slimbox,
bottombar, topbar, slimbottombar and slimtopbar. Default pre-0.21.0 was
'box'.
bottombar and topbar. Default pre-0.21.0 was 'box'.
``seekbarstyle``
Default: bar
@@ -187,7 +174,7 @@ Configurable Options
``seekbarhandlesize``
Default: 0.6
Size ratio of the seek handle if ``seekbarstyle`` is set to ``diamond``
Size ratio of the seek handle if ``seekbarstyle`` is set to ``dimaond``
or ``knob``. This is relative to the full height of the seekbar.
``seekbarkeyframes``
@@ -218,17 +205,10 @@ Configurable Options
seekbar or separately if ``seekbarstyle`` is set to ``bar``.
``seekrangealpha``
Default: 20
Default: 200
Alpha of the seekable ranges, 0 (opaque) to 255 (fully transparent).
``scrollcontrols``
Default: yes
By default, going up or down with the mouse wheel can trigger certain
actions (such as seeking) if the mouse is hovering an OSC element.
Set to ``no`` to disable any special mouse wheel behavior.
``deadzonesize``
Default: 0.5
@@ -271,29 +251,31 @@ Configurable Options
Scale factor of the OSC when fullscreen
``vidscale``
Default: auto
``scaleforcedwindow``
Default: 2.0
Scale the OSC with the video.
``no`` tries to keep the OSC size constant as much as the window size allows.
``auto`` scales the OSC with the OSD, which is scaled with the window or kept at a
constant size, depending on the ``--osd-scale-by-window`` option.
Scale factor of the OSC when rendered on a forced (dummy) window
``vidscale``
Default: yes
Scale the OSC with the video
``no`` tries to keep the OSC size constant as much as the window size allows
``valign``
Default: 0.8
Vertical alignment in box and slimbox layouts, -1 (top) to 1 (bottom).
Vertical alignment, -1 (top) to 1 (bottom)
``halign``
Default: 0.0
Horizontal alignment in box and slimbox layouts, -1 (left) to 1 (right).
Horizontal alignment, -1 (left) to 1 (right)
``barmargin``
Default: 0
Margin from bottom (bottombar, slimbottombar) or top (topbar, slimtopbar),
in pixels.
Margin from bottom (bottombar) or top (topbar), in pixels
``boxalpha``
Default: 80
@@ -309,19 +291,14 @@ Configurable Options
``fadeduration``
Default: 200
Duration of fade effects in ms, 0 = no fade.
``fadein``
Default: no
Enable fade-in.
Duration of fade out in ms, 0 = no fade
``title``
Default: ${!playlist-count==1:[${playlist-pos-1}/${playlist-count}] }${media-title}
Default: ${media-title}
String that supports property expansion that will be displayed as
OSC title.
ASS tags are escaped and newlines are converted to spaces.
ASS tags are escaped, and newlines and trailing slashes are stripped.
``tooltipborder``
Default: 1
@@ -333,13 +310,6 @@ Configurable Options
Show total time instead of time remaining
``remaining_playtime``
Default: yes
Whether the time-remaining display takes speed into account.
``yes`` - how much playback time remains at the current speed.
``no`` - how much video-time remains.
``timems``
Default: no
@@ -358,12 +328,6 @@ Configurable Options
Also supports ``never`` and ``always``
``visibility_modes``
Default: never_auto_always
The list of visibility modes to cycle through when calling the
osc-visibility cycle script message. Modes are separated by ``_``.
``boxmaxchars``
Default: 80
@@ -382,10 +346,10 @@ Configurable Options
default values.) Additionally, ``visibility`` must be set to ``always``.
Otherwise, this option does nothing.
Currently, this is supported for the ``bottombar``, ``slimbottombar``,
``topbar`` and ``slimtopbar`` layouts only. The other layouts do not change
if this option is set. Separately, if window controls are present (see
below), they will be affected regardless of which osc layout is in use.
Currently, this is supported for the ``bottombar`` and ``topbar`` layout
only. The other layouts do not change if this option is set. Separately,
if window controls are present (see below), they will be affected
regardless of which osc layout is in use.
The border is static and appears even if the OSC is configured to appear
only on mouse interaction. If the OSC is invisible, the border is simply
@@ -420,13 +384,6 @@ Configurable Options
Supports ``left`` and ``right`` which will place the controls on those
respective sides.
``windowcontrols_title``
Default: ${media-title}
String that supports property expansion that will be displayed as the
windowcontrols title.
ASS tags are escaped, and newlines and trailing slashes are stripped.
``greenandgrumpy``
Default: no
@@ -438,6 +395,12 @@ Configurable Options
Update chapter markers positions on duration changes, e.g. live streams.
The updates are unoptimized - consider disabling it on very low-end systems.
``chapters_osd``, ``playlist_osd``
Default: yes
Whether to display the chapters/playlist at the OSD when left-clicking the
next/previous OSC buttons, respectively.
``chapter_fmt``
Default: ``Chapter: %s``
@@ -451,174 +414,6 @@ Configurable Options
Use a Unicode minus sign instead of an ASCII hyphen when displaying
the remaining playback time.
``background_color``
Default: #000000
Sets the background color of the OSC.
``timecode_color``
Default: #FFFFFF
Sets the color of the timecode and seekbar, of the OSC.
``title_color``
Default: #FFFFFF
Sets the color of the video title. Formatted as #RRGGBB.
``time_pos_color``
Default: #FFFFFF
Sets the color of the timecode at hover position in the seekbar.
``time_pos_outline_color``
Default: #FFFFFF
Sets the color of the timecode's outline at hover position in the seekbar.
Also affects the timecode in the slimbox layout.
``buttons_color``
Default: #FFFFFF
Sets the colors of the big buttons.
``top_buttons_color``
Default: #FFFFFF
Sets the colors of the top buttons.
``small_buttonsL_color``
Default: #FFFFFF
Sets the colors of the small buttons on the left in the box layout.
``small_buttonsR_color``
Default: #FFFFFF
Sets the colors of the small buttons on the right in the box layout.
``held_element_color``
Default: #999999
Sets the colors of the elements that are being pressed or held down.
``tick_delay``
Default: 1/60
Sets the minimum interval between OSC redraws in seconds. This can be
decreased on fast systems to make OSC rendering smoother.
Ignored if ``tick_delay_follow_display_fps`` is set to yes and the VO
supports the ``display-fps`` property.
``tick_delay_follow_display_fps``
Default: no
Use display fps to calculate the interval between OSC redraws.
The following options configure what commands are run when the buttons are
clicked. ``mbtn_mid`` commands are also triggered with ``shift+mbtn_left``.
``menu_mbtn_left_command=script-binding select/menu; script-message-to osc osc-hide``
``menu_mbtn_mid_command=``
``menu_mbtn_right_command=``
``playlist_prev_mbtn_left_command=playlist-prev; show-text ${playlist} 3000``
``playlist_prev_mbtn_mid_command=show-text ${playlist} 3000``
``playlist_prev_mbtn_right_command=script-binding select/select-playlist; script-message-to osc osc-hide``
``playlist_next_mbtn_left_command=playlist-next; show-text ${playlist} 3000``
``playlist_next_mbtn_mid_command=show-text ${playlist} 3000``
``playlist_next_mbtn_right_command=script-binding select/select-playlist; script-message-to osc osc-hide``
``title_mbtn_left_command=script-binding stats/display-page-5``
``title_mbtn_mid_command=show-text ${path}``
``title_mbtn_right_command=script-binding select/select-watch-history; script-message-to osc osc-hide``
``play_pause_mbtn_left_command=cycle pause``
``play_pause_mbtn_mid_command=cycle-values loop-playlist inf no``
``play_pause_mbtn_right_command=cycle-values loop-file inf no``
``chapter_prev_mbtn_left_command=osd-msg add chapter -1``
``chapter_prev_mbtn_mid_command=show-text ${chapter-list} 3000``
``chapter_prev_mbtn_right_command=script-binding select/select-chapter; script-message-to osc osc-hide``
``chapter_next_mbtn_left_command=osd-msg add chapter 1``
``chapter_next_mbtn_mid_command=show-text ${chapter-list} 3000``
``chapter_next_mbtn_right_command=script-binding select/select-chapter; script-message-to osc osc-hide``
``audio_track_mbtn_left_command=cycle audio``
``audio_track_mbtn_mid_command=cycle audio down``
``audio_track_mbtn_right_command=script-binding select/select-aid; script-message-to osc osc-hide``
``audio_track_wheel_down_command=cycle audio``
``audio_track_wheel_up_command=cycle audio down``
``sub_track_mbtn_left_command=cycle sub``
``sub_track_mbtn_mid_command=cycle sub down``
``sub_track_mbtn_right_command=script-binding select/select-sid; script-message-to osc osc-hide``
``sub_track_wheel_down_command=cycle sub``
``sub_track_wheel_up_command=cycle sub down``
``volume_mbtn_left_command=no-osd cycle mute``
``volume_mbtn_mid_command=``
``volume_mbtn_right_command=script-binding select/select-audio-device; script-message-to osc osc-hide``
``volume_wheel_down_command=add volume -5``
``volume_wheel_up_command=add volume 5``
``fullscreen_mbtn_left_command="cycle fullscreen"``
``fullscreen_mbtn_mid_command=``
``fullscreen_mbtn_right_command="cycle window-maximized"``
Custom Buttons
~~~~~~~~~~~~~~
Additional script-opts are available to define custom buttons in ``bottombar``
and ``topbar`` layouts.
.. admonition:: Example to add loop, shuffle and speed buttons
::
custom_button_1_content=🔁
custom_button_1_mbtn_left_command=cycle-values loop-file inf no
custom_button_1_mbtn_right_command=cycle-values loop-playlist inf no
custom_button_2_content=🔀
custom_button_2_mbtn_left_command=playlist-shuffle
custom_button_3_content=⏱
custom_button_3_mbtn_left_command=add speed 1
custom_button_3_mbtn_right_command=set speed 1
custom_button_3_wheel_up_command=add speed 0.25
custom_button_3_wheel_down_command=add speed -0.25
Script Commands
~~~~~~~~~~~~~~~
@@ -626,16 +421,13 @@ Script Commands
The OSC script listens to certain script commands. These commands can bound
in ``input.conf``, or sent by other scripts.
``osc-message``
Show a message on screen using the OSC. First argument is the message,
second the duration in seconds.
``osc-visibility``
Controls visibility mode ``never`` / ``auto`` (on mouse move) / ``always``
and also ``cycle`` to cycle between the modes. If a second argument is
passed (any value), then the output on the OSD will be silenced.
``osc-show``
Triggers the OSC to show up, just as if user moved mouse.
``osc-hide``
Hide the OSC when ``visibility`` is ``auto``.
and also ``cycle`` to cycle between the modes
Example
@@ -647,5 +439,9 @@ to set auto mode (the default) with ``b``::
``osc-idlescreen``
Controls the visibility of the mpv logo on idle. Valid arguments are ``yes``,
``no``, and ``cycle`` to toggle between yes and no. If a second argument is
passed (any value), then the output on the OSD will be silenced.
``no``, and ``cycle`` to toggle between yes and no.
``osc-playlist``, ``osc-chapterlist``, ``osc-tracklist``
Shows a limited view of the respective type of list using the OSC. First
argument is duration in seconds.
-60
View File
@@ -1,60 +0,0 @@
POSITIONING
===========
This script provides script bindings to pan videos and images. It can be
disabled using the ``--load-positioning=no`` option.
Script bindings
---------------
``pan-x <amount>``
Adjust ``--video-align-x`` relatively to the OSD width, rather than
relatively to the video width like the option. This is useful to pan large
images consistently.
``amount`` is a number such that an amount of 1 scrolls as much as the OSD
width.
``pan-y <amount>``
Adjust ``--video-align-y`` relatively to the OSD height, rather than
relatively to the video height like the option.
``amount`` is a number such that an amount of 1 scrolls as much as the OSD
height.
``drag-to-pan``
Pan the video while holding a mouse button, keeping the clicked part of the
video under the cursor.
``align-to-cursor``
Pan through the whole video while holding a mouse button, or after clicking
once if ``toggle_align_to_cursor`` is ``yes``.
``cursor-centric-zoom <amount>``
Increase ``--video-zoom`` by ``amount`` while keeping the part of the video
hovered by the cursor under it, or the average position of touch points if
known.
Configuration
-------------
This script can be customized through a config file
``script-opts/positioning.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
~~~~~~~~~~~~~~~~~~~~
``toggle_align_to_cursor``
Default: no
Whether ``align-to-cursor`` requires holding down a mouse button to pan. If
``no``, dragging pans. If ``yes``, clicking the first time makes pan follow
the cursor, and clicking a second time disables this.
``suppress_osd``
Default: no
Whether to not print the new value of ``--video-zoom`` when using
``cursor-centric-zoom``.
-163
View File
@@ -1,163 +0,0 @@
SELECT
======
console can present a list of items to browse and select from with the
``mp.input.select`` API. ``select.lua`` is a builtin client of this API
providing script bindings that gather and format the data to be selected in the
console and do operations on the selected item. It can be disabled using the
``--load-select=no`` option.
Key bindings
------------
When using ``mp.input.select``, the key bindings listed in `CONSOLE`_ are
extended with the following:
ENTER, Ctrl+j and Ctrl+m
Select the focused item.
UP and Ctrl+p
Focus the item above, or the last one when the first item is selected.
DOWN and Ctrl+n
Focus the item below, or the first one when the last item is selected.
PGUP and Ctrl+b
Scroll up one page.
PGDN and Ctrl+f
Scroll down one page.
Ctrl+y
Copy the focused item to the clipboard.
MBTN_LEFT
Select the item under the cursor, or close the console if clicking outside
of the menu rectangle.
WHEEL_UP
Scroll up.
WHEEL_DOWN
Scroll down.
Typing printable characters does a fuzzy search of the presented items.
If the query starts with ``'``, only exact matches are filtered. You can also
specify multiple search terms delimited by spaces, and only items matching all
terms are filtered.
Script bindings
---------------
By default select.lua's script bindings are bound to key sequences starting with
``g`` listed in `Keyboard Control`_. The names of the script bindings listed
below can be used to bind them to different keys.
.. admonition:: Example to rebind playlist selection in input.conf
Ctrl+p script-binding select/select-playlist
Available script bindings are:
``select-playlist``
Select a playlist entry. ``--osd-playlist-entry`` determines how playlist
entries are formatted.
``select-sid``
Select a subtitle track, or disable the current one.
``select-secondary-sid``
Select a secondary subtitle track, or disable the current one.
``select-aid``
Select an audio track, or disable the current one.
``select-vid``
Select a video track, or disable the current one.
``select-track``
Select a track of any type, or disable a selected track.
``select-chapter``
Select a chapter.
``select-edition``
Select an MKV edition or DVD/Blu-ray title.
``select-subtitle-line``
Select a subtitle line to seek to. This doesn't work with image subtitles.
This currently requires ``ffmpeg`` in ``PATH``, or in the same folder as mpv
on Windows.
``select-audio-device``
Select an audio device.
``select-watch-history``
Select a file from the watch history. Requires ``--save-watch-history``.
If you don't already use ``--autocreate-playlist``, it is recommended to
enable it with this script binding to populate the playlist with the other
files in the entry's directory.
.. admonition:: Example for input.conf to play files adjacent to the history entry
g-h script-binding select/select-watch-history; no-osd set autocreate-playlist filter
``select-watch-later``
Select a file from watch later config files (see `RESUMING PLAYBACK`_) to
resume playing. Requires ``--write-filename-in-watch-later-config``. This
doesn't work with ``--ignore-path-in-watch-later-config``.
If you don't already use ``--autocreate-playlist``, it is recommended to
enable it with this script binding to populate the playlist with the other
files in the entry's directory.
.. admonition:: Example for input.conf to play files adjacent to the watch later entry
g-w script-binding select/select-watch-later; no-osd set autocreate-playlist filter
``select-binding``
List the defined input bindings. You can also select one to run the
associated command.
``show-properties``
List the names and values of all properties. You can also select one to
print its value on the OSD, which is useful for long values that get
clipped.
``edit-config-file``
Open ``mpv.conf`` in the system text editor, creating it if it doesn't
already exist.
``edit-input-conf``
Open ``input.conf`` in the system text editor, creating it if it doesn't
already exist.
``open-docs``
Open mpv's online documentation in the browser.
``menu``
Show a menu with miscellaneous entries.
Configuration
-------------
This script can be customized through a config file ``script-opts/select.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
~~~~~~~~~~~~~~~~~~~~
``history_date_format``
Default: %Y-%m-%d %H:%M:%S
The format of dates of history entries. This is passed to Lua's ``os.date``,
which uses the same formats as ``strftime(3)``.
``hide_history_duplicates``
Default: yes
Whether to show only the last of history entries with the same path.
+28 -97
View File
@@ -14,7 +14,6 @@ already bound to them:
==== ==============================================
i Show stats for a fixed duration
I Toggle stats (shown until toggled again)
? Toggle displaying the key bindings
==== ==============================================
While the stats are visible on screen the following key bindings are active,
@@ -26,35 +25,29 @@ stats:
2 Show frame timings (scroll)
3 Input cache stats
4 Active key bindings (scroll)
5 Selected Tracks Info (scroll)
0 Internal stuff (scroll)
==== ==================
If stats were displayed by toggling, these key bindings are also active:
==== ==================
ESC Close the stats
==== ==================
On pages which support scroll, these key bindings are also active:
==== ==================
UP Scroll one line up
DOWN Scroll one line down
UP Scroll one line up
DOWN Scroll one line down
==== ==================
On page 4, these key bindings are also active:
Font
~~~~
==== ==================
/ Search key bindings
==== ==================
For optimal visual experience, a font with support for many font weights and
monospaced digits is recommended. By default, the open source font
`Source Sans Pro <https://github.com/adobe-fonts/source-sans-pro>`_ is used.
Configuration
-------------
This script can be customized through a config file ``script-opts/stats.conf``
placed in mpv's user directory and through the ``--script-opts`` command-line
option. The configuration syntax is described in `mp.options functions`_.
option. The configuration syntax is described in `ON SCREEN CONTROLLER`_.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
@@ -67,12 +60,8 @@ Configurable Options
Default: 3
``key_page_4``
Default: 4
``key_page_5``
Default: 5
``key_page_0``
Default: 0
``key_exit``
Default: ESC
Key bindings for page switching while stats are displayed.
@@ -80,8 +69,6 @@ Configurable Options
Default: UP
``key_scroll_down``
Default: DOWN
``key_scroll_search``
Default: /
``scroll_lines``
Default: 1
@@ -105,43 +92,17 @@ Configurable Options
respective duration. This can result in overlapping text when multiple
scripts decide to print text at the same time.
``file_tag_max_length``
Default: 128
Only show file tags shorter than this length, in bytes.
``file_tag_max_count``
Default: 16
Only show the first specified amount of file tags.
``term_clip``
Default: yes
Whether to clip lines to the terminal width.
``plot_perfdata``
Default: no
Default: yes
Show graphs for performance data (page 2).
``plot_vsync_ratio``
Default: no
Default: yes
``plot_vsync_jitter``
Default: no
Show graphs for vsync and jitter values (page 1). Only when toggled.
``plot_cache``
Default: yes
Show graphs for cache values (page 3). Only when toggled.
``plot_tonemapping_lut``
Default: no
Enable tone-mapping LUT visualization automatically. Only when toggled.
Show graphs for vsync and jitter values (page 1). Only when toggled.
``flush_graph_data``
Default: yes
@@ -149,69 +110,47 @@ Configurable Options
Clear data buffers used for drawing graphs when toggling.
``font``
Default: same as ``osd-font``
Default: Source Sans Pro
Font name. Should support as many font weights as possible for optimal
visual experience.
``font_mono``
Default: monospace
Default: Source Sans Pro
Font name for parts where monospaced characters are necessary to align
text. Currently, monospaced digits are sufficient.
``font_size``
Default: 20
Default: 8
Font size used to render text.
``font_color``
Default: same as ``osd-color``
Default: FFFFFF
Color of the text.
Font color.
``border_size``
Default: 1.65
Default: 0.8
Size of border drawn around the font.
``border_color``
Default: same as ``osd-border-color``
Default: 262626
Color of the text border.
``shadow_x_offset``
Default: same as ``--osd-shadow-offset``
The horizontal distance from the text to position the shadow at.
``shadow_y_offset``
Default: same as ``--osd-shadow-offset``
The vertical distance from the text to position the shadow at.
``shadow_color``
Default: same as ``osd-shadow-color``
Color of the text shadow.
Color of drawn border.
``alpha``
Default: 11
Transparency of text when ``font_color`` is specified, of text borders when
``border_color`` is specified, and of text shadows when ``shadow_color`` is
specified.
Transparency for drawn text.
``plot_bg_border_color``
Default: 0000FF
Border color used for drawing graphs.
``plot_bg_border_width``
Default: 1.25
Border width used for drawing graphs.
``plot_bg_color``
Default: 262626
@@ -222,14 +161,6 @@ Configurable Options
Color used for drawing graphs.
``vidscale``
Default: auto
Scale the text and graphs with the video.
``no`` tries to keep the sizes constant.
``auto`` scales the text and graphs with the OSD, which is scaled with the
window or kept at a constant size, depending on the ``--osd-scale-by-window`` option.
Note: colors are given as hexadecimal values and use ASS tag order: BBGGRR
(blue green red).
@@ -244,7 +175,7 @@ Additional keys can be configured in ``input.conf`` to display the stats::
And to display a certain page directly::
i script-binding stats/display-page-1
h script-binding stats/display-page-4-toggle
e script-binding stats/display-page-2
Active key bindings page
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -257,11 +188,11 @@ The keys are grouped automatically using a simple analysis of the command
string, and one should not expect documentation-level grouping accuracy,
however, it should still be reasonably useful.
Using ``--idle --script-opt=stats-bindlist=yes`` will print the list to
the terminal and quit immediately. Long lines are clipped to the terminal width
unless this is disabled with ``--script-opt=stats-term_clip=no``. Escape
sequences can be disabled by adding ``-`` before ``yes``, i.e.
``--script-opt=stats-bindlist=-yes``.
Using ``--idle --script-opts=stats-bindlist=yes`` will print the list to the
terminal and quit immediately. By default long lines are shortened to 79 chars,
and terminal escape sequences are enabled. A different length limit can be
set by changing ``yes`` to a number (at least 40), and escape sequences can be
disabled by adding ``-`` before the value, e.g. ``...=-yes`` or ``...=-120``.
Like with ``--input-test``, the list includes bindings from ``input.conf`` and
from user scripts. Use ``--no-config`` to list only built-in bindings.
@@ -296,8 +227,8 @@ are missing.
Memory usage is approximate and does not reflect internal fragmentation.
JS scripts memory reporting is disabled by default because collecting the data
at the JS side has an overhead and will increase memory usage. It can be
enabled by setting the ``--js-memory-report`` option before starting mpv.
at the JS side has an overhead. It can be enabled by exporting the env var
``MPV_LEAK_REPORT=1`` before starting mpv, and will increase JS memory usage.
If entries have ``/time`` and ``/cpu`` variants, the former gives the real time
(monotonic clock), while the latter the thread CPU time (only if the
+35 -115
View File
@@ -23,8 +23,6 @@ The exact syntax is:
See the ``vf`` command (and ``toggle`` sub-command) for further explanations
and examples.
This is an object settings list option. See `List Options`_ for details.
The general filter entry syntax is:
``["@"<label-name>":"] ["!"] <filter-name> [ "=" <filter-parameter-list> ]``
@@ -46,17 +44,19 @@ The exact syntax is:
the ``lavfi`` filter, which uses a very similar syntax as mpv (MPlayer
historically) to specify filters and their parameters.
.. note::
``--vf`` can only take a single track as input, even if the filter supports
dynamic input. Filters that require multiple inputs can't be used.
Use ``--lavfi-complex`` for such a use case. This also applies for ``--af``.
Filters can be manipulated at run time. You can use ``@`` labels as described
above in combination with the ``vf`` command (see `COMMAND INTERFACE`_) to get
more control over this. Initially disabled filters with ``!`` are useful for
this as well.
You can also set defaults for each filter. The defaults are applied before the
normal filter parameters. This is deprecated and never worked for the
libavfilter bridge.
``--vf-defaults=<filter1[=parameter1:parameter2:...],filter2,...>``
Set defaults for each filter. (Deprecated. ``--af-defaults`` is deprecated
as well.)
.. note::
To get a full list of available video filters, see ``--vf=help`` and
@@ -105,11 +105,16 @@ filter list.
compared. (Passing multiple filters is currently still possible, but
deprecated.)
``--vf-toggle=filter``
``-vf-toggle=filter``
Add the given filter to the list if it was not present yet, or remove it
from the list if it was present. Matching of filters works as described in
``--vf-remove``.
``--vf-del=filter``
Sort of like ``--vf-remove``, but also accepts an index number. Index
numbers start at 0, negative numbers address the end of the list (-1 is the
last). Deprecated.
``--vf-clr``
Completely empties the filter list.
@@ -136,11 +141,6 @@ Available mpv-only filters are:
For a list of available formats, use ``--vf=format=fmt=help``.
.. note::
Conversion between hardware formats is supported in some cases.
eg: ``cuda`` to ``vulkan``, or ``vaapi`` to ``vulkan``.
``<convert=yes|no>``
Force conversion of color parameters (default: no).
@@ -164,9 +164,6 @@ Available mpv-only filters are:
If input and output video parameters are the same, conversion is always
skipped.
When converting between hardware formats, this parameter has no effect,
and the only conversion that is done is the format conversion.
.. admonition:: Examples
``mpv test.mkv --vf=format:colormatrix=ycgco``
@@ -194,7 +191,7 @@ Available mpv-only filters are:
space if the system video driver supports it, but not input and output
levels. The ``scale`` video filter can configure color space and input
levels, but only if the output format is RGB (if the video output driver
supports RGB output, you can force this with ``--vf=scale,format=rgba``).
supports RGB output, you can force this with ``-vf scale,format=rgba``).
If this option is set to ``auto`` (which is the default), the video's
color space flag will be used. If that flag is unset, the color space
@@ -206,13 +203,10 @@ Available mpv-only filters are:
Available color spaces are:
:auto: automatic selection (default)
:bt.601: ITU-R Rec. BT.601 (SD)
:bt.709: ITU-R Rec. BT.709 (HD)
:bt.2020-ncl: ITU-R Rec. BT.2020 (non-constant luminance)
:bt.2020-cl: ITU-R Rec. BT.2020 (constant luminance)
:bt.2100-pq: ITU-R Rec. BT.2100 ICtCp PQ variant
:bt.2100-hlg: ITU-R Rec. BT.2100 ICtCp HLG variant
:dolbyvision: Dolby Vision
:bt.601: ITU-R BT.601 (SD)
:bt.709: ITU-R BT.709 (HD)
:bt.2020-ncl: ITU-R BT.2020 non-constant luminance system
:bt.2020-cl: ITU-R BT.2020 constant luminance system
:smpte-240m: SMPTE-240M
``<colorlevels>``
@@ -261,15 +255,15 @@ Available mpv-only filters are:
:dci-p3: DCI-P3 (Digital Cinema)
:v-gamut: Panasonic V-Gamut primaries
``<transfer>`` or ``<gamma>``
Transfer function the source file was encoded with. Normally this should be set
``<gamma>``
Gamma function the source file was encoded with. Normally this should be set
in the file header, but when playing broken or mistagged files this can be
used to override the setting.
This option only affects video output drivers that perform color management.
If this option is set to ``auto`` (which is the default), the gamma will
be set to BT.1886 for YCbCr content, sRGB for RGB content and st428 for
be set to BT.1886 for YCbCr content, sRGB for RGB content and Linear for
XYZ content.
Available gamma functions are:
@@ -290,7 +284,6 @@ Available mpv-only filters are:
:v-log: Panasonic V-Log transfer curve
:s-log1: Sony S-Log1 transfer curve
:s-log2: Sony S-Log2 transfer curve
:st428: Digital Cinema Distribution Master (XYZ)
``<sig-peak>``
Reference peak illumination for the video file, relative to the
@@ -319,44 +312,19 @@ Available mpv-only filters are:
Whether or not to include Dolby Vision metadata (default: yes). If
disabled, any Dolby Vision metadata will be stripped from frames.
``<hdr10plus=yes|no>``
Whether or not to include HDR10+ metadata (default: yes). If
disabled, any HDR10+ metadata will be stripped from frames.
``<min-luma>``
Set the minimum luminance value for the mastering display metadata.
This is a float value in nits (cd/m²).
.. note::
0.0 means undefined, which is the default. To set 0.0 as actual value,
use a very small value like 1e-6.
``<max-luma>``
Set the maximum luminance value for the mastering display metadata.
This is a float value in nits (cd/m²).
``<max_cll>``
Set the maximum content light level for the mastering display
metadata. This is a float value in nits (cd/m²).
``<max_fall>``
Set the maximum frame-average light level for the mastering
display metadata. This is a float value in nits (cd/m²).
``<film-grain=yes|no>``
Whether or not to include film grain metadata (default: yes). If
disabled, any film grain metadata will be stripped from frames.
``<chroma-location>``
Set the chroma loc of the video. Use
``--vf=format:chroma-location=help`` to list all available modes.
``<stereo-in>``
Set the stereo mode the video is assumed to be encoded in. Use
``--vf=format:stereo-in=help`` to list all available modes. Check with
the ``stereo3d`` filter documentation to see what the names mean.
``<stereo-out>``
Set the stereo mode the video should be displayed as. Takes the
same values as the ``stereo-in`` option.
``<rotate>``
Set the rotation the video is assumed to be encoded with in degrees.
The special value ``-1`` uses the input format.
@@ -379,14 +347,13 @@ Available mpv-only filters are:
Force a specific scaler backend, if applicable. This is a debug option
and could go away any time.
``<alpha=auto|straight|premul|none>``
``<alpha=auto|straight|premul>``
Set the kind of alpha the video uses. Undefined effect if the image
format has no alpha channel (could be ignored or cause an error,
depending on how mpv internals evolve). Setting this may or may not
cause downstream image processing to treat alpha differently, depending
on support. With ``convert`` and zimg used, this will convert the alpha.
libswscale and other FFmpeg components completely ignore this.
``none`` is available only starting from libplacebo vN.344.0.
``lavfi=graph[:sws-flags[:o=opts]]``
Filter video using FFmpeg's libavfilter.
@@ -458,7 +425,7 @@ Available mpv-only filters are:
subtitle colors and video under the influence of the video equalizer
settings.
``vapoursynth=file:buffered-frames:concurrent-frames:user-data``
``vapoursynth=file:buffered-frames:concurrent-frames``
Loads a VapourSynth filter script. This is intended for streamed
processing: mpv actually provides a source filter, instead of using a
native VapourSynth video source. The mpv source will answer frame
@@ -584,10 +551,6 @@ Available mpv-only filters are:
By default, this uses the special value ``auto``, which sets the option
to the number of detected logical CPU cores.
``user-data``
Optional arbitrary string that is passed to the script. Default to empty
string if not set.
The following ``.vpy`` script variables are defined by mpv:
``video_in``
@@ -605,23 +568,13 @@ Available mpv-only filters are:
completely broken (e.g. 0 or NaN). Even if the value is correct,
if another filter changes the real FPS (by dropping or inserting
frames), the value of this variable will not be useful. Note that
the ``--container-fps-override`` command line option overrides this value.
the ``--fps`` command line option overrides this value.
Useful for some filters which insist on having a FPS.
``display_fps``
Refresh rate of the current display. Note that this value can be 0.
``display_res``
Resolution of the current display. This is an integer array with the
first entry corresponding to the width and the second entry corresponding
to the height. These values can be 0. Note that this will not respond to
monitor changes and may not work on all platforms.
``user_data``
User data passed from the filter. This variable always exists, and defaults
to empty string.
``vavpp``
VA-API video post processing. Requires the system to support VA-API,
i.e. Linux/BSD only. Works with ``--vo=vaapi`` and ``--vo=gpu`` only.
@@ -712,33 +665,11 @@ Available mpv-only filters are:
Apply high quality VDPAU scaling (needs capable hardware).
``d3d11vpp``
Direct3D 11 video post-processing. Requires a D3D11 context and works best
with hardware decoding. Software frames are automatically uploaded to hardware
for processing.
Direct3D 11 video post processing. Currently requires D3D11 hardware
decoding for use.
``format``
Convert to the selected image format, e.g., nv12, p010, etc. (default: don't change).
Format names can be queried with ``--vf=d3d11vpp=format=help``.
Note that only a limited subset is supported, and actual support depends
on your hardware. Normally, this shouldn't be changed unless some
processing only works with a specific format, in which case it can be
selected here.
``deint=<yes|no>``
Whether deinterlacing is enabled (default: no).
``scale``
Scaling factor for the video frames (default: 1.0).
``scaling-mode=<standard,intel,nvidia>``
Select the scaling mode to be used. Note that this only enables the
appropriate processing extensions; whether it actually works or not
depends on your hardware and the settings in your GPU driver's control
panel (default: standard).
standard
Default scaling mode as decided by d3d11vpp implementation.
intel
Intel Video Super Resolution.
nvidia
NVIDIA RTX Super Resolution.
``interlaced-only=<yes|no>``
If ``yes``, only deinterlace frames marked as interlaced (default: no).
``mode=<blend|bob|adaptive|mocomp|ivctc|none>``
@@ -747,8 +678,6 @@ Available mpv-only filters are:
which algorithm is actually selected. ``none`` always falls back. On
most if not all hardware, this option will probably do nothing, because
a video processor usually supports all modes or none.
``nvidia-true-hdr``
Enable NVIDIA RTX Video HDR processing.
``fingerprint=...``
Compute video frame fingerprints and provide them as metadata. Actually, it
@@ -822,22 +751,12 @@ Available mpv-only filters are:
read information from this filter instead.
``gpu=...``
Convert video to RGB using the Vulkan or OpenGL renderer normally used with
``--vo=gpu``. In case of OpenGL, this requires that the EGL implementation
supports off-screen rendering on the default display. (This is the case with
Mesa.)
Convert video to RGB using the OpenGL renderer normally used with
``--vo=gpu``. This requires that the EGL implementation supports off-screen
rendering on the default display. (This is the case with Mesa.)
Sub-options:
``api=<type>``
The value ``type`` selects the rendering API. You can also pass
``help`` to get a complete list of compiled in backends.
egl
EGL (default if available)
vulkan
Vulkan
``w=<pixels>``, ``h=<pixels>``
Size of the output in pixels (default: 0). If not positive, this will
use the size of the first filtered input frame.
@@ -865,3 +784,4 @@ Available mpv-only filters are:
Do not use this with ``--vo=gpu``. It will apply filtering twice, since
most ``--vo=gpu`` options are unconditionally applied to the ``gpu``
filter. There is no mechanism in mpv to prevent this.
+101 -156
View File
@@ -10,34 +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 ``--vo=help`` for a list of compiled-in video output drivers.
The recommended output driver is ``--vo=gpu-next``, which is the default.
All other drivers are for compatibility or special purposes. If the default
The recommended output driver is ``--vo=gpu``, which is the default. All
other drivers are for compatibility or special purposes. If the default
does not work, it will fallback to other drivers (in the same order as
listed by ``--vo=help``).
Note that the default video output driver is subject to change, and must
not be relied upon. If a certain VO needs to be used (e.g. for ``libmpv``
rendering API), it must be explicitly specified.
Available video output drivers are:
``gpu-next``
Video renderer based on ``libplacebo``. This supports almost the same set
of features as ``--vo=gpu``. See `GPU renderer options`_ for a list.
Should generally be faster and higher quality, while also implementing some
features specific to ``gpu-next``, but some features may be intentionally
omitted or there may be functional differences to ``--vo=gpu``.
See here for a list of known differences:
https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU
``gpu``
General purpose, customizable, GPU-accelerated video output driver. It
supports extended scaling methods, dithering, color management, custom
@@ -45,11 +28,10 @@ Available video output drivers are:
See `GPU renderer options`_ for options specific to this VO.
By default, mpv utilizes settings that balance quality and performance.
Additionally, two predefined profiles are available: ``fast`` for maximum
performance and ``high-quality`` for superior rendering quality. You can
apply a specific profile using the ``--profile=<name>`` option and inspect
its contents using ``--show-profile=<name>``.
By default, it tries to use fast and fail-safe settings. Use the
``gpu-hq`` profile to use this driver with defaults set to high quality
rendering. The profile can be applied with ``--profile=gpu-hq`` and its
contents can be viewed with ``--show-profile=gpu-hq``.
This VO abstracts over several possible graphics APIs and windowing
contexts, which can be influenced using the ``--gpu-api`` and
@@ -68,6 +50,17 @@ Available video output drivers are:
with ``rgb32f``. If you have problems, you can also try enabling the
``--gpu-dumb-mode=yes`` option.
``gpu-next``
Experimental video renderer based on ``libplacebo``. This supports almost
the same set of features as ``--vo=gpu``. See `GPU renderer options`_ for a
list.
Should generally be faster and higher quality, but some features may still
be missing or misbehave. Expect (and report!) bugs. See here for a list of
known differences and bugs:
https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU
``xv`` (X11 only)
Uses the XVideo extension to enable hardware-accelerated display. This is
the most compatible VO on X, but may be low-quality, and has issues with
@@ -298,20 +291,9 @@ Available video output drivers are:
or VA API hardware decoding. The driver is designed to avoid any GPU to CPU copies,
and to perform scaling and color space conversion using fixed-function hardware,
if available, rather than GPU shaders. This frees up GPU resources for other tasks.
It is highly recommended to use this VO with the appropriate ``--hwdec`` option such
as ``auto-safe``. It can still work in some circumstances without ``--hwdec`` due to
mpv's internal conversion filters, but this is not recommended as it's a needless
extra step. Correct output depends on support from your GPU, drivers, and compositor.
This requires the compositor and mpv to support ``color-management-v1`` to
accurately display colorspaces that are different from the compositor
default (bt.601 in most cases).
.. warning::
This driver is not required for mpv to work on Wayland. ``vo=gpu``
and ``vo=gpu-next`` will switch to the appropriate Wayland context
automatically. This driver is experimental and generally lower quality
than ``gpu``/``gpu-next``.
Currently this driver is experimental and only works with the ``--hwdec=vaapi``
or ``hwdec=drm`` drivers;
OSD is also not supported. Supported compositors : Weston and Sway.
``vaapi``
Intel VA API video output driver with support for hardware decoding. Note
@@ -331,6 +313,25 @@ Available video output drivers are:
nla
``non-linear anamorphic scaling``
``--vo-vaapi-deint-mode=<mode>``
Select deinterlacing algorithm. Note that by default deinterlacing is
initially always off, and needs to be enabled with the ``d`` key
(default key binding for ``cycle deinterlace``).
This option doesn't apply if libva supports video post processing (vpp).
In this case, the default for ``deint-mode`` is ``no``, and enabling
deinterlacing via user interaction using the methods mentioned above
actually inserts the ``vavpp`` video filter. If vpp is not actually
supported with the libva backend in use, you can use this option to
forcibly enable VO based deinterlacing.
no
Don't allow deinterlacing (default for newer libva).
first-field
Show only first field.
bob
bob deinterlacing (default for older libva).
``--vo-vaapi-scaled-osd=<yes|no>``
If enabled, then the OSD is rendered at video resolution and scaled to
display resolution. By default, this is disabled, and the OSD is
@@ -339,7 +340,7 @@ Available video output drivers are:
``null``
Produces no video output. Useful for benchmarking.
Usually, it's better to disable video with ``--video=no`` instead.
Usually, it's better to disable video with ``--no-video`` instead.
The following global options are supported by this video output:
@@ -350,21 +351,6 @@ Available video output drivers are:
``caca``
Color ASCII art video output driver that works on a text console.
This driver reserves some keys for runtime configuration. These keys are
hardcoded and cannot be bound:
d and D
Toggle dithering algorithm.
a and A
Toggle antialiasing method.
h and H
Toggle charset method.
c and C
Toggle color method.
.. note:: This driver is a joke.
``tct``
@@ -377,38 +363,19 @@ Available video output drivers are:
performance.
Note: the TCT image output is not synchronized with other terminal output
from mpv, which can lead to broken images. The options ``--terminal=no`` or
from mpv, which can lead to broken images. The options ``--no-terminal`` or
``--really-quiet`` can help with that.
``--vo-tct-algo=<algo>``
Select how to write the pixels to the terminal.
half-blocks
Uses Unicode LOWER HALF BLOCK character to achieve higher vertical
Uses unicode LOWER HALF BLOCK character to achieve higher vertical
resolution. (Default.)
plain
Uses spaces. Causes vertical resolution to drop twofolds, but in
theory works in more places.
``--vo-tct-buffering=<pixel|line|frame>``
Specifies the size of data batches buffered before being sent to the
terminal.
TCT image output is not synchronized with other terminal output from mpv,
which can lead to broken images. Sending data to the terminal in small
batches may improve parallelism between terminal processing and mpv
processing but incurs a static overhead of generating tens of thousands
of small writes. Also, depending on the terminal used, sending frames in
one chunk might help with tearing of the output, especially if not used
with ``--really-quiet`` and other logs interrupt the data stream.
pixel
Send data to terminal for each pixel.
line
Send data to terminal for each line. (Default)
frame
Send data to terminal for each frame.
``--vo-tct-width=<width>`` ``--vo-tct-height=<height>``
Assume the terminal has the specified character width and/or height.
These default to 80x25 if the terminal size cannot be determined.
@@ -416,62 +383,13 @@ Available video output drivers are:
``--vo-tct-256=<yes|no>`` (default: no)
Use 256 colors - for terminals which don't support true color.
``kitty``
Graphical output for the terminal, using the kitty graphics protocol.
Tested with kitty and Konsole.
You may need to use ``--profile=sw-fast`` to get decent performance.
Kitty size and alignment options:
``--vo-kitty-cols=<columns>``, ``--vo-kitty-rows=<rows>`` (default: 0)
Specify the terminal size in character cells, otherwise (0) read it
from the terminal, or fall back to 80x25.
``--vo-kitty-width=<width>``, ``--vo-kitty-height=<height>`` (default: 0)
Specify the available size in pixels, otherwise (0) read it from the
terminal, or fall back to 320x240.
``--vo-kitty-left=<col>``, ``--vo-kitty-top=<row>`` (default: 0)
Specify the position in character cells where the image starts (1 is
the first column or row). If 0 (default) then try to automatically
determine it according to the other values and the image aspect ratio
and zoom.
``--vo-kitty-config-clear=<yes|no>`` (default: yes)
Whether or not to clear the terminal whenever the output is
reconfigured (e.g. when video size changes).
``--vo-kitty-alt-screen=<yes|no>`` (default: yes)
Whether or not to use the alternate screen buffer and return the
terminal to its previous state on exit. When set to no, the last
kitty image stays on screen after quit, with the cursor following it.
``--vo-kitty-use-shm=<yes|no>`` (default: no)
Use shared memory objects to transfer image data to the terminal.
This is much faster than sending the data as escape codes, but is not
supported by as many terminals. It also only works on the local machine
and not via e.g. SSH connections.
This option is not implemented on Windows.
``--vo-kitty-auto-multiplexer-passthrough=<yes|no>`` (default: no)
Automatically detect terminal multiplexer to passthrough escape
sequences. This allows the image protocol to work in multiplexers that
might not support the kitty image protocol by passing through the
escape sequences directly to the terminal.
Currently only supports tmux and GNU screen.
``sixel``
Graphical output for the terminal, using sixels. Tested with ``mlterm`` and
``xterm``.
Note: the Sixel image output is not synchronized with other terminal
output from mpv, which can lead to broken images.
The option ``--really-quiet`` can help with that, and is recommended.
On some platforms, using the ``--vo-sixel-buffered`` option may work as
well.
Note: the Sixel image output is not synchronized with other terminal output
from mpv, which can lead to broken images. The option ``--really-quiet``
can help with that, and is recommended.
You may need to use ``--profile=sw-fast`` to get decent performance.
@@ -515,25 +433,10 @@ Available video output drivers are:
to take into account padding at the report - this only works correctly
when the overall padding per axis is smaller than the number of cells.
``--vo-sixel-config-clear=<yes|no>`` (default: yes)
Whether or not to clear the terminal whenever the output is
reconfigured (e.g. when video size changes).
``--vo-sixel-alt-screen=<yes|no>`` (default: yes)
Whether or not to use the alternate screen buffer and return the
terminal to its previous state on exit. When set to no, the last
``--vo-sixel-exit-clear=<yes|no>`` (default: yes)
Whether or not to clear the terminal on quit. When set to no - the last
sixel image stays on screen after quit, with the cursor following it.
``--vo-sixel-exit-clear`` is a deprecated alias for this option and
may be removed in the future.
``--vo-sixel-buffered=<yes|no>`` (default: no)
Buffers the full output sequence before writing it to the terminal.
On POSIX platforms, this can help prevent interruption (including from
other applications) and thus broken images, but may come at a
performance cost with some terminals and is subject to implementation
details.
Sixel image quality options:
``--vo-sixel-dither=<algo>``
@@ -623,6 +526,37 @@ Available video output drivers are:
This also supports many of the options the ``gpu`` VO has, depending on the
backend.
``rpi`` (Raspberry Pi)
Native video output on the Raspberry Pi using the MMAL API.
This is deprecated. Use ``--vo=gpu`` instead, which is the default and
provides the same functionality. The ``rpi`` VO will be removed in
mpv 0.23.0. Its functionality was folded into --vo=gpu, which now uses
RPI hardware decoding by treating it as a hardware overlay (without applying
GL filtering). Also to be changed in 0.23.0: the --fs flag will be reset to
"no" by default (like on the other platforms).
The following deprecated global options are supported by this video output:
``--rpi-display=<number>``
Select the display number on which the video overlay should be shown
(default: 0).
``--rpi-layer=<number>``
Select the dispmanx layer on which the video overlay should be shown
(default: -10). Note that mpv will also use the 2 layers above the
selected layer, to handle the window background and OSD. Actual video
rendering will happen on the layer above the selected layer.
``--rpi-background=<yes|no>``
Whether to render a black background behind the video (default: no).
Normally it's better to kill the console framebuffer instead, which
gives better performance.
``--rpi-osd=<yes|no>``
Enabled by default. If disabled with ``no``, no OSD layer is created.
This also means there will be no subtitles rendered.
``drm`` (Direct Rendering Manager)
Video output driver using Kernel Mode Setting / Direct Rendering Manager.
Should be used when one doesn't want to install full-blown graphical
@@ -634,15 +568,18 @@ Available video output drivers are:
The following global options are supported by this video output:
``--drm-connector=<name>``
``--drm-connector=[<gpu_number>.]<name>``
Select the connector to use (usually this is a monitor.) If ``<name>``
is empty or ``auto``, mpv renders the output on the first available
connector. Use ``--drm-connector=help`` to get a list of available
connectors. (default: empty)
connectors. The ``<gpu_number>`` argument can be used to disambiguate
multiple graphic cards, but is deprecated in favor of ``--drm-device``.
(default: empty)
``--drm-device=<path>``
Select the DRM device file to use. If specified this overrides automatic
card selection. (default: empty)
card selection and any card number specified ``--drm-connector``.
(default: empty)
``--drm-mode=<preferred|highest|N|WxH[@R]>``
Mode to use (resolution and frame rate).
@@ -660,6 +597,16 @@ Available video output drivers are:
Use ``--drm-mode=help`` to get a list of available modes for all active
connectors.
``--drm-atomic=<no|auto>``
Toggle use of atomic modesetting. Mostly useful for debugging.
:no: Use legacy modesetting.
:auto: Use atomic modesetting, falling back to legacy modesetting if
not available. (default)
Note: Only affects ``gpu-context=drm``. ``vo=drm`` supports legacy
modesetting only.
``--drm-draw-plane=<primary|overlay|N>``
Select the DRM plane to which video and OSD is drawn to, under normal
circumstances. The plane can be specified as ``primary``, which will
@@ -683,20 +630,17 @@ Available video output drivers are:
lower resolution (the video when handled by the hwdec will be on the
drmprime-video plane and at full 4K resolution)
``--drm-format=<xrgb8888|xbgr8888|xrgb2101010|xbgr2101010|yuyv>``
``--drm-format=<xrgb8888|xrgb2101010>``
Select the DRM format to use (default: xrgb8888). This allows you to
choose the bit depth and color type of the DRM mode.
xrgb8888 is your usual 24bpp packed RGB format with 8 bits of padding.
xrgb2101010 is a 30bpp packed RGB format with 2 bits of padding.
yuyv is a 32bpp packed YUV 4:2:2 format. No planar formats are currently
supported.
choose the bit depth of the DRM mode. xrgb8888 is your usual 24 bit per
pixel/8 bits per channel packed RGB format with 8 bits of padding.
xrgb2101010 is a packed 30 bits per pixel/10 bits per channel packed RGB
format with 2 bits of padding.
There are cases when xrgb2101010 will work with the ``drm`` VO, but not
with the ``drm`` backend for the ``gpu`` VO. This is because with the
``gpu`` VO, in addition to requiring support in your DRM driver,
requires support for xrgb2101010 in your EGL driver.
yuyv only ever works with the ``drm`` VO.
requires support for xrgb2101010 in your EGL driver
``--drm-draw-surface-size=<[WxH]>``
Sets the size of the surface used on the draw plane. The surface will
@@ -709,6 +653,7 @@ Available video output drivers are:
just cause the video to get rendered at a different resolution and then
scaled to screen size.
Note: this option is only available with DRM atomic support.
(default: display resolution)
``--drm-vrr-enabled=<no|yes|auto>``
+9 -9
View File
@@ -37,7 +37,7 @@ Player
* ``--keep-open`` option to stop the player from closing the window and
exiting after playback ends.
* A client API, that allows embedding **mpv** into applications
(see ``mpv/client.h`` in the sources).
(see ``libmpv/client.h`` in the sources).
Input
~~~~~
@@ -135,10 +135,10 @@ Miscellaneous
* Support for precise scrolling which scales the parameter of commands. If the
input doesn't support precise scrolling the scale factor stays 1.
* Allow changing/adjusting video filters at runtime. (This is also used to make
the ``D`` key insert vf_bwdif if deinterlacing is not supported otherwise).
the ``D`` key insert vf_yadif if deinterlacing is not supported otherwise).
* Improved support for .cue files.
macOS
Mac OS X
~~~~~~~~
* Native OpenGL backend.
@@ -177,7 +177,7 @@ Internal changes
* General code cleanups (including refactoring or rewrites of many parts).
* New build system.
* Many bug fixes and removal of long-standing issues.
* Generally preferring FFmpeg over internal demuxers, decoders, and
* Generally preferring FFmpeg/Libav over internal demuxers, decoders, and
filters.
Detailed Listing of User-visible Changes
@@ -214,7 +214,7 @@ Command Line Switches
``-af volnorm`` (removed; use acompressor ffmpeg filter instead)
``-afm hwac3`` ``--ad=spdif:ac3,spdif:dts``
``-ao alsa:device=hw=0.3`` ``--ao=alsa:device=[hw:0,3]``
``-aspect`` ``--video-aspect-override``
``-aspect`` ``--video-aspect``
``-ass-bottom-margin`` ``--vf=sub=bottom:top``
``-ass`` ``--sub-ass``
``-audiofile-cache`` (removed; the main cache settings are used)
@@ -229,7 +229,7 @@ Command Line Switches
``-endpos`` ``--length``
``-fixed-vo`` (removed; always the default)
``-font`` ``--osd-font``
``-forcedsubsonly`` ``--sub-forced-events-only``
``-forcedsubsonly`` ``--sub-forced-only``
``-forceidx`` ``--index``
``-format`` ``--audio-format``
``-fsmode-dontuse`` (removed)
@@ -321,9 +321,9 @@ input.conf and Slave Commands
+--------------------------------+----------------------------------------+
| ``pt_step -1 [0|1]`` | ``playlist-prev [weak|force] (same)`` |
+--------------------------------+----------------------------------------+
| ``switch_ratio [<ratio>]`` | ``set video-aspect-override <ratio>`` |
| ``switch_ratio [<ratio>]`` | ``set video-aspect <ratio>`` |
| | |
| | ``set video-aspect-override 0`` (reset)|
| | ``set video-aspect 0`` (reset aspect) |
+--------------------------------+----------------------------------------+
| ``step_property_osd <prop>`` | ``cycle <prop> <step>`` (wraps), |
| ``<step> <dir>`` | ``add <prop> <step>`` (clamps). |
@@ -410,7 +410,7 @@ Slave mode
`JSON IPC`_ for more information.
* **mpv** also provides a client API, which can be used to embed the player
by loading it as shared library. (See ``mpv/client.h`` in the sources.)
by loading it as shared library. (See ``libmpv/client.h`` in the sources.)
It might also be possible to implement a custom slave mode-like protocol
using Lua scripting.
+47 -68
View File
@@ -1,15 +1,13 @@
Release Policy
==============
A few times a year, a new release is cut off of the master branch and
Once or twice a month, a new release is cut off of the master branch and is
assigned a 0.X.Y version number, where X is incremented each time a release
contains breaking changes, such as changed options or added/removed features,
and Y is incremented if a release contains only bugfixes and other minor
changes.
Releases are tagged on the master branch and will not be maintained separately.
Patch releases may be made if the amount or severity of bugs justify it, or in
the event of security issues.
The goal of releases is to provide Linux distributions with something to
package. If you want the newest features, just use the master branch.
@@ -24,119 +22,100 @@ While on master:
- Update the `RELEASE_NOTES` file, replacing the previous release notes.
- Update the `MPV_VERSION` file.
- Update the `VERSION` file.
- Update `DOCS/client-api-changes.rst` (in particular, update the last version
number if necessary)
- Run `TOOLS/gen-interface-changes.py` to refresh `DOCS/interface-changes.rst`,
and edit manually as necessary.
- Delete all `.txt` files in `DOCS/interface-changes/` except for `example.txt`.
- Update `DOCS/client-api-changes.rst` and `DOCS/interface-changes.rst`
(in particular, update the last version numbers if necessary)
- Create signed commit with changes.
- Create signed tag v0.X.Y.
- Push release branch (`release/0.X`) and tag to GitHub.
- Add -UNKNOWN suffix to version in `VERSION` file.
- Commit changes, push release branch (`release/0.X`) and tag to GitHub.
- Create a new GitHub release using the content of `RELEASE_NOTES` related to
the new version. Check the "Create a discussion for this release" box.
the new version.
- Re-add -UNKNOWN suffix to version in `MPV_VERSION` file and commit.
If necessary (e.g. to exclude commits already on master), the release can
If necessary (to e.g. exclude commits already on master), the release can
be done on a branch with different commit history. The release branch **must**
then be merged to master so `git describe` will pick up the tag.
This does not apply to patch releases, which are tagged directly on the
`release/0.X` branch. The master branch always remains at v0.X.0.
Release notes template
----------------------
Here is a template that should be used for writing the `RELEASE_NOTES` file:
Here is a template that can be used for writing the `RELEASE_NOTES` file.
```markdown
Release 0.X.Y
=============
We are excited to announce the release of mpv 0.X.Y.
Features
--------
Key highlights:
* List of notable stuff
This release requires FFmpeg <ver> or newer and libplacebo <ver> or newer.
# Features
## New
New
~~~
- List of new features
## Changed
- List of changed features
## Removed
Removed
~~~~~~~
- List of removed features
Deprecated
~~~~~~~~~~
# Options and Commands
- List of deprecated features
## Added
Behavior
--------
- List of user-visible changes in behavior
Options and Commands
--------------------
Added
~~~~~
- List of added options and commands
## Changed
Changed
~~~~~~~
- List of changed options and commands
Renamed
~~~~~~~
## Deprecated
- List of renamed options and commands
Deprecated
~~~~~~~~~~
- List of deprecated options and commands
## Removed
Removed
~~~~~~~
- List of removed options and commands
# Fixes and Minor Enhancements
Fixes and Minor Enhancements
----------------------------
- List of fixes and minor enhancements
This listing is not complete. Check DOCS/client-api-changes.rst for a history
of changes to the client API, and DOCS/interface-changes.rst for a history
of changes to other user-visible interfaces.
A complete changelog can be seen by running `git log start..end`
in the git repository or by visiting
<https://github.com/mpv-player/mpv/compare/start...end>.
This listing is not complete. There are many more bug fixes and changes. The
complete change log can be viewed by running `git log <start>..<end>` in
the git repository.
```
Note that the "Release 0.X.Y" title should be removed when creating a new GitHub
release.
When creating a new point release its changes should be added on top of the
`RELEASE_NOTES` file (with the appropriate title) so that all the changes in
the current 0.X branch will be included. This way the `RELEASE_NOTES` file
can be used by distributors as changelog for point releases too.
The changelog lists all changes since the last release, including those
that have been backported to patch releases already. Except for the
"Key highlights" section they are ordered chronologically with older commits
at the top.
Some additional advice:
- Especially for features, try to reword the messages so that the user-visible
change is clear to the reader. But don't simplify too much or be too verbose.
- It often makes sense to merge multiple related changes into one line
- Changes that have been made and reverted within the same release must not
appear in the changelog
- Limit the "Options and Commands" section to relevant changes
- When filling in the GitHub release, remove the "Release 0.X.Y" heading
+63 -62
View File
@@ -11,7 +11,7 @@ player/*.c:
* main():
* basic initializations (e.g. init_libav() and more)
* pre-parse command line (verbosity level, config file locations)
* load config files (mp_parse_cfgfiles())
* load config files (parse_cfgfiles())
* parse command line, add files from the command line to playlist
(m_config_parse_mp_command_line())
* check help options etc. (call handle_help_options()), possibly exit
@@ -45,7 +45,7 @@ player/*.c:
Things worth saying about the playback core:
- most state is in MPContext (core.h), which is not available to the
subsystems (and should not be made available)
- the currently played tracks are in mpctx->current_track, and decoder
- the currently played tracks are in mpctx->current_tracks, and decoder
state in track.dec/d_sub
- the other subsystems rarely call back into the frontend, and the frontend
polls them instead (probably a good thing)
@@ -68,6 +68,7 @@ ta.h & ta.c:
as in it doesn't require valgrind.) You can enable it by setting the
MPV_LEAK_REPORT environment variable to "1":
export MPV_LEAK_REPORT=1
Or permanently by building with --enable-ta-leak-report.
This will list all unfree'd allocations on exit.
Documentation can be found here:
@@ -93,7 +94,7 @@ player/core.h:
usually not accessed by other parts of mpv for the sake of modularization.
player/client.c:
This implements the client API (mpv/client.h). For the most part, this
This implements the client API (libmpv/client.h). For the most part, this
just calls into other parts of the player. This also manages a ringbuffer
of events from player to clients.
@@ -125,16 +126,15 @@ options/options.h, options/options.c
... to get a copy of its options.
See m_config_core.h (below) how to access options.
See m_config.h (below) how to access options.
The actual option parser is spread over m_option.c, m_config_frontend.c,
and parse_commandline.c, and uses the option table in options.c.
The actual option parser is spread over m_option.c, m_config.c, and
parse_commandline.c, and uses the option table in options.c.
options/m_config_*.h & m_config_*.c:
Code for querying and managing options. m_config_frontend.h contains
declarations for the "legacy-ish" global m_config struct, while
m_config_core.h provides ways to access options in a threads-safe way
anywhere, like m_config_cache_alloc().
options/m_config.h & m_config.c:
Code for querying and managing options. This (unfortunately) contains both
declarations for the "legacy-ish" global m_config struct, and ways to access
options in a threads-safe way anywhere, like m_config_cache_alloc().
m_config_cache_alloc() lets anyone read, observe, and write options in any
thread. The only state it needs is struct mpv_global, which is an opaque
@@ -165,15 +165,16 @@ stream/*:
E.g. if mpv sees "http://something" on the command line, it will pick
stream_lavf.c based on the prefix, and pass the rest of the filename to it.
Some stream inputs are quite special: stream_dvdnav.c turns DVDs into mpeg
Some stream inputs are quite special: stream_dvd.c turns DVDs into mpeg
streams (DVDs are actually a bunch of vob files etc. on a filesystem),
stream_tv.c provides TV input including channel switching.
Some stream inputs are just there to invoke special demuxers, like
stream_mf.c. (Basically to make the prefix "mf://" do something special.)
demux/:
Demuxers split data streams into audio/video/sub streams, which in turn
are split in packets. Packets (see packet.h) are mostly byte chunks
are split in packets. Packets (see demux_packet.h) are mostly byte chunks
tagged with a playback time (PTS). These packets are passed to the decoders.
Most demuxers have been removed from this fork, and the only important and
@@ -188,14 +189,6 @@ demux/:
cache, which is implemented as a list of packets. The cache is complex
because it support seeking, multiple ranges, prefetching, and so on.
filters/:
Filter related code. filter.c contains the generic filtering framework
which converts input frames to output frames (audio, video, or demux
packet data). f_decoder_wrapper.c is a source filter which connects the
frontend with the actual audio and video decoders. f_output_chain.c handles
VO/AO output conversions. f_autoconvert.c automatically inserts the
appropriate conversion filters if format conversion is needed.
video/:
This contains several things related to audio/video decoding, as well as
video filters.
@@ -204,18 +197,22 @@ video/:
internally.
video/decode/:
vd_*.c are video decoders. (There's only vd_lavc.c left.)
vd_*.c are video decoders. (There's only vd_lavc.c left.) dec_video.c
handles most of connecting the frontend with the actual decoder.
video/filter/:
vf_*.c are video filters. They are fed by the video decoder, and output the
filtered images to the VOs. By default, no video filters are used.
vf_*.c and vf.c form the video filter chain. They are fed by the video
decoder, and output the filtered images to the VOs though vf_vo.c. By
default, no video filters (except vf_vo) are used. vf_scale is automatically
inserted if the video output can't handle the video format used by the
decoder.
video/out/:
Video output. They also create GUI windows and handle user input. In most
cases, the windowing code is shared among VOs, like x11_common.c for X11 and
w32_common.c for Windows. The VOs stand between frontend and windowing code.
vo_gpu and vo_gpu_next can pick a windowing system at runtime, e.g. the same
binary can provide both X11 and Cocoa support on macOS.
vo_gpu can pick a windowing system at runtime, e.g. the same binary can
provide both X11 and Cocoa support on OSX.
VOs can be reconfigured at runtime. A vo_reconfig() call can change the video
resolution and format, without destroying the window.
@@ -227,13 +224,13 @@ audio/:
compressed formats used for spdif.)
audio/decode/:
ad_*.c handle audio decoding. ad_lavc.c is the decoder using ffmpeg.
ad_spdif.c is not really a decoder, but is used for compressed audio
passthrough.
ad_*.c and dec_audio.c handle audio decoding. ad_lavc.c is the
decoder using ffmpeg. ad_spdif.c is not really a decoder, but is used for
compressed audio passthrough.
audio/filter/:
Audio filters. af_scaletempo2 is inserted by default if playback is different
from normal speed.
Audio filter chain. af_lavrresample is inserted if any form of conversion
between audio formats is needed.
audio/out/:
Audio outputs.
@@ -241,9 +238,9 @@ audio/out/:
Unlike VOs, AOs can't be reconfigured on a format change. On audio format
changes, the AO will simply be closed and re-opened.
buffer.c is the wrapper to support for two types of audio APIs: push and
pull. ao.c calls into that. It contains generic code to deal with the data
flow these APIs impose.
There are wrappers to support for two types of audio APIs: push.c and
pull.c. ao.c calls into one of these. They contain generic code to deal
with the data flow these APIs impose.
Note that mpv synchronizes the video to the audio. That's the reason
why buggy audio drivers can have a bad influence on playback quality.
@@ -260,7 +257,10 @@ sub/:
in turn asks dec_sub.c for subtitle overlay bitmaps, which relays the
request to one of the sd_*.c subtitle decoders/renderers.
Subtitle loading is in demux/. Normally, subtitles are loaded via demux_lavf.c.
Subtitle loading is in demux/. The MPlayer subreader.c is mostly gone - parts
of it survive in demux_subreader.c. It's used as last fallback, or to handle
some text subtitle types on Libav. It should go away eventually. Normally,
subtitles are loaded via demux_lavf.c.
The subtitles are passed to dec_sub.c and the subtitle decoders in sd_*.c
as they are demuxed. All text subtitles are rendered by sd_ass.c. If text
@@ -272,8 +272,8 @@ sub/:
sd_ass.c's internal state.
etc/:
The files input.conf and builtin.conf are actually integrated into the mpv
binary by the build system. They contain the default configs and keybindings.
The file input.conf is actually integrated into the mpv binary by the
build system. It contains the default keybindings.
Best practices and Concepts within mpv
======================================
@@ -430,11 +430,12 @@ like a log file or the internal console.lua script.
Locking
-------
See generally available literature. In mpv, we use mp_thread for this.
See generally available literature. In mpv, we use pthread for this.
Always keep locking clean. Don't skip locking just because it will work "in
practice". (See undefined behavior section.) If your use case is simple, you may
use C11 atomics, but most likely you will only hurt yourself and others.
use C11 atomics (osdep/atomic.h for partial C99 support), but most likely you
will only hurt yourself and others.
Always make clear which fields in a struct are protected by which lock. If a
field is immutable, or simply not thread-safe (e.g. state for a single worker
@@ -555,13 +556,13 @@ Condition variables
-------------------
They're used whenever a thread needs to wait for something, without nonsense
like sleep calls or busy waiting. mpv uses the mp_thread API for this.
There's a lot of literature on condition variables, threading in general. Read it.
like sleep calls or busy waiting. mpv uses the standard pthread API for this.
There's a lot of literature on it. Read it.
For initial understanding, it may be helpful to know that condition variables
are not variables that signal a condition. mp_cond does not have any
state per-se. Maybe mp_cond would better be named mp_interrupt,
because its sole purpose is to interrupt a thread waiting via mp_cond_wait()
are not variables that signal a condition. pthread_cond_t does not have any
state per-se. Maybe pthread_cond_t would better be named pthread_interrupt_t,
because its sole purpose is to interrupt a thread waiting via pthread_cond_wait()
(or similar). The "something" in "waiting for something" can be called
predicate (to avoid confusing it with "condition"). Consult literature for the
proper terms.
@@ -570,24 +571,24 @@ The very short version is...
Shared declarations:
mp_mutex lock;
mp_cond cond_var;
pthread_mutex_t lock;
pthread_cond_t cond_var;
struct something state_var; // protected by lock, changes signaled by cond_var
Waiter thread:
mp_mutex_lock(&lock);
pthread_mutex_lock(&lock);
// Wait for a change in state_var. We want to wait until predicate_fulfilled()
// returns true.
// Must be a loop for 2 reasons:
// 1. cond_var may be associated with other conditions too
// 2. mp_cond_wait() can have sporadic wakeups
// 2. pthread_cond_wait() can have sporadic wakeups
while (!predicate_fulfilled(&state_var)) {
// This unlocks, waits for cond_var to be signaled, and then locks again.
// The _whole_ point of cond_var is that unlocking and waiting for the
// signal happens atomically.
mp_cond_wait(&cond_var, &lock);
pthread_cond_wait(&cond_var, &lock);
}
// Here you may react to the state change. The state cannot change
@@ -595,43 +596,43 @@ Waiter thread:
// and reacquire it).
// ...
mp_mutex_unlock(&lock);
pthread_mutex_unlock(&lock);
Signaler thread:
mp_mutex_lock(&lock);
pthread_mutex_lock(&lock);
// Something changed. Update the shared variable with the new state.
update_state(&state_var);
// Notify that something changed. This will wake up the waiter thread if
// it's blocked in mp_cond_wait(). If not, nothing happens.
mp_cond_broadcast(&cond_var);
// it's blocked in pthread_cond_wait(). If not, nothing happens.
pthread_cond_broadcast(&cond_var);
// Fun fact: good implementations wake up the waiter only when the lock is
// released, to reduce kernel scheduling overhead.
mp_mutex_unlock(&lock);
pthread_mutex_unlock(&lock);
Some basic rules:
1. Always access your state under proper locking
2. Always check your predicate before every call to mp_cond_wait()
(And don't call mp_cond_wait() if the predicate is fulfilled.)
3. Always call mp_cond_wait() in a loop
2. Always check your predicate before every call to pthread_cond_wait()
(And don't call pthread_cond_wait() if the predicate is fulfilled.)
3. Always call pthread_cond_wait() in a loop
(And only if your predicate failed without releasing the lock..)
4. Always call mp_cond_broadcast()/_signal() inside of its associated
4. Always call pthread_cond_broadcast()/_signal() inside of its associated
lock
mpv sometimes violates rule 3, and leaves "retrying" (i.e. looping) to the
caller.
Common pitfalls:
- Thinking that mp_cond is some kind of semaphore, or holds any
- Thinking that pthread_cond_t is some kind of semaphore, or holds any
application state or the user predicate (it _only_ wakes up threads
that are at the same time blocking on mp_cond_wait() and friends,
that are at the same time blocking on pthread_cond_wait() and friends,
nothing else)
- Changing the predicate, but not updating all mp_cond_broadcast()/
- Changing the predicate, but not updating all pthread_cond_broadcast()/
_signal() calls correctly
- Forgetting that mp_cond_wait() unlocks the lock (other threads can
- Forgetting that pthread_cond_wait() unlocks the lock (other threads can
and must acquire the lock)
- Holding multiple nested locks while trying to wait (=> deadlock, violates
the lock order anyway)
+157
View File
@@ -0,0 +1,157 @@
waf build system overview
=========================
mpv's new build system is based on waf and it should completely replace the
custom ./configure + Makefile based system inherited from MPlayer.
Goals and the choice of waf
===========================
The new system comes with some goals, which can be summed up as: be as good as
the old one at what it did well (customizability) and fix some of it's major
shortcomings:
1) The build system must be uniform in how it handles any single feature check.
Repetition and boilerplate have to be avoided.
When adding a new feature using the old configure, one had to add a fair
amount of code to the shell script to do option parsing, detection of the
feature and declaration of variables for the Makefile to pickup. The worst
part is this pieces are spread apart in the configure and copy pasted for
any single case. That brings us to..
2) --enable-feature has to be overridden by the user and helps them understand that
they have libraries missing and should install them for the feature to be
enabled.
3) Must be customizable, hackable, pleasant to the developer eyes and to work
with in general.
4) Must have separate configuration and build steps.
Goal 2 comes as a given on pretty much any build system, since autotools made
this behaviour very popular among users (and rightly so).
Goal 1+3 were somewhat harder to accomplish as it looks like all of the build
systems we evaluated (waf included!) had problems with them. For reference we
had proof of concept build systems with waf, CMake and autotools.
What puts waf apart from CMake and autotools, is that projects using it use
Python to program their build system. Also while the Waf Book shows really
simple API usages, you can write your own build system on top of waf that is
tailored to the project's specific needs.
mpv's custom configure step on top of waf
=========================================
To some extents mpv has a custom build system written on top of waf. This
document will not go over the standard waf behaviour as that is documented in
the `Waf book <https://waf.io/book/>`_.
All of the configuration process is handled with a declarative approach. Lists
of dictionaries define the checks, and some custom Python code traverses these
lists and depending on the check definition it calls into the actual waf API.
A simple example using pkg-config would be::
{
'name': '--vdpau',
'desc': 'VDPAU acceleration',
'deps': [ 'x11' ],
'func': check_pkg_config('vdpau', '>= 0.2'),
}
This defines a feature called ``vdpau`` which can be enabled or disabled by
the users with configure flags (that's the meaning of ``--``). This feature
depends on another feature whose name is ``x11``, and the autodetection check
consists of running ``pkg-config`` and looking for ``vdpau`` with version
``>= 0.2``. If the check succeeds a ``#define HAVE_VDPAU 1`` will be added to
``config.h``, if not ``#define HAVE_VDPAU 0`` will be added.
The defines names are automatically prepended with ``HAVE_``, capitalized and
special characters are replaced with underscores. This happens in
``waftools/inflectors.py``.
Mandatory fields:
-----------------
``name``: indicates the unique identifier used by the custom dependency code
to refer to a feature. If the unique identifier is prepended with ``--``
the build system will also generate options for ``./waf configure`` so that
the feature can be enabled and disabled.
``desc``: this is the textual representation of the feature used in the
interactions with the users.
``func``: function that will perform the check. These functions are defined in
``waftools/checks``. The reusable checks are all functions that return
functions. The return functions will then be applied using waf's configuration
context.
The source code for the reusable checks is a bit convoluted, but it should be
easy to pick up their usage from the ``wscript``. Their signature mirrors
the semantics of some of the shell functions used in mplayer.
If someone expresses some interest, I will extend this document with official
documentation for each check function.
Optional fields
---------------
``deps``: list of dependencies of this feature. It is a list of names of
other features as defined in the ``name`` field (minus the eventual leading
``--``). All of the dependencies must be satisfied. If they are not the check
will be skipped without even running ``func``.
``deps_any``: like deps but it is satisfied even if only one of the dependencies
is satisfied. You can think of ``deps`` as a 'and' condition and ``deps_any``
as a 'or' condition.
``deps_neg``: like deps but it is satisfied when none of the dependencies is
satisfied.
``req``: defaults to False. If set to True makes this feature a hard
dependency of mpv (configuration will fail if autodetection fails). If set to
True you must also provide ``fmsg``.
``fmsg``: string with the failure message in case a required dependency is not
satisfied.
``os_specific_checks``: this takes a dictionary that has ``os-`` dependencies
as keys (such as ``os-win32``), and by values has another dictionary that is
merged on top of the current feature definition only for that specific OS.
For example::
{
'name': '--pthreads',
'desc': 'POSIX threads',
'func': check_pthreads,
'os_specific_checks': {
'os-win32': {
'func': check_pthreads_w32_static.
}
}
}
will override the value of ``func`` with ``check_pthreads_w32_static`` only
if the target OS of the build is Windows.
``groups``: groups a dependency with another one. This can be used to disabled
all the grouped dependencies with one ``--disable-``. At the moment this is
only used for OpenGL backends, where you want to disable them when
``--disable-gl`` is passed to the configure.
mpv's custom build step on top of waf
=====================================
Build step is pretty much vanilla waf. The only difference being that the list
of source files can contain both strings or tuples. If a tuple is found,
the second element in the tuple will be used to match the features detected
in the configure step (the ``name`` field described above). If this feature
was not enabled during configure, the source file will not be compiled in.
All of the custom Python for this is inside the function ``filtered_sources``
contained in the file ``waftools/dependencies.py``.
Also ``dependencies_use`` and ``dependencies_includes`` collect cflags and
ldflags that were generated from the features checks in the configure step.
+5 -4
View File
@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
<https://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -304,7 +304,8 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, see <https://www.gnu.org/licenses/>.
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
@@ -328,8 +329,8 @@ necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Moe Ghoul>, 1 April 1989
Moe Ghoul, President of Vice
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
+14 -13
View File
@@ -2,7 +2,7 @@
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
<https://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
@@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -158,7 +158,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
@@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@@ -267,7 +267,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
@@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
@@ -484,7 +484,8 @@ convey the exclusion of warranty; and each file should have at least the
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <https://www.gnu.org/licenses/>.
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
@@ -495,7 +496,7 @@ necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Moe Ghoul>, 1 April 1990
Moe Ghoul, President of Vice
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
-1
View File
@@ -1 +0,0 @@
0.41.0
+48 -37
View File
@@ -20,7 +20,6 @@
* [Wiki](https://github.com/mpv-player/mpv/wiki)
* [User Scripts](https://github.com/mpv-player/mpv/wiki/User-Scripts)
* [FAQ][FAQ]
* [Manual](https://mpv.io/manual/master/)
@@ -37,26 +36,19 @@ Releases can be found on the [release list][releases].
## System requirements
- A not too ancient Linux (usually, only the latest releases of distributions
are actively supported), Windows 10 1607 or later, or macOS 10.15 or later.
- A not too ancient Linux, Windows 7 or later, or OSX 10.8 or later.
- A somewhat capable CPU. Hardware decoding might help if the CPU is too slow to
decode video in realtime, but must be explicitly enabled with the `--hwdec`
option.
- A not too crappy GPU. mpv's focus is not on power-efficient playback on
embedded or integrated GPUs (for example, hardware decoding is not even
enabled by default). Low power GPUs may cause issues like tearing, stutter,
etc. On such GPUs, it's recommended to use `--profile=fast` for smooth playback.
The main video output uses shaders for video rendering and scaling,
etc. The main video output uses shaders for video rendering and scaling,
rather than GPU fixed function hardware. On Windows, you might want to make
sure the graphics drivers are current. In some cases, ancient fallback video
output methods can help (such as `--vo=xv` on Linux), but this use is not
recommended or supported.
mpv does not go out of its way to break on older hardware or old, unsupported
operating systems, but development is not done with them in mind. Keeping
compatibility with such setups is not guaranteed. If things work, consider it
a happy accident.
## Downloads
@@ -77,15 +69,18 @@ on every release.
Changes to the default key bindings are indicated in
[restore-old-bindings.conf][restore-old-bindings].
Changes to the default OSC bindings are indicated in
[restore-osc-bindings.conf][restore-osc-bindings].
## Compilation
Compiling with full features requires development files for several
external libraries. Mpv requires [meson](https://mesonbuild.com/index.html)
to build. Meson can be obtained from your distro or PyPI.
external libraries. One of the two build systems supported by mpv is required:
[meson](https://mesonbuild.com/index.html) or [waf](https://waf.io/). Meson
can be obtained from your distro or PyPI. Waf can be downloaded by using the
`./bootstrap.py` script. It will get the latest version of waf that was tested
with mpv. Some documentation about the differences between the build systems are
located in [build-system-differences][build-system-differences].
### Meson
After creating your build directory (e.g. `meson setup build`), you can view a list
of all the build options via `meson configure build`. You could also just simply
@@ -98,22 +93,38 @@ Example:
meson compile -C build
meson install -C build
For libplacebo, meson can use a git check out as a subproject for a convenient
way to compile mpv if a sufficient libplacebo version is not easily available
in the build environment. It will be statically linked with mpv. Example:
### Waf
mkdir -p subprojects
git clone https://code.videolan.org/videolan/libplacebo.git --depth=1 --recursive subprojects/libplacebo
For a list of the available build options use `./waf configure --help`. If
you think you have support for some feature installed but configure fails to
detect it, the file `build/config.log` may contain information about the
reasons for the failure.
NOTE: To avoid cluttering the output with unreadable spam, `--help` only shows
one of the two switches for each option. If the option is autodetected or
enabled by default, the `--disable-***` switch is printed; if the option is
disabled by default, the `--enable-***` switch is printed. Either way, you can
use `--enable-***` or `--disable-**` regardless of what is printed by `--help`.
To build the software you can use `./waf build`: the result of the compilation
will be located in `build/mpv`. You can use `./waf install` to install mpv
to the *prefix* after it is compiled.
Example:
./bootstrap.py
./waf configure
./waf
./waf install
Essential dependencies (incomplete list):
- gcc or clang
- X development headers (xlib, xrandr, xext, xscrnsaver, xpresent, libvdpau,
- X development headers (xlib, xrandr, xext, xscrnsaver, xinerama, libvdpau,
libGL, GLX, EGL, xv, ...)
- Audio output development headers (libasound/ALSA, pulseaudio)
- FFmpeg libraries (libavutil libavcodec libavformat libswscale libavfilter
and either libswresample or libavresample)
- libplacebo
- zlib
- iconv (normally provided by the system libc)
- libass (OSD, OSC, text subtitles)
@@ -124,15 +135,15 @@ Essential dependencies (incomplete list):
Libass dependencies (when building libass):
- gcc or clang, nasm on x86 and x86_64
- gcc or clang, yasm on x86 and x86_64
- fribidi, freetype, fontconfig development headers (for libass)
- harfbuzz (required for correct rendering of combining characters, particularly
for correct rendering of non-English text on macOS, and Arabic/Indic scripts on
for correct rendering of non-English text on OSX, and Arabic/Indic scripts on
any platform)
FFmpeg dependencies (when building FFmpeg):
- gcc or clang, nasm on x86 and x86_64
- gcc or clang, yasm on x86 and x86_64
- OpenSSL or GnuTLS (have to be explicitly enabled when compiling FFmpeg)
- libx264/libmp3lame/libfdk-aac if you want to use encoding (have to be
explicitly enabled when compiling FFmpeg)
@@ -148,17 +159,19 @@ you may wish to use the separately available build wrapper ([mpv-build][mpv-buil
which first compiles FFmpeg libraries and libass, and then compiles the player
statically linked against those.
If you want to build a Windows binary, see [Windows compilation][windows_compilation].
If you want to build a Windows binary, you either have to use MSYS2 and MinGW,
or cross-compile from Linux with MinGW. See
[Windows compilation][windows_compilation].
## Release cycle
Once or twice a year, a release is cut off from the current development state
and is assigned a 0.X.0 version number. No further maintenance is done, except
in the event of security issues.
Every other month, an arbitrary git snapshot is made, and is assigned
a 0.X.0 version number. No further maintenance is done.
The goal of releases is to make Linux distributions happy. Linux distributions
are also expected to apply their own patches in case of bugs.
are also expected to apply their own patches in case of bugs and security
issues.
Releases other than the latest release are unsupported and unmaintained.
@@ -171,8 +184,8 @@ Please use the [issue tracker][issue-tracker] provided by GitHub to send us bug
reports or feature requests. Follow the template's instructions or the issue
will likely be ignored or closed as invalid.
Questions can be asked in the [discussions][discussions] or on IRC (see
[Contact](#Contact) below).
Using the bug tracker as place for simple questions is fine but IRC is
recommended (see [Contact](#Contact) below).
## Contributing
@@ -189,7 +202,7 @@ for ideas on what you could contribute with.
## License
GPLv2 "or later" by default, LGPLv2.1 "or later" with `-Dgpl=false`.
GPLv2 "or later" by default, LGPLv2.1 "or later" with `--enable-lgpl`.
See [details.](https://github.com/mpv-player/mpv/blob/master/Copyright)
## History
@@ -201,10 +214,9 @@ see the [FAQ][FAQ].
## Contact
Most activity happens on the IRC channel and the GitHub issue tracker.
Most activity happens on the IRC channel and the github issue tracker.
- **GitHub issue tracker**: [issue tracker][issue-tracker] (report bugs here)
- **Discussions**: [discussions][discussions]
- **User IRC Channel**: `#mpv` on `irc.libera.chat`
- **Developer IRC Channel**: `#mpv-devel` on `irc.libera.chat`
@@ -212,11 +224,10 @@ Most activity happens on the IRC channel and the GitHub issue tracker.
[releases]: https://github.com/mpv-player/mpv/releases
[mpv-build]: https://github.com/mpv-player/mpv-build
[issue-tracker]: https://github.com/mpv-player/mpv/issues
[discussions]: https://github.com/mpv-player/mpv/discussions
[release-policy]: https://github.com/mpv-player/mpv/blob/master/DOCS/release-policy.md
[windows_compilation]: https://github.com/mpv-player/mpv/blob/master/DOCS/compile-windows.md
[interface-changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/interface-changes.rst
[api-changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/client-api-changes.rst
[restore-old-bindings]: https://github.com/mpv-player/mpv/blob/master/etc/restore-old-bindings.conf
[restore-osc-bindings]: https://github.com/mpv-player/mpv/blob/master/etc/restore-osc-bindings.conf
[contribute.md]: https://github.com/mpv-player/mpv/blob/master/DOCS/contribute.md
[build-system-differences]: https://github.com/mpv-player/mpv/blob/master/DOCS/build-system-differences.md
+175 -118
View File
@@ -1,139 +1,196 @@
Release 0.41.0
Release 0.35.1
==============
We are excited to announce the release of mpv 0.41.0.
Bug fix release for the 0.35 branch.
Key highlights:
Fixes and Minor Enhancements
----------------------------
* The libplacebo based `gpu-next` is now the default, over `gpu`
* Vulkan hardware decoding is preferred over other APIs
* New context_menu.lua script for right-click context menus
* AAudio backend for modern, HNI-free audio output on Android
* Improved default color management for gpu-next, and handling on Wayland
* Color representation protocol support for Wayland
* Tablet input support for Wayland
* Clipboard writing support for Wayland and a clipboard backend for X11
* Ambient light support on Linux (using sysfs ALS)
* Built-in helpers to register mpv as a media app on Windows
- ao_pipewire: log version and other useful debug info
- wayland: error out if essential protocol support is missing
- wayland: also log refresh rate on surface entrance
- vo_gpu_next: fix undefined behavior on alpha-first formats
- meson: prepend MPV_CONFDIR path with prefix
- meson: unbreak dl check on BSDs without libdl
- lcms: fix crash with lcms2-related options if lcms is disabled
- meson: fix stdatomic detection on bsd
- osc: don't spam window-controls bindings on every render
- wayland: check for resize/move in touch event first
- ao_coreaudio: use device's nominal sample rate for latency properties
- ao_pipewire: properly clean up resources
- filter_kernels: fix kaiser
- hwdec/d3d11va: fix a possible memory leak
- external_files: set log level for potential files to trace
- vo_opengl: do not blindly reject all Microsoft's OpenGL implementations
- ao_coreaudio: use AudioUnitReset as ao_driver.reset to prevent long restart
- hwdec_drmprime: fix memory leak
- vo: hwdec: fix libdrm-related memory leak
- draw_bmp: ensure last slice width is less than total width
- wayland: dispatch and wait for compositor events in uninit
- demux: boost read EBU R128 gain values to ReplayGain's reference level
- version.py/version.sh: bump copyright year
- vulkan: fix build error for 32bit builds with clang
- vo_wlshm: cleanup on failure
- ra_d3d11: fix incorrect type
- meson: also search for rst2html with .py extension
- audio: fix crash during uninit with ao_lavc
- mp_image: fix XYZ primaries default
- vd_lavc: add "auto" choice for vd-lavc-dr
- vo: implement VO_DR_FLAG_HOST_CACHED
- x11: fix issue with xpresent timing feedback
This release requires FFmpeg 6.1 or newer and libplacebo 6.338.2 or newer.
Release 0.35.0
==============
# Features
This release requires FFmpeg 4.0 or newer.
## New
For packagers: Note that mpv's build system is only supported on Python 3.
If you use the `bootstrap.py` script it will take care of this, otherwise you
need to explicitly invoke the build system using `python3 waf`.
- clipboard-wayland: support clipboard writing
- wayland: add support for wp-color-representation-v1
- wayland: tablet input support
- vo_gpu_next: add support for blend-subtitles=video
- meson: add mpv-register and mpv-unregister helpers on Windows
- context_menu.lua: add this script
- select.lua: add edit-config-file and edit-input-conf
- osc.lua: add indicator for buffering/loading
- osdep/linux-als: support 'ambient-light' property on Linux
- clipboard-x11: add x11 clipboard backend
- ao/aaudio: implement native AAudio backend for Android
## Changed
- vd_lavc: prefer Vulkan hwdec when available
- vd_lavc: prefer non-copy hwdec before falling back to -copy variant
- vo: move vo_mediacodec_embed to not be the default on Android
- sub/osd_libass: don't rerender OSD if not changed
- vo: prefer vo_gpu_next over vo_gpu by default
- vo_gpu_next: respect ICC profile color space over any metadata
- vo_gpu_next: linearize sRGB as a pure 2.2 power function
- meson: warn if building with SDL2 due to known problems
- osxbundle: make bundle category configurable and default to video
- ao_pipewire: avoid setting any media.role by default
This release adds the Meson build system as an alternative to waf.
It is supposed to be feature-complete but please report any issues you encounter.
# Options and Commands
Features
--------
## Added
Added
~~~~~
- sub: add control for libass caching options (glyph-limit, bitmap-max-size)
- vo: add options to control background tile appearance (transparency)
- command: add default and forced flags to the track add commands
- vo_gpu_next: add options to control subtitle peak for HDR output
- video/out/d3d11: add d3d11 composition mode support
- vd_lavc: add --hwdec-threads
- stream_bluray: add --bluray-angle
- vo_gpu_next: add options to control output colorspace metadata more precisely
- sub: make --sub-fix-timing configurable
- vo_gpu_next: add --hdr-reference-white
- audio/out: add --audio-set-media-role
## Changed
- options: revert --prefetch-playlist default back to 'no'
- vo_gpu_next: change --target-colorspace-hint to 'auto' by default
- options: handle runtime --wid change
- options: reduce swapchain-depth to 2 by default
- screenshot: add osd and scaled flags to screenshot commands
- vo_gpu_next: add new libplacebo-based renderer
- build: add meson build support
- vo_gpu_next: forward Dolby Vision metadata to libplacebo
- ao_pipewire: add PipeWire audio backend
- ao_sndio: readd this audio output again
- vo_gpu_next: apply film grain if such metadata is present
- drm: context_drm_egl: add support for enabling VRR
- demux: add support for R128 replaygain tags
- x11: support X Present extension
- af_rubberband: add support for new engine in rubberband 3.0.0
- hwdec/drmprime: add drmprime hwdec-interop (commonly found on SoCs)
- various: support binding functions keys beyond F12
- audio: support hotplug events for multiple AOs
- sub: use Unicode linebreaking for non-ASS subs and OSD
- vo_gpu: hwdec: add Android hwdec utilizing AImageReader
- vo_dmabuf_wayland: add wayland VO displaying dmabuf buffers (vaapi or drm hwdec only)
- lua/console: add history deduplication
# Fixes and Minor Enhancements
Changed
~~~~~~~
- vo_kitty: add auto-multiplexer-passthrough option
- vd_lavc: enable FFv1 hwaccel by default
- clipboard-wayland: prevent reading from hung up fd
- demux_mkv: fix compilation after deprecated definitions removal
- filters: handle flipping video if displaymatrix indicates so
- player/scripting: fix race condition when destroying clients
- {osd,msg}: use PU codepoints for escape codes instead of invalid UTF-8
- vo_dmabuf_wayland: only load needed hardware decoding drivers
- video/image_writer: tag accurate bit depth
- demux_lavf: fix unconstrained cache size with wrapped AVFrame packets
- libarchive: fix reading name of certain UTF-8 files
- sub/sd_lavc: fix decoding with libaribb24
- ao_avfoundation: fix memory leak
- osc.lua: fix volume icon not updating while paused
- context_wayland: implement target_csp for wayland
- vo_gpu: fix target colorspace for redrawn frames
- vo_dmabuf_wayland: don't set HDR metadata on SDR transfers
- vo_gpu_next: don't do partial updates on hint luminance
- sub/ass_mp: add missing padding for ass packer
- stream_dvb: allow to enforce DVB-S/T for old zap format channels.conf
- demux_libarchive: fix reading archives with '%' in stream URL path
- vo_gpu_next: allow UINT upload if no other format is supported
- ytdl_hook.lua: fix incorrect default format used with yt-dlp
- vo_gpu_next: allow unsetting LUTs
- stream_bluray: use bd_get_main_title() to get main title
- vo_gpu_next: when tone-mapping, set better maxCLL value
- stream_libarchive: seek source stream to 0 before probing
- path-unix: support ~~desktop path expansion
- ytdl_hook.lua: don't crash if playlist entries don't have an usable URL
- mac/vulkan: fix frame not displayed when paused
- mac/common: render first frame on init if possible
- video/out/w32_common: support --wid=0
- demux_mkv: map and expose hearing/visual impaired flags
- player/misc: show percentage progress for --stream-dump
- command: fix null dereference for invalid command in input-commands
- cplugin: fix missing init of pfn_mpv_get_time_ns
- vo_dmabuf_wayland: actually reuse OSD buffers
- mp_image: add support for AVAlphaMode
- vo_gpu_next: add --border-background=blur and --background-blur-radius
- demux/cue: fix crash when there are no tracks
- vf_format: add some basic HDR10 metadata
- vo/context_android: fix surface tearing on resize
- meson: remove redundant 'sdl2' option
- mac/common: fix window position on multi monitor setups
- vo_gpu_next: limit min_luma to 1000:1 contrast ratio in SDR mode
- ao_pipewire: fix some incorrect channel mappings
- wayland: correct geometry handling for rotated outputs
- demux: clear packet pool when upper memory limit is lowered
- mp_image: add ycgco-{re,ro} support
- wayland: convert luminance values to libplacebo space
- vo: trigger manual redraws at most at slightly over display fps
- osxbundle: add new macOS 26 compatible App icon
- wayland: support color-management-v1 version 2
- filters: re-add vavpp hardware deinterlacing auto-filter (for --deinterlace)
- swresample: don't forcibly clip audio on every conversion
- ytdl_hook: always set HTTP headers to fix yt-dlp on certain sites
Removed
~~~~~~~
- libmpv: remove opengl_cb API and other deprecated symbols
- lua: remove deprecated mp.suspend(), resume() and resume_all()
- build: raise minimum libplacebo version requirement to v4.157.0
Options and Commands
--------------------
Added
~~~~~
- vo_gpu_next: add --target-colorspace-hint to facilitate HDR passthrough
- vo_gpu_next: new tone mapping options 'auto', 'spline', 'bt.2446a'
and add --tone-mapping-crosstalk, --inverse-tone-mapping
- vo_gpu: add --gamut-mapping-mode and --tone-mapping-mode
- options: add 'always' choice to --stop-screensaver
- options: add --osd-playing-msg-duration
- player: add --cover-art-whitelist option
- x11: add --x11-present option
Changed
~~~~~~~
- ao_openal: enable --openal-direct-channels by default
- options: only apply --sub-visibility to primary subtitles
- options: make --cover-art-auto=exact the default
- vo_gpu/hwdec: rename and introduce legacy names for some interops
Deprecated
~~~~~~~~~~
- vo_gpu: deprecate --gamma-factor and --gamma-auto
Removed
~~~~~~~
- vo_gpu: remove --gamut-clipping, --gamut-warning, --tone-mapping-desaturate and
--tone-mapping-desaturate-exponent (replacements available)
- vulkan: remove --vulkan-disable-events
Fixes and Minor Enhancements
----------------------------
- context_drm_egl: use gbm_surface_create_with_modifiers
- context_drm_egl: add support for BGR surface formats
- vo_gpu: vulkan: open DRM render fd when using VK_KHR_display
- client API: use symbol visibility attributes
- vo_gpu: hwdec_vaapi: add dma-buf modifiers support
- wayland: fix various issues that could lead to jitter
- osc: fix cache displaying 60s in some cases
- player: make --keep-open=always work with --loop-playlist
- opengl: support driver debug message under OpenGL ES
- vo_gpu: opengl: fixes for OpenGL ES version and extension handling
- f_decoder_wrapper: support frame rotation metadata (used by JPEG)
- wscript: switch shaderc checks to pkgconfig
- vd_lavc: enable hwdec for prores by default
- vo_gpu: add HOOKED_gather for custom shaders
- wayland, x11: sanitize window title for valid UTF-8
- win32: apply geometry position to content instead of window
- filter_kernels: add cosine window
- vo_gpu: hwdec_vaapi: don't probe formats for irrelevant endpoints
- vo_gpu: hwdec: load hwdec interops on-demand by default
- stats.lua: graphs: fix bad rendering due to division by 0
- hwdec: warn on unsupported --hwdec option value
- x11: fix --screen-name option
- x11: avoid wasteful rendering when possible
- video/image_writer: add JPEG XL support
- stream_lavf: enable ipfs, ipns and rist protocol support
- osc.lua: fix crash when calling osc-tracklist while idle
- player: add jxl, tiff, tif to list of image extensions
- various: switch to new AVChannelLayout structure
- lua: command_native_async: always run callback asynchronously (edge case)
- context_x11egl: remove supposed transparency workaround
- vo_gpu: fix 3DLUT precision
- drm: avoid drmModeAtomicCommit races by blocking
- drm_common: skip cards that don't support KMS for autodetection
- hwdec/dmabuf_interop_gl: support basic multi-plane formats
- misc/random: switch to internal xoshiro rng implementation
- ytdl_hook: improve track detection
- ad_lavc: strip non-normalized floats
- mpv.metainfo.xml: add XDG appstream metadata manifest
- mac: avoid unnecessary unsafe conversions; fixes crash in debug builds
- af_scaletempo2: fix crash when the number of channels increases
- wayland: correctly handle non-CLOCK_MONOTONIC clocks
- x11: fix --on-all-workspaces option
- sd_ass: improve handling of subtitles with unknown duration
- hwdec/vaapi: improve probing of supported sw formats
- demux_mf: enable support for QOI, PHM and HDR images
- demux_mkv: add AVS2 and AVS3 to tag list
- TOOLS/lua/autoload: fix incorrect duplicate file loading behavior
- demux/codec_tags: support more WAVEFORMATEXTENSIBLE tags
- sd_ass: never mangle colours on RGB video
This listing is not complete. Check DOCS/client-api-changes.rst for a history
of changes to the client API, and DOCS/interface-changes.rst for a history
of changes to other user-visible interfaces.
A complete changelog can be seen by running `git log v0.40.0..v0.41.0`
in the git repository or by visiting
<https://github.com/mpv-player/mpv/compare/v0.40.0...v0.41.0>.
A complete changelog can be seen by running `git log v0.34.0..v0.35.1`
in the git repository or by visiting either
https://github.com/mpv-player/mpv/compare/v0.34.0...v0.35.1 or
https://git.srsfckn.biz/mpv/log/?qt=range&q=v0.34.0..v0.35.1
View File
Whitespace-only changes.
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/bash
set -e
export DEST_OS=win32
export CC=gcc
export PKG_CONFIG=/usr/bin/pkg-config
export PERL=/usr/bin/perl
export PYTHON=/usr/bin/python3
"$PYTHON" bootstrap.py
"$PYTHON" waf configure \
--check-c-compiler=gcc \
--enable-spirv-cross \
--enable-d3d-hwaccel \
--enable-d3d11 \
--enable-jpeg \
--enable-lcms2 \
--enable-libarchive \
--enable-lua \
--enable-rubberband \
--enable-shaderc \
--enable-uchardet \
--enable-vulkan
"$PYTHON" waf build
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/bash
set -e
export PYTHON=/usr/bin/python3
# Write an empty fonts.conf to speed up fc-cache
export FONTCONFIG_FILE=/dummy-fonts.conf
cat >"$FONTCONFIG_FILE" <<EOF
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig></fontconfig>
EOF
# Install build dependencies for mpv
pacman -S --noconfirm --needed \
$MINGW_PACKAGE_PREFIX-toolchain \
$MINGW_PACKAGE_PREFIX-cmake \
$MINGW_PACKAGE_PREFIX-lcms2 \
$MINGW_PACKAGE_PREFIX-libarchive \
$MINGW_PACKAGE_PREFIX-libass \
$MINGW_PACKAGE_PREFIX-libjpeg-turbo \
$MINGW_PACKAGE_PREFIX-libplacebo \
$MINGW_PACKAGE_PREFIX-lua51 \
$MINGW_PACKAGE_PREFIX-ninja \
$MINGW_PACKAGE_PREFIX-rubberband \
$MINGW_PACKAGE_PREFIX-shaderc \
$MINGW_PACKAGE_PREFIX-spirv-cross \
$MINGW_PACKAGE_PREFIX-uchardet \
$MINGW_PACKAGE_PREFIX-vulkan
# Delete unused packages to reduce space used in the Appveyor cache
pacman -Sc --noconfirm
# Compile ffmpeg
(
git clone --depth=1 https://github.com/FFmpeg/ffmpeg.git && cd ffmpeg
mkdir build && cd build
../configure \
--prefix=$MINGW_PREFIX \
--target-os=mingw32 \
--arch=$MSYSTEM_CARCH \
--disable-static \
--disable-doc \
--disable-asm \
--enable-gpl \
--enable-version3 \
--enable-shared \
--enable-pic \
--enable-d3d11va \
--enable-dxva2 \
--enable-schannel
make -j4 install
)
-67
View File
@@ -1,67 +0,0 @@
#!/usr/bin/env python3
"""
Wrapper around docutils rst2x commands,
converting their dependency files to a format understood by meson/ninja.
"""
#
# This file is part of mpv.
#
# mpv is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# mpv is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
import os
import subprocess
import sys
def convert_depfile(output, depfile):
with open(depfile) as f:
deps = f.readlines()
with open(depfile, "w") as f:
f.write(os.path.abspath(output))
f.write(": \\\n")
for dep in deps:
dep = dep[:-1]
f.write("\t")
f.write(os.path.abspath(dep))
f.write(" \\\n")
def remove(path):
try:
os.remove(path)
except FileNotFoundError:
pass
argv = sys.argv[1:]
depfile = None
output = argv[-1]
for opt, optarg in zip(argv, argv[1:]):
if opt == "--record-dependencies":
depfile = optarg
try:
proc = subprocess.run(argv, check=True)
if depfile is not None:
convert_depfile(output, depfile)
except Exception:
remove(output)
if depfile is not None:
remove(depfile)
sys.exit(1)
sys.exit(proc.returncode)
+130
View File
@@ -0,0 +1,130 @@
#!/usr/bin/env python3
import re
import os
import sys
import shutil
import subprocess
from functools import partial
sys_re = re.compile("^/System")
usr_re = re.compile("^/usr/lib/")
exe_re = re.compile("@executable_path")
def is_user_lib(objfile, libname):
return not sys_re.match(libname) and \
not usr_re.match(libname) and \
not exe_re.match(libname) and \
not "libobjc." in libname and \
not "libSystem." in libname and \
not "libc." in libname and \
not "libgcc." in libname and \
not os.path.basename(libname) == 'Python' and \
not os.path.basename(objfile) in libname and \
not "libswift" in libname
def otool(objfile):
command = "otool -L '%s' | grep -e '\t' | awk '{ print $1 }'" % objfile
output = subprocess.check_output(command, shell = True, universal_newlines=True)
return set(filter(partial(is_user_lib, objfile), output.split()))
def get_rpaths_dev_tools(binary):
command = "otool -l '%s' | grep -A2 LC_RPATH | grep path | grep \"Xcode\|CommandLineTools\"" % binary
result = subprocess.check_output(command, shell = True, universal_newlines=True)
pathRe = re.compile("^\s*path (.*) \(offset \d*\)$")
output = []
for line in result.splitlines():
output.append(pathRe.search(line).group(1).strip())
return output
def install_name_tool_change(old, new, objfile):
subprocess.call(["install_name_tool", "-change", old, new, objfile])
def install_name_tool_id(name, objfile):
subprocess.call(["install_name_tool", "-id", name, objfile])
def install_name_tool_add_rpath(rpath, binary):
subprocess.call(["install_name_tool", "-add_rpath", rpath, binary])
def install_name_tool_delete_rpath(rpath, binary):
subprocess.call(["install_name_tool", "-delete_rpath", rpath, binary])
def libraries(objfile, result = dict()):
libs_list = otool(objfile)
result[objfile] = libs_list
for lib in libs_list:
if lib not in result:
libraries(lib, result)
return result
def lib_path(binary):
return os.path.join(os.path.dirname(binary), 'lib')
def lib_name(lib):
return os.path.join("@executable_path", "lib", os.path.basename(lib))
def process_libraries(libs_dict, binary):
libs_set = set(libs_dict)
# Remove binary from libs_set to prevent a duplicate of the binary being
# added to the libs directory.
libs_set.remove(binary)
for src in libs_set:
name = lib_name(src)
dst = os.path.join(lib_path(binary), os.path.basename(src))
shutil.copy(src, dst)
os.chmod(dst, 0o755)
install_name_tool_id(name, dst)
if src in libs_dict[binary]:
install_name_tool_change(src, name, binary)
for p in libs_set:
if p in libs_dict[src]:
install_name_tool_change(p, lib_name(p), dst)
def process_swift_libraries(binary):
command = ['xcrun', '--find', 'swift-stdlib-tool']
swiftStdlibTool = subprocess.check_output(command, universal_newlines=True).strip()
# from xcode11 on the dynamic swift libs reside in a separate directory from
# the std one, might need versioned paths for future swift versions
swiftLibPath = os.path.join(swiftStdlibTool, '../../lib/swift-5.0/macosx')
swiftLibPath = os.path.abspath(swiftLibPath)
command = [swiftStdlibTool, '--copy', '--platform', 'macosx', '--scan-executable', binary, '--destination', lib_path(binary)]
if os.path.exists(swiftLibPath):
command.extend(['--source-libraries', swiftLibPath])
subprocess.check_output(command, universal_newlines=True)
print(">> setting additional rpath for swift libraries")
install_name_tool_add_rpath("@executable_path/lib", binary)
def remove_dev_tools_rapths(binary):
for path in get_rpaths_dev_tools(binary):
install_name_tool_delete_rpath(path, binary)
def main():
binary = os.path.abspath(sys.argv[1])
if not os.path.exists(lib_path(binary)):
os.makedirs(lib_path(binary))
print(">> gathering all linked libraries")
libs = libraries(binary)
print(">> copying and processing all linked libraries")
process_libraries(libs, binary)
print(">> removing rpath definitions towards dev tools")
remove_dev_tools_rapths(binary)
print(">> copying and processing swift libraries")
process_swift_libraries(binary)
if __name__ == "__main__":
main()
-313
View File
@@ -1,313 +0,0 @@
#!/usr/bin/env python3
import json
import os
import re
import shutil
import subprocess
import sys
from functools import partial
sys_re = re.compile("^/System")
usr_re = re.compile("^/usr/lib/")
exe_re = re.compile("@executable_path")
def is_user_lib(objfile, libname):
return not sys_re.match(libname) and \
not usr_re.match(libname) and \
not exe_re.match(libname) and \
"libobjc." not in libname and \
"libSystem." not in libname and \
"libc." not in libname and \
"libgcc." not in libname and \
os.path.basename(libname) != "Python" and \
os.path.basename(objfile) not in libname and \
"libswift" not in libname
def otool(objfile, rapths):
command = f"otool -L '{objfile}' | grep -e '\t' | awk '{{ print $1 }}'"
output = subprocess.check_output(command, shell=True, universal_newlines=True)
libs = set(filter(partial(is_user_lib, objfile), output.split()))
libs_resolved = set()
libs_relative = set()
for lib in libs:
lib_path = resolve_lib_path(objfile, lib, rapths)
libs_resolved.add(lib_path)
if lib_path != lib:
libs_relative.add(lib)
return libs_resolved, libs_relative
def get_rapths(objfile):
rpaths: list[str] = []
command = f"otool -l '{objfile}' | grep -A2 LC_RPATH | grep path"
path_re = re.compile(r"^\s*path (.*) \(offset \d*\)$")
try:
result = subprocess.check_output(command, shell=True, universal_newlines=True)
except Exception:
return rpaths
for line in result.splitlines():
match = path_re.search(line)
if match is None:
continue
line_clean = match.group(1).strip()
# resolve @loader_path
if line_clean.startswith("@loader_path/"):
line_clean = line_clean[len("@loader_path/"):]
line_clean = os.path.join(os.path.dirname(objfile), line_clean)
line_clean = os.path.normpath(line_clean)
rpaths.append(line_clean)
return rpaths
def get_rpaths_dev_tools(binary):
command = (
f"otool -l '{binary}' | grep -A2 LC_RPATH | grep path | "
'grep "Xcode\\|CommandLineTools"'
)
result = subprocess.check_output(command, shell = True, universal_newlines=True)
path_re = re.compile(r"^\s*path (.*) \(offset \d*\)$")
return [
match.group(1).strip()
for line in result.splitlines()
if (match := path_re.search(line)) is not None
]
def resolve_lib_path(objfile, lib, rapths):
if os.path.exists(lib):
return lib
if lib.startswith("@rpath/"):
lib = lib[len("@rpath/"):]
for rpath in rapths:
lib_path = os.path.join(rpath, lib)
if os.path.exists(lib_path):
return lib_path
elif lib.startswith("@loader_path/"):
lib = lib[len("@loader_path/"):]
lib_path = os.path.normpath(os.path.join(objfile, lib))
if os.path.exists(lib_path):
return lib_path
raise Exception("Could not resolve library: " + lib)
def check_vulkan_max_version(version):
try:
subprocess.check_output(
f"pkg-config vulkan --max-version={version}",
shell=True,
)
return True
except Exception:
return False
def get_homebrew_prefix():
# set default to standard ARM path, intel path is already in the vulkan
# loader search array
result = "/opt/homebrew"
try:
result = subprocess.check_output(
["brew", "--prefix"],
universal_newlines=True,
stderr=subprocess.DEVNULL,
).strip()
except Exception:
pass
return result
def install_name_tool_change(old, new, objfile):
subprocess.call(
["install_name_tool", "-change", old, new, objfile],
stderr=subprocess.DEVNULL,
)
def install_name_tool_id(name, objfile):
subprocess.call(
["install_name_tool", "-id", name, objfile],
stderr=subprocess.DEVNULL,
)
def install_name_tool_add_rpath(rpath, binary):
subprocess.call(["install_name_tool", "-add_rpath", rpath, binary])
def install_name_tool_delete_rpath(rpath, binary):
subprocess.call(["install_name_tool", "-delete_rpath", rpath, binary])
def libraries(objfile, result=None, result_relative=None, rapths=None):
if result is None:
result = {}
if result_relative is None:
result_relative = set()
if rapths is None:
rapths = []
rapths = get_rapths(objfile) + rapths
libs_list, libs_relative = otool(objfile, rapths)
result[objfile] = libs_list
result_relative |= libs_relative
for lib in libs_list:
if lib not in result:
libraries(lib, result, result_relative, rapths)
return result, result_relative
def lib_path(binary):
return os.path.join(os.path.dirname(binary), "lib")
def resources_path(binary):
return os.path.join(os.path.dirname(binary), "../Resources")
def lib_name(lib):
return os.path.join("@executable_path", "lib", os.path.basename(lib))
def process_libraries(libs_dict, libs_dyn, binary):
libs_set = set(libs_dict)
# Remove binary from libs_set to prevent a duplicate of the binary being
# added to the libs directory.
libs_set.remove(binary)
for src in libs_set:
name = lib_name(src)
dst = os.path.join(lib_path(binary), os.path.basename(src))
shutil.copy(src, dst)
os.chmod(dst, 0o755)
install_name_tool_id(name, dst)
if src in libs_dict[binary]:
install_name_tool_change(src, name, binary)
for p in libs_set:
if p in libs_dict[src]:
install_name_tool_change(p, lib_name(p), dst)
for lib in libs_dyn:
install_name_tool_change(lib, lib_name(lib), dst)
for lib in libs_dyn:
install_name_tool_change(lib, lib_name(lib), binary)
def process_swift_libraries(binary):
swift_stdlib_tool = subprocess.check_output(
["xcrun", "--find", "swift-stdlib-tool"],
universal_newlines=True,
).strip()
# from xcode11 on the dynamic swift libs reside in a separate directory from
# the std one, might need versioned paths for future swift versions
swift_lib_path = os.path.join(swift_stdlib_tool, "../../lib/swift-5.0/macosx")
swift_lib_path = os.path.abspath(swift_lib_path)
command = [
swift_stdlib_tool, "--copy", "--platform", "macosx",
"--scan-executable", binary, "--destination", lib_path(binary),
]
if os.path.exists(swift_lib_path):
command.extend(["--source-libraries", swift_lib_path])
subprocess.check_output(command, universal_newlines=True)
print(">> setting additional rpath for swift libraries")
install_name_tool_add_rpath("@executable_path/lib", binary)
def process_vulkan_loader(binary, loader_name, loader_relative_folder, library_node):
# https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderDriverInterface.md#example-macos-driver-search-path
# https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#macos-layer-discovery
loader_system_search_folders = [
os.path.join(os.path.expanduser("~"), ".config", loader_relative_folder),
os.path.join("/etc/xdg", loader_relative_folder),
os.path.join("/usr/local/etc", loader_relative_folder),
os.path.join("/etc", loader_relative_folder),
os.path.join(os.path.expanduser("~"), ".local/share", loader_relative_folder),
os.path.join("/usr/local/share", loader_relative_folder),
os.path.join("/usr/share/vulkan", loader_relative_folder),
os.path.join(get_homebrew_prefix(), "etc", loader_relative_folder),
os.path.join(get_homebrew_prefix(), "share", loader_relative_folder), # old location
]
loader_system_folder = ""
for loader_system_search_folder in loader_system_search_folders:
if os.path.exists(loader_system_search_folder):
loader_system_folder = loader_system_search_folder
break
if not loader_system_folder:
print(">>> could not find loader folder " + loader_relative_folder)
return
loader_bundle_folder = os.path.join(resources_path(binary), loader_relative_folder)
loader_system_path = os.path.join(loader_system_folder, loader_name)
loader_bundle_path = os.path.join(loader_bundle_folder, loader_name)
library_relative_folder = "../../../Frameworks/"
if not os.path.exists(loader_system_path):
print(">>> could not find loader " + loader_name)
return
if not os.path.exists(loader_bundle_folder):
os.makedirs(loader_bundle_folder)
loader_system_file = open(loader_system_path)
loader_json_data = json.load(loader_system_file)
library_path = loader_json_data[library_node]["library_path"]
library_system_path = os.path.join(loader_system_folder, library_path)
if not os.path.exists(library_system_path):
print(">>> could not find loader library " + library_system_path)
return
print(">>> modifying and writing loader json " + loader_name)
loader_bundle_file = open(loader_bundle_path, "w")
loader_library_name = os.path.basename(library_system_path)
library_path = os.path.join(library_relative_folder, loader_library_name)
loader_json_data[library_node]["library_path"] = library_path
json.dump(loader_json_data, loader_bundle_file, indent=4)
print(">>> copying loader library " + loader_library_name)
framework_bundle_folder = os.path.join(
loader_bundle_folder, library_relative_folder,
)
if not os.path.exists(framework_bundle_folder):
os.makedirs(framework_bundle_folder)
library_target_path = os.path.join(framework_bundle_folder, loader_library_name)
shutil.copy(library_system_path, library_target_path)
def remove_dev_tools_rapths(binary):
for path in get_rpaths_dev_tools(binary):
install_name_tool_delete_rpath(path, binary)
def process(binary):
binary = os.path.abspath(binary)
if not os.path.exists(lib_path(binary)):
os.makedirs(lib_path(binary))
print(">> gathering all linked libraries")
libs, libs_rel = libraries(binary)
print(">> copying and processing all linked libraries")
process_libraries(libs, libs_rel, binary)
print(">> removing rpath definitions towards dev tools")
remove_dev_tools_rapths(binary)
print(">> copying and processing swift libraries")
process_swift_libraries(binary)
print(">> copying and processing vulkan loader")
process_vulkan_loader(binary, "MoltenVK_icd.json", "vulkan/icd.d", "ICD")
if check_vulkan_max_version("1.3.261.1"):
process_vulkan_loader(
binary,
"VkLayer_khronos_synchronization2.json",
"vulkan/explicit_layer.d",
"layer",
)
if __name__ == "__main__":
process(sys.argv[1])
+12 -9
View File
@@ -22,24 +22,27 @@
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
import os
import sys
def file2string(infilename, infile, outfile):
outfile.write(f"// Generated from {infilename}\n\n")
outfile.write("// Generated from %s\n\n" % infilename)
conv = [f"\\{c:03o}" for c in range(256)]
conv = ["\\%03o" % c for c in range(256)]
safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" \
"0123456789!#%&'()*+,-./:;<=>[]^_{|}~ "
for c in safe_chars:
conv[ord(c)] = c
for c, esc in [("\n", "n"), ("\t", "t"), ("\\", "\\"), ('"', '"')]:
conv[ord(c)] = "\\" + esc
for c, esc in ("\nn", "\tt", r"\\", '""'):
conv[ord(c)] = '\\' + esc
for line in infile:
outfile.write('"' + "".join(conv[c] for c in line) + '"\n')
outfile.write('"' + ''.join(conv[c] for c in line) + '"\n')
if __name__ == "__main__":
with open(sys.argv[1], "rb") as infile, open(sys.argv[2], "w") as outfile:
file2string(os.path.relpath(sys.argv[1], sys.argv[3]), infile, outfile)
if len(sys.argv) < 2:
outfile = sys.stdout
else:
outfile = open(sys.argv[2], "w")
with open(sys.argv[1], 'rb') as infile:
file2string(sys.argv[1], infile, outfile)
-92
View File
@@ -1,92 +0,0 @@
#!/usr/bin/env python3
# Generate a new interface-changes.rst based on the entries in
# the interface-changes directory.
#
# This file is part of mpv.
#
# mpv is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# mpv is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
import pathlib
import sys
import textwrap
from shutil import which
from subprocess import check_output
def add_new_entries(docs_dir, out, git):
changes_dir = pathlib.Path(docs_dir) / "interface-changes"
files = []
for f in pathlib.Path(changes_dir).glob("*.txt"):
if f.is_file() and f.name != "example.txt":
timestamp = check_output([git, "log", "--format=%ct", "-n", "1", "--",
f], encoding="UTF-8")
if timestamp:
content = f.read_text()
files.append(content)
else:
print(f"Skipping file not tracked by git: {f.name}")
# Sort the changes by "severity", which roughly corresponds to
# alphabetical order by accident (e.g. remove > deprecate > change > add)
for file in reversed(sorted(files)):
for line in file.splitlines():
line = textwrap.fill(line.rstrip(), width=80,
initial_indent=" - ",
subsequent_indent=" ")
out.write(line + "\n")
if __name__ == "__main__":
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <version>")
sys.exit(1)
git = which("git")
if not git:
print("Unable to find git binary")
sys.exit(1)
# Accept passing only the major version number and the full 0 version.
major_version = None
if sys.argv[1].isdigit():
major_version = sys.argv[1]
else:
ver_split = sys.argv[1].split(".")
if len(ver_split) == 3 and ver_split[1].isdigit():
major_version = ver_split[1]
if not major_version:
print(f"Invalid version number: {sys.argv[1]}")
sys.exit(1)
docs_dir = pathlib.Path(sys.argv[0]).resolve().parents[1] / "DOCS"
interface_changes = docs_dir / "interface-changes.rst"
with open(interface_changes) as f:
lines = [line.rstrip() for line in f]
ver_line = " --- mpv 0." + major_version + ".0 ---"
next_ver_line = " --- mpv 0." + str(int(major_version) + 1) + ".0 ---"
found = False
with open(interface_changes, "w", newline="\n") as f:
for line in lines:
if line == ver_line:
f.write(next_ver_line + "\n")
f.write(line + "\n")
if line == ver_line:
add_new_entries(docs_dir, f, git)
found = True
if not found:
print(f"Nothing changed! The following line was not found:\n{ver_line}")
-50
View File
@@ -1,50 +0,0 @@
#!/usr/bin/env python3
# Modify X-KDE-Protocols in the mpv.desktop file based on output from
# mpv --list-protocols.
#
# This file is part of mpv.
#
# mpv is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# mpv is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
import sys
if __name__ == "__main__":
with open(sys.argv[1], encoding="UTF-8") as f:
next(f)
mpv_desktop = dict([line.split("=", 1) for line in f])
if not mpv_desktop["X-KDE-Protocols"]:
raise ValueError("Missing X-KDE-Protocols entry in mpv.desktop file")
with open(sys.argv[2], encoding="UTF-8") as mpv_protocols_f:
mpv_protocols = {
line.strip(" :/")
for line in mpv_protocols_f.read().splitlines()
if "://" in line
}
if len(mpv_protocols) == 0:
raise ValueError("Unable to parse any protocols from mpv '--list-protocols'")
protocol_list = set(mpv_desktop["X-KDE-Protocols"].strip().split(","))
compatible_protocols = sorted(mpv_protocols & protocol_list)
mpv_desktop["X-KDE-Protocols"] = ",".join(compatible_protocols) + "\n"
with open(sys.argv[3], "w", encoding="UTF-8") as f:
f.write("[Desktop Entry]" + "\n")
for key, value in mpv_desktop.items():
f.write(f"{key}={value}")
+1 -1
View File
@@ -22,7 +22,7 @@
testfun()
{
$ILDETECT_MPV "$@" \
--vf-add=lavfi="[idet]" --msg-level=ffmpeg=v \
--vf-add=lavfi="[idet]" --msg-level ffmpeg=v \
--o= --vo=null --no-audio --untimed \
$ILDETECT_MPVFLAGS \
| { if [ -n "$ILDETECT_QUIET" ]; then cat; else tee /dev/stderr; fi } \
+101 -104
View File
@@ -8,151 +8,148 @@ local mp = require 'mp'
local options = require 'mp.options'
local o = {
default_enable = false,
show_osd = true,
osd_timeout = 4000,
filter_label = mp.get_script_name(),
default_enable = false,
show_osd = true,
osd_timeout = 4000,
filter_label = mp.get_script_name(),
key_toggle = 'n',
key_increase_threshold = 'F1',
key_decrease_threshold = 'Shift+F1',
key_increase_ratio = 'F2',
key_decrease_ratio = 'Shift+F2',
key_increase_knee = 'F3',
key_decrease_knee = 'Shift+F3',
key_increase_makeup = 'F4',
key_decrease_makeup = 'Shift+F4',
key_increase_attack = 'F5',
key_decrease_attack = 'Shift+F5',
key_increase_release = 'F6',
key_decrease_release = 'Shift+F6',
key_toggle = 'n',
key_increase_threshold = 'F1',
key_decrease_threshold = 'Shift+F1',
key_increase_ratio = 'F2',
key_decrease_ratio = 'Shift+F2',
key_increase_knee = 'F3',
key_decrease_knee = 'Shift+F3',
key_increase_makeup = 'F4',
key_decrease_makeup = 'Shift+F4',
key_increase_attack = 'F5',
key_decrease_attack = 'Shift+F5',
key_increase_release = 'F6',
key_decrease_release = 'Shift+F6',
default_threshold = -25.0,
default_ratio = 3.0,
default_knee = 2.0,
default_makeup = 8.0,
default_attack = 20.0,
default_release = 250.0,
default_threshold = -25.0,
default_ratio = 3.0,
default_knee = 2.0,
default_makeup = 8.0,
default_attack = 20.0,
default_release = 250.0,
step_threshold = -2.5,
step_ratio = 1.0,
step_knee = 1.0,
step_makeup = 1.0,
step_attack = 10.0,
step_release = 10.0,
step_threshold = -2.5,
step_ratio = 1.0,
step_knee = 1.0,
step_makeup = 1.0,
step_attack = 10.0,
step_release = 10.0,
}
options.read_options(o)
local params = {
{ name = 'attack', min=0.01, max=2000, hide_default=true, dB='' },
{ name = 'release', min=0.01, max=9000, hide_default=true, dB='' },
{ name = 'threshold', min= -30, max= 0, hide_default=false, dB='dB' },
{ name = 'ratio', min= 1, max= 20, hide_default=false, dB='' },
{ name = 'knee', min= 1, max= 10, hide_default=true, dB='dB' },
{ name = 'makeup', min= 0, max= 24, hide_default=false, dB='dB' },
{ name = 'attack', min=0.01, max=2000, hide_default=true, dB='' },
{ name = 'release', min=0.01, max=9000, hide_default=true, dB='' },
{ name = 'threshold', min= -30, max= 0, hide_default=false, dB='dB' },
{ name = 'ratio', min= 1, max= 20, hide_default=false, dB='' },
{ name = 'knee', min= 1, max= 10, hide_default=true, dB='dB' },
{ name = 'makeup', min= 0, max= 24, hide_default=false, dB='dB' },
}
local function parse_value(value)
-- Using nil here because tonumber differs between lua 5.1 and 5.2 when
-- parsing fractions in combination with explicit base argument set to 10.
-- And we can't omit it because gsub returns 2 values which would get
-- unpacked and cause more problems. Gotta love scripting languages.
return tonumber(value:gsub('dB$', ''), nil)
-- Using nil here because tonumber differs between lua 5.1 and 5.2 when parsing fractions in combination with explicit base argument set to 10.
-- And we can't omit it because gsub returns 2 values which would get unpacked and cause more problems. Gotta love scripting languages.
return tonumber(value:gsub('dB$', ''), nil)
end
local function format_value(value, dB)
return string.format('%g%s', value, dB)
return string.format('%g%s', value, dB)
end
local function show_osd(filter)
if not o.show_osd then
return
end
if not o.show_osd then
return
end
if not filter.enabled then
mp.commandv('show-text', 'Dynamic range compressor: disabled', o.osd_timeout)
return
end
if not filter.enabled then
mp.commandv('show-text', 'Dynamic range compressor: disabled', o.osd_timeout)
return
end
local pretty = {}
for _,param in ipairs(params) do
local value = parse_value(filter.params[param.name])
if not (param.hide_default and value == o['default_' .. param.name]) then
pretty[#pretty+1] = string.format('%s: %g%s', param.name:gsub("^%l", string.upper),
value, param.dB)
end
end
local pretty = {}
for _,param in ipairs(params) do
local value = parse_value(filter.params[param.name])
if not (param.hide_default and value == o['default_' .. param.name]) then
pretty[#pretty+1] = string.format('%s: %g%s', param.name:gsub("^%l", string.upper), value, param.dB)
end
end
if #pretty == 0 then
pretty = ''
else
pretty = '\n(' .. table.concat(pretty, ', ') .. ')'
end
if #pretty == 0 then
pretty = ''
else
pretty = '\n(' .. table.concat(pretty, ', ') .. ')'
end
mp.commandv('show-text', 'Dynamic range compressor: enabled' .. pretty, o.osd_timeout)
mp.commandv('show-text', 'Dynamic range compressor: enabled' .. pretty, o.osd_timeout)
end
local function get_filter()
local af = mp.get_property_native('af', {})
local af = mp.get_property_native('af', {})
for i = 1, #af do
if af[i].label == o.filter_label then
return af, i
end
end
for i = 1, #af do
if af[i].label == o.filter_label then
return af, i
end
end
af[#af+1] = {
name = 'acompressor',
label = o.filter_label,
enabled = false,
params = {},
}
af[#af+1] = {
name = 'acompressor',
label = o.filter_label,
enabled = false,
params = {},
}
for _,param in pairs(params) do
af[#af].params[param.name] = format_value(o['default_' .. param.name], param.dB)
end
for _,param in pairs(params) do
af[#af].params[param.name] = format_value(o['default_' .. param.name], param.dB)
end
return af, #af
return af, #af
end
local function toggle_acompressor()
local af, i = get_filter()
af[i].enabled = not af[i].enabled
mp.set_property_native('af', af)
show_osd(af[i])
local af, i = get_filter()
af[i].enabled = not af[i].enabled
mp.set_property_native('af', af)
show_osd(af[i])
end
local function update_param(name, increment)
for _,param in pairs(params) do
if param.name == string.lower(name) then
local af, i = get_filter()
local value = parse_value(af[i].params[param.name])
value = math.max(param.min, math.min(value + increment, param.max))
af[i].params[param.name] = format_value(value, param.dB)
af[i].enabled = true
mp.set_property_native('af', af)
show_osd(af[i])
return
end
end
for _,param in pairs(params) do
if param.name == string.lower(name) then
local af, i = get_filter()
local value = parse_value(af[i].params[param.name])
value = math.max(param.min, math.min(value + increment, param.max))
af[i].params[param.name] = format_value(value, param.dB)
af[i].enabled = true
mp.set_property_native('af', af)
show_osd(af[i])
return
end
end
mp.msg.error('Unknown parameter "' .. name .. '"')
mp.msg.error('Unknown parameter "' .. name .. '"')
end
mp.add_key_binding(o.key_toggle, "toggle-acompressor", toggle_acompressor)
mp.register_script_message('update-param', update_param)
for _,param in pairs(params) do
for direction,step in pairs({increase=1, decrease=-1}) do
mp.add_key_binding(o['key_' .. direction .. '_' .. param.name],
'acompressor-' .. direction .. '-' .. param.name,
function() update_param(param.name, step*o['step_' .. param.name]); end,
{ repeatable = true })
end
for direction,step in pairs({increase=1, decrease=-1}) do
mp.add_key_binding(o['key_' .. direction .. '_' .. param.name],
'acompressor-' .. direction .. '-' .. param.name,
function() update_param(param.name, step*o['step_' .. param.name]); end,
{ repeatable = true })
end
end
if o.default_enable then
local af, i = get_filter()
af[i].enabled = true
mp.set_property_native('af', af)
local af, i = get_filter()
af[i].enabled = true
mp.set_property_native('af', af)
end
+2 -4
View File
@@ -3,14 +3,12 @@
-- particular for ao=wasapi, since the internal IMMNotificationClient code that
-- normally triggers ao-reload will not be running in this case.
local reloading
local function do_reload()
function do_reload()
mp.command("ao-reload")
reloading = nil
end
local function on_audio_device_list_change()
function on_audio_device_list_change()
if mp.get_property("current-ao") == "null" and not reloading then
mp.msg.verbose("audio-device-list changed: reloading audio")
-- avoid calling ao-reload too often
+4 -2
View File
@@ -1,6 +1,8 @@
mp.observe_property("audio-device-list", "native", function(_, val)
local utils = require("mp.utils")
mp.observe_property("audio-device-list", "native", function(name, val)
print("Audio device list changed:")
for _, e in ipairs(val) do
for index, e in ipairs(val) do
print(" - '" .. e.name .. "' (" .. e.description .. ")")
end
end)
+157 -123
View File
@@ -1,71 +1,105 @@
--[[
This script uses the lavfi cropdetect filter and the video-crop property to
automatically crop the currently playing video with appropriate parameters.
This script uses the lavfi cropdetect filter to automatically
insert a crop filter with appropriate parameters for the
currently playing video.
It automatically crops the video when playback starts.
It will automatically crop the video, when playback starts.
You can also manually crop the video by pressing the "C" (shift+c) key.
Pressing it again undoes the crop.
Also It registers the key-binding "C" (shift+c). You can manually
crop the video by pressing the "C" (shift+c) key.
The workflow is as follows: First, it inserts the cropdetect filter. After
<detect_seconds> (default is 1) seconds, it then sets video-crop based on the
vf-metadata values gathered by cropdetect. The cropdetect filter is removed
after video-crop is set as it is no longer needed.
If the "C" key is pressed again, the crop filter is removed
restoring playback to its original state.
Since the crop parameters are determined from the 1 second of video between
inserting the cropdetect filter and setting video-crop, the "C" key should be
pressed at a position in the video where the crop region is unambiguous (i.e.,
not a black frame, black background title card, or dark scene).
The workflow is as follows: First, it inserts the filter
vf=lavfi=cropdetect. After <detect_seconds> (default is 1)
seconds, it then inserts the filter vf=crop=w:h:x:y, where
w,h,x,y are determined from the vf-metadata gathered by
cropdetect. The cropdetect filter is removed immediately after
the crop filter is inserted as it is no longer needed.
If non-copy-back hardware decoding is in use, hwdec is temporarily disabled for
the duration of cropdetect as the filter would fail otherwise.
Since the crop parameters are determined from the 1 second of
video between inserting the cropdetect and crop filters, the "C"
key should be pressed at a position in the video where the crop
region is unambiguous (i.e., not a black frame, black background
title card, or dark scene).
These are the default options. They can be overridden by adding
script-opts-append=autocrop-<parameter>=<value> to mpv.conf.
The default options can be overridden by adding
script-opts-append=autocrop-<parameter>=<value> into mpv.conf
List of available parameters (For default values, see <options>):
auto: bool - Whether to automatically apply crop at the start of
playback. If you don't want to crop automatically, set it to
false or add "script-opts-append=autocrop-auto=no" into
mpv.conf.
auto_delay: seconds - Delay before starting crop in auto mode.
You can try to increase this value to avoid dark scene or
fade in at beginning. Automatic cropping will not occur if
the value is larger than the remaining playback time.
detect_limit: number[0-255] - Black threshold for cropdetect.
Smaller values will generally result in less cropping.
See limit of https://ffmpeg.org/ffmpeg-filters.html#cropdetect
detect_round: number[2^n] - The value which the width/height
should be divisible by. Smaller values ​​have better detection
accuracy. If you have problems with other filters,
you can try to set it to 4 or 16.
See round of https://ffmpeg.org/ffmpeg-filters.html#cropdetect
detect_min_ratio: number[0.0-1.0] - The ratio of the minimum clip
size to the original. If the picture is over cropped or under
cropped, try adjusting this value.
detect_seconds: seconds - How long to gather cropdetect data.
Increasing this may be desirable to allow cropdetect more
time to collect data.
suppress_osd: bool - Whether the OSD shouldn't be used when filters
are applied and removed.
--]]
require "mp.msg"
require 'mp.options'
local options = {
-- Whether to automatically apply crop at the start of playback. If you
-- don't want to crop automatically, add
-- script-opts-append=autocrop-auto=no to mpv.conf.
auto = true,
-- Delay before starting crop in auto mode. You can try to increase this
-- value to avoid dark scenes or fade ins at beginning. Automatic cropping
-- will not occur if the value is larger than the remaining playback time.
auto_delay = 4,
-- Black threshold for cropdetect. Smaller values will generally result in
-- less cropping. See limit of
-- https://ffmpeg.org/ffmpeg-filters.html#cropdetect
detect_limit = "24/255",
-- The value which the width/height should be divisible by. Smaller
-- values have better detection accuracy. If you have problems with
-- other filters, you can try to set it to 4 or 16. See round of
-- https://ffmpeg.org/ffmpeg-filters.html#cropdetect
detect_round = 2,
-- The ratio of the minimum clip size to the original. A number from 0 to
-- 1. If the picture is over cropped, try adjusting this value.
detect_min_ratio = 0.5,
-- How long to gather cropdetect data. Increasing this may be desirable to
-- allow cropdetect more time to collect data.
detect_seconds = 1,
-- Whether the OSD shouldn't be used when cropdetect and video-crop are
-- applied and removed.
suppress_osd = false,
}
read_options(options)
require "mp.options".read_options(options)
local label_prefix = mp.get_script_name()
local labels = {
crop = string.format("%s-crop", label_prefix),
cropdetect = string.format("%s-cropdetect", label_prefix)
}
local cropdetect_label = mp.get_script_name() .. "-cropdetect"
local timers = {
timers = {
auto_delay = nil,
detect_crop = nil
}
local hwdec_backup
local command_prefix = options.suppress_osd and 'no-osd' or ''
local function is_enough_time(seconds)
function is_filter_present(label)
local filters = mp.get_property_native("vf")
for index, filter in pairs(filters) do
if filter["label"] == label then
return true
end
end
return false
end
function is_enough_time(seconds)
-- Plus 1 second for deviation.
local time_needed = seconds + 1
local playtime_remaining = mp.get_property_native("playtime-remaining")
@@ -73,82 +107,81 @@ local function is_enough_time(seconds)
return playtime_remaining and time_needed < playtime_remaining
end
local function is_cropable(time_needed)
if mp.get_property_native('current-tracks/video/image') ~= false then
mp.msg.warn("autocrop only works for videos.")
return false
end
if not is_enough_time(time_needed) then
mp.msg.warn("Not enough time to detect crop.")
return false
end
return true
end
local function remove_cropdetect()
for _, filter in pairs(mp.get_property_native("vf")) do
if filter.label == cropdetect_label then
mp.command(
string.format("%s vf remove @%s", command_prefix, filter.label))
return
function is_cropable()
for _, track in pairs(mp.get_property_native('track-list')) do
if track.type == 'video' and track.selected then
return not track.albumart
end
end
return false
end
local function restore_hwdec()
if hwdec_backup then
mp.set_property("hwdec", hwdec_backup)
hwdec_backup = nil
function remove_filter(label)
if is_filter_present(label) then
mp.command(string.format('%s vf remove @%s', command_prefix, label))
return true
end
return false
end
local function cleanup()
remove_cropdetect()
function cleanup()
-- Remove all existing filters.
for key, value in pairs(labels) do
remove_filter(value)
end
-- Kill all timers.
for index, timer in pairs(timers) do
if timer then
timer:kill()
timers[index] = nil
timer = nil
end
end
restore_hwdec()
end
local function apply_crop(meta)
-- Verify if it is necessary to crop.
local is_effective = meta.w and meta.h and meta.x and meta.y and
(meta.x > 0 or meta.y > 0
or meta.w < meta.max_w or meta.h < meta.max_h)
function detect_crop()
-- Verify it is not over cropped.
local is_excessive = false
if is_effective and (meta.w < meta.min_w or meta.h < meta.min_h) then
mp.msg.info("The area to be cropped is too large.")
mp.msg.info("You might need to decrease detect_min_ratio.")
is_excessive = true
end
if not is_effective or is_excessive then
-- Clear any existing crop.
mp.command(string.format("%s set file-local-options/video-crop ''", command_prefix))
-- If it's not cropable, exit.
if not is_cropable() then
mp.msg.warn("autocrop only works for videos.")
return
end
-- Apply crop.
mp.command(string.format("%s set file-local-options/video-crop %sx%s+%s+%s",
command_prefix, meta.w, meta.h, meta.x, meta.y))
-- Verify if there is enough time to detect crop.
local time_needed = options.detect_seconds
if not is_enough_time(time_needed) then
mp.msg.warn("Not enough time to detect crop.")
return
end
-- Insert the cropdetect filter.
local limit = options.detect_limit
local round = options.detect_round
mp.command(
string.format(
'%s vf pre @%s:cropdetect=limit=%s:round=%d:reset=0',
command_prefix, labels.cropdetect, limit, round
)
)
-- Wait to gather data.
timers.detect_crop = mp.add_timeout(time_needed, detect_end)
end
local function detect_end()
function detect_end()
-- Get the metadata and remove the cropdetect filter.
local cropdetect_metadata = mp.get_property_native(
"vf-metadata/" .. cropdetect_label)
remove_cropdetect()
local cropdetect_metadata =
mp.get_property_native(
string.format("vf-metadata/%s",
labels.cropdetect
)
)
remove_filter(labels.cropdetect)
-- Remove the timer of detect crop.
if timers.detect_crop then
@@ -156,9 +189,7 @@ local function detect_end()
timers.detect_crop = nil
end
restore_hwdec()
local meta
local meta = {}
-- Verify the existence of metadata.
if cropdetect_metadata then
@@ -171,7 +202,7 @@ local function detect_end()
else
mp.msg.error("No crop data.")
mp.msg.info("Was the cropdetect filter successfully inserted?")
mp.msg.info("Does your version of FFmpeg support AVFrame metadata?")
mp.msg.info("Does your version of ffmpeg/libav support AVFrame metadata?")
return
end
@@ -193,41 +224,44 @@ local function detect_end()
else
mp.msg.error("Got empty crop data.")
mp.msg.info("You might need to increase detect_seconds.")
return
end
apply_crop(meta)
end
local function detect_crop()
local time_needed = options.detect_seconds
function apply_crop(meta)
if not is_cropable(time_needed) then
-- Verify if it is necessary to crop.
local is_effective = meta.x > 0 or meta.y > 0
or meta.w < meta.max_w or meta.h < meta.max_h
if not is_effective then
mp.msg.info("No area detected for cropping.")
return
end
local hwdec_current = mp.get_property("hwdec-current", "no")
if hwdec_current:find("-copy$") == nil and hwdec_current ~= "no" and
hwdec_current ~= "crystalhd" and hwdec_current ~= "rkmpp" then
hwdec_backup = mp.get_property("hwdec")
mp.set_property("hwdec", "no")
-- Verify it is not over cropped.
local is_excessive = meta.w < meta.min_w and meta.h < meta.min_h
if is_excessive then
mp.msg.info("The area to be cropped is too large.")
mp.msg.info("You might need to decrease detect_min_ratio.")
return
end
-- Insert the cropdetect filter.
local limit = options.detect_limit
local round = options.detect_round
-- Remove existing crop.
remove_filter(labels.crop)
-- Apply crop.
mp.command(
string.format(
'%s vf pre @%s:cropdetect=limit=%s:round=%d:reset=0',
command_prefix, cropdetect_label, limit, round
string.format("%s vf pre @%s:lavfi-crop=w=%s:h=%s:x=%s:y=%s",
command_prefix, labels.crop, meta.w, meta.h, meta.x, meta.y
)
)
-- Wait to gather data.
timers.detect_crop = mp.add_timeout(time_needed, detect_end)
end
local function on_start()
function on_start()
-- Clean up at the beginning.
cleanup()
@@ -248,7 +282,8 @@ local function on_start()
-- Verify if there is enough time for autocrop.
local time_needed = options.auto_delay + options.detect_seconds
if not is_cropable(time_needed) then
if not is_enough_time(time_needed) then
mp.msg.warn("Not enough time for autocrop.")
return
end
@@ -266,7 +301,7 @@ local function on_start()
end
end
local function on_toggle()
function on_toggle()
-- If it is during auto_delay, kill the timer.
if timers.auto_delay then
@@ -275,8 +310,7 @@ local function on_toggle()
end
-- Cropped => Remove it.
if mp.get_property("video-crop") ~= "" then
mp.command(string.format("%s set file-local-options/video-crop ''", command_prefix))
if remove_filter(labels.crop) then
return
end
@@ -286,7 +320,7 @@ local function on_toggle()
return
end
-- Neither => Detect crop.
-- Neither => Do delectcrop.
detect_crop()
end
+38 -39
View File
@@ -8,7 +8,7 @@
-- telecined and the interlacing field dominance.
--
-- Based on this information, it may set mpv's ``deinterlace`` property (which
-- usually inserts the bwdif filter), or insert the ``pullup`` filter if the
-- usually inserts the yadif filter), or insert the ``pullup`` filter if the
-- content is telecined. It also sets field dominance with lavfi setfield.
--
-- OPTIONS:
@@ -26,21 +26,19 @@
require "mp.msg"
local script_name = mp.get_script_name()
local detect_label = string.format("%s-detect", script_name)
local pullup_label = string.format("%s", script_name)
local dominance_label = string.format("%s-dominance", script_name)
local ivtc_detect_label = string.format("%s-ivtc-detect", script_name)
local timer
local progressive, interlaced_tff, interlaced_bff, interlaced = 0, 1, 2, 3
script_name = mp.get_script_name()
detect_label = string.format("%s-detect", script_name)
pullup_label = string.format("%s", script_name)
dominance_label = string.format("%s-dominance", script_name)
ivtc_detect_label = string.format("%s-ivtc-detect", script_name)
-- number of seconds to gather cropdetect data
local detect_seconds = tonumber(mp.get_opt(string.format("%s.detect_seconds", script_name)))
detect_seconds = tonumber(mp.get_opt(string.format("%s.detect_seconds", script_name)))
if not detect_seconds then
detect_seconds = 4
end
local function del_filter_if_present(label)
function del_filter_if_present(label)
-- necessary because mp.command('vf del @label:filter') raises an
-- error if the filter doesn't exist
local vfs = mp.get_property_native("vf")
@@ -59,13 +57,39 @@ local function add_vf(label, filter)
return mp.command(('vf add @%s:%s'):format(label, filter))
end
local function stop_detect()
function start_detect()
-- exit if detection is already in progress
if timer then
mp.msg.warn("already detecting!")
return
end
mp.set_property("deinterlace","no")
del_filter_if_present(pullup_label)
del_filter_if_present(dominance_label)
-- insert the detection filters
if not (add_vf(detect_label, 'idet') and
add_vf(dominance_label, 'setfield=mode=auto') and
add_vf(pullup_label, 'lavfi-pullup') and
add_vf(ivtc_detect_label, 'idet')) then
mp.msg.error("failed to insert detection filters")
return
end
-- wait to gather data
timer = mp.add_timeout(detect_seconds, select_filter)
end
function stop_detect()
del_filter_if_present(detect_label)
del_filter_if_present(ivtc_detect_label)
timer = nil
end
local function judge(label)
progressive, interlaced_tff, interlaced_bff, interlaced = 0, 1, 2, 3, 4
function judge(label)
-- get the metadata
local result = mp.get_property_native(string.format("vf-metadata/%s", label))
local num_tff = tonumber(result["lavfi.idet.multiple.tff"])
@@ -94,7 +118,7 @@ local function judge(label)
end
end
local function select_filter()
function select_filter()
-- handle the first detection filter results
local verdict = judge(detect_label)
local ivtc_verdict = judge(ivtc_detect_label)
@@ -122,36 +146,11 @@ local function select_filter()
mp.msg.info(string.format("telecined with %s field dominance: using pullup", dominance))
stop_detect()
else
mp.msg.info("interlaced with " .. dominance ..
" field dominance: setting deinterlace property")
mp.msg.info(string.format("interlaced with %s field dominance: setting deinterlace property", dominance))
del_filter_if_present(pullup_label)
mp.set_property("deinterlace","yes")
stop_detect()
end
end
local function start_detect()
-- exit if detection is already in progress
if timer then
mp.msg.warn("already detecting!")
return
end
mp.set_property("deinterlace","no")
del_filter_if_present(pullup_label)
del_filter_if_present(dominance_label)
-- insert the detection filters
if not (add_vf(detect_label, 'idet') and
add_vf(dominance_label, 'setfield=mode=auto') and
add_vf(pullup_label, 'lavfi-pullup') and
add_vf(ivtc_detect_label, 'idet')) then
mp.msg.error("failed to insert detection filters")
return
end
-- wait to gather data
timer = mp.add_timeout(detect_seconds, select_filter)
end
mp.add_key_binding("ctrl+d", script_name, start_detect)
+124 -310
View File
@@ -1,5 +1,5 @@
-- This script automatically loads playlist entries before and after the
-- currently played file. It does so by scanning the directory a file is
-- the currently played file. It does so by scanning the directory a file is
-- located in when starting playback. It sorts the directory entries
-- alphabetically, and adds entries before and after the current file to
-- the internal playlist. (It stops if it would add an already existing
@@ -10,330 +10,153 @@
To configure this script use file autoload.conf in directory script-opts (the "script-opts"
directory must be in the mpv configuration directory, typically ~/.config/mpv/).
Option `ignore_patterns` is a comma-separated list of patterns (see lua.org/pil/20.2.html).
Additionally to the standard lua patterns, you can also escape commas with `%`,
for example, the option `bak%,x%,,another` will be resolved as patterns `bak,x,` and `another`.
But it does not mean you need to escape all lua patterns twice,
so the option `bak%%,%.mp4,` will be resolved as two patterns `bak%%` and `%.mp4`.
Example configuration would be:
disabled=no
images=no
videos=yes
audio=yes
additional_image_exts=list,of,ext
additional_video_exts=list,of,ext
additional_audio_exts=list,of,ext
ignore_hidden=yes
same_type=yes
directory_mode=recursive
ignore_patterns=^~,^bak-,%.bak$
--]]
local MAX_ENTRIES = 5000
local MAX_DIR_STACK = 20
MAXENTRIES = 5000
local msg = require 'mp.msg'
local options = require 'mp.options'
local utils = require 'mp.utils'
local o = {
o = {
disabled = false,
images = true,
videos = true,
audio = true,
additional_image_exts = "",
additional_video_exts = "",
additional_audio_exts = "",
ignore_hidden = true,
same_type = false,
directory_mode = "auto",
ignore_patterns = ""
ignore_hidden = true
}
options.read_options(o)
local function Set(t)
function Set (t)
local set = {}
for _, v in pairs(t) do set[v] = true end
return set
end
local EXTENSIONS_VIDEO_DEFAULT = Set {
function SetUnion (a,b)
local res = {}
for k in pairs(a) do res[k] = true end
for k in pairs(b) do res[k] = true end
return res
end
EXTENSIONS_VIDEO = Set {
'3g2', '3gp', 'avi', 'flv', 'm2ts', 'm4v', 'mj2', 'mkv', 'mov',
'mp4', 'mpeg', 'mpg', 'ogv', 'rmvb', 'webm', 'wmv', 'y4m'
}
local EXTENSIONS_AUDIO_DEFAULT = Set {
EXTENSIONS_AUDIO = Set {
'aiff', 'ape', 'au', 'flac', 'm4a', 'mka', 'mp3', 'oga', 'ogg',
'ogm', 'opus', 'wav', 'wma'
}
local EXTENSIONS_IMAGES_DEFAULT = Set {
EXTENSIONS_IMAGES = Set {
'avif', 'bmp', 'gif', 'j2k', 'jp2', 'jpeg', 'jpg', 'jxl', 'png',
'svg', 'tga', 'tif', 'tiff', 'webp'
}
local EXTENSIONS, EXTENSIONS_VIDEO, EXTENSIONS_AUDIO, EXTENSIONS_IMAGES
EXTENSIONS = Set {}
if o.videos then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_VIDEO) end
if o.audio then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_AUDIO) end
if o.images then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_IMAGES) end
local function SetUnion(a, b)
for k in pairs(b) do a[k] = true end
return a
end
-- Returns first and last positions in string or past-to-end indices
local function FindOrPastTheEnd(string, pattern, start_at)
local pos1, pos2 = string:find(pattern, start_at)
return pos1 or #string + 1,
pos2 or #string + 1
end
local function Split(list)
local set = {}
local item_pos = 1
local item = ""
while item_pos <= #list do
local pos1, pos2 = FindOrPastTheEnd(list, "%%*,", item_pos)
local pattern_length = pos2 - pos1
local is_comma_escaped = pattern_length % 2
local pos_before_escape = pos1 - 1
local item_escape_count = pattern_length - is_comma_escaped
item = item .. string.sub(list, item_pos, pos_before_escape + item_escape_count)
if is_comma_escaped == 1 then
item = item .. ","
else
set[item] = true
item = ""
end
item_pos = pos2 + 1
end
set[item] = true
-- exclude empty items
set[""] = nil
return set
end
local function split_option_exts(video, audio, image)
if video then o.additional_video_exts = Split(o.additional_video_exts) end
if audio then o.additional_audio_exts = Split(o.additional_audio_exts) end
if image then o.additional_image_exts = Split(o.additional_image_exts) end
end
local function split_patterns()
o.ignore_patterns = Split(o.ignore_patterns)
end
local function create_extensions()
EXTENSIONS = {}
EXTENSIONS_VIDEO = {}
EXTENSIONS_AUDIO = {}
EXTENSIONS_IMAGES = {}
if o.videos then
SetUnion(SetUnion(EXTENSIONS_VIDEO, EXTENSIONS_VIDEO_DEFAULT), o.additional_video_exts)
SetUnion(EXTENSIONS, EXTENSIONS_VIDEO)
end
if o.audio then
SetUnion(SetUnion(EXTENSIONS_AUDIO, EXTENSIONS_AUDIO_DEFAULT), o.additional_audio_exts)
SetUnion(EXTENSIONS, EXTENSIONS_AUDIO)
end
if o.images then
SetUnion(SetUnion(EXTENSIONS_IMAGES, EXTENSIONS_IMAGES_DEFAULT), o.additional_image_exts)
SetUnion(EXTENSIONS, EXTENSIONS_IMAGES)
end
end
local function validate_directory_mode()
if o.directory_mode ~= "recursive" and o.directory_mode ~= "lazy"
and o.directory_mode ~= "ignore" then
o.directory_mode = nil
end
end
options.read_options(o, nil, function(list)
split_option_exts(list.additional_video_exts, list.additional_audio_exts,
list.additional_image_exts)
if list.videos or list.additional_video_exts or
list.audio or list.additional_audio_exts or
list.images or list.additional_image_exts then
create_extensions()
end
if list.directory_mode then
validate_directory_mode()
end
if list.ignore_patterns then
split_patterns()
end
end)
split_option_exts(true, true, true)
split_patterns()
create_extensions()
validate_directory_mode()
local function add_files(files)
function add_files_at(index, files)
index = index - 1
local oldcount = mp.get_property_number("playlist-count", 1)
for i = 1, #files do
mp.commandv("loadfile", files[i][1], "append")
mp.commandv("playlist-move", oldcount + i - 1, files[i][2])
mp.commandv("loadfile", files[i], "append")
mp.commandv("playlist-move", oldcount + i - 1, index + i - 1)
end
end
local function get_extension(path)
return path:match("%.([^%.]+)$") or "nomatch"
end
local function is_ignored(file)
for pattern in pairs(o.ignore_patterns) do
if file:match(pattern) then
return true
end
end
return false
end
-- alphanum sorting for humans in Lua
-- http://notebook.kulchenko.com/algorithms/alphanumeric-natural-sorting-for-humans-in-lua
local function alphanumsort(filenames)
local function padnum(n, d)
return #d > 0 and ("%03d%s%.12f"):format(#n, n, tonumber(d) / (10 ^ #d))
or ("%03d%s"):format(#n, n)
end
local tuples = {}
for i, f in ipairs(filenames) do
tuples[i] = {f:lower():gsub("0*(%d+)%.?(%d*)", padnum), f}
end
table.sort(tuples, function(a, b)
return a[1] == b[1] and #b[2] < #a[2] or a[1] < b[1]
end)
for i, tuple in ipairs(tuples) do filenames[i] = tuple[2] end
return filenames
end
local autoloaded
local added_entries = {}
local autoloaded_dir
local function scan_dir(path, current_file, dir_mode, separator, dir_depth, total_files, extensions)
if dir_depth == MAX_DIR_STACK then
return
end
msg.trace("scanning: " .. path)
local files = utils.readdir(path, "files") or {}
local dirs = dir_mode ~= "ignore" and utils.readdir(path, "dirs") or {}
local prefix = path == "." and "" or path
local function filter(t, iter)
for i = #t, 1, -1 do
if not iter(t[i]) then
table.remove(t, i)
end
end
end
filter(files, function(v)
-- Always accept current file
local current = prefix .. v == current_file
if current then
return true
end
if o.ignore_hidden and v:match("^%.") then
return false
end
if is_ignored(v) then
return false
end
local ext = get_extension(v)
return ext and extensions[ext:lower()]
end)
filter(dirs, function(d)
return not (o.ignore_hidden and d:match("^%."))
end)
alphanumsort(files)
alphanumsort(dirs)
for i, file in ipairs(files) do
files[i] = prefix .. file
end
local function append(t1, t2)
local t1_size = #t1
for i = 1, #t2 do
t1[t1_size + i] = t2[i]
end
end
append(total_files, files)
if dir_mode == "recursive" then
for _, dir in ipairs(dirs) do
scan_dir(prefix .. dir .. separator, current_file, dir_mode,
separator, dir_depth + 1, total_files, extensions)
end
function get_extension(path)
match = string.match(path, "%.([^%.]+)$" )
if match == nil then
return "nomatch"
else
for i, dir in ipairs(dirs) do
dirs[i] = prefix .. dir
end
append(total_files, dirs)
return match
end
end
local function find_and_add_entries()
local aborted = mp.get_property_native("playback-abort")
if aborted then
msg.debug("stopping: playback aborted")
return
table.filter = function(t, iter)
for i = #t, 1, -1 do
if not iter(t[i]) then
table.remove(t, i)
end
end
end
-- splitbynum and alnumcomp from alphanum.lua (C) Andre Bogus
-- Released under the MIT License
-- http://www.davekoelle.com/files/alphanum.lua
-- split a string into a table of number and string values
function splitbynum(s)
local result = {}
for x, y in (s or ""):gmatch("(%d*)(%D*)") do
if x ~= "" then table.insert(result, tonumber(x)) end
if y ~= "" then table.insert(result, y) end
end
return result
end
function clean_key(k)
k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower()
return splitbynum(k)
end
-- compare two strings
function alnumcomp(x, y)
local xt, yt = clean_key(x), clean_key(y)
for i = 1, math.min(#xt, #yt) do
local xe, ye = xt[i], yt[i]
if type(xe) == "string" then ye = tostring(ye)
elseif type(ye) == "string" then xe = tostring(xe) end
if xe ~= ye then return xe < ye end
end
return #xt < #yt
end
local autoloaded = nil
function get_playlist_filenames()
local filenames = {}
for n = 0, pl_count - 1, 1 do
local filename = mp.get_property('playlist/'..n..'/filename')
local _, file = utils.split_path(filename)
filenames[file] = true
end
return filenames
end
function find_and_add_entries()
local path = mp.get_property("path", "")
local dir, filename = utils.split_path(path)
msg.trace(("dir: %s, filename: %s"):format(dir, filename))
if o.disabled then
msg.debug("stopping: autoload disabled")
msg.verbose("stopping: autoload disabled")
return
elseif #dir == 0 then
msg.debug("stopping: not a local path")
msg.verbose("stopping: not a local path")
return
end
local pl_count = mp.get_property_number("playlist-count", 1)
local this_ext = get_extension(filename)
pl_count = mp.get_property_number("playlist-count", 1)
-- check if this is a manually made playlist
if pl_count > 1 and autoloaded == nil then
msg.debug("stopping: manually made playlist")
if (pl_count > 1 and autoloaded == nil) or
(pl_count == 1 and EXTENSIONS[string.lower(get_extension(filename))] == nil) then
msg.verbose("stopping: manually made playlist")
return
elseif pl_count == 1 then
autoloaded = true
autoloaded_dir = dir
added_entries = {}
end
local extensions
if o.same_type then
if EXTENSIONS_VIDEO[this_ext:lower()] then
extensions = EXTENSIONS_VIDEO
elseif EXTENSIONS_AUDIO[this_ext:lower()] then
extensions = EXTENSIONS_AUDIO
elseif EXTENSIONS_IMAGES[this_ext:lower()] then
extensions = EXTENSIONS_IMAGES
end
else
extensions = EXTENSIONS
end
if not extensions then
msg.debug("stopping: no matched extensions list")
return
autoloaded = true
end
local pl = mp.get_property_native("playlist", {})
@@ -341,78 +164,69 @@ local function find_and_add_entries()
msg.trace(("playlist-pos-1: %s, playlist: %s"):format(pl_current,
utils.to_string(pl)))
local files = {}
scan_dir(autoloaded_dir, path,
o.directory_mode or mp.get_property("directory-mode", "lazy"),
mp.get_property_native("platform") == "windows" and "\\" or "/",
0, files, extensions)
if next(files) == nil then
msg.debug("no other files or directories in directory")
local files = utils.readdir(dir, "files")
if files == nil then
msg.verbose("no other files in directory")
return
end
table.filter(files, function (v, k)
-- The current file could be a hidden file, ignoring it doesn't load other
-- files from the current directory.
if (o.ignore_hidden and not (v == filename) and string.match(v, "^%.")) then
return false
end
local ext = get_extension(v)
if ext == nil then
return false
end
return EXTENSIONS[string.lower(ext)]
end)
table.sort(files, alnumcomp)
if dir == "." then
dir = ""
end
-- Find the current pl entry (dir+"/"+filename) in the sorted dir list
local current
for i = 1, #files do
if files[i] == path then
if files[i] == filename then
current = i
break
end
end
if not current then
msg.debug("current file not found in directory")
if current == nil then
return
end
msg.trace("current file position in files: "..current)
-- treat already existing playlist entries, independent of how they got added
-- as if they got added by autoload
for _, entry in ipairs(pl) do
added_entries[entry.filename] = true
end
-- stop initial file from being added twice
added_entries[path] = true
local append = {[-1] = {}, [1] = {}}
local filenames = get_playlist_filenames()
for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
for i = 1, MAX_ENTRIES do
local pos = current + i * direction
local file = files[pos]
for i = 1, MAXENTRIES do
local file = files[current + i * direction]
if file == nil or file[1] == "." then
break
end
-- skip files that are/were already in the playlist
if not added_entries[file] then
if direction == -1 then
msg.verbose("Prepending " .. file)
table.insert(append[-1], 1, {file, pl_current + i * direction + 1})
else
msg.verbose("Adding " .. file)
if pl_count > 1 then
table.insert(append[1], {file, pl_current + i * direction - 1})
else
mp.commandv("loadfile", file, "append")
end
local filepath = dir .. file
-- skip files already in playlist
if filenames[file] then break end
if direction == -1 then
if pl_current == 1 then -- never add additional entries in the middle
msg.info("Prepending " .. file)
table.insert(append[-1], 1, filepath)
end
added_entries[file] = true
else
msg.info("Adding " .. file)
table.insert(append[1], filepath)
end
end
if pl_count == 1 and direction == -1 and #append[-1] > 0 then
local load = append[-1]
for i = 1, #load do
mp.commandv("loadfile", load[i][1], "append")
end
mp.commandv("playlist-move", 0, current)
end
end
if pl_count > 1 then
add_files(append[1])
add_files(append[-1])
end
add_files_at(pl_current + 1, append[1])
add_files_at(pl_current, append[-1])
end
mp.register_event("start-file", find_and_add_entries)
+11 -16
View File
@@ -2,7 +2,7 @@
local utils = require("mp.utils")
local function join(sep, arr, count)
function join(sep, arr, count)
local r = ""
if count == nil then
count = #arr
@@ -31,19 +31,19 @@ mp.observe_property("vo-configured", "bool", function(_, v)
mp.set_property("screenshot-format", "png")
mp.set_property("screenshot-png-compression", "9")
local timer = mp.add_periodic_timer(0.1, function() print("I'm alive") end)
timer = mp.add_periodic_timer(0.1, function() print("I'm alive") end)
timer:resume()
print("Slow screenshot command...")
local result = mp.command_native({"screenshot"})
print("done, res: " .. utils.to_string(result))
res, err = mp.command_native({"screenshot"})
print("done, res: " .. utils.to_string(res))
print("Slow screenshot async command...")
result = mp.command_native_async({"screenshot"}, function(res)
res, err = mp.command_native_async({"screenshot"}, function(res)
print("done (async), res: " .. utils.to_string(res))
timer:kill()
end)
print("done (sending), res: " .. utils.to_string(result))
print("done (sending), res: " .. utils.to_string(res))
print("Broken screenshot async command...")
mp.command_native_async({"screenshot-to-file", "/nonexistent/bogus.png"},
@@ -51,11 +51,7 @@ mp.observe_property("vo-configured", "bool", function(_, v)
print("done err scr.: " .. join(" ", {res, val, err}))
end)
mp.command_native_async({
name = "subprocess",
args = {"sh", "-c", "echo hi && sleep 10s"},
capture_stdout = true
},
mp.command_native_async({name = "subprocess", args = {"sh", "-c", "echo hi && sleep 10s"}, capture_stdout = true},
function(res, val, err)
print("done subprocess: " .. join(" ", {res, val, err}))
end)
@@ -82,13 +78,13 @@ mp.observe_property("vo-configured", "bool", function(_, v)
mp.command_native_async({name = "subprocess", args = {"wc", "-c"},
stdin_data = "hello", capture_stdout = true},
function(_, val)
function(res, val, err)
print("Should be '5': " .. val.stdout)
end)
-- blocking stdin by default
mp.command_native_async({name = "subprocess", args = {"cat"},
capture_stdout = true},
function(_, val)
function(res, val, err)
print("Should be 0: " .. #val.stdout)
end)
-- stdin + detached
@@ -96,7 +92,7 @@ mp.observe_property("vo-configured", "bool", function(_, v)
args = {"bash", "-c", "(sleep 5s ; cat)"},
stdin_data = "this should appear after 5s.\n",
detach = true},
function(_, val)
function(res, val, err)
print("5s test: " .. val.status)
end)
@@ -109,8 +105,7 @@ mp.observe_property("vo-configured", "bool", function(_, v)
playback_only = false, args = {"sleep", "inf"}})
end)
local counter
local function freeze_test(playback_only)
function freeze_test(playback_only)
-- This "freezes" the script, should be killed via timeout.
counter = counter and counter + 1 or 0
print("freeze! " .. counter)
+7 -7
View File
@@ -15,11 +15,11 @@
-- TODO: It might make sense to use hardware assisted vdpaupp=pullup,
-- if available, but I don't have hardware to test it. Patch welcome.
local script_name = mp.get_script_name()
local pullup_label = string.format("%s-pullup", script_name)
script_name = mp.get_script_name()
pullup_label = string.format("%s-pullup", script_name)
local function pullup_on()
for _, vf in pairs(mp.get_property_native('vf')) do
function pullup_on()
for i,vf in pairs(mp.get_property_native('vf')) do
if vf['label'] == pullup_label then
return "yes"
end
@@ -27,10 +27,10 @@ local function pullup_on()
return "no"
end
local function do_cycle()
function do_cycle()
if pullup_on() == "yes" then
-- if pullup is on remove it
mp.command(string.format("vf remove @%s:pullup", pullup_label))
mp.command(string.format("vf del @%s:pullup", pullup_label))
return
elseif mp.get_property("deinterlace") == "yes" then
-- if deinterlace is on, turn it off and insert pullup filter
@@ -44,7 +44,7 @@ local function do_cycle()
end
end
local function cycle_deinterlace_pullup_handler()
function cycle_deinterlace_pullup_handler()
do_cycle()
-- independently determine current state and give user feedback
mp.osd_message(string.format("deinterlace: %s\n"..
-29
View File
@@ -1,29 +0,0 @@
local function lux_to_gamma(lmin, lmax, rmin, rmax, lux)
if lmax <= lmin or lux == 0 then
return 1
end
local num = (rmax - rmin) * (math.log(lux, 10) - math.log(lmin, 10))
local den = math.log(lmax, 10) - math.log(lmin, 10)
local result = num / den + rmin
-- clamp the result
local max = math.max(rmax, rmin)
local min = math.min(rmax, rmin)
return math.max(math.min(result, max), min)
end
local function lux_changed(_, lux)
local gamma = lux_to_gamma(16.0, 256.0, 1.0, 1.2, lux or 0)
mp.set_property_number("gamma-factor", gamma)
end
if mp.get_property("platform") == "linux" then
-- observing ambient-light isn't supported on Linux
mp.add_periodic_timer(1, function()
lux_changed(nil, mp.get_property_number("ambient-light"))
end)
else
mp.observe_property("ambient-light", "number", lux_changed)
end
+3 -3
View File
@@ -3,10 +3,10 @@
local utils = require 'mp.utils'
local prop_name = "scale-param1"
prop_name = "scale-param1"
-- internal NaN, return string "default" instead of NaN
local v = mp.get_property_native(prop_name, "fail")
v = mp.get_property_native(prop_name, "fail")
print("Exp:", "string", "\"default\"")
print("Got:", type(v), utils.to_string(v))
@@ -25,7 +25,7 @@ print("Exp:", "number", 123)
print("Got:", type(v), utils.to_string(v))
-- try to set an actual NaN
local st, msg = mp.set_property_number(prop_name, 0.0/0)
st, msg = mp.set_property_number(prop_name, 0.0/0)
print("Exp:", nil, "<message>")
print("Got:", st, msg)
+5 -5
View File
@@ -6,17 +6,17 @@
local utils = require("mp.utils")
local function observe(name)
mp.observe_property(name, "native", function(prop, val)
print("property '" .. prop .. "' changed to '" ..
function observe(name)
mp.observe_property(name, "native", function(name, val)
print("property '" .. name .. "' changed to '" ..
utils.to_string(val) .. "'")
end)
end
for _, name in ipairs(mp.get_property_native("property-list")) do
for i,name in ipairs(mp.get_property_native("property-list")) do
observe(name)
end
for _, name in ipairs(mp.get_property_native("options")) do
for i,name in ipairs(mp.get_property_native("options")) do
observe("options/" .. name)
end
+1 -1
View File
@@ -3,7 +3,7 @@
local was_ontop = false
mp.observe_property("pause", "bool", function(_, value)
mp.observe_property("pause", "bool", function(name, value)
local ontop = mp.get_property_native("ontop")
if value then
if ontop then
+1 -1
View File
@@ -1,7 +1,7 @@
local assdraw = require 'mp.assdraw'
local utils = require 'mp.utils'
local things = {}
things = {}
for i = 1, 2 do
things[i] = {
osd1 = mp.create_osd_overlay("ass-events"),
+1 -1
View File
@@ -4,7 +4,7 @@
local did_minimize = false
mp.observe_property("window-minimized", "bool", function(_, value)
mp.observe_property("window-minimized", "bool", function(name, value)
local pause = mp.get_property_native("pause")
if value == true then
if pause == false then
+9 -11
View File
@@ -22,14 +22,14 @@ Example script-opts/skip-logo.conf:
name = "black frame", -- print if matched
skip = 10, -- number of seconds to skip forward
score = 0.3, -- required score
fingerprint = string.rep("0", 512),
fingerprint = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
{
-- Skip ahead 20 seconds if a white frame was detected
-- Note: this is dangerous non-sense. It's just for demonstration.
name = "fun2",
skip = 20,
fingerprint = string.rep("f", 512),
fingerprint = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
},
}
@@ -70,6 +70,7 @@ frames of a video. This could be fixed, but the author was too lazy to do so.
--]]
local utils = require "mp.utils"
local msg = require "mp.msg"
local label = "skip-logo"
@@ -120,10 +121,8 @@ end
local function load_config()
local conf_file = mp.find_config_file("script-opts/skip-logo.conf")
local conf_fn
local err
local err = nil
if conf_file then
-- luacheck: push
-- luacheck: ignore setfenv
if setfenv then
conf_fn, err = loadfile(conf_file)
if conf_fn then
@@ -132,13 +131,12 @@ local function load_config()
else
conf_fn, err = loadfile(conf_file, "t", config)
end
-- luacheck: pop
else
err = "config file not found"
end
if conf_fn and (not err) then
local _, err2 = pcall(conf_fn)
local ok, err2 = pcall(conf_fn)
err = err2
end
@@ -148,7 +146,7 @@ local function load_config()
if config.cases then
for n, case in ipairs(config.cases) do
err = nil
local err = nil
case.bitmap = hex_to_norm8(case.fingerprint)
if case.bitmap == nil then
err = "invalid or missing fingerprint field"
@@ -234,7 +232,7 @@ local function read_frames()
end
end
mp.observe_property(meta_property, "native", function()
mp.observe_property(meta_property, "none", function()
-- Ignore frames that are decoded/filtered during seeking.
if seeking then
return
@@ -243,7 +241,7 @@ mp.observe_property(meta_property, "native", function()
read_frames()
end)
mp.observe_property("seeking", "bool", function(_, val)
mp.observe_property("seeking", "bool", function(name, val)
seeking = val
if seeking == false then
playback_start_pts = mp.get_property_number("playback-time")
@@ -261,7 +259,7 @@ for _, f in ipairs(filters) do
end
if found then
mp.command(("no-osd vf add @%s:fingerprint"):format(label))
mp.command(("no-osd vf add @%s:fingerprint"):format(label, filter))
else
msg.warn("vf_fingerprint not found")
end
+5 -7
View File
@@ -3,14 +3,12 @@
-- Also, this is based on a rather old version of the
-- builtin mpv status line.
local newStatus
-- Add a string to the status line
local function atsl(s)
function atsl(s)
newStatus = newStatus .. s
end
local function update_status_line()
function update_status_line()
-- Reset the status line
newStatus = ""
@@ -43,7 +41,7 @@ local function update_status_line()
atsl(string.format(" x%4.2f", r))
end
r = mp.get_property_number("avsync")
r = mp.get_property_number("avsync", nil)
if r ~= nil then
atsl(string.format(" A-V: %f", r))
end
@@ -80,9 +78,9 @@ local function update_status_line()
mp.set_property("options/term-status-msg", newStatus)
end
local timer = mp.add_periodic_timer(1, update_status_line)
timer = mp.add_periodic_timer(1, update_status_line)
local function on_pause_change(_, value)
function on_pause_change(name, value)
if value == false then
timer:resume()
else
+4 -4
View File
@@ -1,7 +1,7 @@
local utils = require("mp.utils")
local function hardsleep()
os.execute("sleep 1")
function hardsleep()
os.execute("sleep 1s")
end
local hooks = {"on_before_start_file", "on_load", "on_load_fail",
@@ -25,8 +25,8 @@ end
local props = {"path", "metadata"}
for _, name in ipairs(props) do
mp.observe_property(name, "native", function(prop, val)
print("property '" .. prop .. "' changed to '" ..
mp.observe_property(name, "native", function(name, val)
print("property '" .. name .. "' changed to '" ..
utils.to_string(val) .. "'")
end)
end
+43 -25
View File
@@ -1,50 +1,68 @@
#!/usr/bin/env python3
# This checks for the sdk path, the sdk version, and
# the sdk build version.
# Logic copied from compiler_swift.py in the waf build. This checks for the sdk
# path, the sdk version, and the sdk build version. The sdk path is returned
# along with what is selected as the sdk version.
import re
import os
import subprocess
import string
import sys
from distutils.version import StrictVersion
from shutil import which
from subprocess import check_output
def find_macos_sdk():
sdk = os.environ.get("MACOS_SDK", "")
sdk_version = os.environ.get("MACOS_SDK_VERSION", "0.0")
xcrun = which("xcrun")
xcodebuild = which("xcodebuild")
sdk = os.environ.get('MACOS_SDK', '')
sdk_version = os.environ.get('MACOS_SDK_VERSION', '0.0')
xcrun = which('xcrun')
if not xcrun:
return sdk,sdk_version
if not sdk:
sdk = check_output([xcrun, "--sdk", "macosx", "--show-sdk-path"],
sdk = check_output([xcrun, '--sdk', 'macosx', '--show-sdk-path'],
encoding="UTF-8")
# find macOS SDK paths and version
if sdk_version == "0.0":
sdk_version = check_output([xcrun, "--sdk", "macosx", "--show-sdk-version"],
if sdk_version == '0.0':
# show-sdk-build-version: is not available on older command line tools, but returns a build version (eg 17A360)
# show-sdk-version: is always available, but on older dev tools it's only the major version
sdk_build_version = check_output([xcrun, '--sdk', 'macosx',
'--show-sdk-build-version'], encoding="UTF-8")
sdk_version = check_output([xcrun, '--sdk', 'macosx', '--show-sdk-version'],
encoding="UTF-8")
# use xcode tools when installed, still necessary for xcode versions <12.0
try:
if not xcodebuild:
raise ValueError
sdk_version = check_output(
[xcodebuild, "-sdk", "macosx", "-version", "ProductVersion"],
encoding="UTF-8",
stderr=subprocess.DEVNULL,
)
except Exception:
pass
if sdk:
build_version = '10.10.0'
# convert build version to a version string
# first 2 two digits are the major version, starting with 15 which is 10.11 (offset of 4)
# 1 char is the minor version, A => 0, B => 1 and ongoing
# last digits are bugfix version, which are not relevant for us
# eg 16E185 => 10.12.4, 17A360 => 10.13, 18B71 => 10.14.1
if sdk_build_version and isinstance(sdk_build_version, str):
verRe = re.compile("(\d+)(\D+)(\d+)")
version_parts = verRe.search(sdk_build_version)
major = int(version_parts.group(1)) - 4
minor = string.ascii_lowercase.index(version_parts.group(2).lower())
build_version = '10.' + str(major) + '.' + str(minor)
# from 20 onwards macOS 11.0 starts
if int(version_parts.group(1)) >= 20:
build_version = '11.' + str(minor)
if not isinstance(sdk_version, str):
sdk_version = "10.10.0"
sdk_version = '10.10.0'
return sdk.strip(),sdk_version.strip()
# pick the higher version, always pick sdk over build if newer
if StrictVersion(build_version) > StrictVersion(sdk_version):
return sdk,build_version
else:
return sdk,sdk_version
return sdk,sdk_version
if __name__ == "__main__":
sdk_info = find_macos_sdk()
sys.stdout.write(",".join(sdk_info))
sys.stdout.write(','.join(sdk_info))
+2 -6
View File
@@ -8,9 +8,8 @@ import sys
from shutil import which
from subprocess import check_output
def find_swift_lib():
swift_lib_dir = os.environ.get("SWIFT_LIB_DYNAMIC", "")
swift_lib_dir = os.environ.get('SWIFT_LIB_DYNAMIC', '')
if swift_lib_dir:
return swift_lib_dir
@@ -28,10 +27,7 @@ def find_swift_lib():
xcode_path = check_output([xcode_select, "-p"], encoding="UTF-8")
swift_lib_dir = os.path.join(
xcode_path,
"Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx",
)
swift_lib_dir = os.path.join(xcode_path, "Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx")
if os.path.isdir(swift_lib_dir):
return swift_lib_dir
+245 -254
View File
@@ -4,10 +4,6 @@ Generate C definitions for parsing Matroska files.
Can also be used to directly parse Matroska files and display their contents.
"""
import sys
from binascii import hexlify
from math import ldexp
#
# This file is part of mpv.
#
@@ -27,220 +23,205 @@ from math import ldexp
elements_ebml = (
"EBML, 1a45dfa3, sub", (
"EBMLVersion, 4286, uint",
"EBMLReadVersion, 42f7, uint",
"EBMLMaxIDLength, 42f2, uint",
"EBMLMaxSizeLength, 42f3, uint",
"DocType, 4282, str",
"DocTypeVersion, 4287, uint",
"DocTypeReadVersion, 4285, uint",
'EBML, 1a45dfa3, sub', (
'EBMLVersion, 4286, uint',
'EBMLReadVersion, 42f7, uint',
'EBMLMaxIDLength, 42f2, uint',
'EBMLMaxSizeLength, 42f3, uint',
'DocType, 4282, str',
'DocTypeVersion, 4287, uint',
'DocTypeReadVersion, 4285, uint',
),
"CRC32, bf, binary",
"Void, ec, binary",
'CRC32, bf, binary',
'Void, ec, binary',
)
elements_matroska = (
"Segment, 18538067, sub", (
'Segment, 18538067, sub', (
"SeekHead*, 114d9b74, sub", (
"Seek*, 4dbb, sub", (
"SeekID, 53ab, ebml_id",
"SeekPosition, 53ac, uint",
'SeekHead*, 114d9b74, sub', (
'Seek*, 4dbb, sub', (
'SeekID, 53ab, ebml_id',
'SeekPosition, 53ac, uint',
),
),
"Info*, 1549a966, sub", (
"SegmentUID, 73a4, binary",
"PrevUID, 3cb923, binary",
"NextUID, 3eb923, binary",
"TimecodeScale, 2ad7b1, uint",
"DateUTC, 4461, sint",
"Title, 7ba9, str",
"MuxingApp, 4d80, str",
"WritingApp, 5741, str",
"Duration, 4489, float",
'Info*, 1549a966, sub', (
'SegmentUID, 73a4, binary',
'PrevUID, 3cb923, binary',
'NextUID, 3eb923, binary',
'TimecodeScale, 2ad7b1, uint',
'DateUTC, 4461, sint',
'Title, 7ba9, str',
'MuxingApp, 4d80, str',
'WritingApp, 5741, str',
'Duration, 4489, float',
),
"Cluster*, 1f43b675, sub", (
"Timecode, e7, uint",
"BlockGroup*, a0, sub", (
"Block, a1, binary",
"BlockDuration, 9b, uint",
"ReferenceBlock*, fb, sint",
"DiscardPadding, 75A2, sint",
"BlockAdditions, 75A1, sub", (
"BlockMore*, A6, sub", (
"BlockAddID, EE, uint",
"BlockAdditional, A5, binary",
'Cluster*, 1f43b675, sub', (
'Timecode, e7, uint',
'BlockGroup*, a0, sub', (
'Block, a1, binary',
'BlockDuration, 9b, uint',
'ReferenceBlock*, fb, sint',
'DiscardPadding, 75A2, sint',
'BlockAdditions, 75A1, sub', (
'BlockMore*, A6, sub', (
'BlockAddID, EE, uint',
'BlockAdditional, A5, binary',
),
),
),
"SimpleBlock*, a3, binary",
'SimpleBlock*, a3, binary',
),
"Tracks*, 1654ae6b, sub", (
"TrackEntry*, ae, sub", (
"TrackNumber, d7, uint",
"TrackUID, 73c5, uint",
"TrackType, 83, uint",
"FlagEnabled, b9, uint",
"FlagDefault, 88, uint",
"FlagForced, 55aa, uint",
"FlagHearingImpaired, 55ab, uint",
"FlagVisualImpaired, 55ac, uint",
"FlagLacing, 9c, uint",
"MinCache, 6de7, uint",
"MaxCache, 6df8, uint",
"DefaultDuration, 23e383, uint",
"TrackTimecodeScale, 23314f, float",
"MaxBlockAdditionID, 55ee, uint",
"Name, 536e, str",
"Language, 22b59c, str",
"LanguageBCP47, 22b59d, str",
"CodecID, 86, str",
"CodecPrivate, 63a2, binary",
"CodecName, 258688, str",
"CodecDecodeAll, aa, uint",
"CodecDelay, 56aa, uint",
"SeekPreRoll, 56bb, uint",
"Video, e0, sub", (
"FlagInterlaced, 9a, uint",
"PixelWidth, b0, uint",
"PixelHeight, ba, uint",
"DisplayWidth, 54b0, uint",
"DisplayHeight, 54ba, uint",
"DisplayUnit, 54b2, uint",
"PixelCropTop, 54bb, uint",
"PixelCropLeft, 54cc, uint",
"PixelCropRight, 54dd, uint",
"PixelCropBottom, 54aa, uint",
"FrameRate, 2383e3, float",
"ColourSpace, 2eb524, binary",
"StereoMode, 53b8, uint",
"Colour, 55b0, sub", (
"MatrixCoefficients, 55B1, uint",
"BitsPerChannel, 55B2, uint",
"ChromaSubsamplingHorz, 55B3, uint",
"ChromaSubsamplingVert, 55B4, uint",
"CbSubsamplingHorz, 55B5, uint",
"CbSubsamplingVert, 55B6, uint",
"ChromaSitingHorz, 55B7, uint",
"ChromaSitingVert, 55B8, uint",
"Range, 55B9, uint",
"TransferCharacteristics, 55BA, uint",
"Primaries, 55BB, uint",
"MaxCLL, 55BC, uint",
"MaxFALL, 55BD, uint",
"MasteringMetadata, 55D0, sub", (
"PrimaryRChromaticityX, 55D1, float",
"PrimaryRChromaticityY, 55D2, float",
"PrimaryGChromaticityX, 55D3, float",
"PrimaryGChromaticityY, 55D4, float",
"PrimaryBChromaticityX, 55D5, float",
"PrimaryBChromaticityY, 55D6, float",
"WhitePointChromaticityX, 55D7, float",
"WhitePointChromaticityY, 55D8, float",
"LuminanceMax, 55D9, float",
"LuminanceMin, 55DA, float",
'Tracks*, 1654ae6b, sub', (
'TrackEntry*, ae, sub', (
'TrackNumber, d7, uint',
'TrackUID, 73c5, uint',
'TrackType, 83, uint',
'FlagEnabled, b9, uint',
'FlagDefault, 88, uint',
'FlagForced, 55aa, uint',
'FlagLacing, 9c, uint',
'MinCache, 6de7, uint',
'MaxCache, 6df8, uint',
'DefaultDuration, 23e383, uint',
'TrackTimecodeScale, 23314f, float',
'MaxBlockAdditionID, 55ee, uint',
'Name, 536e, str',
'Language, 22b59c, str',
'CodecID, 86, str',
'CodecPrivate, 63a2, binary',
'CodecName, 258688, str',
'CodecDecodeAll, aa, uint',
'CodecDelay, 56aa, uint',
'SeekPreRoll, 56bb, uint',
'Video, e0, sub', (
'FlagInterlaced, 9a, uint',
'PixelWidth, b0, uint',
'PixelHeight, ba, uint',
'DisplayWidth, 54b0, uint',
'DisplayHeight, 54ba, uint',
'DisplayUnit, 54b2, uint',
'FrameRate, 2383e3, float',
'ColourSpace, 2eb524, binary',
'StereoMode, 53b8, uint',
'Colour, 55b0, sub', (
'MatrixCoefficients, 55B1, uint',
'BitsPerChannel, 55B2, uint',
'ChromaSubsamplingHorz, 55B3, uint',
'ChromaSubsamplingVert, 55B4, uint',
'CbSubsamplingHorz, 55B5, uint',
'CbSubsamplingVert, 55B6, uint',
'ChromaSitingHorz, 55B7, uint',
'ChromaSitingVert, 55B8, uint',
'Range, 55B9, uint',
'TransferCharacteristics, 55BA, uint',
'Primaries, 55BB, uint',
'MaxCLL, 55BC, uint',
'MaxFALL, 55BD, uint',
'MasteringMetadata, 55D0, sub', (
'PrimaryRChromaticityX, 55D1, float',
'PrimaryRChromaticityY, 55D2, float',
'PrimaryGChromaticityX, 55D3, float',
'PrimaryGChromaticityY, 55D4, float',
'PrimaryBChromaticityX, 55D5, float',
'PrimaryBChromaticityY, 55D6, float',
'WhitePointChromaticityX, 55D7, float',
'WhitePointChromaticityY, 55D8, float',
'LuminanceMax, 55D9, float',
'LuminanceMin, 55DA, float',
),
),
"Projection, 7670, sub", (
"ProjectionType, 7671, uint",
"ProjectionPrivate, 7672, binary",
"ProjectionPoseYaw, 7673, float",
"ProjectionPosePitch, 7674, float",
"ProjectionPoseRoll, 7675, float",
'Projection, 7670, sub', (
'ProjectionType, 7671, uint',
'ProjectionPrivate, 7672, binary',
'ProjectionPoseYaw, 7673, float',
'ProjectionPosePitch, 7674, float',
'ProjectionPoseRoll, 7675, float',
),
),
"Audio, e1, sub", (
"SamplingFrequency, b5, float",
"OutputSamplingFrequency, 78b5, float",
"Channels, 9f, uint",
"BitDepth, 6264, uint",
'Audio, e1, sub', (
'SamplingFrequency, b5, float',
'OutputSamplingFrequency, 78b5, float',
'Channels, 9f, uint',
'BitDepth, 6264, uint',
),
"ContentEncodings, 6d80, sub", (
"ContentEncoding*, 6240, sub", (
"ContentEncodingOrder, 5031, uint",
"ContentEncodingScope, 5032, uint",
"ContentEncodingType, 5033, uint",
"ContentCompression, 5034, sub", (
"ContentCompAlgo, 4254, uint",
"ContentCompSettings, 4255, binary",
'ContentEncodings, 6d80, sub', (
'ContentEncoding*, 6240, sub', (
'ContentEncodingOrder, 5031, uint',
'ContentEncodingScope, 5032, uint',
'ContentEncodingType, 5033, uint',
'ContentCompression, 5034, sub', (
'ContentCompAlgo, 4254, uint',
'ContentCompSettings, 4255, binary',
),
),
),
"BlockAdditionMapping*, 41e4, sub", (
"BlockAddIDValue, 41f0, uint",
"BlockAddIDName, 41a4, str",
"BlockAddIDType, 41e7, uint",
"BlockAddIDExtraData, 41ed, binary",
),
),
'Cues, 1c53bb6b, sub', (
'CuePoint*, bb, sub', (
'CueTime, b3, uint',
'CueTrackPositions*, b7, sub', (
'CueTrack, f7, uint',
'CueClusterPosition, f1, uint',
'CueRelativePosition, f0, uint',
'CueDuration, b2, uint',
),
),
),
"Cues, 1c53bb6b, sub", (
"CuePoint*, bb, sub", (
"CueTime, b3, uint",
"CueTrackPositions*, b7, sub", (
"CueTrack, f7, uint",
"CueClusterPosition, f1, uint",
"CueRelativePosition, f0, uint",
"CueDuration, b2, uint",
),
'Attachments, 1941a469, sub', (
'AttachedFile*, 61a7, sub', (
'FileDescription, 467e, str',
'FileName, 466e, str',
'FileMimeType, 4660, str',
'FileData, 465c, binary',
'FileUID, 46ae, uint',
),
),
"Attachments, 1941a469, sub", (
"AttachedFile*, 61a7, sub", (
"FileDescription, 467e, str",
"FileName, 466e, str",
"FileMimeType, 4660, str",
"FileData, 465c, binary",
"FileUID, 46ae, uint",
),
),
"Chapters, 1043a770, sub", (
"EditionEntry*, 45b9, sub", (
"EditionUID, 45bc, uint",
"EditionFlagHidden, 45bd, uint",
"EditionFlagDefault, 45db, uint",
"EditionFlagOrdered, 45dd, uint",
"ChapterAtom*, b6, sub", (
"ChapterUID, 73c4, uint",
"ChapterTimeStart, 91, uint",
"ChapterTimeEnd, 92, uint",
"ChapterFlagHidden, 98, uint",
"ChapterFlagEnabled, 4598, uint",
"ChapterSegmentUID, 6e67, binary",
"ChapterSegmentEditionUID, 6ebc, uint",
"ChapterDisplay*, 80, sub", (
"ChapString, 85, str",
"ChapLanguage*, 437c, str",
"ChapLanguageBCP47*, 437d, str",
"ChapCountry*, 437e, str",
'Chapters, 1043a770, sub', (
'EditionEntry*, 45b9, sub', (
'EditionUID, 45bc, uint',
'EditionFlagHidden, 45bd, uint',
'EditionFlagDefault, 45db, uint',
'EditionFlagOrdered, 45dd, uint',
'ChapterAtom*, b6, sub', (
'ChapterUID, 73c4, uint',
'ChapterTimeStart, 91, uint',
'ChapterTimeEnd, 92, uint',
'ChapterFlagHidden, 98, uint',
'ChapterFlagEnabled, 4598, uint',
'ChapterSegmentUID, 6e67, binary',
'ChapterSegmentEditionUID, 6ebc, uint',
'ChapterDisplay*, 80, sub', (
'ChapString, 85, str',
'ChapLanguage*, 437c, str',
'ChapCountry*, 437e, str',
),
),
),
),
"Tags*, 1254c367, sub", (
"Tag*, 7373, sub", (
"Targets, 63c0, sub", (
"TargetTypeValue, 68ca, uint",
"TargetType, 63ca, str",
"TargetTrackUID, 63c5, uint",
"TargetEditionUID, 63c9, uint",
"TargetChapterUID, 63c4, uint",
"TargetAttachmentUID, 63c6, uint",
'Tags*, 1254c367, sub', (
'Tag*, 7373, sub', (
'Targets, 63c0, sub', (
'TargetTypeValue, 68ca, uint',
'TargetType, 63ca, str',
'TargetTrackUID, 63c5, uint',
'TargetEditionUID, 63c9, uint',
'TargetChapterUID, 63c4, uint',
'TargetAttachmentUID, 63c6, uint',
),
"SimpleTag*, 67c8, sub", (
"TagName, 45a3, str",
"TagLanguage, 447a, str",
"TagLanguageBCP47, 447b, str",
"TagString, 4487, str",
"TagDefault, 4484, uint",
'SimpleTag*, 67c8, sub', (
'TagName, 45a3, str',
'TagLanguage, 447a, str',
'TagString, 4487, str',
'TagDefault, 4484, uint',
),
),
),
@@ -248,9 +229,15 @@ elements_matroska = (
)
import sys
from math import ldexp
from binascii import hexlify
def byte2num(s):
return int(hexlify(s), 16)
class EOF(Exception): pass
def camelcase_to_words(name):
parts = []
start = 0
@@ -260,29 +247,29 @@ def camelcase_to_words(name):
parts.append(name[start:i])
start = i
parts.append(name[start:])
return "_".join(parts).lower()
return '_'.join(parts).lower()
class MatroskaElement:
class MatroskaElement(object):
def __init__(self, name, elid, valtype, namespace):
self.name = name
self.definename = f"{namespace}_ID_{name.upper()}"
self.definename = '{0}_ID_{1}'.format(namespace, name.upper())
self.fieldname = camelcase_to_words(name)
self.structname = "ebml_" + self.fieldname
self.structname = 'ebml_' + self.fieldname
self.elid = elid
self.valtype = valtype
if valtype == "sub":
self.ebmltype = "EBML_TYPE_SUBELEMENTS"
self.valname = "struct " + self.structname
if valtype == 'sub':
self.ebmltype = 'EBML_TYPE_SUBELEMENTS'
self.valname = 'struct ' + self.structname
else:
self.ebmltype = "EBML_TYPE_" + valtype.upper()
self.ebmltype = 'EBML_TYPE_' + valtype.upper()
try:
self.valname = {"uint": "uint64_t", "str": "char *",
"binary": "bstr", "ebml_id": "uint32_t",
"float": "double", "sint": "int64_t",
self.valname = {'uint': 'uint64_t', 'str': 'char *',
'binary': 'bstr', 'ebml_id': 'uint32_t',
'float': 'double', 'sint': 'int64_t',
}[valtype]
except KeyError:
raise SyntaxError("Unrecognized value type " + valtype)
raise SyntaxError('Unrecognized value type ' + valtype)
self.subelements = ()
def add_subelements(self, subelements):
@@ -291,14 +278,14 @@ class MatroskaElement:
elementd = {}
elementlist = []
def parse_elems(elements, namespace):
def parse_elems(l, namespace):
subelements = []
for el in elements:
for el in l:
if isinstance(el, str):
name, hexid, eltype = (x.strip() for x in el.split(","))
name, hexid, eltype = [x.strip() for x in el.split(',')]
hexid = hexid.lower()
multiple = name.endswith("*")
name = name.strip("*")
multiple = name.endswith('*')
name = name.strip('*')
new = MatroskaElement(name, hexid, eltype, namespace)
elementd[hexid] = new
elementlist.append(new)
@@ -307,19 +294,19 @@ def parse_elems(elements, namespace):
new.add_subelements(parse_elems(el, namespace))
return subelements
parse_elems(elements_ebml, "EBML")
parse_elems(elements_matroska, "MATROSKA")
parse_elems(elements_ebml, 'EBML')
parse_elems(elements_matroska, 'MATROSKA')
def printf(out, *args):
out.write(" ".join(str(x) for x in args))
out.write("\n")
out.write(' '.join(str(x) for x in args))
out.write('\n')
def generate_c_header(out):
printf(out, "// Generated by TOOLS/matroska.py, do not edit manually")
def generate_C_header(out):
printf(out, '// Generated by TOOLS/matroska.py, do not edit manually')
printf(out)
for el in elementlist:
printf(out, f"#define {el.definename:40} 0x{el.elid}")
printf(out, '#define {0.definename:40} 0x{0.elid}'.format(el))
printf(out)
@@ -327,46 +314,46 @@ def generate_c_header(out):
if not el.subelements:
continue
printf(out)
printf(out, f"struct {el.structname} {{")
length = max(len(subel.valname) for subel, multiple in el.subelements)+1
printf(out, 'struct {0.structname} {{'.format(el))
l = max(len(subel.valname) for subel, multiple in el.subelements)+1
for subel, multiple in el.subelements:
printf(out, " {e.valname:{length}} {star}{e.fieldname};".format(
e=subel, length=length, star=" *"[multiple]))
printf(out, ' {e.valname:{l}} {star}{e.fieldname};'.format(
e=subel, l=l, star=' *'[multiple]))
printf(out)
for subel, multiple in el.subelements:
printf(out, f" int n_{subel.fieldname};")
printf(out, "};")
printf(out, ' int n_{0.fieldname};'.format(subel))
printf(out, '};')
for el in elementlist:
if not el.subelements:
continue
printf(out, f"extern const struct ebml_elem_desc {el.structname}_desc;")
printf(out, 'extern const struct ebml_elem_desc {0.structname}_desc;'.format(el))
printf(out)
printf(out, "#define MAX_EBML_SUBELEMENTS", max(len(el.subelements)
printf(out, '#define MAX_EBML_SUBELEMENTS', max(len(el.subelements)
for el in elementlist))
def generate_c_definitions(out):
printf(out, "// Generated by TOOLS/matroska.py, do not edit manually")
def generate_C_definitions(out):
printf(out, '// Generated by TOOLS/matroska.py, do not edit manually')
printf(out)
for el in reversed(elementlist):
printf(out)
if el.subelements:
printf(out, "#define N", el.fieldname)
printf(out, f'E_S("{el.name}", {len(el.subelements)})')
printf(out, '#define N', el.fieldname)
printf(out, 'E_S("{0}", {1})'.format(el.name, len(el.subelements)))
for subel, multiple in el.subelements:
msg = f"F({subel.definename}, {subel.fieldname}, {int(multiple)})"
printf(out, msg)
printf(out, "}};")
printf(out, "#undef N")
printf(out, 'F({0.definename}, {0.fieldname}, {1})'.format(
subel, int(multiple)))
printf(out, '}};')
printf(out, '#undef N')
else:
printf(out, f'E("{el.name}", {el.fieldname}, {el.ebmltype})')
printf(out, 'E("{0.name}", {0.fieldname}, {0.ebmltype})'.format(el))
def read(s, length):
t = s.read(length)
if len(t) != length:
raise EOFError
raise EOF
return t
def read_id(s):
@@ -424,48 +411,47 @@ def read_float(s, length):
return f
def parse_one(s, depth, parent, maxlen):
elid = hexlify(read_id(s)).decode("ascii")
elid = hexlify(read_id(s)).decode('ascii')
elem = elementd.get(elid)
size, length = read_vint(s)
this_length = len(elid) / 2 + size + length
if elem is not None:
if elem.valtype != "skip":
indent = " " * depth
print(f"{indent} [{elid}] {elem.name} size: {length} value:", end=" ")
if elem.valtype == "sub":
print("subelements:")
if elem.valtype != 'skip':
print(" " * depth, '[' + elid + ']', elem.name, 'size:', length, 'value:', end=' ')
if elem.valtype == 'sub':
print('subelements:')
while length > 0:
length -= parse_one(s, depth + 1, elem, length)
if length < 0:
raise SyntaxError
elif elem.valtype == "str":
print("string", repr(read_str(s, length).decode("utf8", "replace")))
elif elem.valtype in ("binary", "ebml_id"):
elif elem.valtype == 'str':
print('string', repr(read_str(s, length).decode('utf8', 'replace')))
elif elem.valtype in ('binary', 'ebml_id'):
t = read_str(s, length)
dec = ""
if elem.valtype == "ebml_id":
idelem = elementd.get(hexlify(t).decode("ascii"))
dec = ''
if elem.valtype == 'ebml_id':
idelem = elementd.get(hexlify(t).decode('ascii'))
if idelem is None:
dec = "(UNKNOWN)"
dec = '(UNKNOWN)'
else:
dec = f"({idelem.name})"
dec = '({0.name})'.format(idelem)
if len(t) < 20:
t = hexlify(t).decode("ascii")
t = hexlify(t).decode('ascii')
else:
t = f"<{len(t)} bytes>"
print("binary", t, dec)
elif elem.valtype == "uint":
print("uint", read_uint(s, length))
elif elem.valtype == "sint":
print("sint", read_sint(s, length))
elif elem.valtype == "float":
print("float", read_float(s, length))
elif elem.valtype == "skip":
t = '<{0} bytes>'.format(len(t))
print('binary', t, dec)
elif elem.valtype == 'uint':
print('uint', read_uint(s, length))
elif elem.valtype == 'sint':
print('sint', read_sint(s, length))
elif elem.valtype == 'float':
print('float', read_float(s, length))
elif elem.valtype == 'skip':
read(s, length)
else:
raise NotImplementedError
else:
print(" " * depth, "[" + elid + "] Unknown element! size:", length)
print(" " * depth, '[' + elid + '] Unknown element! size:', length)
read(s, length)
return this_length
@@ -473,17 +459,22 @@ if __name__ == "__main__":
def parse_toplevel(s):
parse_one(s, 0, None, 1 << 63)
if sys.argv[1] == "--generate-header":
generate_c_header(open(sys.argv[2], "w"))
elif sys.argv[1] == "--generate-definitions":
generate_c_definitions(open(sys.argv[2], "w"))
if len(sys.argv) < 3:
outfile = sys.stdout
else:
outfile = open(sys.argv[2], "w")
if sys.argv[1] == '--generate-header':
generate_C_header(outfile)
elif sys.argv[1] == '--generate-definitions':
generate_C_definitions(outfile)
else:
s = open(sys.argv[1], "rb")
while 1:
start = s.tell()
try:
parse_toplevel(s)
except EOFError:
except EOF:
if s.tell() != start:
raise Exception("Unexpected end of file")
break
-16
View File
@@ -1,16 +0,0 @@
Steps to add new icons:
- Install [FontForge](https://fontforge.org/en-US/)
- Load a freely licensed font and mpv's glyph directory, for example:
`fontforge Symbola.ttf TOOLS/mpv-osd-symbols.sfdir`
- Check the Unicode hex value of the desired character (`g-a` in vim)
- Scroll until that value in the font window and click it
- Copy the selected glyph (Ctrl+c)
- Focus the window with TOOLS/mpv-osd-symbols.sfdir
- Click an unused character slot
- Paste the glyph (Ctrl+v)
- Save (Ctrl+s)
- Edit the numbers in the glyph file to match the size and position of adjacent
icons (TODO: find a better way)
- Run `sh TOOLS/gen-osd-font.sh`
- Add the icon to osc.lua following the instructions there
+3 -3
View File
@@ -1,4 +1,4 @@
SplineFontDB: 3.2
SplineFontDB: 3.0
FontName: mpv-osd-symbols-Regular
FullName: mpv-osd-symbols Regular
FamilyName: mpv-osd-symbols
@@ -22,7 +22,7 @@ OS2Version: 3
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 0
CreationTime: 1408646554
ModificationTime: 1735420479
ModificationTime: 1576096543
PfmFamily: 81
TTFWeight: 400
TTFWidth: 5
@@ -63,7 +63,7 @@ NameList: AGL For New Fonts
DisplaySize: -72
AntiAlias: 1
FitToEm: 0
WinInfo: 57540 14 11
WinInfo: 57600 8 2
BeginPrivate: 8
BlueValues 31 [-10 0 640 650 720 730 800 810]
BlueScale 5 0.037
-15
View File
@@ -1,15 +0,0 @@
StartChar: uniE00D
Encoding: 57357 57357 34
Width: 880
Flags: HW
HStem: 780 20G<200 200>
VStem: 200 375<400 400 400 800>
LayerCount: 2
Fore
SplineSet
200 400 m 1
575 800 l 1
575 0 l 1
200 400 l 1
EndSplineSet
EndChar
-25
View File
@@ -1,25 +0,0 @@
StartChar: uniE102
Encoding: 57602 57602 35
Width: 880
VWidth: 880
Flags: HW
LayerCount: 2
Fore
SplineSet
880 640 m 1
0 640 l 1
0 800 l 1
880 800 l 1
880 640 l 1
880 320 m 1
0 320 l 1
0 480 l 1
880 480 l 1
880 320 l 1
880 0 m 1
0 0 l 1
0 160 l 1
880 160 l 1
880 0 l 1
EndSplineSet
EndChar
Loaded 100 of 809 files, more files were not shown because too many files have changed in this diff. Show more