Compare commits

..
42 Commits
Author SHA1 Message Date
Jan Ekström 723fd02919 Release 0.29.1 2018-10-02 22:03:41 +03:00
Akemi 7c2368ad7d cocoa-cb: fix side by side Split View
when entering a Split View a windowDidEnterFullScreen event happens
without a previous toggleFullScreen call. in that case it tries to stop
an animation that was never initiated by us and basically breaks the
system initiated fullscreen, or in this case the Split View. immediately
after entering the fullscreen it tries top stop the animation and
resizes the window, which causes the window to exit fullscreen. only
try to stop an animation that was initiated by us and is safe to stop.

(cherry picked from commit 2b0b9bb6a1)
2018-10-02 20:36:55 +03:00
Rodger Combs 008ddf42a1 {mac,cocoa}: trim trailing null out of macosx_icon when loading it
This prevents crashes when loading the application icon image.

Suggested-by: Akemi <der.richter@gmx.de>
(cherry picked from commit 1842a932d3)
2018-10-02 00:42:58 +03:00
Rodger Combs 5b9cf1d0a6 mac: fix crash if we can't get an event tap
without assistive-device permissions the event tap can't be create on
10.14 any more which lead to an assertion.

System Preferences > Security & Privacy > Privacy > Accessibility and
add mpv or your terminal App to the list.

(cherry picked from commit ada4f7c600)
2018-10-02 00:42:51 +03:00
Niklas Haas a985e8ed6b encode: fix AVPacket deinitialization logic
Since this function is called with packets on the stack, trying to free
them makes no sense. Instead, it should unref (which is what
`av_interleaved_write_frame` does anyway, rather than freeing).

Also, the calling code tried unreffing the packet a second time, even
after it was "freed" by the callee in the failure case - and after
ownership was taken over by `av_interleaved_write_frame` in the
successful case. Both of these cases were wrong.

(cherry picked from commit 6d61c5f68a)
2018-10-01 20:29:51 +03:00
wm4 36eeeecff6 demux_lavf: hack-fix EDL mp4 DASH hack
I encountered a stream that fails with "Could not demux init fragment.".
It turns out this is a regression from the recent change to that code.
The assumption was that demux_lavf.c would treat this as concatenated
stream - which it does, but not for probing.

Doing this transparently is hard without doing it properly. Doing it
properly would mean creating some sort of stream_concat (reminiscent of
that FFmpeg security bug). I probably don't want to go there, and I
think libavformat should just support this directly, so whatever.
Hack-fix this with the knowledge that the init segment will always
contain the headers.

(cherry picked from commit 315004a38a)
2018-10-01 18:55:06 +03:00
wm4 e74ffab36e stream_libarchive: fix hangs when demuxer does out of bound seeks
This happened with a .flac file inside an archive. It tried to seek
beyond the end of the archive entry in a format where seeking isn't
supported. stream_libarchive handles these situations by skipping data.
But when the end of the archive is reached, archive_read_data() returns
0. While libarchive didn't bother to fucking document this, they do say
it's supposed to work like read(), so I guess a return value of 0 really
means EOF. So change the "< 0" to "<= 0". Also add some error logging.

The same file actually worked without out of bounds reads when
extracted, so there still might be something very wrong.

(cherry picked from commit 7e85dc2167)
2018-10-01 18:54:54 +03:00
wm4 4f47596043 demux_lavf: v4l streams are not seekable
FFmpeg is retarded enough not to give us any indication whether it is
(unless we query fields not in the ABI/API). I bet FFmpeg developers
love it when library users have to litter their code with duplicated
information.

(cherry picked from commit 20d381d1e9)
2018-10-01 18:54:27 +03:00
Akemi 3e8fd22f07 cocoa-cb: add Apple Software Renderer support
by default the pixel format creation falls back to software renderer
when everything fails. this is mostly needed for VMs. additionally one
can directly request an sw renderer or exclude it entirely.

(cherry picked from commit 8d2d0f0640)
2018-09-30 23:38:11 +03:00
Akemi 53a1a955d7 cocoa-cb: move macOS option retrieval to the earliest point possible
moved the retrieval of the macOS specific options from the backend
initialisation to the initialisation of the CocoaCB class, the earliest
point possible. this way macOS specific options can be used for the
opengl context creation for example.

(cherry picked from commit 44e49aee3c)
2018-09-30 23:38:04 +03:00
Akemi 5a9add1fb3 add swift as main dependency so all dependencies can be disabled easily
(cherry picked from commit 5c2056ad0a)
2018-09-30 23:37:57 +03:00
Akemi 89e52a228c build: check for Swift version and disable dependencies if needed
(cherry picked from commit 50787acb27)
2018-09-30 23:37:50 +03:00
Anton Kindestam 46969b449a drm_atomic: Allow to create atomic context w/o drmprime video plane
This is to improve the experience when running with default settings
on a driver that doesn't have any overlay planes (or indeed only one
plane), but still supports DRM atomic. Since the drmprime video plane
is set to pick an overlay plane by default it would fail on these
drivers due to not being able to create any atomic context. Users with
such cards had to specify --drm-video-plane-id manually to some bogus
value (it's not used after all).

The "video" plane is only ever used by the drmprime-drm hwdec interop,
which is not used at all in the typical usecase where everything is
actually rendered on to the "OSD" plane using EGL, so having an atomic
context without the "video" plane should be fine most of the time.

(cherry picked from commit 810acf32d6)
2018-09-30 17:16:40 +03:00
Anton Kindestam ed9d644e06 manpage: minor fix to --drm-format
Looking at other examples, a bar should be used when listing OPT_CHOICE options.

(cherry picked from commit f277f9f6d2)
2018-09-30 17:16:33 +03:00
Tom Yan 5a7aca4be8 demux/packet: fix demux_packet_shorten
for the rawaudio demuxer to do the expected gapless playback

(cherry picked from commit 95636c65e7)
2018-09-30 12:35:13 +03:00
Jan Ekström af39f87258 travis: enable CI for release branches
(cherry picked from commit 085943df25)
2018-09-29 23:07:19 +03:00
Jan Ekström e0682490d7 ao_alsa: log the ALSA state if we get a non-XRUN error
The ALSA state generally can tell us more information in case we
get an unexpected error.

(cherry picked from commit cea4ff3e5f)
2018-09-29 23:07:19 +03:00
Jan Ekström 03e3abcb0c ao_alsa: handle XRUNs separately from other errors
According to ALSA doxy, EPIPE is a synonym to SND_PCM_STATE_XRUN,
and that is a state that we should attempt to automatically recover
from. In case recovery fails, log an error and return zero.

A warning message will still be output for each XRUN since those
are not something we should generally be receiving.

(cherry picked from commit fdc952486a)
2018-09-29 23:07:19 +03:00
Jan Ekström 1dd77e41c1 ao_alsa: early exit get_space if paused or ALSA is not ready
This has been way too long coming, and for me to notice that a
whole lot of ao_alsa functions do an early return if the AO is
paused.

For the STATE_SETUP case, I had this reproduced once, and never
since. Still, seems like we can start calling this function before
the ALSA device has been fully initialized so we might as well
early exit in that case.

(cherry picked from commit 3218a58082)
2018-09-29 23:07:19 +03:00
Ricardo Constantino 8e0b94e7eb man/options: emphasize ytdl_hook's script options
(cherry picked from commit 9c184078a6)
2018-09-29 23:07:15 +03:00
Ricardo Constantino 0f7b08b0fc ytdl_hook: fix audio not being picked up for some sites
(cherry picked from commit 9dbab9661c)
2018-09-29 23:06:49 +03:00
Niklas Haas a8a4c7def7 ao_jack: only auto-connect to audio ports
This prevents ao_jack from auto-connecting to MIDI ports (or other,
hypothetical future port types).

(cherry picked from commit fed0ea111b)
2018-09-29 23:06:49 +03:00
TSaaristo c994a81aa4 encode: fix expected streams when using --lavfi-complex
mpctx->current_track[0][STREAM_VIDEO] (and STREAM_AUDIO) are empty when
using --lavfi-complex. Moving the muxer stream hinting after audio/video chain
initialization and checking if the chains exist fixes encoding with --lavfi-complex.

Previously, the output audio/video streams did not get prepared and the encode
would fail due to unexpected stream addition.

(cherry picked from commit 3744d0bda9)
2018-09-29 23:06:49 +03:00
Niklas Haas 5ae13ad13b mp_image: strip all HDR peak information from SDR clips
By overriding it with 1.0 (aka SDR). This prevents blowing up on
mistagged clips.

Fixes #6111

(cherry picked from commit 48c38f730d)
2018-09-29 23:06:49 +03:00
Tom Yan 0a92548684 ao_pulse: fix tlength calculation
also remove the now unused non-sensical af_fmt_seconds_to_bytes.

(cherry picked from commit 9d6b15ab32)
2018-09-29 23:06:49 +03:00
Michael Hoang 56098c5636 Revert "ao_openal: enable building on OSX"
This reverts commit af6126adbe. Apple's
OpenAL support is ridiculously out of date, revert back to just using
OpenAL Soft on macOS (fixes #4645).

(cherry picked from commit 91786fa99c)
2018-09-29 23:06:49 +03:00
Niklas Haas 312b88d360 vo_gpu: avoid overwriting compute shader block sizes
When using multiple compute shaders as part of the same pass, there can
be a conflict in the block sizes. In the problematic case, the HDR
detection shader can collide with the polar sampling shader. In this
case, the solution is clear - the passes that can handle any size should
"give in" and not overwrite the block sizes.

Fixes #6083.

(cherry picked from commit 1890ca024e)
2018-09-29 23:06:49 +03:00
Hector Martin b97f172faa af_rubberband: reset delay to 0 on reset
This fixes A-V drift on seeking

(cherry picked from commit a10754f038)
2018-09-29 23:06:49 +03:00
Anton Kindestam f3a58e5f4a manpage: fix reference to --tone-mapping by old option name
(cherry picked from commit d2d7dba6ee)
2018-09-29 23:06:49 +03:00
Ricardo Constantino 49606f5a3b ytdl_hook: always load ytdl:// links with ytdl_hook first
Suggested in IRC by sfan5.

(cherry picked from commit d8131568c8)
2018-09-29 23:06:03 +03:00
Michael Hoang 7d5468ace3 osx: Fix initialization and access of service menu
Replace dot syntax with accessor syntax so that clang no longer errors
out due to not finding the property servicesMenu on NSApp.

(cherry picked from commit 4e9e46b9f8)
2018-09-29 22:22:20 +03:00
Akemi a4e7580c5a cocoa-cb: fix crash on macOS 10.10
the colorspace of the layer is only available on 10.11 and upwards.

Fixes #6041

(cherry picked from commit 049816c145)
2018-09-29 22:22:20 +03:00
Akemi 7b91bf7f20 cocoa-cb: fix crash when no screen is available
instead of force unwrapping and chaining the optional vars in our
containsMouseLocation function, safely unwrap and guard the resulting
var.

Fixes #6062

(cherry picked from commit 6bf0edc59c)
2018-09-29 22:22:20 +03:00
Tom Yan 4243d06761 audio/format: decouple af_fmt_is_planar from af_fmt_to_planar
so that af_fmt_to_planar (and hence af_fmt_from_planar) can just
return the input when it is not an interleaved (planar) format.

(cherry picked from commit f2311ff514)
2018-09-29 22:22:20 +03:00
jaseg 4d074a960d manpage: Correct show-text duration default value
duration is parsed as an integer, and the default value is used if ```-1``` is passed. Passing ```-``` as described here causes a parameter value error.

(cherry picked from commit cfecbac863)
2018-09-29 22:22:20 +03:00
pavelxdd 071556efee manpage: fix --vf exclamation mark description
An exclamation mark disables the filter by default instead of
enabling it.

(cherry picked from commit 759a6a259e)
2018-09-29 22:22:20 +03:00
Tom Yan 876341417a audio/format: minor fix for af_fmt_from_planar
See af_fmt_to_planar.

(cherry picked from commit 4e91cb72ef)
2018-09-29 22:22:20 +03:00
Martin Herkt 6a57e1a298 ci: explicitly call waf with python3
Python 2 may not be present in the CI images in the future,
but waf’s shebang line still uses its executable name.
Explicitly call the right major version of the interpreter.

(cherry picked from commit 6eb59fea2f)
2018-09-29 22:22:20 +03:00
Jan Ekström 0e316d7032 ci: do bootstrap outside the docker container
This way the docker container in itself does no networking.

It seems like travis disabled network access from the actual docker
containers.

(cherry picked from commit 2d785f3ea3)
2018-09-29 22:22:20 +03:00
Yclept Nemo 0914da082f stream_smb/stream_file: fix write_buffer
Functions `write` and `smbc_write` are given a diminishing buffer of
incorrect constant size. After partial writes, the code would do another
write of the full original length, failing to subtract the amount
already written.
2018-07-29 12:59:03 +03:00
Yclept Nemo 021bea1592 stream_smb: locking to bypass libsmbclient issues
Thread-unsafe libsmbclient is likely to crash when used simultaneously
across threads. For example, by:

    mpv "smb://...mkv" --sub-file "smb://...srt"

Work around this by locking all calls to this library under a single
global mutex. This is a temporary solution. When the libsmbclient bug
[1] is fixed, switch to the code from branch [2] which uses a new api to
create per-thread smb contexts. Fixes [3].

[1] https://bugzilla.samba.org/show_bug.cgi?id=11413
[2] https://github.com/orbisvicis/mpv/tree/smbclient_threaded_api
[3] https://github.com/mpv-player/mpv/issues/5936

(cherry picked from commit 112b3fa922)
2018-07-29 12:59:03 +03:00
Daniel M. Capella 0d134dc010 manpage: fixup mistaken show playlist/track-list shortcuts
This was mistaken in 496b13227b and
not noticed in review.

(cherry picked from commit 45beb7073a)
2018-07-23 01:33:53 +03:00
820 changed files with 68485 additions and 117334 deletions

No files matched your search

-16
View File
@@ -1,16 +0,0 @@
# To use this config on you editor, follow the instructions at:
# http://editorconfig.org
root = true
[*]
charset = utf-8
insert_final_newline = true
indent_style = space
indent_size = 4
tab_width = 7
max_line_length = 80
trim_trailing_whitespace = true
[.git/COMMIT*]
max_line_length = 72
+26
View File
@@ -0,0 +1,26 @@
### mpv version and platform
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
### Expected behavior
### Actual behavior
### Log file
Make a log file made with -v or --log-file=output.txt, paste it to
https://0x0.st/ or a similar site, and replace this text with a link to it.
Providing a log file is strongly encouraged. It is very helpful for reproducing
bugs or getting important technical context. Without a log it might not be
possible to analyze and fix certain bugs, and your bug report will be closed
or ignored.
### 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,148 +0,0 @@
name: "Report a Linux Issue"
description: "Create a report for a runtime related Linux Issue"
labels: ["os:linux"]
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 follwing 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
- 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.
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 mpv:
- Introduced in version:
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 -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
@@ -1,143 +0,0 @@
name: "Report a macOS Issue"
description: "Create a report for a runtime related macOS Issue"
labels: ["os:mac"]
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
- 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.
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:
- Introduced in version:
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 -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
@@ -1,145 +0,0 @@
name: "Report a Windows Issue"
description: "Create a report for a runtime related Windows Issue"
labels: ["os:win"]
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: `ver` (cmd) or
`"$([Environment]::OSVersion)/$((gp 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name CurrentBuild).CurrentBuild).$((gp 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name UBR).UBR)"` (PowerShell)
- GPU model, driver and 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.
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:
- Introduced in version:
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 -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 approriate `.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
-141
View File
@@ -1,141 +0,0 @@
name: "Report a different Issue"
description: "Create a report for a runtime related Issue"
labels: []
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
- 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.
Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- Platform version:
- GPU model, driver and version:
- Source:
- Introduced in version:
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 -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
@@ -1,70 +0,0 @@
name: "Report a build Problem"
description: "Create a report for a build related Issue"
labels: ["core:meson"]
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
@@ -1,55 +0,0 @@
name: "Request a new Feature"
description: "Create a request for a new feature"
labels: ["meta:feature-request"]
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/)
-12
View File
@@ -1,12 +0,0 @@
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
- name: mpv IRC developer channel
url: https://mpv.io/community/
about: Ask questions related to the development of mpv here
irc://irc.libera.chat/mpv-devel
+6 -4
View File
@@ -1,5 +1,7 @@
Read this before you submit this pull request:
https://github.com/mpv-player/mpv/blob/master/DOCS/contribute.md
Ideally, you shouldn't need enter any text here, and your commit messages should
explain your changes sufficiently (especially why they are needed). Read
https://github.com/mpv-player/mpv/blob/master/DOCS/contribute.md for coding
style and development conventions. Remove this text block, but if you haven't
agreed to it before, leave the following sentence in place:
Reading this link and following the rules will get your pull request reviewed
and merged faster. Nobody wants lazy pull requests.
I agree that my changes can be relicensed to LGPL 2.1 or later.
-569
View File
@@ -1,569 +0,0 @@
name: build
on:
push:
branches:
- 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
strategy:
fail-fast: false
matrix:
include:
- target: i686-w64-mingw32
wine: wine32
- target: x86_64-w64-mingw32
wine: wine64
steps:
- uses: actions/checkout@v4
- name: Get time
id: get_time
run: echo "timestamp=`date +%s%N`" >> $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: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y ccache g++-mingw-w64 gcc-multilib meson nasm ninja-build pkg-config ${{ matrix.wine }}
- name: Install Meson Wraps
run: |
mkdir subprojects -p
meson wrap install mujs
- 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
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@v4
with:
name: mpv-${{ matrix.target }}
path: mpv-git-*.zip
- name: Save Cache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
win32:
runs-on: windows-latest
env:
VS: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
CC: "ccache clang"
CXX: "ccache clang++"
CC_LD: "lld"
CXX_LD: "lld"
WINDRES: "llvm-rc"
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@v4
- 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: x86_64-windows-msvc-${{ steps.get_time.outputs.timestamp }}
restore-keys: x86_64-windows-msvc-
# https://github.com/mesonbuild/meson/pull/11715
- name: Install dependencies
run: |
git clone https://github.com/kasper93/meson --depth 1 -b 8981
python -m pip install build wheel
python -m build --wheel --no-isolation meson
python -m pip install (Get-Item ./meson/dist/meson-*-py3-none-any.whl).FullName
choco install ccache nasm
- 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:\Strawberry\c\bin' }) -join ';'
$env:PATH += ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64"
./ci/build-win32.ps1
- name: Print build log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
run: |
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' -and `
$_ -ne 'C:\Strawberry\c\bin' }) -join ';'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64"
meson test -C build mpv:
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v4
with:
name: mpv-x86_64-windows-msvc
path: |
build/mpv.???
build/vulkan-*.dll
!build/mpv.lib
- name: Save Cache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: x86_64-windows-msvc-${{ steps.get_time.outputs.timestamp }}
macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
cc:
- "clang"
cxx:
- "clang++"
os:
- "macos-12"
- "macos-13"
- "macos-14"
include:
- os: "macos-12"
arch: "intel"
- os: "macos-13"
arch: "intel"
- os: "macos-14"
arch: "arm"
xcode: "Xcode_15.2"
steps:
- uses: actions/checkout@v4
- 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: Change Xcode version
if: ${{ matrix.xcode != '' }}
run: |
sudo xcode-select -s /Applications/${{ matrix.xcode }}.app
- name: Install dependencies
run: |
brew update
brew install -q autoconf automake pkg-config libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg meson uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
- name: Build with meson
id: build
run: |
./ci/build-macos.sh
env:
CC: "${{ matrix.cc }}"
CXX: "${{ matrix.cxx }}"
TRAVIS_OS_NAME: "${{ matrix.os }}"
- name: Create App Bundle
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' }}
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
- uses: actions/upload-artifact@v4
with:
name: mpv-${{ matrix.os }}-${{ matrix.arch }}
path: mpv.tar.gz
linux:
runs-on: ubuntu-latest
container:
image: "registry.opensuse.org/home/mia/images/images/mpv-ci:stable-deps"
env:
CC: "${{ matrix.config.cc }}"
CXX: "${{ matrix.config.cxx }}"
ASAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:detect_leaks=0"
strategy:
matrix:
config:
- {
cc: "gcc",
cxx: "g++",
}
- {
cc: "clang",
cxx: "clang++",
}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
# workaround to avoid "fatal: unsafe repository" error
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build with meson
id: build
run: |
./ci/build-tumbleweed.sh
- 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@v4
- name: Build with meson
id: build
run: |
meson setup build \
--werror \
-Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
-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@v4
- 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 \
samurai
- name: Build with meson
id: build
run: |
./ci/build-linux-old.sh
- 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
openbsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 30 # avoid any weirdness with the VM
steps:
- uses: actions/checkout@v4
- name: Test in OpenBSD VM
uses: cross-platform-actions/action@v0.25.0
with:
operating_system: openbsd
version: '7.5'
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 \
sdl2 \
shaderc \
spirv-cross \
spirv-headers \
uchardet \
vulkan-loader \
vulkan-headers \
zimg
./ci/build-openbsd.sh
meson test -C build
freebsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 30 # avoid any weirdness with the VM
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD VM
uses: cross-platform-actions/action@v0.25.0
with:
operating_system: freebsd
version: '14.1'
run: |
sudo pkg update
sudo pkg install -y \
alsa-lib \
cmake \
evdev-proto \
ffmpeg \
git \
iconv \
jackit \
libarchive \
libbluray \
libcaca \
libcdio-paranoia \
libdvdnav \
libplacebo \
libXinerama \
libxkbcommon \
libxpresent \
libXv \
luajit \
meson \
mujs \
openal-soft \
pipewire \
pkgconf \
pulseaudio \
python3 \
rubberband \
sekrit-twc-zimg \
sdl2 \
sndio \
uchardet \
v4l_compat \
vulkan-headers \
wayland-protocols
./ci/build-freebsd.sh
meson test -C build
msys2:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sys:
- clang32
- clang64
- mingw32
- mingw64
- ucrt64
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@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: git
pacboy: >-
ca-certificates:p
cc:p
ffmpeg:p
lcms2:p
libarchive:p
libass:p
libdvdnav:p
libjpeg-turbo:p
libplacebo:p
lua51:p
meson:p
ninja:p
pkgconf:p
python:p
shaderc:p
spirv-cross:p
vulkan-devel:p
- name: Install dependencies
if: ${{ matrix.sys != 'clang32' && matrix.sys != 'mingw32' }}
run: |
pacboy --noconfirm -S angleproject cppwinrt libcdio-paranoia rst2pdf \
rubberband uchardet vapoursynth
- name: Build with meson
id: build
run: |
./ci/build-msys2.sh meson
env:
SYS: ${{ matrix.sys }}
- 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
-40
View File
@@ -1,40 +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("x86_64-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 }}
-45
View File
@@ -1,45 +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 pull request found"
exit 1
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@v4
- name: Docs
run: |
sudo apt-get install 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@v4
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@v3
with:
sarif_file: cifuzz-sarif/results.sarif
checkout_path: cifuzz-sarif
-35
View File
@@ -1,35 +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@v4
with:
fetch-depth: 50
- name: Lint
run: |
./ci/lint-commit-msg.py
swift-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: norio-nomura/action-swiftlint@3.2.1
lua-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lunarmodules/luacheck@v1
+38 -3
View File
@@ -1,3 +1,38 @@
/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
-108
View File
@@ -1,108 +0,0 @@
local mp_globals = {
mp = {
fields = {
command = {},
commandv = {},
command_native = {},
command_native_async = {},
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
add_hook = {},
disable_key_bindings = {},
enable_key_bindings = {},
find_config_file = {},
format_time = {},
get_mouse_pos = {},
set_key_bindings = {},
set_mouse_area = {},
set_osd_ass = {},
}
},
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
-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
+56
View File
@@ -0,0 +1,56 @@
language: generic
os:
- linux
services:
- docker
sudo: required
env:
matrix:
- CONTAINER=registry.cirno.systems/kiwi/containers/mpv-ci:stable-deps CI_SCRIPT=ci/build-tumbleweed.sh CC=gcc
- CONTAINER=registry.cirno.systems/kiwi/containers/mpv-ci:stable-deps CI_SCRIPT=ci/build-tumbleweed.sh CC=clang
- CONTAINER=registry.cirno.systems/kiwi/containers/mpv-ci:snapshot-deps CI_SCRIPT=ci/build-tumbleweed.sh CC=gcc
- CONTAINER=registry.cirno.systems/kiwi/containers/mpv-ci:snapshot-deps CI_SCRIPT=ci/build-tumbleweed.sh CC=clang
- CONTAINER=registry.cirno.systems/kiwi/containers/mpv-ci-mingw64:i686 CI_SCRIPT=ci/build-mingw64.sh TARGET=i686-w64-mingw32
- CONTAINER=registry.cirno.systems/kiwi/containers/mpv-ci-mingw64:x86_64 CI_SCRIPT=ci/build-mingw64.sh TARGET=x86_64-w64-mingw32
global:
# Coverity token
- secure: "H21mSRlMhk4BKS0xHZvCFGJxteCP0hRVUxTuNfM2Z9HBsyutuLEYMtViLO86VtM+Tqla3xXPzUdS4ozLwI72Ax/5ZUDXACROj73yW6QhFB5D6rLut12+FjqC7M33Qv2hl0xwgNBmR5dsm1ToP37+Wn+ecJQNvN8fkTXF+HVzOEw="
# Travis token for mpv.io
- secure: "nlTVLJK6kRhtXvhKCoJ3YdFGHuKaq/eHowfPw25hqRWuBOZd+HjHY5KIYjV7SxuKFDpJE4GpNcvA3Q31nsqomxpkLYgrwjg6TSazN7ZP+x85ZgV1QGFebrPfGm2n5UR5CAPAwFoeF3pZheLi4bajVzwq1fWW+x3grS188P9OZso="
branches:
only:
- master
- ci
- coverity_scan
- /release\/.*$/
before_install:
- docker pull $CONTAINER
script:
- ./bootstrap.py
- docker run --env CC --env TARGET -v $TRAVIS_BUILD_DIR:/build $CONTAINER /bin/sh -c "cd /build && $CI_SCRIPT"
after_failure: cat ./build/config.log
after_script: TOOLS/travis-rebuild-website
notifications:
email: false
irc:
channels:
- "irc.freenode.org#mpv-devel"
on_success: change
on_failure: always
addons:
coverity_scan:
project:
name: "mpv-player/mpv"
description: "Build submitted via Travis CI"
notification_email: mpv-team@googlegroups.com
build_command_prepend: "./bootstrap.py && ./waf configure"
build_command: "./waf build"
branch_pattern: coverity_scan
+21 -10
View File
@@ -4,7 +4,7 @@ mpv as a whole is licensed under the GNU General Public License GPL version 2
or later (called GPLv2+ in this document, see LICENSE.GPL for full license
text) by default, or the GNU Lesser General Public License LGPL version 2 or
later (LGPLv2.1+ in this document, see LICENSE.LGPL for full license text) if
built with the -Dgpl=false configure switch.
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
@@ -21,8 +21,6 @@ project can relicense the changes to LGPLv2.1+ at a later point without asking
the contributor. This is a safeguard for making potential relicensing of
remaining GPL code to LGPLv2.1+ easier.
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.
@@ -31,11 +29,11 @@ contains the complete SVN and CVS history as well.
Some libraries are GPLv2+ or GPLv3+ only. Building mpv with Samba support makes
it GPLv3+.
mpv can be built as LGPLv2.1+ with the -Dgpl=false configure option. To add a
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:
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)
@@ -45,14 +43,23 @@ 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
demux/demux_tv.c will stay GPL
stream/ai_* will stay GPL (TV code)
stream/audio_in.* will stay GPL (TV code)
stream/dvb* must stay GPL
stream/frequencies.* must stay GPL
stream/stream_cdda.c unknown
stream/stream_dvb.* must stay GPL
stream/stream_dvd.c unknown
stream/stream_dvd_common.* unknown
stream/stream_dvdnav.c unknown
stream/stream_smb.c will stay GPLv3
stream/stream_tv.c will stay GPL
stream/tv* will stay GPL
video/out/vo_caca.c unknown
video/out/vo_direct3d.c unknown
video/out/vo_vaapi.c probably impossible (some company's code)
@@ -69,6 +76,10 @@ The following files are still GPL only (-Dgpl=false disables them):
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
The following files contain some optional GPL code (--enable-lgpl disables it):
options/parse_commandline.c dvd:// expansion
None of the exceptions listed above affect the final binary if it's built as
LGPL. Linked libraries still can affect the final license (for example if
FFmpeg was built as GPL).
+2 -62
View File
@@ -16,7 +16,7 @@ The version number is the same as used for MPV_CLIENT_API_VERSION (see
``client.h`` how to convert between major/minor version numbers and the flat
32 bit integer).
Also, read the section ``Compatibility`` in ``client.h``, and compatibility.rst.
Also, read the section ``Compatibility`` in ``client.h``.
Options, commands, properties
=============================
@@ -32,66 +32,6 @@ API changes
::
--- 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
- remove deprecated mpv_detach_destroy. Use mpv_destroy instead.
- remove obsolete mpv_suspend and mpv_resume
- remove deprecated SCRIPT_INPUT_DISPATCH, PAUSE and UNPAUSE, TRACKS_CHANGED
TRACK_SWITCHED, METADATA_UPDATE, CHAPTER_CHANGE events
--- mpv 0.33.0 ---
1.109 - add MPV_RENDER_API_TYPE_SW and related (software rendering API)
- inactivate the opengl_cb API (always fails to initialize now)
The opengl_cb API was deprecated over 2 years ago. Use the render API
instead.
1.108 - Deprecate MPV_EVENT_IDLE
- add mpv_event_start_file
- add the following fields to mpv_event_end_file: playlist_entry_id,
playlist_insert_id, playlist_insert_num_entries
- add mpv_event_to_node()
- add mpv_client_id()
1.107 - Remove the deprecated qthelper.hpp. This was obviously not part of the
libmpv API, only an "additionally" provided helper, thus this is not
considered an API change. If you are maintaining a project that relies
on this header, you can simply download this file and adjust the
include statement to use it instead:
https://raw.githubusercontent.com/mpv-player/mpv/v0.32.0/libmpv/qthelper.hpp
It is a good idea to write better wrappers for your use, though.
--- mpv 0.31.0 ---
1.107 - Deprecate MPV_EVENT_TICK
--- mpv 0.30.0 ---
1.106 - Add cancel_fn to mpv_stream_cb_info
1.105 - Fix deadlock problems with MPV_RENDER_PARAM_ADVANCED_CONTROL and if
the "vd-lavc-dr" option is enabled (which it is by default).
There were no actual API changes.
API users on older API versions and mpv releases should set
"vd-lavc-dr" to "no" to avoid these issues.
API users must still adhere to the tricky rules documented in render.h
to avoid other deadlocks.
1.104 - Deprecate struct mpv_opengl_drm_params. Replaced by mpv_opengl_drm_params_v2
- Deprecate MPV_RENDER_PARAM_DRM_DISPLAY. Replaced by MPV_RENDER_PARAM_DRM_DISPLAY_V2.
1.103 - redo handling of async commands
- add mpv_event_command and make it possible to return values from
commands issued with mpv_command_async() or mpv_command_node_async()
- add mpv_abort_async_command()
1.102 - rename struct mpv_opengl_drm_osd_size to mpv_opengl_drm_draw_surface_size
- rename MPV_RENDER_PARAM_DRM_OSD_SIZE to MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE
--- mpv 0.29.0 ---
1.101 - add MPV_RENDER_PARAM_ADVANCED_CONTROL and related API
- add MPV_RENDER_PARAM_NEXT_FRAME_INFO and related symbols
@@ -283,7 +223,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
-195
View File
@@ -1,195 +0,0 @@
CLI and API compatibility policy
================================
Human users and API users rely on the mpv/libmpv/scripting/IPC interface not
breaking their use case. On the other hand, active development occasionally
requires breaking things, such as removing old options or changing options in
a way that may break.
This document lists rules when, what, and how incompatible changes can be made.
It's interesting both for mpv developers, who want to change user-visible parts,
and mpv users, who want to know what is guaranteed to remain stable.
Any of the rules below may be overridden by statements in more specific
documentation (for example, if the manpage says that a particular option may be
removed any time, it means that, and the option probably won't even go through
deprecation).
Additions
---------
Additions are basically always allowed. API users etc. are supposed to deal with
the possibility that for example new API functions are added. Some parts of the
API may document how they are extended.
Options, commands, properties, events, hooks (command interface)
----------------------------------------------------------------
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.
(This may also list compatible additions, but it's not a requirement.)
Degrees of importance and compatibility preservation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Critical and central parts of the command interface have the strictest
requirements. It may not be reasonable to break them, and other means to achieve
some change have to be found. For example, the "seek" command is a bit of a
mess, but since changing it would likely affect almost every user, it may be
impossible to break at least the commonly used syntax. If changed anyway, there
should be a deprecation period of at least 1 year, during which the command
still works, and possibly a warning should remain even after this.
Important/often used parts must be deprecated for at least 2 releases before
they can be broken. There must be at least 1 release where the deprecated
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.
Parts for debugging and testing may be removed any time, potentially even
without any sort of documentation.
Currently, the importance of a part is not documented and not even well-defined,
which is probably a mistake.
Renaming or removing options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Typically, renaming an option can be done in a compatible way with OPT_REPLACED.
You may need to check whether the corresponding properties still work (including
messy details like observing properties for changes).
OPT_REMOVED can be used to inform the user of alternatives or reasons for the
removal, which is better than an option not found error. Likewise,
m_option.deprecation_message should be set to something helpful.
Both OPT_REPLACED and OPT_REMOVED can remain in the code for a long time, since
they're unintrusive and hopefully make incompatible changes less painful for
users.
Scripting APIs
--------------
This affects internal scripting APIs (currently Lua and JavaScript).
Vaguely the same rules as with the command interface apply. Since there is a
large number of scripts, an effort should be made to provide compatibility
for old scripts, but it does not need to be stronger than that of the command
interface.
Undocumented parts of the scripting APIs are _not_ guaranteed for compatibility.
This applies especially for internals. Languages like Lua do not have strict
access control (nor does the mpv code try to emulate any), so if a script
accesses private parts, and breaks on the next mpv release, it's not mpv's
problem.
JSON IPC
--------
The JSON IPC is a thin protocol wrapping the libmpv API and the command
interface. Compatibility-wise, it's about the same as the scripting APIs.
The JSON protocol commands should remain as compatible as possible, and it
should probably accept the current way commands are delimited (line breaks)
forever.
The protocol may accept non-standard JSON extensions, but only standard JSON
(possibly with restrictions) is guaranteed for compatibility. Clients which want
to remain compatible should not use any extensions.
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.
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
distinguish between options and filenames must remain consistent (if the
non-deprecated options syntax is used).
Terminal and log output
-----------------------
There are no compatibility guarantees for the terminal output, or the text
logged via ``MPV_EVENT_LOG_MESSAGE`` and similar APIs. In particular, scripts
invoking mpv CLI are extremely discouraged from trying to parse text output,
and should use other mechanisms such as the JSON IPC.
Protocols, filters, demuxers, etc.
----------------------------------
Which of these are present is generally not guaranteed, and can even depend
on compile time settings.
The filter list and their sub-options are considered part of the
command-interface.
libmpv C API
------------
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.
All API changes are documented in client-api-changes.rst.
API compatibility
^^^^^^^^^^^^^^^^^
The API is *always* compatible. Incompatible changes are only allowed on major
API version changes (see ``MPV_CLIENT_API_VERSION``). A major version change is
an extremely rare event, which means usually no API symbols are ever removed.
Essentially removing API functions by making them always return an error, or
making it do nothing is allowed in cases where it is unlikely to break most
clients, but requires a deprecation period of 2 releases. (This has happened to
``mpv_suspend()`` for example.)
API symbols can be deprecated. This should be clearly marked in the doxygen
with ``@deprecated``, and if possible, the affected API symbols should not be
visible if the API user defines ``MPV_ENABLE_DEPRECATED`` to 0.
ABI compatibility
^^^^^^^^^^^^^^^^^
The ABI must never be broken, except on major API version changes. For example,
constants don't change their values.
Structs are tricky. If a struct can be allocated by a user (such as ``mpv_node``),
no fields can be added. (Unless it's an union, and the addition does not change
the offset or alignment of any of the fields or the struct itself. This has
happened to ``mpv_node`` in the past.) If a struct is allocated by libmpv only,
new fields can be appended to the end (for example ``mpv_event``).
The ABI is only backward compatible. This means if a host application is linked
to an older libmpv, and libmpv is updated to a newer version, it will still
work (as in not causing any undefined behavior).
Forward compatibility (an application would work with an older libmpv than it
was linked to) is not required.
+172 -233
View File
@@ -1,270 +1,209 @@
# 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-6.1
depth = 1
[provide]
libavcodec = libavcodec_dep
libavdevice = libavdevice_dep
libavfilter = libavfilter_dep
libavformat = libavformat_dep
libavutil = libavutil_dep
libswresample = libswresample_dep
libswscale = libswscale_dep
EOF
```
3. Build
``` bash
meson setup -Ddefault_library=static -Dprefer_static=true \
-Dc_link_args='-static' -Dcpp_link_args='-static' \
--cross-file cross-file.txt build
ninja -C build mpv.exe mpv.com
```
This will produce fully portabiel, statically linked, ``mpv.exe`` and ``mpv.com``
binaries.
#### Building libmpv
- To also build ``libmpv``, execute the following commands:
``` bash
# For a static library
meson configure build -Dlibmpv=true -Ddefault_library=static
ninja -C build libmpv.a
# For a shared library
meson configure build -Dlibmpv=true -Ddefault_library=shared
ninja -C build libmpv-2.dll
```
- Depending on the use case, you might want to use ``-Dgpl=false`` and review
similar options for subprojects.
- If any of Meson's subprojects are not linked statically, you might need to
specify options like the following example for ffmpeg:
``-Dffmpeg:default_library=static``.
#### Enabling more mpv features
The process above produces a basic mpv build. You can enable additional features.
Check the Meson
[WrapDB packages](https://mesonbuild.com/Wrapdb-projects.html) for available
dependencies or by providing them through other means.
Enhancing mpv with more features is as simple as adding more arguments to the
Meson setup command, for example:
``` bash
-Dlua=enabled -Djavascript=enabled -Dlcms2=enabled -Dlibplacebo:lcms=enabled
```bash
DEST_OS=win32 TARGET=i686-w64-mingw32 ./waf configure
```
they will be automatically downloaded and built by Meson.
[MXE](http://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):
- **Important**: At the time of writing, there is an issue in Meson with
escaping response files.
Example with MXE
----------------
See: [mesonbuild/meson#8981](https://github.com/mesonbuild/meson/issues/8981)
and [mesonbuild/meson#11715](https://github.com/mesonbuild/meson/pull/11715)
```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
#
# http://mxe.cc/#requirements
#
# Scroll down for disto/OS-specific instructions to install them.
If you wish to install a fixed version, follow the steps outlined
[here](https://github.com/mpv-player/mpv/blob/481e498427fc34956ad24b94157553908f5cd638/.github/workflows/build.yml#L132-L135).
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
# Download MXE. Note that compiling the required packages requires about 1.4 GB
# or more!
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.
cd /opt
git clone https://github.com/mxe/mxe mxe
cd mxe
This process will produce a fully static ``mpv.exe`` and ``mpv.com``, as well as
a static ``libmpv.a``.
# Set build options.
## Native Compilation with 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
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.
# 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
### Installing MSYS2
# If you want to build 64 bit version, use this:
# echo "MXE_TARGETS := x86_64-w64-mingw32.static" >> 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.
# Build required packages. The following provide a minimum required to build
# a reasonable mpv binary (though not an absolute minimum).
### Updating MSYS2
make gcc ffmpeg libass jpeg lua
For guidance on updating MSYS2, please refer to the official documentation:
[Updating MSYS2](https://www.msys2.org/docs/updating/).
# Add MXE binaries to $PATH
export PATH=/opt/mxe/usr/bin/:$PATH
### Installing mpv Dependencies
# 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).
``` bash
# Install pacboy and git
pacman -S pactoys git
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,angleproject-git}
```
### 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
---------------------------------
You can build C++ programs in Visual Studio and link them with libmpv. 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
+36 -140
View File
@@ -5,60 +5,35 @@ General
-------
The main contact for mpv development is IRC, specifically #mpv
and #mpv-devel on Libera.chat. GitHub is used for code review and
long term discussions.
and #mpv-devel on Freenode.
Sending patches
---------------
- 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
commit message and authorship information.
- Never send patches to any of the developers email addresses.
- If your changes are not supposed to be merged immediately, mark them as
"[RFC]" in the commit message or the pull request title.
- Be sure to test your changes. If you didn't, please say so in the commit
message and the pull request text.
Copyright of contributions
--------------------------
- The copyright belongs to contributors. The project is a collaborative work. By
sending your changes, you agree to license your contributions according to the
requirements of this project.
- Make a github pull request, or send a link to a plaintext patch created with
``git format-patch``. diffs posted as pastebins (especially if the http link
returns HTML) just cause extra work for everyone, because they lack commit
message and authorship information.
- All new code must be LGPLv2.1+ licensed, or come with the implicit agreement
that it will be relicensed to LGPLv2.1+ later (see ``Copyright`` in the
repository root directory).
- 100% compatible licenses are allowed too.
- Changes in files with more liberal licenses (such as BSD, MIT, or ISC) are
assumed to be dual-licensed under LGPLv2.1+ and the license indicated in the
file header.
- You must be either the exclusive author of the patch, or acknowledge all
authors involved in the commit message. If you take 3rd party code, authorship
and copyright must be properly acknowledged. If you're making changes on
behalf of your employer, and the employer owns the copyright, you must mention
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
and copyright must be properly acknowledged. If the license of the code is not
LGPLv2.1+, this must be mentioned.
- Don't use fake names (something that looks like an actual names, and may be
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
this project, and neither copyright law nor any of the used licenses require
it.
Write good commit messages
--------------------------
- When creating pull requests, be sure to test your changes. If you didn't,
please say so in the pull request message.
- Write informative commit messages. Use present tense to describe the
situation with the patch applied, and past tense for the situation before
the change.
- The subject line (the first line in a commit message) must contain a
- The subject line (the first line in a commit message) should contain a
prefix identifying the sub system, followed by a short description what
impact this commit has. This subject line and the commit message body
must not be longer than 72 characters per line, because it messes up the
shouldn't be longer than 72 characters per line, because it messes up the
output of many git tools otherwise.
For example, you fixed a crash in af_volume.c:
@@ -68,16 +43,7 @@ Write good commit messages
Having a prefix gives context, and is especially useful when trying to find
a specific change by looking at the history, or when running ``git blame``.
Sample prefixes: ``vo_gpu: ...``, ``command: ...``, ``DOCS/input: ...``,
``TOOLS/osxbundle: ...``, ``osc.lua: ...``, etc. You can always check the git
log for commits which modify specific files to see which prefixes are used.
- The first word after the ``:`` is lower case.
- Don't end the subject line with a ``.``.
- Put an empty line between the subject line and the commit message.
If this is missing, it will break display in common git tools.
- The body of the commit message (everything else after the subject line) must
- The body of the commit message (everything else after the subject line) should
be as informative as possible and contain everything that isn't obvious. Don't
hesitate to dump as much information as you can - it doesn't cost you
anything. Put some effort into it. If someone finds a bug months or years
@@ -86,81 +52,35 @@ Write good commit messages
information to test the original bug. The old bug might be reintroduced while
fixing the new bug.
The commit message must be wrapped on 72 characters per line, because git
The commit message should be wrapped on 72 characters per line, because git
tools usually do not break text automatically. On the other hand, you do not
need to break text that would be unnatural to break (like data for test cases,
or long URLs).
- Another summary of good conventions: https://chris.beams.io/posts/git-commit/
Split changes into multiple commits
-----------------------------------
- Follow git good practices, and split independent changes into several commits.
It's usually OK to put them into a single pull request.
Important: put an empty line between the subject line and the commit message.
If this is missing, it will break display in common git tools.
- Try to separate cosmetic and functional changes. It's ok to make a few
additional cosmetic changes in the same file you're working on. But don't do
something like reformatting a whole file, and hiding an actual functional
change in the same commit.
- Splitting changes does _not_ mean that you should make them as fine-grained
as possible. Commits should form logical steps in development. The way you
split changes is important for code review and analyzing bugs.
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
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
"changes from all commits" view (which just encourages bad git and review
practices).
Touching user-visible parts may require updating the mpv docs
-------------------------------------------------------------
- Most user-visible things are normally documented in DOCS/man/. If your commit
touches documented behavior, list of sub-options, etc., you need to adjust the
documentation.
- These changes usually go into the same commit that changes the code.
- 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.
- 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.
documented in options.rst. Changes to input properties or input commands must
be documented in input.rst. All changes to the user interface (options,
properties, commands) must be documented with a small note in
interface-changes.rst (although documenting additions is optional, and
obscure corner cases can potentially be skipped too). Changes to the libmpv
API must be reflected in the libmpv's headers doxygen, and should be
documented in client-api-changes.rst.
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).
- Add a single space between keywords and binary operators. There are some other
cases where spaces must be added. Example:
cases where spaces should be added. Example:
```C
if ((a * b) > c) {
@@ -168,9 +88,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.
@@ -193,7 +113,7 @@ mpv uses C11 with K&R formatting, with some exceptions.
do_something();
}
```
- If the if has an else branch, both branches must use braces, even if they're
- If the if has an else branch, both branches should use braces, even if they're
technically redundant.
Example:
@@ -223,32 +143,18 @@ mpv uses C11 with K&R formatting, with some exceptions.
(If the if body is simple enough, this rule can be skipped.)
- Remove any trailing whitespace.
- Do not make stray whitespaces changes.
Header #include statement order
-------------------------------
The order of ``#include`` statements in the source code is not very consistent.
New code must follow the following conventions:
- Put standard includes (``#include <stdlib.h>`` etc.) on the top,
- then after a blank line, add library includes (``#include <zlib.h>`` etc.)
- then after a blank line, add internal includes (``#include "player/core.h"``)
- sort them alphabetically within these sections
General coding
--------------
- Use C11. Also freely make use of C11 features if it's appropriate, but do not
use 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.
- Use C99. Also freely make use of C99 features if it's appropriate, such as
stdbool.h.
- Don't use GNU-only features. In some cases they may be warranted, if they
are optional (such as attributes enabling printf-like format string checks).
But in general, standard C99 should 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.
- 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.
@@ -256,14 +162,6 @@ General coding
channel first. There might be a better way to add a feature and it can avoid
wasted work.
Code of Conduct
---------------
Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms.
The Contributor Code of Conduct can be found here:
https://www.contributor-covenant.org/version/2/0/code_of_conduct/
Rules for git push access
-------------------------
@@ -282,9 +180,7 @@ you got access, the following rules must be followed:
major bug fixes, or you're the original author of the code). If there is more
than one maintainer, you may need to come to an agreement with the others how
to handle this to avoid conflict.
- If you make a pull requests (especially if it's to code you maintain), and you
want reviews, explicitly ping the people from which you expect reviews.
- As a maintainer, you can approve pull requests by others to "your" code.
- As a maintainer, you can approve pushes by others to "your" code.
- If you approve or merge 3rd party changes, make sure they follow the general
development rules.
- Changes to user interface and public API must always be approved by the
+1 -240
View File
@@ -100,18 +100,6 @@ entries affect all other file entries in the EDL file. Their format is highly
implementation specific. They should generally follow the file header, and come
before any file entries.
Disabling chapter generation and copying
========================================
By default, chapters from the source ranges are copied to the virtual file's
chapters. Also, a chapter is inserted after each range. This can be disabled
with the ``no_chapters`` header.
Example::
!no_chapters
MP4 DASH
========
@@ -143,184 +131,6 @@ The current implementation will
- not add segment boundaries as chapter points
- require full compatibility between all segments (same codec etc.)
Another header part of this mechanism is ``no_clip``. This header is similar
to ``mp4_dash``, but does not include on-demand opening/closing of segments,
and does not support init segments. It also exists solely to support internal
ytdl requirements. Using ``no_clip`` with segments is not recommended and
probably breaks. ``mp4_dash`` already implicitly does a variant of ``no_clip``.
The ``mp4_dash`` and ``no_clip`` headers are not part of the core EDL format.
They may be changed or removed at any time, depending on mpv's internal
requirements.
Separate files for tracks
=========================
The special ``new_stream`` header lets you specify separate parts and time
offsets for separate tracks. This can for example be used to source audio and
video track from separate files.
Example::
# mpv EDL v0
video.mkv
!new_stream
audio.mkv
This adds all tracks from both files to the virtual track list. Upon playback,
the tracks will be played at the same time, instead of appending them. The files
can contain more than 1 stream; the apparent effect is the same as if the second
part after the ``!new_stream`` part were in a separate ``.edl`` file and added
with ``--external-file``.
Note that all metadata between the stream sets created by ``new_stream`` is
disjoint. Global metadata is taken from the first part only.
In context of mpv, this is redundant to the ``--audio-file`` and
``--external-file`` options, but (as of this writing) has the advantage that
this will use a unified cache for all streams.
The ``new_stream`` header is not part of the core EDL format. It may be changed
or removed at any time, depending on mpv's internal requirements.
If the first ``!new_stream`` is redundant, it is ignored. This is the same
example as above::
# mpv EDL v0
!new_stream
video.mkv
!new_stream
audio.mkv
Note that ``!new_stream`` must be the first header. Whether the parser accepts
(i.e. ignores) or rejects other headers before that is implementation specific.
Track metadata
==============
The special ``track_meta`` header can set some specific metadata fields of the
current ``!new_stream`` partition. The tags are applied to all tracks within
the partition. It is not possible to set the metadata for individual tracks (the
feature was needed only for single-track media).
It provides following parameters change track metadata:
``lang``
Set the language tag.
``title``
Set the title tag.
``byterate``
Number of bytes per second this stream uses. (Purely informational.)
``index``
The numeric index of the track this should map to (default: -1). This is
the 0-based index of the virtual stream as seen by the player, enumerating
all audio/video/subtitle streams. If nothing matches, this is silently
discarded. The special index -1 (the default) has two meanings: if there
was a previous meta data entry (either ``!track_meta`` or ``!delay_open``
element since the last ``!new_stream``), then this element manipulates
the previous meta data entry. If there was no previous entry, a new meta
data entry that matches all streams is created.
Example::
# mpv EDL v0
!track_meta,lang=bla,title=blabla
file.mkv
!new_stream
!track_meta,title=ducks
sub.srt
If ``file.mkv`` has an audio and a video stream, both will use ``blabla`` as
title. The subtitle stream will use ``ducks`` as title.
The ``track_meta`` header is not part of the core EDL format. It may be changed
or removed at any time, depending on mpv's internal requirements.
Global metadata
===============
The special ``global_tags`` header can set metadata fields (aka tags) of the EDL
file. This metadata is supposed to be informational, much like for example ID3
tags in audio files. Due to lack of separation of different kinds of metadata it
is unspecified what names are allowed, how they are interpreted, and whether
some of them affect playback functionally. (Much of this is unfortunately
inherited from FFmpeg. Another consequence of this is that FFmpeg "normalized"
tags are recognized, or stuff like replaygain tags.)
Example::
!global_tags,title=bla,something_arbitrary=even_more_arbitrary
Any parameter names are allowed. Repeated use of this adds to the tag list. If
``!new_stream`` is used, the location doesn't matter.
May possibly be ignored in some cases, such as delayed media opening.
Delayed media opening
=====================
The special ``delay_open`` header can be used to open the media URL of the
stream only when the track is selected for the first time. This is supposed to
be an optimization to speed up opening of a remote stream if there are many
tracks for whatever reasons.
This has various tricky restrictions, and also will defer failure to open a
stream to "later". By design, it's supposed to be used for single-track streams.
Using multiple segments requires you to specify all offsets and durations (also
it was never tested whether it works at all). Interaction with ``mp4_dash`` may
be strange.
You can describe multiple sub-tracks by using multiple ``delay_open`` headers
before the same source URL. (If there are multiple sub-tracks of the same media
type, then the mapping to the real stream is probably rather arbitrary.) If the
source contains tracks not described, a warning is logged when the delayed
opening happens, and the track is hidden.
This has the following parameters:
``media_type``
Required. Must be set to ``video``, ``audio``, or ``sub``. (Other tracks in
the opened URL are ignored.)
``codec``
The mpv codec name that is expected. Although mpv tries to initialize a
decoder with it currently (and will fail track selection if it does not
initialize successfully), it is not used for decoding - decoding still uses
the information retrieved from opening the actual media information, and may
be a different codec (you should try to avoid this, of course). Defaults to
``null``.
Above also applies for similar fields such as ``w``. These fields are
mostly to help with user track pre-selection.
``flags``
A ``+`` separated list of boolean flags. Currently defined flags:
``default``
Set the default track flag.
``forced``
Set the forced track flag.
Other values are ignored after triggering a warning.
``w``, ``h``
For video codecs: expected video size. See ``codec`` for details.
``fps``
For video codecs: expected video framerate, as integer. (The rate is usually
only crudely reported, and it makes no sense to expect exact values.)
``samplerate``
For audio codecs: expected sample rate, as integer.
The ``delay_open`` header is not part of the core EDL format. It may be changed
or removed at any time, depending on mpv's internal requirements.
Timestamp format
================
@@ -328,8 +138,7 @@ Currently, time values are floating point values in seconds.
As an extension, you can set the ``timestamps=chapters`` option. If this option
is set, timestamps have to be integers, and refer to chapter numbers, starting
with 0. The default value for this parameter is ``seconds``, which means the
time is as described in the previous paragraph.
with 0.
Example::
@@ -338,54 +147,6 @@ Example::
Plays chapter 3 and ends with the start of chapter 7 (4 chapters later).
Implicit chapters
=================
mpv will add one chapter per segment entry to the virtual timeline.
By default, the chapter's titles will match the entries' filenames.
You can override set the ``title`` option to override the chapter title for
that segment.
Example::
# mpv EDL v0
cap.ts,5,240
OP.mkv,0,90,title=Show Opening
The virtual timeline will have two chapters, one called "cap.ts" from 0-240s
and a second one called "Show Opening" from 240-330s.
Entry which defines the track layout
====================================
Normally, you're supposed to put only files with compatible layouts into an EDL
file. However, at least the mpv implementation accepts entries that use
different codecs, or even have a different number of audio/video/subtitle
tracks. In this case, it's not obvious, which virtual tracks the EDL show should
expose when being played.
Currently, mpv will apply an arbitrary heuristic which tracks the EDL file
should expose. (Before mpv 0.30.0, it always used the first source file in the
segment list.)
You can set the ``layout`` option to ``this`` to make a specific entry define
the track layout.
Example::
# mpv EDL v0
file_with_2_streams.ts,5,240
file_with_5_streams.mkv,0,90,layout=this
The way the different virtual EDL tracks are associated with the per-segment
ones is highly implementation-defined, and uses a heuristic. If a segment is
missing a track, there will be a "hole", and bad behavior may result. Improving
this is subject to further development (due to being fringe cases, they don't
have a high priority).
If future versions of mpv change this again, this option may be ignored.
Syntax of EDL URIs
==================
+39 -43
View File
@@ -3,26 +3,26 @@ General usage
::
mpv infile --o=outfile [--of=outfileformat] [--ofopts=formatoptions] [--orawts] \
mpv infile -o outfile [-of outfileformat] [-ofopts formatoptions] [-orawts] \
[(any other mpv options)] \
--ovc=outvideocodec [--ovcopts=outvideocodecoptions] \
--oac=outaudiocodec [--oacopts=outaudiocodecoptions]
-ovc outvideocodec [-ovcopts outvideocodecoptions] \
-oac outaudiocodec [-oacopts outaudiocodecoptions]
Help for these options is provided if giving help as parameter, as in::
mpv --ovc=help
mpv -ovc help
The suboptions of these generally are identical to ffmpeg's (as option parsing
is simply delegated to ffmpeg). The option --ocopyts enables copying timestamps
is simply delegated to ffmpeg). The option -ocopyts enables copying timestamps
from the source as-is, instead of fixing them to match audio playback time
(note: this doesn't work with all output container formats); --orawts even turns
(note: this doesn't work with all output container formats); -orawts even turns
off discontinuity fixing.
Note that if neither --ofps nor --oautofps is specified, VFR encoding is assumed
and the time base is 24000fps. --oautofps sets --ofps to a guessed fps number
Note that if neither -ofps nor -oautofps is specified, VFR encoding is assumed
and the time base is 24000fps. -oautofps sets -ofps to a guessed fps number
from the input video. Note that not all codecs and not all formats support VFR
encoding, and some which do have bugs when a target bitrate is specified - use
--ofps or --oautofps to force CFR encoding in these cases.
-ofps or -oautofps to force CFR encoding in these cases.
Of course, the options can be stored in a profile, like this .config/mpv/mpv.conf
section::
@@ -30,13 +30,9 @@ section::
[myencprofile]
vf-add = scale=480:-2
ovc = libx264
ovcopts-add = preset=medium
ovcopts-add = tune=fastdecode
ovcopts-add = preset=medium,tune=fastdecode
ovcopts-add = crf=23
ovcopts-add = maxrate=1500k
ovcopts-add = bufsize=1000k
ovcopts-add = rc_init_occupancy=900k
ovcopts-add = refs=2
ovcopts-add = maxrate=1500k,bufsize=1000k,rc_init_occupancy=900k,refs=2
ovcopts-add = profile=baseline
oac = aac
oacopts-add = b=96k
@@ -48,7 +44,7 @@ to encoding. This is not the case anymore.)
One can then encode using this profile using the command::
mpv infile --o=outfile.mp4 --profile=myencprofile
mpv infile -o outfile.mp4 -profile myencprofile
Some example profiles are provided in a file
etc/encoding-profiles.conf; as for this, see below.
@@ -62,10 +58,10 @@ for.
Typical MPEG-4 Part 2 ("ASP", "DivX") encoding, AVI container::
mpv infile --o=outfile.avi \
mpv infile -o outfile.avi \
--vf=fps=25 \
--ovc=mpeg4 --ovcopts=qscale=4 \
--oac=libmp3lame --oacopts=b=128k
-ovc mpeg4 -ovcopts qscale=4 \
-oac libmp3lame -oacopts ab=128k
Note: AVI does not support variable frame rate, so the fps filter must be used.
The frame rate should ideally match the input (25 for PAL, 24000/1001 or
@@ -73,22 +69,22 @@ The frame rate should ideally match the input (25 for PAL, 24000/1001 or
Typical MPEG-4 Part 10 ("AVC", "H.264") encoding, Matroska (MKV) container::
mpv infile --o=outfile.mkv \
--ovc=libx264 --ovcopts=preset=medium,crf=23,profile=baseline \
--oac=libopus --oacopts=qscale=3
mpv infile -o outfile.mkv \
-ovc libx264 -ovcopts preset=medium,crf=23,profile=baseline \
-oac libvorbis -oacopts qscale=3
Typical MPEG-4 Part 10 ("AVC", "H.264") encoding, MPEG-4 (MP4) container::
mpv infile --o=outfile.mp4 \
--ovc=libx264 --ovcopts=preset=medium,crf=23,profile=baseline \
--oac=aac --oacopts=b=128k
mpv infile -o outfile.mp4 \
-ovc libx264 -ovcopts preset=medium,crf=23,profile=baseline \
-oac aac -oacopts ab=128k
Typical VP8 encoding, WebM (restricted Matroska) container::
mpv infile -o outfile.mkv \
--of=webm \
--ovc=libvpx --ovcopts=qmin=6,b=1000000k \
--oac=libopus --oacopts=qscale=3
-of webm \
-ovc libvpx -ovcopts qmin=6,b=1000000k \
-oac libvorbis -oacopts qscale=3
Device targets
@@ -111,18 +107,18 @@ section.
Refer to the top of that file for more comments - in a nutshell, the following
options are added by it::
--profile=enc-to-dvdpal # DVD-Video PAL, use dvdauthor -v pal+4:3 -a ac3+en
--profile=enc-to-dvdntsc # DVD-Video NTSC, use dvdauthor -v ntsc+4:3 -a ac3+en
--profile=enc-to-bb-9000 # MP4 for Blackberry Bold 9000
--profile=enc-to-nok-6300 # 3GP for Nokia 6300
--profile=enc-to-psp # MP4 for PlayStation Portable
--profile=enc-to-iphone # MP4 for iPhone
--profile=enc-to-iphone-4 # MP4 for iPhone 4 (double res)
--profile=enc-to-iphone-5 # MP4 for iPhone 5 (even larger res)
-profile enc-to-dvdpal DVD-Video PAL, use dvdauthor -v pal+4:3 -a ac3+en
-profile enc-to-dvdntsc DVD-Video NTSC, use dvdauthor -v ntsc+4:3 -a ac3+en
-profile enc-to-bb-9000 MP4 for Blackberry Bold 9000
-profile enc-to-nok-6300 3GP for Nokia 6300
-profile enc-to-psp MP4 for PlayStation Portable
-profile enc-to-iphone MP4 for iPhone
-profile enc-to-iphone-4 MP4 for iPhone 4 (double res)
-profile enc-to-iphone-5 MP4 for iPhone 5 (even larger res)
You can encode using these with a command line like::
mpv infile --o=outfile.mp4 --profile=enc-to-bb-9000
mpv infile -o outfile.mp4 -profile enc-to-bb-9000
Of course, you are free to override options set by these profiles by specifying
them after the -profile option.
@@ -133,19 +129,19 @@ What works
* Encoding at variable frame rate (default)
* Encoding at constant frame rate using --vf=fps=RATE
* 2-pass encoding (specify flags=+pass1 in the first pass's --ovcopts, specify
* 2-pass encoding (specify flags=+pass1 in the first pass's -ovcopts, specify
flags=+pass2 in the second pass)
* Hardcoding subtitles using vobsub, ass or srt subtitle rendering (just
configure mpv for the subtitles as usual)
* Hardcoding any other mpv OSD (e.g. time codes, using --osdlevel=3 and
--vf=expand=::::1)
* Hardcoding any other mpv OSD (e.g. time codes, using -osdlevel 3 and -vf
expand=::::1)
* Encoding directly from a DVD, network stream, webcam, or any other source
mpv supports
* Using x264 presets/tunings/profiles (by using profile=, tune=, preset= in the
--ovcopts)
-ovcopts)
* Deinterlacing/Inverse Telecine with any of mpv's filters for that
* Audio file converting: mpv --o=outfile.m4a infile.flac --no-video
--oac=aac --oacopts=b=320k
* Audio file converting: mpv -o outfile.mp3 infile.flac -no-video -oac
libmp3lame -oacopts ab=320k
What does not work yet
======================
+5 -569
View File
@@ -7,583 +7,20 @@ mpv provides access to its internals via the following means:
- commands
- properties
- events
- hooks
The sum of these mechanisms is sometimes called command interface.
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.
Also see compatibility.rst.
This document lists changes to them. New options/commands/etc. are not always
listed.
**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.
Interface changes
=================
::
--- mpv 0.40.0 ---
--- 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.
- 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 implictly saves cache files in XDG_CACHE_HOME by default. This only has
an effect if the user enables options that would lead to cache being stored and
only makes a difference on linux/bsd systems.
- `--cache-on-disk` no longer requires explictly setting the `--cache-dir` option
- add `--icc-cache` and `--gpu-shader-cache` options to control whether or not to
save cache files for these features; explictly setting `--icc-cache-dir` and
`--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`,
`--interpolation-preserve` `--lut`, `--lut-type`, `--image-lut`,
`--image-lut-type` and `--target-lut` along with it.
- add `--target-colorspace-hint`
- add `--tone-mapping-crosstalk`
- add `--tone-mapping` options `auto`, `spline` and `bt.2446a`
- add `--inverse-tone-mapping`
- add `--gamut-mapping-mode`, replacing `--gamut-clipping` and `--gamut-warning`
- add `--tone-mapping-mode`, replacing `--tone-mapping-desaturate` and
`--tone-mapping-desaturate-exponent`.
- add `dolbyvision` sub-parameter to `format` video filter
- `--sub-visibility` no longer has any effect on secondary subtitles
- add `film-grain` sub-parameter to `format` video filter
- add experimental `--vo=dmabuf-wayland` video output driver
- add `--x11-present` for controlling whether to use xorg's present extension
- add `engine` option to the `rubberband` audio filter to support the new
engine introduced in rubberband 3.0.0. Defaults to `finer` (new engine).
- add `--wayland-configure-bounds` option
- deprecate `--gamma-factor`
- deprecate `--gamma-auto`
- remove `--vulkan-disable-events`
- add `--glsl-shader-opts`
--- mpv 0.34.0 ---
- deprecate selecting by card number with `--drm-connector`, add
`--drm-device` which can be used instead
- add `--screen-name` and `--fs-screen-name` flags to allow selecting the
screen by its name instead of the index
- add `--macos-geometry-calculation` to change the rectangle used for screen
position and size calculation. the old behavior used the whole screen,
which didn't take the menu bar and Dock into account. The new default
behaviour includes both. To revert to the old behavior set this to
`whole`.
- add an additional optional `albumart` argument to the `video-add` command,
which tells mpv to load the given video as album art.
- undeprecate `--cache-secs` option
- remove `--icc-contrast` and introduce `--icc-force-contrast`. The latter
defaults to the equivalent of the old `--icc-contrast=inf`, and can
instead be used to specifically set the contrast to any value.
- add a `--watch-later-options` option to allow configuring which
options quit-watch-later saves
- make `current-window-scale` writeable and use it in the default input.conf
- add `--input-builtin-bindings` flag to control loading of built-in key
bindings during start-up (default: yes).
- add ``track-list/N/image`` sub-property
- remove `--opengl-restrict` option
- js custom-init: use filename ~~/init.js instead of ~~/.init.js (dot)
--- mpv 0.33.0 ---
- add `--d3d11-exclusive-fs` flag to enable D3D11 exclusive fullscreen mode
when the player enters fullscreen.
- directories in ~/.mpv/scripts/ (or equivalent) now have special semantics
(see mpv Lua scripting docs)
- 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
- 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
libmpv API (mpv_hook_add(), mpv_hook_continue()), or the Lua scripting
wrappers (mp.add_hook()).
- improve how property change notifications are delivered on events and on
hooks. In particular, a hook event is only returned to a client after all
changes initiated before the hook point were delivered to the same client.
In addition, it should no longer happen that events and property change
notifications were interleaved in bad ways (it could happen that a
property notification delivered after an event contained a value that was
valid only before the event happened).
- the playlist-pos and playlist-pos-1 properties now can return and accept
-1, and are never unavailable. Out of range indexes are now accepted, but
behave like writing -1.
- the playlist-pos and playlist-pos-1 properties deprecate the current
behavior when writing back the current value to the property: currently,
this restarts playback, but in the future, it will do nothing.
Using the "playlist-play-index" command is recommended instead.
- add "playlist-play-index" command
- add playlist-current-pos, playlist-playing-pos properties
- Lua end-file events set the "error" field; this is deprecated; use the
"file_error" instead for this specific event. Scripts relying on the
"error" field for end-file will silently break at some point in the
future.
- remove deprecated --input-file option, add --input-ipc-client, which is
vaguely a replacement of the removed option, but not the same
- change another detail for track selection options (see --aid manpage
entry)
- reading loop-file property as native property or mpv_node will now return
"inf" instead of boolean true (also affects loop option)
- remove some --vo-direct3d-... options (it got dumbed down; use --vo=gpu)
- remove video-params/plane-depth property (was too vaguely defined)
- remove --video-sync-adrop-size option (implementation was changed, no
replacement for what this option did)
- undeprecate --video-sync=display-adrop
- deprecate legacy auto profiles (profiles starting with "extension." and
"protocol."). Use conditional auto profiles instead.
- the "subprocess" command does not connect spawned processes' stdin to
mpv's stdin anymore. Instead, stdin is connected to /dev/null by default.
To get the old behavior, set the "passthrough_stdin" argument to true.
- key/value list options do not accept ":" as item separator anymore,
only ",". This means ":" is always considered part of the value.
- remove deprecated --vo-vdpau-deint option
- add `delete-watch-later-config` command to complement
`write-watch-later-config`
--- mpv 0.32.0 ---
- change behavior when using legacy option syntax with options that start
with two dashes (``--`` instead of a ``-``). Now, using the recommended
syntax is required for options starting with ``--``, which means an option
value must be strictly passed after a ``=``, instead of as separate
argument. For example, ``--log-file f.txt`` was previously accepted and
behaved like ``--log-file=f.txt``, but now causes an error. Use of legacy
syntax that is still supported now prints a deprecation warning.
--- mpv 0.31.0 ---
- add `--resume-playback-check-mtime` to check consistent mtime when
restoring playback state.
- add `--d3d11-output-csp` to enable explicit selection of a D3D11
swap chain color space.
- the --sws- options and similar now affect vo_image and screenshot
conversion (does not matter as much for vo_gpu, which does most of this
with shaders)
- add a builtin "sw-fast" profile, which restores performance settings
for software video conversion. These were switched to higher quality since
mpv 0.30.0 (related to the previous changelog entry). This affects video
outputs like vo_x11 and vo_drm, and screenshots, but not much else.
- deprecate --input-file (there are no plans to remove this short-term,
but it will probably eventually go away <- that was a lie)
- deprecate --video-sync=display-adrop (might be removed if it's in the way;
undeprecated or readded if it's not too much of a problem)
- 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)
- deprecate --display-fps, introduce --override-display-fps. The display-fps
property now is unavailable if no VO exists (or the VO did not return a
display FPS), instead of returning the option value in this case. The
property will keep existing, but writing to it is deprecated.
- the vf/af properties now do not reject the set value anymore, even if
filter chain initialization fails. Instead, the vf/af options are always
set to the user's value, even if it does not reflect the "runtime" vf/af
chain.
- the vid/aid/sid/secondary-sid properties (and their aliases: "audio",
"video", "sub") will now allow setting any track ID; before this change,
only IDs of actually existing tracks could be set (the restriction was
active the MPV_EVENT_FILE_LOADED/"file-loaded" event was sent). Setting
an ID for which no track exists is equivalent to disabling it. Note that
setting the properties to non-existing tracks may report it as selected
track for a small time window, until it's forced back to "no". The exact
details how this is handled may change in the future.
- remove old Apple Remote support, including --input-appleremote
- add MediaPlayer support and remove the old Media Key event tap on macOS.
this possibly also re-adds the Apple Remote support
- the "edition" property now strictly returns the value of the option,
instead of the runtime value. The new "current-edition" property needs to
be queried to read the runtime-chosen edition. This is a breaking change
for any users which expected "edition" to return the runtime-chosen
edition at default settings (--edition=auto).
- the "window-scale" property now strictly returns the value of the option,
instead of the actual size of the window. The new "current-window-scale"
property needs to be queried to read the value as indicated by the current
window size. This is a breaking change.
- explicitly deprecate passing more than 1 item to "-add" suffix in key/value
options (for example --script-opts-add). This was actually always
deprecated, like with other list options, but the option parser did not
print a warning in this particular case.
- deprecate -del for list options (use -remove instead, which is by content
instead of by integer index)
- if `--fs` is used but `--fs-screen` is not set, mpv will now use `--screen`
instead.
- change the default of --hwdec to "no" on RPI. The default used to be "mmal"
specifically if 'Raspberry Pi support' was enabled at configure time
(equivalent to --enable-rpi). Use --hwdec=mmal to get the old behavior.
--- mpv 0.30.0 ---
- add `--d3d11-output-format` to enable explicit selection of a D3D11
swap chain format.
- rewrite DVB channel switching to use an integer value
`--dvbin-channel-switch-offset` for switching instead of the old
stream controls which are now gone. Cycling this property up or down will
change the offset to the channel which was initially tuned to.
Example for `input.conf`: `H cycle dvbin-channel-switch-offset up`,
`K cycle dvbin-channel-switch-offset down`.
- adapt `stream_dvb` to support writing to `dvbin-prog` at runtime
and also to consistently use dvbin-configuration over URI parameters
when provided
- add `--d3d11-adapter` to enable explicit selection of a D3D11 rendering
adapter by name.
- rename `--drm-osd-plane-id` to `--drm-draw-plane`, `--drm-video-plane-id` to
`--drm-drmprime-video-plane` and `--drm-osd-size` to `--drm-draw-surface-size`
to better reflect what the options actually control, that the values they
accept aren't actually internal DRM ID's (like with similar options in
ffmpeg's KMS support), and that the video plane is only used when the drmprime
overlay hwdec interop is active, with the video being drawn to the draw plane
otherwise.
- in addition to the above, the `--drm-draw-plane` and `--drm-drmprime-video-plane`
options now accept either an integer index, or the values primary or overlay.
`--drm-draw-plane` now defaults to primary and `--drm-drmprime-video-plane`
defaults to overlay. This should be similar to previous behavior on most drivers
due to how planes are usually sorted.
- rename --opensles-frames-per-buffer to --opensles-frames-per-enqueue to
better reflect its purpose. In the past it overrides the buffer size the AO
requests (but not the default/value of the generic --audio-buffer option).
Now it only guarantees that the soft buffer size will not be smaller than
itself while setting the size per Enqueue.
- add --opensles-buffer-size-in-ms, allowing user to tune the soft buffer size.
It overrides the --audio-buffer option unless it's set to 0 (with the default
being 250).
- remove `--linear-scaling`, replaced by `--linear-upscaling` and
`--linear-downscaling`. This means that `--sigmoid-upscaling` no longer
implies linear light downscaling as well, which was confusing.
- the built-in `gpu-hq` profile now includes` --linear-downscaling`.
- support for `--spirv-compiler=nvidia` has been removed, leaving `shaderc`
as the only option. The `--spirv-compiler` option itself has been marked
as deprecated, and may be removed in the future.
- split up `--tone-mapping-desaturate`` into strength + exponent, instead of
only using a single value (which previously just controlled the exponent).
The strength now linearly blends between the linear and nonlinear tone
mapped versions of a color.
- add --hdr-peak-decay-rate and --hdr-scene-threshold-low/high
- add --tone-mapping-max-boost
- ipc: require that "request_id" fields are integers. Other types are still
accepted for compatibility, but this will stop in the future. Also, if no
request_id is provided, 0 will be assumed.
- mpv_command_node() and mp.command_native() now support named arguments
(see manpage). If you want to use them, use a new version of the manpage
as reference, which lists the definitive names.
- edition and disc title switching will now fully reload playback (may have
consequences for scripts, client API, or when using file-local options)
- with the removal of the stream cache, the following properties and options were
dropped: `cache`, `cache-size`, `cache-free`, `cache-used`, `--cache-default`,
`--cache-initial`, `--cache-seek-min`, `--cache-backbuffer`, `--cache-file`,
`--cache-file-size`
- the --cache option does not take a number value anymore
- remove async playback abort hack. This may make it impossible to abort
playback if --demuxer-thread=no is forced.
- remove `--macos-title-bar-style`, replaced by `--macos-title-bar-material`
and `--macos-title-bar-appearance`.
- The default for `--vulkan-async-compute` has changed to `yes` from `no`
with the move to libplacebo as the back-end for vulkan rendering.
- Remove "disc-titles", "disc-title", "disc-title-list", and "angle"
properties. dvd:// does not support title ranges anymore.
- Remove all "tv-..." options and properties, along with the classic Linux
analog TV support.
- remove "program" property (no replacement)
- always prefer EGL over GLX, which helps with AMD/vaapi, but will break
vdpau with --vo=gpu - use --gpu-context=x11 to be able to use vdpau. This
does not affect --vo=vdpau or --hwdec=vdpau-copy.
- remove deprecated --chapter option
- deprecate --record-file
- add `--demuxer-cue-codepage`
- add ``track-list/N/demux-bitrate``, ``track-list/N/demux-rotation`` and
``track-list/N/demux-par`` property
- Deprecate ``--video-aspect`` and add ``--video-aspect-override`` to
replace it. (The `video-aspect` option remains unchanged.)
--- mpv 0.29.1 ---
- add --cocoa-cb-sw-renderer to control the usage of Apple Software Renderer
--- mpv 0.29.0 ---
- drop --opensles-sample-rate, as --audio-samplerate should be used if desired
- drop deprecated --videotoolbox-format, --ff-aid, --ff-vid, --ff-sid,
@@ -668,11 +105,10 @@ Interface changes
of 3D content doesn't justify such an option anyway.
- change cycle-values command to use the current value, instead of an
internal counter that remembered the current position.
- edition and disc title switching will now fully reload playback (may have
consequences for scripts, client API, or when using file-local options)
- remove deprecated ao/vo auto profiles. Consider using scripts like
auto-profiles.lua instead.
- --[c]scale-[w]param[1|2] and --tone-mapping-param now accept "default",
and if set to that value, reading them as property will also return
"default", instead of float nan as in previous versions
--- mpv 0.28.0 ---
- rename --hwdec=mediacodec option to mediacodec-copy, to reflect
conventions followed by other hardware video decoding APIs
-1
View File
@@ -1 +0,0 @@
deprecate `--foo`, instead use `--bar=foo` as a replacement
+52 -56
View File
@@ -19,11 +19,49 @@ 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:
``lavrresample[=option1:option2:...]``
This filter uses libavresample (or libswresample, depending on the build)
to change sample rate, sample format, or channel layout of the audio stream.
This filter is automatically enabled if the audio output does not support
the audio configuration of the file being played.
.. warning::
Deprecated. Either use the ``--audio-resample-...`` options to customize
resampling, or the libavfilter ``--af=aresample`` filter, which has its
own options.
It supports only the following sample formats: u8, s16, s32, float.
``filter-size=<length>``
Length of the filter with respect to the lower sampling rate. (default:
16)
``phase-shift=<count>``
Log2 of the number of polyphase entries. (..., 10->1024, 11->2048,
12->4096, ...) (default: 10->1024)
``cutoff=<cutoff>``
Cutoff frequency (0.0-1.0), default set depending upon filter length.
``linear``
If set then filters will be linearly interpolated between polyphase
entries. (default: no)
``no-detach``
Do not detach if input and output audio format/rate/channels match.
(If you just want to set defaults for this filter that will be used
even by automatically inserted lavrresample instances, you should
prefer setting them with the ``--audio-resample-...`` options.) This
does not do anything anymore and the filter will never detach.
``normalize=<yes|no|auto>``
Whether to normalize when remixing channel layouts (default: auto).
``auto`` uses the value set by ``--audio-normalize-downmix``.
``o=<string>``
Set AVOptions on the SwrContext or AVAudioResampleContext. These should
be documented by FFmpeg or Libav.
``lavcac3enc[=options]``
Encode multi-channel audio to AC-3 at runtime using libavcodec. Supports
16-bit native-endian input format, maximum 6 channels. The output is
@@ -100,7 +138,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
@@ -116,8 +154,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
@@ -162,59 +200,21 @@ Available filters are:
Changing playback speed would change pitch, leaving audio tempo at
1.2x.
``scaletempo2[=option1:option2:...]``
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.
By default, the ``search-interval`` and ``window-size`` parameters
have the same values as in chromium.
``min-speed=<speed>``
Mute audio if the playback speed is below ``<speed>``. (default: 0.25)
``max-speed=<speed>``
Mute audio if the playback speed is above ``<speed>``
and ``<speed> != 0``. (default: 8.0)
``search-interval=<amount>``
Length in milliseconds to search for best overlap position. (default: 40)
``window-size=<amount>``
Length in milliseconds of the overlap-and-add window. (default: 12)
``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
for each option. The options are not documented here, because they 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.
http://breakfastquay.com/rubberband/code-doc/classRubberBand_1_1RubberBandStretcher.html
(The mapping of the mpv rubberband filter sub-option names and values to
those of librubberband follows a simple pattern: ``"Option" + Name + Value``.)
@@ -226,7 +226,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.
@@ -255,10 +258,3 @@ Available filters are:
broken filters. In practice, these broken filters will either cause slow
A/V desync over time (with some files), or break playback completely if
you seek or start playback from the middle of a file.
``drop``
This filter drops or repeats audio frames to adapt to playback speed. It
always operates on full audio frames, because it was made to handle SPDIF
(compressed audio passthrough). This is used automatically if the
``--video-sync=display-adrop`` option is used. Do not use this filter (or
the given option); they are extremely low quality.
+47 -116
View File
@@ -12,63 +12,17 @@ in the list.
.. 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`` or ``--ao=sndio``
may work (the latter being experimental).
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::
@@ -77,8 +31,7 @@ Available audio output drivers are:
explicitly reject multichannel output, as there is no way to detect
whether a certain channel layout is actually supported.
You can also try `using the upmix plugin
<https://github.com/mpv-player/mpv/wiki/ALSA-Surround-Sound-and-Upmixing>`_.
You can also try `using the upmix plugin <http://git.io/vfuAy>`_.
This setup enables multichannel audio on the ``default`` device
with automatic upmixing with shared access, so playing stereo
and multichannel audio at the same time will work as expected.
@@ -86,6 +39,15 @@ Available audio output drivers are:
``oss``
OSS audio output driver
The following global options are supported by this audio output:
``--oss-mixer-device``
Sets the audio mixer device (default: ``/dev/mixer``).
``--oss-mixer-channel``
Sets the audio mixer channel (default: ``pcm``). Other valid values
include **vol, pcm, line**. For a complete list of options look for
``SOUND_DEVICE_NAMES`` in ``/usr/include/linux/soundcard.h``.
``jack``
JACK (Jack Audio Connection Kit) audio output driver.
@@ -116,8 +78,8 @@ Available audio output drivers are:
mode is probably not very useful, other than for debugging or when used
with fixed setups.
``coreaudio`` (macOS only)
Native macOS audio output driver using AudioUnits and the CoreAudio
``coreaudio`` (Mac OS X only)
Native Mac OS X audio output driver using AudioUnits and the CoreAudio
sound server.
Automatically redirects to ``coreaudio_exclusive`` when playing compressed
@@ -142,23 +104,13 @@ 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
``coreaudio_exclusive`` (Mac OS X only)
Native Mac OS X 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.
``openal``
OpenAL audio output driver.
OpenAL audio output driver
``--openal-num-buffers=<2-128>``
Specify the number of audio buffers to use. Lower values are better for
@@ -170,7 +122,9 @@ Available audio output drivers are:
``--openal-direct-channels=<yes|no>``
Enable OpenAL Soft's direct channel extension when available to avoid
tinting the sound with ambisonics or HRTF. Default: yes.
tinting the sound with ambisonics or HRTF.
Channels are dropped when when they are not available as downmixing
will be disabled. Default: no.
``pulse``
PulseAudio audio output driver
@@ -185,44 +139,22 @@ 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).
``--pulse-allow-suspended=<yes|no>``
Allow mpv to use PulseAudio even if the sink is suspended (default: no).
Can be useful if PulseAudio is running as a bridge to jack and mpv has its sink-input set to the one jack is using.
``pipewire``
PipeWire audio output driver
The following global options are supported by this audio output:
``--pipewire-buffer=<1-2000|native>``
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.
``--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.
If you have stuttering video when using pulse, try to enable this
option. (Or try to update PulseAudio.)
``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
@@ -237,6 +169,10 @@ Available audio output drivers are:
obtained exact buffer size. A value of 0 selects the sound system
default.
``--sdl-bufcnt=<count>``
Sets the number of extra audio buffers in mpv. Usually needs not be
changed.
``null``
Produces no audio output but maintains video playback speed. You can use
``--ao=null --ao-null-untimed`` for benchmarking.
@@ -293,26 +229,21 @@ Available audio output drivers are:
``no-waveheader`` option - with ``waveheader`` it's broken, because
it will write a WAVE header every time the file is opened.
``rsound``
Audio output to an RSound daemon. Use ``--audio-device=rsound/<hostname>``
to set the host name (with ``<hostname>`` replaced, without the ``< >``).
.. note:: Completely useless, unless you intend to run RSound. Not to be
confused with RoarAudio, which is something completely
different.
``sndio``
Audio output to the OpenBSD sndio sound system
.. note:: Experimental. There are known bugs and issues.
(Note: only supports mono, stereo, 4.0, 5.1 and 7.1 channel
layouts.)
``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.
+4 -5
View File
@@ -8,11 +8,10 @@ There is no real changelog, but you can look at the following things:
https://github.com/mpv-player/mpv/releases
* 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.
* C API changes are listed in
https://github.com/mpv-player/mpv/blob/master/DOCS/client-api-changes.rst
* The files ``client-api-changes.rst`` and ``interface-changes.rst`` in the
``DOCS`` sub directoryon the git repository, which document API and user
interface changes (the latter usually documents breaking changes only, rather
than additions).
* The file ``mplayer-changes.rst`` in the ``DOCS`` sub directory on the git
repository, which used to be in place of this section. It documents some
changes that happened since mplayer2 forked off MPlayer. (Not updated
-170
View File
@@ -1,170 +0,0 @@
CONSOLE
=======
The console is a REPL for mpv input commands. It is displayed on the video
window. It also shows log messages. It can be disabled entirely using the
``--load-osd-console=no`` option.
Keybindings
-----------
\`
Show the console.
ESC and Ctrl+[
Hide the console.
ENTER, Ctrl+j and Ctrl+m
Run the typed command.
Shift+ENTER
Type a literal newline character.
LEFT and Ctrl+b
Move the cursor to the previous character.
RIGHT and Ctrl+f
Move the cursor to the next character.
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
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
Move the cursor to the start of the current line.
END and Ctrl+e
Move the cursor to the end of the current line.
BACKSPACE and Ctrl+h
Delete the previous character.
Ctrl+d
Hide the console if the current line is empty, otherwise delete the next
character.
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
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
Delete text from the cursor to the beginning of the current line.
Ctrl+k
Delete text from the cursor to the end of the current line.
Ctrl+c
Clear the current line.
UP and Ctrl+p
Move back in the command history.
DOWN and Ctrl+n
Move forward in the command history.
PGUP
Go to the first command in the history.
PGDN
Stop navigating the command history.
Ctrl+r
Search the command history.
INSERT
Toggle insert mode.
Ctrl+v
Paste text (uses the clipboard on X11 and Wayland).
Shift+INSERT
Paste text (uses the primary selection on X11 and Wayland).
TAB and Ctrl+i
Complete the text at the cursor. The first press inserts the longest common
prefix of the completions, and subsequent presses cycle through them.
Shift+TAB
Cycle through the completions backwards.
Ctrl+l
Clear all log messages from the console.
Commands
--------
``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.
.. admonition:: Examples for input.conf
``% script-message-to console type "seek absolute-percent; keypress ESC" 6``
Enter a percent position to seek to and close the console.
``Ctrl+o script-message-to console type "loadfile ''; keypress ESC" 11``
Enter a file or URL to play. Tab completes paths in the filesystem.
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
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`_.
Key bindings can be changed in a standard way, see for example stats.lua
documentation.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
``font``
Default: unset (picks a hardcoded font depending on detected platform)
Set the font used for the REPL and the console.
This has to be a monospaced font for the completion suggestions to be
aligned correctly.
``font_size``
Default: 16
Set the font size used for the REPL and the console. This will be
multiplied by ``display-hidpi-scale``.
``border_size``
Default: 1
Set the font border size used for the REPL and the console.
``case_sensitive``
Default: no on Windows, yes on other platforms.
Whether Tab completion is case sensitive. Only works with ASCII characters.
``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 table width of completion suggestions.
Values in the range 1.8..2.5 make sense for common monospace fonts.
+32 -19
View File
@@ -8,18 +8,18 @@ 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>``
Specifies the output format options for libavformat.
See ``--ofopts=help`` for a full list of supported options.
This is a key/value list option. See `List Options`_ for details.
Options are managed in lists. There are a few commands to manage the
options list.
``--ofopts-add=<option>``
Appends the option given as an argument to the options list. (Passing
multiple options is currently still possible, but deprecated.)
``--ofopts-add=<options1[,options2,...]>``
Appends the options given as arguments to the options list.
``--ofopts=""``
Completely empties the options list.
@@ -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.
@@ -37,19 +41,27 @@ You can encode files from one format/codec to another using this facility.
"``--oac=libmp3lame --oacopts=b=128000``"
selects 128 kbps MP3 encoding.
This is a key/value list option. See `List Options`_ for details.
Options are managed in lists. There are a few commands to manage the
options list.
``--oacopts-add=<option>``
Appends the option given as an argument to the options list. (Passing
multiple options is currently still possible, but deprecated.)
``--oacopts-add=<options1[,options2,...]>``
Appends the options given as arguments to the options list.
``--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.
@@ -62,23 +74,28 @@ You can encode files from one format/codec to another using this facility.
``"--ovc=libx264 --ovcopts=crf=23"``
selects VBR quality factor 23 for H.264 encoding.
This is a key/value list option. See `List Options`_ for details.
Options are managed in lists. There are a few commands to manage the
options list.
``--ovcopts-add=<option>``
Appends the option given as an argument to the options list. (Passing
multiple options is currently still possible, but deprecated.)
``--ovcopts-add=<options1[,options2,...]>``
Appends the options given as arguments to the options list.
``--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.
@@ -86,8 +103,6 @@ You can encode files from one format/codec to another using this facility.
FLAC allow almost arbitrary keys, while support in MP4 and MP3 is more
limited.
This is a key/value list option. See `List Options`_ for details.
.. admonition:: Example
"``--oset-metadata=title="Output title",comment="Another tag"``"
@@ -97,8 +112,6 @@ You can encode files from one format/codec to another using this facility.
Specifies metadata to exclude from the output file when copying from the
input file.
This is a string list option. See `List Options`_ for details.
.. admonition:: Example
"``--oremove-metadata=comment,genre``"
+479 -2064
View File
File diff suppressed because it is too large. Load diff
+5 -133
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::
@@ -73,18 +71,9 @@ To be able to simultaneously read and write from the IPC pipe, like on Linux,
it's necessary to write an external program that uses overlapped file I/O (or
some wrapper like .NET's NamedPipeClientStream.)
You can open the pipe in PuTTY as "serial" device. This is not very
comfortable, but gives a way to test interactively without having to write code.
Protocol
--------
The protocol uses UTF-8-only JSON as defined by RFC-8259. Unlike standard JSON,
"\u" escape sequences are not allowed to construct surrogate pairs. To avoid
getting conflicts, encode all text characters including and above codepoint
U+0020 as UTF-8. mpv might output broken UTF-8 in corner cases (see "UTF-8"
section below).
Clients can execute commands on the player by sending JSON messages of the
following form:
@@ -118,11 +107,8 @@ can also be present. See `List of events`_ for a list of all supported events.
Because events can occur at any time, it may be difficult at times to determine
which response goes with which command. Commands may optionally include a
``request_id`` which, if provided in the command request, will be copied
verbatim into the response. mpv does not interpret the ``request_id`` in any
way; it is solely for the use of the requester. The only requirement is that
the ``request_id`` field must be an integer (a number without fractional parts
in the range ``-2^63..2^63-1``). Using other types is deprecated and will
currently show a warning. In the future, this will raise an error.
verbatim into the response. mpv does not intrepret the ``request_id`` in any
way; it is solely for the use of the requester.
For example, this request:
@@ -136,8 +122,6 @@ Would generate this response:
{ "error": "success", "data": 1.468135, "request_id": 100 }
If you don't specify a ``request_id``, command replies will set it to 0.
All commands, replies, and events are separated from each other with a line
break character (``\n``).
@@ -149,72 +133,6 @@ with ``#`` and empty lines are ignored.
Currently, embedded 0 bytes terminate the current line, but you should not
rely on this.
Data flow
---------
Currently, the mpv-side IPC implementation does not service the socket while a
command is executed and the reply is written. It is for example not possible
that other events, that happened during the execution of the command, are
written to the socket before the reply is written.
This might change in the future. The only guarantee is that replies to IPC
messages are sent in sequence.
Also, since socket I/O is inherently asynchronous, it is possible that you read
unrelated event messages from the socket, before you read the reply to the
previous command you sent. In this case, these events were queued by the mpv
side before it read and started processing your command message.
If the mpv-side IPC implementation switches away from blocking writes and
blocking command execution, it may attempt to send events at any time.
You can also use asynchronous commands, which can return in any order, and
which do not block IPC protocol interaction at all while the command is
executed in the background.
Asynchronous commands
---------------------
Command can be run asynchronously. This behaves exactly as with normal command
execution, except that execution is not blocking. Other commands can be sent
while it's executing, and command completion can be arbitrarily reordered.
The ``async`` field controls this. If present, it must be a boolean. If missing,
``false`` is assumed.
For example, this initiates an asynchronous command:
::
{ "command": ["screenshot"], "request_id": 123, "async": true }
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.
Some commands execute synchronously, but these will behave like asynchronous
commands that finished execution immediately.
Cancellation of asynchronous commands is available in the libmpv API, but has
not yet been implemented in the IPC protocol.
Commands with named arguments
-----------------------------
If the ``command`` field is a JSON object, named arguments are expected. This
is described in the C API ``mpv_command_node()`` documentation (the
``MPV_FORMAT_NODE_MAP`` case). In some cases, this may make commands more
readable, while some obscure commands basically require using named arguments.
Currently, only "proper" commands (as listed by `List of Input Commands`_)
support named arguments.
Commands
--------
@@ -340,50 +258,4 @@ sometimes sends invalid JSON. If that is a problem for the client application's
parser, it should filter the raw data for invalid UTF-8 sequences and perform
the desired replacement, before feeding the data to its JSON parser.
mpv will not attempt to construct invalid UTF-8 with broken "\u" escape
sequences. This includes surrogate pairs.
JSON extensions
---------------
The following non-standard extensions are supported:
- a list or object item can have a trailing ","
- object syntax accepts "=" in addition of ":"
- object keys can be unquoted, if they start with a character in "A-Za-z\_"
and contain only characters in "A-Za-z0-9\_"
- byte escapes with "\xAB" are allowed (with AB being a 2 digit hex number)
Example:
::
{ objkey = "value\x0A" }
Is equivalent to:
::
{ "objkey": "value\n" }
Alternative ways of starting clients
------------------------------------
You can create an anonymous IPC connection without having to set
``--input-ipc-server``. This is achieved through a mpv pseudo scripting backend
that starts processes.
You can put ``.run`` file extension in the mpv scripts directory in its config
directory (see the `FILES`_ section for details), or load them through other
means (see `Script location`_). These scripts are simply executed with the OS
native mechanism (as if you ran them in the shell). They must have a proper
shebang and have the executable bit set.
When executed, a socket (the IPC connection) is passed to them through file
descriptor inheritance. The file descriptor is indicated as the special command
line argument ``--mpv-ipc-fd=N``, where ``N`` is the numeric file descriptor.
The rest is the same as with a normal ``--input-ipc-server`` IPC connection. mpv
does not attempt to observe or other interact with the started script process.
This does not work in Windows yet.
mpv will not attempt to construct invalid UTF-8 with broken escape sequences.
+29 -86
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``
@@ -59,7 +58,7 @@ Language features - ECMAScript 5
The scripting backend which mpv currently uses is MuJS - a compatible minimal
ES5 interpreter. As such, ``String.substring`` is implemented for instance,
while the common but non-standard ``String.substr`` is not. Please consult the
MuJS pages on language features and platform support - https://mujs.com .
MuJS pages on language features and platform support - http://mujs.com .
Unsupported Lua APIs and their JS alternatives
----------------------------------------------
@@ -74,6 +73,12 @@ Unsupported Lua APIs and their JS alternatives
``utils.to_string(v)`` see ``dump`` below.
``mp.suspend()`` JS: none (deprecated).
``mp.resume()`` JS: none (deprecated).
``mp.resume_all()`` JS: none (deprecated).
``mp.get_next_timeout()`` see event loop below.
``mp.dispatch_events([allow_wait])`` see event loop below.
@@ -83,7 +88,7 @@ Scripting APIs - identical to Lua
(LE) - Last-Error, indicates that ``mp.last_error()`` can be used after the
call to test for success (empty string) or failure (non empty reason string).
Where the Lua APIs use ``nil`` to indicate error, JS APIs use ``undefined``.
Otherwise, where the Lua APIs return ``nil`` on error, JS returns ``undefined``.
``mp.command(string)`` (LE)
@@ -91,13 +96,6 @@ Where the Lua APIs use ``nil`` to indicate error, JS APIs use ``undefined``.
``mp.command_native(table [,def])`` (LE)
``id = mp.command_native_async(table [,fn])`` (LE) Notes: ``id`` is true-thy on
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)
@@ -136,8 +134,6 @@ success, ``error`` is empty string on success.
``mp.get_script_name()``
``mp.get_script_directory()``
``mp.osd_message(text [,duration])``
``mp.get_wakeup_pipe()``
@@ -152,10 +148,6 @@ success, ``error`` is empty string on success.
``mp.unregister_script_message(name)``
``mp.create_osd_overlay(format)``
``mp.get_osd_size()`` (returned object has properties: width, height, aspect)
``mp.msg.log(level, ...)``
``mp.msg.fatal(...)``
@@ -176,8 +168,7 @@ success, ``error`` is empty string on success.
``mp.utils.readdir(path [, filter])`` (LE)
``mp.utils.file_info(path)`` (LE) Note: like lua - this does NOT expand
meta-paths like ``~~/foo`` (other JS file functions do expand meta paths).
``mp.utils.file_info(path)`` (LE)
``mp.utils.split_path(path)``
@@ -187,26 +178,11 @@ meta-paths like ``~~/foo`` (other JS file functions do expand meta paths).
``mp.utils.subprocess_detached(t)``
``mp.utils.get_env_list()``
``mp.utils.getpid()`` (LE)
``mp.add_hook(type, priority, fn(hook))``
``mp.add_hook(type, priority, fn)``
``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)``
``mp.options.read_options(obj [, identifier])`` (types: string/boolean/number)
Additional utilities
--------------------
@@ -230,9 +206,8 @@ Additional utilities
``undefined`` if the variable is not defined.
``mp.utils.get_user_path(path)``
Trivial wrapper of the ``expand-path`` mpv command, returns a string.
``read_file``, ``write_file``, ``append_file`` and ``require`` already
expand the path internally and accept mpv meta-paths like ``~~desktop/foo``.
Expands (mpv) meta paths like ``~/x``, ``~~/y``, ``~~desktop/z`` etc.
``read_file``, ``write_file`` and ``require`` already use this internaly.
``mp.utils.read_file(fname [,max])``
Returns the content of file ``fname`` as string. If ``max`` is provided and
@@ -243,12 +218,7 @@ Additional utilities
prefixed with ``file://`` as simple protection against accidental arguments
switch, e.g. ``mp.utils.write_file("file://~/abc.txt", "hello world")``.
``mp.utils.append_file(fname, str)``
Same as ``mp.utils.write_file`` if the file ``fname`` does not exist. If it
does exist then append instead of overwrite.
Note: ``read_file``, ``write_file`` and ``append_file`` throw on errors, allow
text content only.
Note: ``read_file`` and ``write_file`` throw on errors, allow text content only.
``mp.get_time_ms()``
Same as ``mp.get_time()`` but in ms instead of seconds.
@@ -265,9 +235,6 @@ text content only.
anything from the filesystem), and returns it as a function. Very similar
to a ``Function`` constructor, but shows at stack traces as ``fname``.
``mp.module_paths``
Global modules search paths array for the ``require`` function (see below).
Timers (global)
---------------
@@ -306,11 +273,9 @@ CommonJS modules and ``require(id)``
------------------------------------
CommonJS Modules are a standard system where scripts can export common functions
for use by other scripts. Specifically, a module is a script which adds
properties (functions, etc) to its pre-existing ``exports`` object, which
another script can access with ``require(module-id)``. This runs the module and
returns its ``exports`` object. Further calls to ``require`` for the same module
will return its cached ``exports`` object without running the module again.
for use by other scripts. A module is a script which adds properties (functions,
etc) to its invisible ``exports`` object, which another script can access by
loading it with ``require(module-id)`` - which returns that ``exports`` object.
Modules and ``require`` are supported, standard compliant, and generally similar
to node.js. However, most node.js modules won't run due to missing modules such
@@ -320,20 +285,13 @@ do work. In general, this is for mpv modules and not a node.js replacement.
A ``.js`` file extension is always added to ``id``, e.g. ``require("./foo")``
will load the file ``./foo.js`` and return its ``exports`` object.
An id which starts with ``./`` or ``../`` is relative to the script or module
which ``require`` it. Otherwise it's considered a top-level id (CommonJS term).
An id is relative (to the script which ``require``'d it) if it starts with
``./`` or ``../``. Otherwise, it's considered a "top-level id" (CommonJS term).
Top-level id is evaluated as absolute filesystem path if possible, e.g. ``/x/y``
or ``~/x``. Otherwise it's considered a global module id and searched according
to ``mp.module_paths`` in normal array order, e.g. ``require("x")`` tries to
load ``x.js`` at one of the array paths, and id ``foo/x`` tries to load ``x.js``
inside dir ``foo`` at one of the paths.
The ``mp.module_paths`` array is empty by default except for scripts which are
loaded as a directory where it contains one item - ``<directory>/modules/`` .
The array may be updated from a script (or using custom init - see below) which
will affect future calls to ``require`` for global module id's which are not
already loaded/cached.
Top level id is evaluated as absolute filesystem path if possible (e.g. ``/x/y``
or ``~/x``). Otherwise, it's searched at ``scripts/modules.js/`` in mpv config
dirs - in normal config search order. E.g. ``require("x")`` is searched as file
``x.js`` at those dirs, and id ``foo/x`` is searched as file ``foo/x.js``.
No ``global`` variable, but a module's ``this`` at its top lexical scope is the
global object - also in strict mode. If you have a module which needs ``global``
@@ -341,21 +299,6 @@ as the global object, you could do ``this.global = this;`` before ``require``.
Functions and variables declared at a module don't pollute the global object.
Custom initialization
---------------------
After mpv initializes the JavaScript environment for a script but before it
loads the script - it tries to run the file ``init.js`` at the root of the mpv
configuration directory. Code at this file can update the environment further
for all scripts. E.g. if it contains ``mp.module_paths.push("/foo")`` then
``require`` at all scripts will search global module id's also at ``/foo``
(do NOT do ``mp.module_paths = ["/foo"];`` because this will remove existing
paths - like ``<script-dir>/modules`` for scripts which load from a directory).
The custom-init file is ignored if mpv is invoked with ``--no-config``.
Before mpv 0.34, the file name was ``.init.js`` (with dot) at the same dir.
The event loop
--------------
+8 -12
View File
@@ -10,9 +10,9 @@ Since libmpv merely allows access to underlying mechanisms that can control
mpv, further documentation is spread over a few places:
- https://github.com/mpv-player/mpv/blob/master/libmpv/client.h
- https://mpv.io/manual/master/#options
- https://mpv.io/manual/master/#list-of-input-commands
- https://mpv.io/manual/master/#properties
- http://mpv.io/manual/master/#options
- http://mpv.io/manual/master/#list-of-input-commands
- http://mpv.io/manual/master/#properties
- https://github.com/mpv-player/mpv-examples/tree/master/libmpv
C PLUGINS
@@ -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.
Currently, they must be explicitly enabled at build time with
``--enable-cplugins``. They are available on Linux/BSD platforms only.
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
---
@@ -64,13 +64,9 @@ Linkage to libmpv
-----------------
The current implementation requires that your plugins are **not** linked against
libmpv. What your plugins use are not symbols from a libmpv binary, but
libmpv. What your plugins uses 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
--------
+192 -386
View File
@@ -1,7 +1,12 @@
LUA SCRIPTING
=============
mpv can load Lua scripts. (See `Script location`_.)
mpv can load Lua scripts. Scripts passed to the ``--script`` option, or found in
the ``scripts`` subdirectory of the mpv configuration directory (usually
``~/.config/mpv/scripts/``) will be loaded on program start. mpv also appends the
``scripts`` subdirectory to the end of Lua's path so you can import scripts from
there too. Since it's added to the end, don't name scripts you want to import
the same as Lua libraries because they will be overshadowed by them.
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
@@ -25,55 +30,6 @@ A script which leaves fullscreen mode when the player is paused:
mp.observe_property("pause", "bool", on_pause_change)
Script location
---------------
Scripts can be passed to the ``--script`` option, and are automatically loaded
from the ``scripts`` subdirectory of the mpv configuration directory (usually
``~/.config/mpv/scripts/``).
A script can be a single file. The file extension is used to select the
scripting backend to use for it. For Lua, it is ``.lua``. If the extension is
not recognized, an error is printed. (If an error happens, the extension is
either mistyped, or the backend was not compiled into your mpv binary.)
mpv internally loads the script's name by stripping the ``.lua`` extension and
replacing all nonalphanumeric characters with ``_``. E.g., ``my-tools.lua``
becomes ``my_tools``. If there are several scripts with the same name, it is
made unique by appending a number. This is the name returned by
``mp.get_script_name()``.
Entries with ``.disable`` extension are always ignored.
If a script is a directory (either if a directory is passed to ``--script``,
or any sub-directories in the script directory, such as for example
``~/.config/mpv/scripts/something/``), then the directory represents a single
script. The player will try to load a file named ``main.x``, where ``x`` is
replaced with the file extension. For example, if ``main.lua`` exists, it is
loaded with the Lua scripting backend.
You must not put any other files or directories that start with ``main.`` into
the script's top level directory. If the script directory contains for example
both ``main.lua`` and ``main.js``, only one of them will be loaded (and which
one depends on mpv internals that may change any time). Likewise, if there is
for example ``main.foo``, your script will break as soon as mpv adds a backend
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.)
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
(without the dangers of auto-updates). Another suggestion is to use git
submodules to share common files or libraries.
Details on the script initialization and lifecycle
--------------------------------------------------
@@ -153,58 +109,12 @@ The ``mp`` module is preloaded, although it can be loaded manually with
``mp.command_native(table [,def])``
Similar to ``mp.commandv``, but pass the argument list as table. This has
the advantage that in at least some cases, arguments can be passed as
native types. It also allows you to use named argument.
If the table is an array, each array item is like an argument in
``mp.commandv()`` (but can be a native type instead of a string).
If the table contains string keys, it's interpreted as command with named
arguments. This requires at least an entry with the key ``name`` to be
present, which must be a string, and contains the command name. The special
entry ``_flags`` is optional, and if present, must be an array of
`Input Command Prefixes`_ to apply. All other entries are interpreted as
arguments.
native types.
Returns a result table on success (usually empty), or ``def, error`` on
error. ``def`` is the second parameter provided to the function, and is
nil if it's missing.
``mp.command_native_async(table [,fn])``
Like ``mp.command_native()``, but the command is ran asynchronously (as far
as possible), and upon completion, fn is called. fn has three arguments:
``fn(success, result, error)``:
``success``
Always a Boolean and is true if the command was successful,
otherwise false.
``result``
The result value (can be nil) in case of success, nil otherwise (as
returned by ``mp.command_native()``).
``error``
The error string in case of an error, nil otherwise.
Returns a table with undefined contents, which can be used as argument for
``mp.abort_async_command``.
If starting the command failed for some reason, ``nil, error`` is returned,
and ``fn`` is called indicating failure, using the same error value.
``fn`` is always called asynchronously, even if the command failed to start.
``mp.abort_async_command(t)``
Abort a ``mp.command_native_async`` call. The argument is the return value
of that command (which starts asynchronous execution of the command).
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 +202,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``
@@ -311,43 +209,22 @@ The ``mp`` module is preloaded, although it can be loaded manually with
an example). The name should be unique across other bindings in the same
script - if not, the previous binding with the same name will be
overwritten. You can omit the name, in which case a random name is generated
internally. (Omitting works as follows: either pass ``nil`` for ``name``,
or pass the ``fn`` argument in place of the name. The latter is not
recommended and is handled for compatibility only.)
internally.
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``.
``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):
``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.
``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.
``key_name``
The name of they key that triggered this, or ``nil`` if
invoked artificially. If the key name is unknown, it's an
empty string.
``key_text``
Text if triggered by a text key, otherwise ``nil``. See
description of ``script-binding`` command for details (this
field is equivalent to the 5th argument).
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 an ``event`` entry, which
is set to one of the strings ``down``, ``repeat``, ``up`` or
``press`` (the latter if key up/down can't be tracked). It further
has an ``is_mouse`` entry, which tells whether the event was caused
by a mouse button.
Internally, key bindings are dispatched via the ``script-message-to`` or
``script-binding`` input commands and ``mp.register_script_message``.
@@ -435,41 +312,29 @@ The ``mp`` module is preloaded, although it can be loaded manually with
of times in a row, only the last change triggers the change function. (The
exact behavior depends on timing and other things.)
If a property is unavailable, or on error, the value argument to ``fn`` is
``nil``. (The ``observe_property()`` call always succeeds, even if a
property does not exist.)
In some cases the function is not called even if the property changes.
This depends on the property, and it's a valid feature request to ask for
better update handling of a specific property.
Whether this can happen depends on the 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.
You always get an initial change notification. This is meant to initialize
the user's state to the current value of the property.
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.
``mp.unobserve_property(fn)``
Undo ``mp.observe_property(..., fn)``. This removes all property handlers
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.
@@ -508,8 +373,8 @@ The ``mp`` module is preloaded, although it can be loaded manually with
(``true``). This value is used when the timer expires (but before
the timer callback function fn is run).
Note that these are methods, and you have to call them using ``:`` instead
of ``.`` (Refer to https://www.lua.org/manual/5.2/manual.html#3.4.9 .)
Note that these are method, and you have to call them using ``:`` instead
of ``.`` (Refer to http://www.lua.org/manual/5.2/manual.html#3.4.9 .)
Example:
@@ -535,16 +400,11 @@ The ``mp`` module is preloaded, although it can be loaded manually with
Return the name of the current script. The name is usually made of the
filename of the script, with directory and file extension removed. If
there are several scripts which would have the same name, it's made unique
by appending a number. Any nonalphanumeric characters are replaced with ``_``.
by appending a number.
.. admonition:: Example
The script ``/path/to/foo-script.lua`` becomes ``foo_script``.
``mp.get_script_directory()``
Return the directory if this is a script packaged as directory (see
`Script location`_ for a description). Return nothing if this is a single
file script.
The script ``/path/to/fooscript.lua`` becomes ``fooscript``.
``mp.osd_message(text [,duration])``
Show an OSD message on the screen. ``duration`` is in seconds, and is
@@ -556,6 +416,18 @@ Advanced mp functions
These also live in the ``mp`` module, but are documented separately as they
are useful only in special situations.
``mp.suspend()``
This function has been deprecated in mpv 0.21.0 and does nothing starting
with mpv 0.23.0 (no replacement).
``mp.resume()``
This function has been deprecated in mpv 0.21.0 and does nothing starting
with mpv 0.23.0 (no replacement).
``mp.resume_all()``
This function has been deprecated in mpv 0.21.0 and does nothing starting
with mpv 0.23.0 (no replacement).
``mp.get_wakeup_pipe()``
Calls ``mpv_get_wakeup_pipe()`` and returns the read end of the wakeup
pipe. This is deprecated, but still works. (See ``client.h`` for details.)
@@ -610,42 +482,6 @@ are useful only in special situations.
Undo a previous registration with ``mp.register_script_message``. Does
nothing if the ``name`` wasn't registered.
``mp.create_osd_overlay(format)``
Create an OSD overlay. This is a very thin wrapper around the ``osd-overlay``
command. The function returns a table, which mostly contains fields that
will be passed to ``osd-overlay``. The ``format`` parameter is used to
initialize the ``format`` field. The ``data`` field contains the text to
be used as overlay. For details, see the ``osd-overlay`` command.
In addition, it provides the following methods:
``update()``
Commit the OSD overlay to the screen, or in other words, run the
``osd-overlay`` command with the current fields of the overlay table.
Returns the result of the ``osd-overlay`` command itself.
``remove()``
Remove the overlay from the screen. A ``update()`` call will add it
again.
Example:
::
ov = mp.create_osd_overlay("ass-events")
ov.data = "{\\an5}{\\b1}hello world!"
ov:update()
The advantage of using this wrapper (as opposed to running ``osd-overlay``
directly) is that the ``id`` field is allocated automatically.
``mp.get_osd_size()``
Returns a tuple of ``osd_width, osd_height, osd_par``. The first two give
the size of the OSD in pixels (for video outputs like ``--vo=xv``, this may
be "scaled" pixels). The third is the display pixel aspect ratio.
May return invalid/nonsense values if OSD is not initialized yet.
mp.msg functions
----------------
@@ -676,38 +512,25 @@ command-line. All you have to do is to supply a table with default options to
the read_options function. The function will overwrite the default values
with values found in the config-file and the command-line (in that order).
``options.read_options(table [, identifier [, on_update]])``
``options.read_options(table [, identifier])``
A ``table`` with key-value pairs. The type of the default values is
important for converting the values read from the config file or
command-line back. Do not use ``nil`` as a default value!
The ``identifier`` is used to identify the config-file and the command-line
options. These needs to unique to avoid collisions with other scripts.
Defaults to ``mp.get_script_name()`` if the parameter is ``nil`` or missing.
The ``on_update`` parameter enables run-time updates of all matching option
values via the ``script-opts`` option/property. If any of the matching
options changes, the values in the ``table`` (which was originally passed to
the function) are changed, and ``on_update(list)`` is called. ``list`` is
a table where each updated option has a ``list[option_name] = true`` entry.
There is no initial ``on_update()`` call. This never re-reads the config file.
``script-opts`` is always applied on the original config file, ignoring
previous ``script-opts`` values (for example, if an option is removed from
``script-opts`` at runtime, the option will have the value in the config
file). ``table`` entries are only written for option values whose values
effectively change (this is important if the script changes ``table``
entries independently).
Defaults to ``mp.get_script_name()``.
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)
@@ -786,7 +609,7 @@ strictly part of the guaranteed API.
``mtime``
time of last modification
``ctime``
time of last metadata change
time of last metadata change (Linux) / time of creation (Windows)
``is_file``
Whether ``path`` is a regular file (boolean)
``is_dir``
@@ -798,7 +621,7 @@ strictly part of the guaranteed API.
The booleans ``is_file`` and ``is_dir`` are provided as a convenience;
they can be and are derived from ``mode``.
On error (e.g. path does not exist), ``nil, error`` is returned.
On error (eg. path does not exist), ``nil, error`` is returned.
``utils.split_path(path)``
Split a path into directory component and filename component, and return
@@ -807,29 +630,49 @@ strictly part of the guaranteed API.
``utils.join_path(p1, p2)``
Return the concatenation of the 2 paths. Tries to be clever. For example,
if ``p2`` is an absolute path, ``p2`` is returned without change.
if ```p2`` is an absolute path, p2 is returned without change.
``utils.subprocess(t)``
Runs an external process and waits until it exits. Returns process status
and the captured output. This is a legacy wrapper around calling the
``subprocess`` command with ``mp.command_native``. It does the following
things:
and the captured output.
- copy the table ``t``
- rename ``cancellable`` field to ``playback_only``
- rename ``max_size`` to ``capture_size``
- set ``capture_stdout`` field to ``true`` if unset
- set ``name`` field to ``subprocess``
- call ``mp.command_native(copied_t)``
- if the command failed, create a dummy result table
- copy ``error_string`` to ``error`` field if the string is non-empty
- return the result table
The parameter ``t`` is a table. The function reads the following entries:
It is recommended to use ``mp.command_native`` or ``mp.command_native_async``
directly, instead of calling this legacy wrapper. It is for compatibility
only.
``args``
Array of strings. The first array entry is the executable. This
can be either an absolute path, or a filename with no path
components, in which case the ``PATH`` environment variable is
used to resolve the executable. The other array elements are
passed as command line arguments.
See the ``subprocess`` documentation for semantics and further parameters.
``cancellable``
Optional. If set to ``true`` (default), then if the user stops
playback or goes to the next file while the process is running,
the process will be killed.
``max_size``
Optional. The maximum size in bytes of the data that can be captured
from stdout. (Default: 16 MB.)
The function returns a table as result with the following entries:
``status``
The raw exit status of the process. It will be negative on error.
``stdout``
Captured output stream as string, limited to ``max_size``.
``error``
``nil`` on success. The string ``killed`` if the process was
terminated in an unusual way. The string ``init`` if the process
could not be started.
On Windows, ``killed`` is only returned when the process has been
killed by mpv as a result of ``cancellable`` being set to ``true``.
``killed_by_us``
Set to ``true`` if the process has been killed by mpv as a result
of ``cancellable`` being set to ``true``.
``utils.subprocess_detached(t)``
Runs an external process and detaches it from mpv's control.
@@ -842,17 +685,10 @@ strictly part of the guaranteed API.
The function returns ``nil``.
This is a legacy wrapper around calling the ``run`` command with
``mp.commandv`` and other functions.
``utils.getpid()``
Returns the process ID of the running mpv process. This can be used to identify
the calling mpv when launching (detached) subprocesses.
``utils.get_env_list()``
Returns the C environment as a list of strings. (Do not confuse this with
the Lua "environment", which is an unrelated concept.)
``utils.parse_json(str [, trail])``
Parses the given string argument as JSON, and returns it as a Lua table. On
error, returns ``nil, error``. (Currently, ``error`` is just a string
@@ -879,131 +715,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. You can close the console from within the
callback by calling ``input.terminate()``. If you don't, the console
stays open and the user can input more text.
``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 presses TAB. 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.lua will filter the suggestions beginning
with the the text between this position and the cursor, sort them
alphabetically, insert their longest common prefix, and show them when
there are multiple ones.
``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.
``id``
An identifier that determines which input history and log buffer to use
among the ones stored for ``input.get()`` calls. The input histories
and logs are stored in memory and do not persist across different mpv
invocations. 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 the
console uses for errors. 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
user can type part of the desired item and/or navigate 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.
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. Unlike with ``input.get()``, the
console is automatically closed on submit without having to call
``input.terminate()``.
Example:
::
input.select({
items = {
"First playlist entry",
"Second playlist entry",
},
submit = function (id)
mp.commandv("playlist-play-index", id - 1)
end,
})
Events
------
@@ -1023,7 +734,116 @@ Example:
mp.register_event("file-loaded", my_fn)
For the existing event types, see `List of events`_.
List of events
--------------
``start-file``
Happens right before a new file is loaded. When you receive this, the
player is loading the file (or possibly already done with it).
``end-file``
Happens after a file was unloaded. Typically, the player will load the
next file right away, or quit if this was the last file.
The event has the ``reason`` field, which takes one of these values:
``eof``
The file has ended. This can (but doesn't have to) include
incomplete files or broken network connections under
circumstances.
``stop``
Playback was ended by a command.
``quit``
Playback was ended by sending the quit command.
``error``
An error happened. In this case, an ``error`` field is present with
the error string.
``redirect``
Happens with playlists and similar. Details see
``MPV_END_FILE_REASON_REDIRECT`` in the C API.
``unknown``
Unknown. Normally doesn't happen, unless the Lua API is out of sync
with the C API. (Likewise, it could happen that your script gets
reason strings that did not exist yet at the time your script was
written.)
``file-loaded``
Happens after a file was loaded and begins playback.
``seek``
Happens on seeking. (This might include cases when the player seeks
internally, even without user interaction. This includes e.g. segment
changes when playing ordered chapters Matroska files.)
``playback-restart``
Start of playback after seek or after file was loaded.
``idle``
Idle mode is entered. This happens when playback ended, and the player was
started with ``--idle`` or ``--force-window``. This mode is implicitly ended
when the ``start-file`` or ``shutdown`` events happen.
``tick``
Called after a video frame was displayed. This is a hack, and you should
avoid using it. Use timers instead and maybe watch pausing/unpausing events
to avoid wasting CPU when the player is paused.
``shutdown``
Sent when the player quits, and the script should terminate. Normally
handled automatically. See `Details on the script initialization and lifecycle`_.
``log-message``
Receives messages enabled with ``mp.enable_messages``. The message data
is contained in the table passed as first parameter to the event handler.
The table contains, in addition to the default event fields, the following
fields:
``prefix``
The module prefix, identifies the sender of the message. This is what
the terminal player puts in front of the message text when using the
``--v`` option, and is also what is used for ``--msg-level``.
``level``
The log level as string. See ``msg.log`` for possible log level names.
Note that later versions of mpv might add new levels or remove
(undocumented) existing ones.
``text``
The log message. The text will end with a newline character. Sometimes
it can contain multiple lines.
Keep in mind that these messages are meant to be hints for humans. You
should not parse them, and prefix/level/text of messages might change
any time.
``get-property-reply``
Undocumented (not useful for Lua scripts).
``set-property-reply``
Undocumented (not useful for Lua scripts).
``command-reply``
Undocumented (not useful for Lua scripts).
``client-message``
Undocumented (used internally).
``video-reconfig``
Happens on video output or filter reconfig.
``audio-reconfig``
Happens on audio output or filter reconfig.
The following events also happen, but are deprecated: ``tracks-changed``,
``track-switched``, ``pause``, ``unpause``, ``metadata-update``,
``chapter-change``. Use ``mp.observe_property()`` instead.
Extras
------
@@ -1037,22 +857,8 @@ guarantee a stable interface.
their result (normally, the Lua scripting interface is asynchronous from
the point of view of the player core). ``priority`` is an arbitrary integer
that allows ordering among hooks of the same kind. Using the value 50 is
recommended as neutral default value.
``fn(hook)`` is the function that will be called during execution of the
hook. The parameter passed to it (``hook``) is a Lua object that can control
further aspects about the currently invoked hook. It provides the following
methods:
``defer()``
Returning from the hook function should not automatically continue
the hook. Instead, the API user wants to call ``hook:cont()`` on its
own at a later point in time (before or after the function has
returned).
``cont()``
Continue the hook. Doesn't need to be called unless ``defer()`` was
called.
recommended as neutral default value. ``fn`` is the function that will be
called during execution of the hook.
See `Hooks`_ for currently existing hooks and what they do - only the hook
list is interesting; handling hook execution is done by the Lua script
+209 -729
View File
File diff suppressed because it is too large. Load diff
+1274 -3274
View File
File diff suppressed because it is too large. Load diff
+39 -234
View File
@@ -43,8 +43,7 @@ pl next
============= ================================================
title
| Displays current media-title, filename, custom title, or target chapter
name while hovering the seekbar.
| Displays current media-title, filename, or custom title
============= ================================================
left-click show playlist position and length and full title
@@ -85,7 +84,6 @@ seekbar
============= ================================================
left-click seek to position
mouse wheel seek forward/backward
============= ================================================
time left
@@ -102,7 +100,6 @@ audio and sub
left-click cycle audio/sub tracks forward
right-click cycle audio/sub tracks backwards
shift+L-click show available audio/sub tracks
mouse wheel cycle audio/sub tracks forward/backwards
============= ================================================
vol
@@ -130,9 +127,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
~~~~~~~~~~~~~~~~~~~
@@ -157,53 +167,18 @@ Configurable Options
``seekbarstyle``
Default: bar
Sets the style of the playback position marker and overall shape
of the seekbar: ``bar``, ``diamond`` or ``knob``.
``seekbarhandlesize``
Default: 0.6
Size ratio of the seek handle if ``seekbarstyle`` is set to ``diamond``
or ``knob``. This is relative to the full height of the seekbar.
Sets the style of the seekbar, slider (diamond marker), knob (circle
marker with guide), or bar (fill).
Default pre-0.21.0 was 'slider'.
``seekbarkeyframes``
Default: yes
Controls the mode used to seek when dragging the seekbar. If set to ``yes``,
default seeking mode is used (usually keyframes, but player defaults and
heuristics can change it to exact). If set to ``no``, exact seeking on
mouse drags will be used instead. Keyframes are preferred, but exact seeks
may be useful in cases where keyframes cannot be found. Note that using
exact seeks can potentially make mouse dragging much slower.
``seekrangestyle``
Default: inverted
Display seekable ranges on the seekbar. ``bar`` shows them on the full
height of the bar, ``line`` as a thick line and ``inverted`` as a thin
line that is inverted over playback position markers. ``none`` will hide
them. Additionally, ``slider`` will show a permanent handle inside the seekbar
with cached ranges marked inside. Note that these will look differently
based on the seekbarstyle option. Also, ``slider`` does not work with
``seekbarstyle`` set to ``bar``.
``seekrangeseparate``
Default: yes
Controls whether to show line-style seekable ranges on top of the
seekbar or separately if ``seekbarstyle`` is set to ``bar``.
``seekrangealpha``
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.
Controls the mode used to seek when dragging the seekbar. By default,
keyframes are used. If set to false, exact seeking on mouse drags
will be used instead. Keyframes are preferred, but exact seeks may be
useful in cases where keyframes cannot be found. Note that using exact
seeks can potentially make mouse dragging much slower.
``deadzonesize``
Default: 0.5
@@ -232,11 +207,6 @@ Configurable Options
Enable the OSC when fullscreen
``idlescreen``
Default: yes
Show the mpv logo and message when idle
``scalewindowed``
Default: 1.0
@@ -247,13 +217,16 @@ 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
@@ -291,7 +264,7 @@ Configurable Options
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
@@ -303,25 +276,15 @@ 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
Display timecodes with milliseconds
``tcspace``
Default: 100 (allowed: 50-200)
``seekranges``
Default: yes
Adjust space reserved for timecodes (current time and time remaining) in
the ``bottombar`` and ``topbar`` layouts. The timecode width depends on the
font, and with some fonts the spacing near the timecodes becomes too small.
Use values above 100 to increase that spacing, or below 100 to decrease it.
Display seekable ranges on the seekbar
``visibility``
Default: auto (auto hide/show on mouse move)
@@ -336,157 +299,6 @@ Configurable Options
default is conservative to allow wide fonts to be used without overflow.
However, with many common fonts a bigger number can be used. YMMV.
``boxvideo``
Default: no
Whether to overlay the osc over the video (``no``), or to box the video
within the areas not covered by the osc (``yes``). If this option is set,
the osc may overwrite the ``--video-margin-ratio-*`` options, even if the
user has set them. (It will not overwrite them if all of them are set to
default values.) Additionally, ``visibility`` must be set to ``always``.
Otherwise, this option does nothing.
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
filled with the background color (black by default).
This currently still makes the OSC overlap with subtitles (if the
``--sub-use-margins`` option is set to ``yes``, the default). This may be
fixed later.
This does not work correctly with video outputs like ``--vo=xv``, which
render OSD into the unscaled video.
``windowcontrols``
Default: auto (Show window controls if there is no window border)
Whether to show window management controls over the video, and if so,
which side of the window to place them. This may be desirable when the
window has no decorations, either because they have been explicitly
disabled (``border=no``) or because the current platform doesn't support
them (eg: gnome-shell with wayland).
The set of window controls is fixed, offering ``minimize``, ``maximize``,
and ``quit``. Not all platforms implement ``minimize`` and ``maximize``,
but ``quit`` will always work.
``windowcontrols_alignment``
Default: right
If window controls are shown, indicates which side should they be aligned
to.
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
Set to ``yes`` to reduce festivity (i.e. disable santa hat in December.)
``livemarkers``
Default: yes
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``
Template for the chapter-name display when hovering the seekbar.
Use ``no`` to disable chapter display on hover. Otherwise it's a lua
``string.format`` template and ``%s`` is replaced with the actual name.
``unicodeminus``
Default: no
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.
Script Commands
~~~~~~~~~~~~~~~
@@ -499,10 +311,7 @@ in ``input.conf``, or sent by other scripts.
``osc-visibility``
Controls visibility mode ``never`` / ``auto`` (on mouse move) / ``always``
and also ``cycle`` to cycle between the modes.
``osc-show``
Triggers the OSC to show up, just as if user moved mouse.
and also ``cycle`` to cycle between the modes
Example
@@ -512,10 +321,6 @@ to set auto mode (the default) with ``b``::
a script-message osc-visibility never
b script-message osc-visibility auto
``osc-idlescreen``
Controls the visibility of the mpv logo on idle. Valid arguments are ``yes``,
``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.
+25 -156
View File
@@ -22,59 +22,40 @@ stats:
==== ==================
1 Show usual stats
2 Show frame timings (scroll)
3 Input cache stats
4 Active key bindings (scroll)
5 Selected Tracks Info (scroll)
0 Internal stuff (scroll)
2 Show frame timings
==== ==================
On pages which support scroll, these key bindings are also active:
Font
~~~~
==== ==================
UP Scroll one line up
DOWN Scroll one line down
==== ==================
Page 4 also binds ``/`` to search for input bindings by typing part of a binding
or command.
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
~~~~~~~~~~~~~~~~~~~~
``key_oneshot``
Default: i
``key_toggle``
Default: I
Key bindings to display stats.
``key_page_1``
Default: 1
``key_page_2``
Default: 2
``key_page_3``
Default: 3
``key_page_4``
Default: 4
``key_page_5``
Default: 5
``key_page_0``
Default: 0
Key bindings for page switching while stats are displayed.
``key_scroll_up``
Default: UP
``key_scroll_down``
Default: DOWN
``key_scroll_search``
Default: /
``scroll_lines``
Default: 1
Scroll key bindings and number of lines to scroll on pages which support it.
``duration``
Default: 4
@@ -93,28 +74,6 @@ 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_width_limit``
Default: -1
Sets the terminal width.
A value of 0 means the width is infinite, -1 means it's automatic.
``term_height_limit``
Default: -1
Sets the terminal height.
A value of 0 means the height is infinite, -1 means it's automatic.
``plot_perfdata``
Default: yes
@@ -127,24 +86,19 @@ Configurable Options
Show graphs for vsync and jitter values (page 1). Only when toggled.
``plot_tonemapping_lut``
Default: no
Enable tone-mapping LUT visualization automatically. Only when toggled.
``flush_graph_data``
Default: yes
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.
@@ -155,9 +109,9 @@ Configurable Options
Font size used to render text.
``font_color``
Default: same as ``osd-color``
Default: FFFFFF
Color of the text.
Font color.
``border_size``
Default: 0.8
@@ -165,42 +119,20 @@ Configurable Options
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: 0
The horizontal distance from the text to position the shadow at.
``shadow_y_offset``
Default: 0
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: 0.5
Border width used for drawing graphs.
``plot_bg_color``
Default: 262626
@@ -211,83 +143,20 @@ 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).
Different key bindings
~~~~~~~~~~~~~~~~~~~~~~
Additional keys can be configured in ``input.conf`` to display the stats::
A different key binding can be defined with the aforementioned options
``key_oneshot`` and ``key_toggle`` but also with commands in ``input.conf``,
for example::
e script-binding stats/display-stats
E script-binding stats/display-stats-toggle
And to display a certain page directly::
Using ``input.conf``, it is also possible to directly display a certain page::
i script-binding stats/display-page-1
e script-binding stats/display-page-2
Active key bindings page
~~~~~~~~~~~~~~~~~~~~~~~~
Lists the active key bindings and the commands they're bound to, excluding the
interactive keys of the stats script itself. See also ``--input-test`` for more
detailed view of each binding.
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-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.
Internal stuff page
~~~~~~~~~~~~~~~~~~~
Most entries shown on this page have rather vague meaning. Likely none of this
is useful for you. Don't attempt to use it. Forget its existence.
Selecting this for the first time will start collecting some internal
performance data. That means performance will be slightly lower than normal for
the rest of the time the player is running (even if the stats page is closed).
Note that the stats page itself uses a lot of CPU and even GPU resources, and
may have a heavy impact on performance.
The displayed information is accumulated over the redraw delay (shown as
``poll-time`` field).
This adds entries for each Lua script. If there are too many scripts running,
parts of the list will simply be out of the screen, but it can be scrolled.
If the underlying platform does not support pthread per thread times, the
displayed times will be 0 or something random (I suspect that at time of this
writing, only Linux provides the correct via pthread APIs for per thread times).
Most entries are added lazily and only during data collection, which is why
entries may pop up randomly after some time. It's also why the memory usage
entries for scripts that have been inactive since the start of data collection
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.
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
corresponding pthread API works and is supported).
+96 -366
View File
@@ -44,21 +44,23 @@ 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
https://ffmpeg.org/ffmpeg-filters.html .
http://ffmpeg.org/ffmpeg-filters.html .
Also, keep in mind that most actual filters are available via the ``lavfi``
wrapper, which gives you access to most of libavfilter's filters. This
@@ -83,9 +85,6 @@ this as well.
Video filters are managed in lists. There are a few commands to manage the
filter list.
``--vf-append=filter``
Appends the filter given as arguments to the filter list.
``--vf-add=filter``
Appends the filter given as arguments to the filter list. (Passing multiple
filters is currently still possible, but deprecated.)
@@ -94,19 +93,12 @@ filter list.
Prepends the filters given as arguments to the filter list. (Passing
multiple filters is currently still possible, but deprecated.)
``--vf-remove=filter``
Deletes the filter from the list. The filter can be either given the way it
was added (filter name and its full argument list), or by label (prefixed
with ``@``). Matching of filters works as follows: if either of the compared
filters has a label set, only the labels are compared. If none of the
filters have a label, the filter name, arguments, and argument order are
compared. (Passing multiple filters is currently still possible, but
deprecated.)
``--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``
Deletes the filter. The filter can even given the way it was added (filter
name and its full argument list), by label (prefixed with ``@``), or as
index number. Index numbers start at 0, negative numbers address the end of
the list (-1 is the last). (Passing multiple filters is currently still
possible, but deprecated.)
``--vf-clr``
Completely empties the filter list.
@@ -120,65 +112,15 @@ With filters that support it, you can access parameters by their name.
Available mpv-only filters are:
``format=fmt=<value>:colormatrix=<value>:...``
Applies video parameter overrides, with optional conversion. By default,
this overrides the video's parameters without conversion (except for the
``fmt`` parameter), but can be made to perform an appropriate conversion
with ``convert=yes`` for parameters for which conversion is supported.
Restricts the color space for the next filter without doing any conversion.
Use together with the scale filter for a real conversion.
.. note::
For a list of available formats, see ``format=fmt=help``.
``<fmt>``
Image format name, e.g. rgb15, bgr24, 420p, etc. (default: don't change).
This filter always performs conversion to the given format.
.. note::
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).
If this is disabled (the default), the only conversion that is possibly
performed is format conversion if ``<fmt>`` is set. All other parameters
(like ``<colormatrix>``) are forced without conversion. This mode is
typically useful when files have been incorrectly tagged.
If this is enabled, libswscale or zimg is used if any of the parameters
mismatch. zimg is used of the input/output image formats are supported
by mpv's zimg wrapper, and if ``--sws-allow-zimg=yes`` is used. Both
libraries may not support all kinds of conversions. This typically
results in silent incorrect conversion. zimg has in many cases a better
chance of performing the conversion correctly.
In both cases, the color parameters are set on the output stage of the
image format conversion (if ``fmt`` was set). The difference is that
with ``convert=no``, the color parameters are not passed on to the
converter.
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``
Results in incorrect colors (if test.mkv was tagged correctly).
``mpv test.mkv --vf=format:colormatrix=ycgco:convert=yes --sws-allow-zimg``
Results in true conversion to ``ycgco``, assuming the renderer
supports it (``--vo=gpu`` normally does). You can add ``--vo=xv``
to force a VO which definitely does not support it, which should
show incorrect colors as confirmation.
Using ``--sws-allow-zimg=no`` (or disabling zimg at build time)
will use libswscale, which cannot perform this conversion as
of this writing.
Format name, e.g. rgb15, bgr24, 420p, etc. (default: don't change).
``<colormatrix>``
Controls the YUV to RGB color space conversion when playing video. There
@@ -192,7 +134,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
@@ -204,13 +146,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>``
@@ -277,10 +216,7 @@ Available mpv-only filters are:
:srgb: IEC 61966-2-4 (sRGB)
:linear: Linear light
:gamma1.8: Pure power curve (gamma 1.8)
:gamma2.0: Pure power curve (gamma 2.0)
:gamma2.2: Pure power curve (gamma 2.2)
:gamma2.4: Pure power curve (gamma 2.4)
:gamma2.6: Pure power curve (gamma 2.6)
:gamma2.8: Pure power curve (gamma 2.8)
:prophoto: ProPhoto RGB (ROMM) curve
:pq: ITU-R BT.2100 PQ (Perceptual quantizer) curve
@@ -312,35 +248,18 @@ Available mpv-only filters are:
:709-1886: Scene-referred using the BT709+BT1886 interaction
:gamma1.2: Scene-referred using a pure power OOTF (gamma=1.2)
``<dolbyvision=yes|no>``
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.
``<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.
Set the stereo mode the video is assumed to be encoded in. Takes the
same values as the ``--video-stereo-mode`` option.
``<stereo-out>``
Set the stereo mode the video should be displayed as. Takes the
same values as the ``--video-stereo-mode`` option.
``<rotate>``
Set the rotation the video is assumed to be encoded with in degrees.
The special value ``-1`` uses the input format.
``<w>``, ``<h>``
If not 0, perform conversion to the given size. Ignored if
``convert=yes`` is not set.
``<dw>``, ``<dh>``
Set the display size. Note that setting the display size such that
the video is scaled in both directions instead of just changing the
@@ -351,17 +270,16 @@ Available mpv-only filters are:
but values such as ``[16:9]`` can be passed too (``[...]`` for quoting
to prevent the option parser from interpreting the ``:`` character).
``<force-scaler=auto|zimg|sws>``
Force a specific scaler backend, if applicable. This is a debug option
and could go away any time.
``<spherical-type>``
Type of the spherical projection:
``<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.
:auto: As indicated by the file (default)
:none: Normal video
:equirect: Equirectangular
:unknown: Unknown projection
``<spherical-yaw>``, ``<spherical-pitch>``, ``<spherical-roll>``
Reference angle in degree, if spherical video is used.
``lavfi=graph[:sws-flags[:o=opts]]``
Filter video using FFmpeg's libavfilter.
@@ -405,7 +323,7 @@ Available mpv-only filters are:
option gives the flags which should be passed to libswscale. This
option is numeric and takes a bit-wise combination of ``SWS_`` flags.
See ``https://git.videolan.org/?p=ffmpeg.git;a=blob;f=libswscale/swscale.h``.
See ``http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libswscale/swscale.h``.
``<o>``
Set AVFilterGraph options. These should be documented by FFmpeg.
@@ -433,7 +351,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
@@ -442,38 +360,29 @@ Available mpv-only filters are:
of that will return errors. As such, you can't use the full power of
VapourSynth, but you can use certain filters.
.. warning::
Do not use this filter, unless you have expert knowledge in VapourSynth,
and know how to fix bugs in the mpv VapourSynth wrapper code.
If you just want to play video generated by VapourSynth (i.e. using
If you just want to play video generated by a VapourSynth (i.e. using
a native VapourSynth video source), it's better to use ``vspipe`` and a
pipe or FIFO to feed the video to mpv. The same applies if the filter script
FIFO to feed the video to mpv. The same applies if the filter script
requires random frame access (see ``buffered-frames`` parameter).
This filter is experimental. If it turns out that it works well and is
used, it will be ported to libavfilter. Otherwise, it will be just removed.
``file``
Filename of the script source. Currently, this is always a python
script (``.vpy`` in VapourSynth convention).
The variable ``video_in`` is set to the mpv video source, and it is
expected that the script reads video from it. (Otherwise, mpv will
decode no video, and the video packet queue will overflow, eventually
leading to only audio playing, or worse.)
The filter graph created by the script is also expected to pass through
timestamps using the ``_DurationNum`` and ``_DurationDen`` frame
properties.
See the end of the option list for a full list of script variables
defined by mpv.
script. The variable ``video_in`` is set to the mpv video source,
and it is expected that the script reads video from it. (Otherwise,
mpv will decode no video, and the video packet queue will overflow,
eventually leading to audio being stopped.) The script is also
expected to pass through timestamps using the ``_DurationNum`` and
``_DurationDen`` frame properties.
.. admonition:: Example:
::
import vapoursynth as vs
from vapoursynth import core
core = vs.get_core()
core.std.AddBorders(video_in, 10, 10, 20, 20).set_output()
.. warning::
@@ -484,61 +393,21 @@ Available mpv-only filters are:
``buffered-frames``
Maximum number of decoded video frames that should be buffered before
the filter (default: 4). This specifies the maximum number of frames
the script can request in backward direction.
the script can request in reverse direction.
E.g. if ``buffered-frames=5``, and the script just requested frame 15,
it can still request frame 10, but frame 9 is not available anymore.
If it requests frame 30, mpv will decode 15 more frames, and keep only
frames 25-30.
The only reason why this buffer exists is to serve the random access
requests the VapourSynth filter can make.
The VapourSynth API has a ``getFrameAsync`` function, which takes an
absolute frame number. Source filters must respond to all requests. For
example, a source filter can request frame 2432, and then frame 3.
Source filters typically implement this by pre-indexing the entire
file.
mpv on the other hand is stream oriented, and does not allow filters to
seek. (And it would not make sense to allow it, because it would ruin
performance.) Filters get frames sequentially in playback direction, and
cannot request them out of order.
To compensate for this mismatch, mpv allows the filter to access frames
within a certain window. ``buffered-frames`` controls the size of this
window. Most VapourSynth filters happen to work with this, because mpv
requests frames sequentially increasing from it, and most filters only
require frames "close" to the requested frame.
If the filter requests a frame that has a higher frame number than the
highest buffered frame, new frames will be decoded until the requested
frame number is reached. Excessive frames will be flushed out in a FIFO
manner (there are only at most ``buffered-frames`` in this buffer).
If the filter requests a frame that has a lower frame number than the
lowest buffered frame, the request cannot be satisfied, and an error
is returned to the filter. This kind of error is not supposed to happen
in a "proper" VapourSynth environment. What exactly happens depends on
the filters involved.
Increasing this buffer will not improve performance. Rather, it will
waste memory, and slow down seeks (when enough frames to fill the buffer
need to be decoded at once). It is only needed to prevent the error
described in the previous paragraph.
How many frames a filter requires depends on filter implementation
details, and mpv has no way of knowing. A scale filter might need only
1 frame, an interpolation filter may require a small number of frames,
and the ``Reverse`` filter will require an infinite number of frames.
If you want reliable operation to the full extend VapourSynth is
capable, use ``vspipe``.
The actual number of buffered frames also depends on the value of the
``concurrent-frames`` option. Currently, both option values are
multiplied to get the final buffer size.
(Normally, VapourSynth source filters must provide random access, but
mpv was made for playback, and does not provide frame-exact random
access. The way this video filter works is a compromise to make simple
filters work anyway.)
``concurrent-frames``
Number of frames that should be requested in parallel. The
level of concurrency depends on the filter and how quickly mpv can
@@ -547,29 +416,15 @@ Available mpv-only filters are:
making it higher than the number of cores can actually make it
slower.
Technically, mpv will call the VapourSynth ``getFrameAsync`` function
in a loop, until there are ``concurrent-frames`` frames that have not
been returned by the filter yet. This also assumes that the rest of the
mpv filter chain reads the output of the ``vapoursynth`` filter quickly
enough. (For example, if you pause the player, filtering will stop very
soon, because the filtered frames are waiting in a queue.)
Actual concurrency depends on many other factors.
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:
The following variables are defined by mpv:
``video_in``
The mpv video source as vapoursynth clip. Note that this has an
incorrect (very high) length set, which confuses many filters. This is
necessary, because the true number of frames is unknown. You can use the
``Trim`` filter on the clip to reduce the length.
The mpv video source as vapoursynth clip. Note that this has no length
set, which confuses many filters. Using ``Trim`` on the clip with a
high dummy length can turn it into a finite clip.
``video_in_dw``, ``video_in_dh``
Display size of the video. Can be different from video size if the
@@ -579,28 +434,42 @@ Available mpv-only filters are:
FPS value as reported by file headers. This value can be wrong or
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.
frames), the value of this variable might not be useful. Note that
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.
``vapoursynth-lazy``
The same as ``vapoursynth``, but doesn't load Python scripts. Instead, a
custom backend using Lua and the raw VapourSynth API is used. The syntax
is completely different, and absolutely no convenience features are
provided. There's no type checking either, and you can trigger crashes.
``user_data``
User data passed from the filter. This variable always exists, and defaults
to empty string.
.. admonition:: Example:
::
video_out = invoke("morpho", "Open", {clip = video_in})
The special variable ``video_in`` is the mpv video source, while the
special variable ``video_out`` is used to read video from. The 1st argument
is the plugin (queried with ``getPluginByNs``), the 2nd is the filter name,
and the 3rd argument is a table with the arguments. Positional arguments
are not supported. The types must match exactly. Since Lua is terrible and
can't distinguish integers and floats, integer arguments must be prefixed
with ``i_``, in which case the prefix is removed and the argument is cast
to an integer. Should the argument's name start with ``i_``, you're out of
luck.
Clips (VSNodeRef) are passed as light userdata, so trying to pass any
other userdata type will result in hard crashes.
``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.
Currently deinterlaces. This filter is automatically inserted if
VA-AP-API video post processing. Works with ``--vo=vaapi`` and ``--vo=gpu``
only. Currently deinterlaces. This filter is automatically inserted if
deinterlacing is requested (either using the ``d`` key, by default mapped to
the command ``cycle deinterlace``, or the ``--deinterlace`` option).
@@ -628,7 +497,7 @@ Available mpv-only filters are:
``reversal-bug=<yes|no>``
:no: Use the API as it was interpreted by older Mesa drivers. While
this interpretation was more obvious and intuitive, it was
this interpretation was more obvious and inuitive, it was
apparently wrong, and not shared by Intel driver developers.
:yes: Use Intel interpretation of surface forward and backwards
references (default). This is what Intel drivers and newer Mesa
@@ -687,33 +556,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>``
@@ -722,120 +569,3 @@ 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.
``fingerprint=...``
Compute video frame fingerprints and provide them as metadata. Actually, it
currently barely deserved to be called ``fingerprint``, because it does not
compute "proper" fingerprints, only tiny downscaled images (but which can be
used to compute image hashes or for similarity matching).
The main purpose of this filter is to support the ``skip-logo.lua`` script.
If this script is dropped, or mpv ever gains a way to load user-defined
filters (other than VapourSynth), this filter will be removed. Due to the
"special" nature of this filter, it will be removed without warning.
The intended way to read from the filter is using ``vf-metadata`` (also
see ``clear-on-query`` filter parameter). The property will return a list
of key/value pairs as follows:
::
fp0.pts = 1.2345
fp0.hex = 1234abcdef...bcde
fp1.pts = 1.4567
fp1.hex = abcdef1234...6789
...
fpN.pts = ...
fpN.hex = ...
type = gray-hex-16x16
Each ``fp<N>`` entry is for a frame. The ``pts`` entry specifies the
timestamp of the frame (within the filter chain; in simple cases this is
the same as the display timestamp). The ``hex`` field is the hex encoded
fingerprint, whose size and meaning depend on the ``type`` filter option.
The ``type`` field has the same value as the option the filter was created
with.
This returns the frames that were filtered since the last query of the
property. If ``clear-on-query=no`` was set, a query doesn't reset the list
of frames. In both cases, a maximum of 10 frames is returned. If there are
more frames, the oldest frames are discarded. Frames are returned in filter
order.
(This doesn't return a structured list for the per-frame details because the
internals of the ``vf-metadata`` mechanism suck. The returned format may
change in the future.)
This filter uses zimg for speed and profit. However, it will fallback to
libswscale in a number of situations: lesser pixel formats, unaligned data
pointers or strides, or if zimg fails to initialize for unknown reasons. In
these cases, the filter will use more CPU. Also, it will output different
fingerprints, because libswscale cannot perform the full range expansion we
normally request from zimg. As a consequence, the filter may be slower and
not work correctly in random situations.
``type=...``
What fingerprint to compute. Available types are:
:gray-hex-8x8: grayscale, 8 bit, 8x8 size
:gray-hex-16x16: grayscale, 8 bit, 16x16 size (default)
Both types simply remove all colors, downscale the image, concatenate
all pixel values to a byte array, and convert the array to a hex string.
``clear-on-query=yes|no``
Clear the list of frame fingerprints if the ``vf-metadata`` property for
this filter is queried (default: yes). This requires some care by the
user. Some types of accesses might query the filter multiple times,
which leads to lost frames.
``print=yes|no``
Print computed fingerprints to the terminal (default: no). This is
mostly for testing and such. Scripts should use ``vf-metadata`` to
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.)
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.
.. warning::
This is highly experimental. Performance is bad, and it will not work
everywhere in the first place. Some features are not supported.
.. warning::
This does not do OSD rendering. If you see OSD, then it has been
rendered by the VO backend. (Subtitles are rendered by the ``gpu``
filter, if possible.)
.. warning::
If you use this with encoding mode, keep in mind that encoding mode will
convert the RGB filter's output back to yuv420p in software, using the
configured software scaler. Using ``zimg`` might improve this, but in
any case it might go against your goals when using this filter.
.. warning::
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.
+173 -365
View File
@@ -19,53 +19,8 @@ in the list.
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``
General purpose, customizable, GPU-accelerated video output driver. It
supports extended scaling methods, dithering, color management, custom
shaders, HDR, and more.
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>``.
This VO abstracts over several possible graphics APIs and windowing
contexts, which can be influenced using the ``--gpu-api`` and
``--gpu-context`` options.
Hardware decoding over OpenGL-interop is supported to some degree. Note
that in this mode, some corner case might not be gracefully handled, and
color space conversion and chroma upsampling is generally in the hand of
the hardware decoder APIs.
``gpu`` makes use of FBOs by default. Sometimes you can achieve better
quality or performance by changing the ``--fbo-format`` option to
``rgb16f``, ``rgb32f`` or ``rgb``. Known problems include Mesa/Intel not
accepting ``rgb16``, Mesa sometimes not being compiled with float texture
support, and some macOS setups being very slow with ``rgb16`` but fast
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
@@ -116,16 +71,11 @@ Available video output drivers are:
Shared memory video output driver without hardware acceleration that works
whenever X11 is present.
Since mpv 0.30.0, you may need to use ``--profile=sw-fast`` to get decent
performance.
.. note:: This is a fallback only, and should not be normally used.
``vdpau`` (X11 only)
Uses the VDPAU interface to display and optionally also decode video.
Hardware decoding is used with ``--hwdec=vdpau``. Note that there is
absolutely no reason to use this, other than compatibility. We strongly
recommend that you use ``--vo=gpu`` with ``--hwdec=nvdec`` instead.
Hardware decoding is used with ``--hwdec=vdpau``.
.. note::
@@ -146,6 +96,29 @@ Available video output drivers are:
Apply a noise reduction algorithm to the video (default: 0; no noise
reduction).
``--vo-vdpau-deint=<-4-4>``
(Deprecated. See note about ``vdpaupp``.)
Select deinterlacing mode (default: 0). In older versions (as well as
MPlayer/mplayer2) you could use this option to enable deinterlacing.
This doesn't work anymore, and deinterlacing is enabled with either
the ``d`` key (by default mapped to the command ``cycle deinterlace``),
or the ``--deinterlace`` option. Also, to select the default deint mode,
you should use something like ``--vf-defaults=vdpaupp:deint-mode=temporal``
instead of this sub-option.
0
Pick the ``vdpaupp`` video filter default, which corresponds to 3.
1
Show only first field.
2
Bob deinterlacing.
3
Motion-adaptive temporal deinterlacing. May lead to A/V desync
with slow video hardware and/or high resolution.
4
Motion-adaptive temporal deinterlacing with edge-guided spatial
interpolation. Needs fast video hardware.
``--vo-vdpau-chroma-deint``
(Deprecated. See note about ``vdpaupp``.)
@@ -228,8 +201,33 @@ Available video output drivers are:
.. note:: This driver is for compatibility with systems that don't provide
proper OpenGL drivers, and where ANGLE does not perform well.
.. note:: Before to 0.21.0, ``direct3d_shaders`` and ``direct3d`` were
different, with ``direct3d`` not using shader by default. Now
both use shaders by default, and ``direct3d_shaders`` is a
deprecated alias. Use the ``--vo-direct3d-prefer-stretchrect``
or the ``--vo-direct3d-disable-shaders`` options to get the old
behavior of ``direct3d``.
The following global options are supported by this video output:
``--vo-direct3d-prefer-stretchrect``
Use ``IDirect3DDevice9::StretchRect`` over other methods if possible.
``--vo-direct3d-disable-stretchrect``
Never render the video using ``IDirect3DDevice9::StretchRect``.
``--vo-direct3d-disable-textures``
Never render the video using D3D texture rendering. Rendering with
textures + shader will still be allowed. Add ``disable-shaders`` to
completely disable video rendering with textures.
``--vo-direct3d-disable-shaders``
Never use shaders when rendering video.
``--vo-direct3d-only-8bit``
Never render YUV video with more than 8 bits per component.
Using this flag will force software conversion to 8-bit.
``--vo-direct3d-disable-texture-align``
Normally texture sizes are always aligned to 16. With this option
enabled, the video texture will always have exactly the same size as
@@ -275,13 +273,42 @@ Available video output drivers are:
``--vo-direct3d-exact-backbuffer``
Always resize the backbuffer to window size.
``gpu``
General purpose, customizable, GPU-accelerated video output driver. It
supports extended scaling methods, dithering, color management, custom
shaders, HDR, and more.
See `GPU renderer options`_ for options specific to this VO.
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
``--gpu-context`` options.
Hardware decoding over OpenGL-interop is supported to some degree. Note
that in this mode, some corner case might not be gracefully handled, and
color space conversion and chroma upsampling is generally in the hand of
the hardware decoder APIs.
``gpu`` makes use of FBOs by default. Sometimes you can achieve better
quality or performance by changing the ``--gpu-fbo-format`` option to
``rgb16f``, ``rgb32f`` or ``rgb``. Known problems include Mesa/Intel not
accepting ``rgb16``, Mesa sometimes not being compiled with float texture
support, and some OS X setups being very slow with ``rgb16`` but fast
with ``rgb32f``. If you have problems, you can also try enabling the
``--gpu-dumb-mode=yes`` option.
``sdl``
SDL 2.0+ Render video output driver, depending on system with or without
hardware acceleration. Should work on all platforms supported by SDL 2.0.
For tuning, refer to your copy of the file ``SDL_hints.h``.
.. note:: This driver is for compatibility with systems that don't provide
proper graphics drivers.
proper graphics drivers, or which support GLES only.
The following global options are supported by this video output:
@@ -291,23 +318,13 @@ Available video output drivers are:
``--sdl-switch-mode``
Instruct SDL to switch the monitor video mode when going fullscreen.
``dmabuf-wayland``
Experimental Wayland output driver designed for use with either drm stateless
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.
Weston and wlroots-based compositors like Sway and Intel GPUs are known to generally
work.
``vaapi``
Intel VA API video output driver with support for hardware decoding. Note
that there is absolutely no reason to use this, other than compatibility.
This is low quality, and has issues with OSD. We strongly recommend that
you use ``--vo=gpu`` with ``--hwdec=vaapi`` instead.
This is low quality, and has issues with OSD.
.. note:: This driver is for compatibility with crappy systems. You can
use vaapi hardware decoding with ``--vo=gpu`` too.
The following global options are supported by this video output:
@@ -321,6 +338,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
@@ -329,7 +365,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:
@@ -340,35 +376,12 @@ 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``
Color Unicode art video output driver that works on a text console.
By default depends on support of true color by modern terminals to display
the images at full color range, but 256-colors output is also supported (see
below). On Windows it requires an ansi terminal such as mintty.
Since mpv 0.30.0, you may need to use ``--profile=sw-fast`` to get decent
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
``--really-quiet`` can help with that.
Depends on support of true color by modern terminals to display the images
at full color range. On Windows it requires an ansi terminal such as mintty.
``--vo-tct-algo=<algo>``
Select how to write the pixels to the terminal.
@@ -380,25 +393,6 @@ Available video output drivers are:
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.
@@ -406,160 +400,6 @@ 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.
``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.
You may need to use ``--profile=sw-fast`` to get decent performance.
Note: at the time of writing, ``xterm`` does not enable sixel by default -
launching it as ``xterm -ti 340`` is one way to enable it. Also, ``xterm``
does not display images bigger than 1000x1000 pixels by default.
To render and align sixel images correctly, mpv needs to know the terminal
size both in cells and in pixels. By default it tries to use values which
the terminal reports, however, due to differences between terminals this is
an error-prone process which cannot be automated with certainty - some
terminals report the size in pixels including the padding - e.g. ``xterm``,
while others report the actual usable number of pixels - like ``mlterm``.
Additionally, they may behave differently when maximized or in fullscreen,
and mpv cannot detect this state using standard methods.
Sixel size and alignment options:
``--vo-sixel-cols=<columns>``, ``--vo-sixel-rows=<rows>`` (default: 0)
Specify the terminal size in character cells, otherwise (0) read it
from the terminal, or fall back to 80x25. Note that mpv doesn't use the
the last row with sixel because this seems to result in scrolling.
``--vo-sixel-width=<width>``, ``--vo-sixel-height=<height>`` (default: 0)
Specify the available size in pixels, otherwise (0) read it from the
terminal, or fall back to 320x240. Other than excluding the last line,
the height is also further rounded down to a multiple of 6 (sixel unit
height) to avoid overflowing below the designated size.
``--vo-sixel-left=<col>``, ``--vo-sixel-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-sixel-pad-x=<pad_x>``, ``--vo-sixel-pad-y=<pad_y>`` (default: -1)
Used only when mpv reads the size in pixels from the terminal.
Specify the number of padding pixels (on one side) which are included
at the size which the terminal reports. If -1 (default) then the number
of pixels is rounded down to a multiple of number of cells (per axis),
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
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>``
Selects the dither algorithm which libsixel should apply.
Can be one of the below list as per libsixel's documentation.
auto (Default)
Let libsixel choose the dithering method.
none
Don't diffuse
atkinson
Diffuse with Bill Atkinson's method.
fs
Diffuse with Floyd-Steinberg method
jajuni
Diffuse with Jarvis, Judice & Ninke method
stucki
Diffuse with Stucki's method
burkes
Diffuse with Burkes' method
arithmetic
Positionally stable arithmetic dither
xor
Positionally stable arithmetic xor based dither
``--vo-sixel-fixedpalette=<yes|no>`` (default: yes)
Use libsixel's built-in static palette using the XTERM256 profile
for dither. Fixed palette uses 256 colors for dithering. Note that
using ``no`` (at the time of writing) will slow down ``xterm``.
``--vo-sixel-reqcolors=<colors>`` (default: 256)
Has no effect with fixed palette. Set up libsixel to use required
number of colors for dynamic palette. This value depends on the
terminal emulator as well. Xterm supports 256 colors. Can set this to
a lower value for faster performance.
``--vo-sixel-threshold=<threshold>`` (default: -1)
Has no effect with fixed palette. Defines the threshold to change the
palette - as percentage of the number of colors, e.g. 20 will change
the palette when the number of colors changed by 20%. It's a simple
measure to reduce the number of palette changes, because it can be slow
in some terminals (``xterm``). The default (-1) will choose a palette
on every frame and will have better quality.
``image``
Output each frame into an image file in the current directory. Each file
takes the frame number padded with leading zeros as name.
@@ -575,8 +415,6 @@ Available video output drivers are:
JPEG files, extension .jpeg.
png
PNG files.
webp
WebP files.
``--vo-image-png-compression=<0-9>``
PNG compression factor (speed vs. file size tradeoff) (default: 7)
@@ -587,17 +425,11 @@ Available video output drivers are:
JPEG quality factor (default: 90)
``--vo-image-jpeg-optimize=<0-100>``
JPEG optimization factor (default: 100)
``--vo-image-webp-lossless=<yes|no>``
Enable writing lossless WebP files (default: no)
``--vo-image-webp-quality=<0-100>``
WebP quality (default: 75)
``--vo-image-webp-compression=<0-6>``
WebP compression factor (default: 4)
``--vo-image-outdir=<dirname>``
Specify the directory to save the image files to (default: ``./``).
``libmpv``
For use with libmpv direct embedding. As a special case, on macOS it
For use with libmpv direct embedding. As a special case, on OS X it
is used like a normal VO within mpv (cocoa-cb). Otherwise useless in any
other contexts.
(See ``<mpv/render.h>``.)
@@ -605,106 +437,91 @@ 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
environment (e.g. no X). Does not support hardware acceleration (if you
need this, check the ``drm`` backend for ``gpu`` VO).
Since mpv 0.30.0, you may need to use ``--profile=sw-fast`` to get decent
performance.
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)
connector. Use ``--drm-connector=help`` to get list of available
connectors. When using multiple graphic cards, use the ``<gpu_number>``
argument to disambiguate.
(default: empty)
``--drm-device=<path>``
Select the DRM device file to use. If specified this overrides automatic
card selection. (default: empty)
``--drm-mode=<number>``
Mode ID to use (resolution and frame rate).
(default: 0)
``--drm-mode=<preferred|highest|N|WxH[@R]>``
Mode to use (resolution and frame rate).
Possible values:
``--drm-osd-plane-id=<number>``
Select the DRM plane index to use for OSD (or OSD and video).
Index is zero based, and related to crtc.
When using this option with the drm_prime renderer, it will only affect
the OSD contents. Otherwise it will set OSD & video plane.
(default: primary plane)
:preferred: Use the preferred mode for the screen on the selected
connector. (default)
:highest: Use the mode with the highest resolution available on the
selected connector.
:N: Select mode by index.
:WxH[@R]: Specify mode by width, height, and optionally refresh rate.
In case several modes match, selects the mode that comes
first in the EDID list of modes.
``--drm-video-plane-id=<number>``
Select the DRM plane index to use for video layer.
Index is zero based, and related to crtc.
This option only has effect when using the drm_prime renderer (which
supports several layers) together with ``vo=gpu`` and ``gpu-context=drm``.
(default: first overlay plane)
Use ``--drm-mode=help`` to get a list of available modes for all active
connectors.
``--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
pick the first applicable primary plane; ``overlay``, which will pick
the first applicable overlay plane; or by index. The index is zero
based, and related to the CRTC.
(default: primary)
When using this option with the drmprime-overlay hwdec interop, only the
OSD is rendered to this plane.
``--drm-drmprime-video-plane=<primary|overlay|N>``
Select the DRM plane to use for video with the drmprime-overlay hwdec
interop (used by e.g. the rkmpp hwdec on RockChip SoCs, and v4l2 hwdec:s
on various other SoC:s). The plane is unused otherwise. This option
accepts the same values as ``--drm-draw-plane``. (default: overlay)
To be able to successfully play 4K video on various SoCs you might need
to set ``--drm-draw-plane=overlay --drm-drmprime-video-plane=primary``
and setting ``--drm-draw-surface-size=1920x1080``, to render the OSD at a
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.
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.
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.
Unless you have an intel graphics card, a recent kernel and a recent
version of mesa (>=18) xrgb2101010 is unlikely to work for you.
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.
``--drm-draw-surface-size=<[WxH]>``
Sets the size of the surface used on the draw plane. The surface will
then be upscaled to the current screen resolution. This option can be
useful when used together with the drmprime-overlay hwdec interop at
high resolutions, as it allows scaling the draw plane (which in this
case only handles the OSD) down to a size the GPU can handle.
When used without the drmprime-overlay hwdec interop this option will
just cause the video to get rendered at a different resolution and then
scaled to screen size.
This currently only has an effect when used together with the ``drm``
backend for the ``gpu`` VO. The ``drm`` VO always uses xrgb8888.
``--drm-osd-size=<[WxH]>``
Sets the OSD OpenGL size to the specified size. OSD will then be upscaled
to the current screen resolution. This option can be useful when using
several layers in high resolutions with a GPU which cannot handle it.
Note : this option is only available with DRM atomic support.
(default: display resolution)
``--drm-vrr-enabled=<no|yes|auto>``
Toggle use of Variable Refresh Rate (VRR), aka Freesync or Adaptive Sync
on compatible systems. VRR allows for the display to be refreshed at any
rate within a range (usually ~40Hz-60Hz for 60Hz displays). This can help
with playback of 24/25/50fps content. Support depends on the use of a
compatible monitor, GPU, and a sufficiently new kernel with drivers
that support the feature.
:no: Do not attempt to enable VRR. (default)
:yes: Attempt to enable VRR, whether the capability is reported or not.
:auto: Attempt to enable VRR if support is reported.
``mediacodec_embed`` (Android)
Renders ``IMGFMT_MEDIACODEC`` frames directly to an ``android.view.Surface``.
Requires ``--hwdec=mediacodec`` for hardware decoding, along with
@@ -714,14 +531,5 @@ Available video output drivers are:
many of mpv's features (subtitle rendering, OSD/OSC, video filters, etc)
are not available with this driver.
To use hardware decoding with ``--vo=gpu`` instead, use ``--hwdec=mediacodec``
or ``mediacodec-copy`` along with ``--gpu-context=android``.
``wlshm`` (Wayland only)
Shared memory video output driver without hardware acceleration that works
whenever Wayland is present.
Since mpv 0.30.0, you may need to use ``--profile=sw-fast`` to get decent
performance.
.. note:: This is a fallback only, and should not be normally used.
To use hardware decoding with ``--vo-gpu`` instead, use
``--hwdec=mediacodec-copy`` along with ``--gpu-context=android``.
+10 -9
View File
@@ -52,7 +52,7 @@ Input
* Classic LIRC support was removed. Install remotes as input devices instead.
This way they will send X11 key events to the mpv window, which can be bound
using the normal ``input.conf``.
Also see: https://github.com/mpv-player/mpv/wiki/IR-remotes
Also see: http://github.com/mpv-player/mpv/wiki/IR-remotes
* Joystick support was removed. It was considered useless and was the cause
of some problems (e.g. a laptop's accelerator being recognized as joystick).
* Support for relative seeking by percentage.
@@ -135,15 +135,16 @@ 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.
* Cocoa event loop is independent from MPlayer's event loop, so user
actions like accessing menus and live resizing do not block the playback.
* Apple Remote support.
* Media Keys support.
* VDA support using libavcodec hwaccel API instead of FFmpeg's decoder with up
to 2-2.5x reduction in CPU usage.
@@ -177,7 +178,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 +215,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 +230,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)
@@ -247,7 +248,7 @@ Command Line Switches
``-msglevel`` ``--msg-level`` (changed semantics)
``-msgmodule`` ``--msg-module``
``-name`` ``--x11-name``
``-noar`` ``(removed; replaced by MediaPlayer framework)``
``-noar`` ``--no-input-appleremote``
``-noautosub`` ``--no-sub-auto``
``-noconsolecontrols`` ``--no-input-terminal``
``-nosound`` ``--no-audio``
@@ -321,9 +322,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). |
+29 -55
View File
@@ -1,15 +1,13 @@
Release Policy
==============
Once or twice a year, a new release is cut off of the master branch and is
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.
@@ -22,47 +20,33 @@ Release procedure
While on master:
- Update the `RELEASE_NOTES` file, replacing the previous release notes.
- Update the `RELEASE_NOTES` file.
- Update the `MPV_VERSION` file.
- Update the `VERSION` file.
- Update `DOCS/client-api-changes.rst` (in particular, update the last version
number if necessary)
- Update `DOCS/client-api-changes.rst` and `DOCS/interface-changes.rst`
(in particular, update the last version numbers if necessary)
- Run `TOOLS/gen-interface-changes.py` to refresh `DOCS/interface-changes.rst`,
edit manually as necessary.
- Delete all `.txt` files in the `DOCS/interface-changes` directory except for `example.txt`.
- Create signed commit with changes.
- Commit 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 branch and tag to GitHub.
- Create a new GitHub release using the content of `RELEASE_NOTES` related to
the new version.
- Readd -UNKNOWN suffix to version in `MPV_VERSION` file.
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 can 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
=============
This release requires FFmpeg <ver> or newer.
Features
--------
@@ -71,18 +55,20 @@ New
- List of new features
Changed
~~~~~~~
- List of changed features
Removed
~~~~~~~
- List of removed features
Deprecated
~~~~~~~~~~
- List of deprecated features
Behavior
--------
- List of user-visible changes in behavior
Options and Commands
--------------------
@@ -92,52 +78,40 @@ Added
- List of added options and commands
Changed
~~~~~~~
- List of changed options and commands
Renamed
~~~~~~~
- List of renamed options and commands
Deprecated
~~~~~~~~~~
- List of deprecated options and commands
Removed
~~~~~~~
- List of removed options and commands
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.
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 of lists all changes since the last release, including those
that have been backported to patch releases already.
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
+40 -455
View File
@@ -11,11 +11,11 @@ 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
* call mp_play_files() function that works down the playlist:
* call play_files() function that works down the playlist:
* run idle loop (idle_loop()), until there are files in the
playlist or an exit command was given (only if --idle it set)
* actually load and play a file in play_current_file():
@@ -30,7 +30,7 @@ player/*.c:
* determine next entry on the playlist to play
* loop, or exit if no next file or quit is requested
(see enum stop_play_reason)
* call mp_destroy()
* call exit_player_with_rc()
* run_playloop():
* calls fill_audio_out_buffers()
This checks whether new audio needs to be decoded, and pushes it
@@ -44,9 +44,9 @@ 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
state in track.dec/d_sub
subsystems
- the currently played tracks are in mpctx->current_tracks, and decoder
state in track.d_video/d_audio/d_sub
- the other subsystems rarely call back into the frontend, and the frontend
polls them instead (probably a good thing)
- one exceptions are wakeup callbacks, which notify a "higher" component
@@ -68,7 +68,6 @@ 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:
@@ -104,45 +103,12 @@ options/options.h, options/options.c
options.c. Most default values for options and MPOpts are in
mp_default_opts at the end of options.c.
MPOpts is unfortunately quite monolithic, but is being incrementally broken
up into sub-structs. Many components have their own sub-option structs
separate from MPOpts. New options should be bound to the component that uses
them. Add a new option table/struct if needed.
MPOpts is unfortunately quite monolithic, and virtually accessed by
everything.But some components (like video outputs and video filters) have
their own sub-option tables separate from MPOpts.
The global MPOpts still contains the sub-structs as fields, which serves to
link them to the option parser. For example, an entry like this may be
typical:
{"", OPT_SUBSTRUCT(demux_opts, demux_conf)},
This directs the option access code to include all options in demux_conf
into the global option list, with no prefix (""), and as part of the
MPOpts.demux_opts field. The MPOpts.demux_opts field is actually not
accessed anywhere, and instead demux.c does this:
struct m_config_cache *opts_cache =
m_config_cache_alloc(demuxer, global, &demux_conf);
struct demux_opts *opts = opts_cache->opts;
... to get a copy of its options.
See m_config_core.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.
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().
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
type that can be passed "down" the component hierarchy. For safety reasons,
you should not pass down any pointers to option structs (like MPOpts), but
instead pass down mpv_global, and use m_config_cache_alloc() (or similar)
to get a synchronized copy of the options.
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.
input/input.c:
This translates keyboard input coming from VOs and other sources (such
@@ -166,15 +132,19 @@ 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.)
cache.c is a caching wrapper around streams implementations, needed for
smooth network playback.
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
@@ -185,18 +155,6 @@ demux/:
There is a stream header for each audio/video/sub stream, and each of them
holds codec information about the stream and other information.
demux.c is a bit big, the main reason being that it contains the demuxer
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.
@@ -205,18 +163,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.
@@ -228,13 +190,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.
@@ -242,9 +204,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.
@@ -261,7 +223,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
@@ -273,385 +238,5 @@ 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.
Best practices and Concepts within mpv
======================================
General contribution etc.
-------------------------
See: DOCS/contribute.md
Error checking
--------------
If an error is relevant, it should be handled. If it's interesting, log the
error. However, mpv often keeps errors silent and reports failures somewhat
coarsely by propagating them upwards the caller chain. This is OK, as long as
the errors are not very interesting, or would require a developer to debug it
anyway (in which case using a debugger would be more convenient, and the
developer would need to add temporary debug printfs to get extremely detailed
information which would not be appropriate during normal operation).
Basically, keep a balance on error reporting. But always check them, unless you
have a good argument not to.
Memory allocation errors (OOM) are a special class of errors. Normally such
allocation failures are not handled "properly". Instead, abort() is called.
(New code should use MP_HANDLE_OOM() for this.) This is done out of laziness and
for convenience, and due to the fact that MPlayer/mplayer2 never handled it
correctly. (MPlayer varied between handling it correctly, trying to do so but
failing, and just not caring, while mplayer2 started using abort() for it.)
This is justifiable in a number of ways. Error handling paths are notoriously
untested and buggy, so merely having them won't make your program more reliable.
Having these error handling paths also complicates non-error code, due to the
need to roll back state at any point after a memory allocation.
Take any larger body of code, that is supposed to handle OOM, and test whether
the error paths actually work, for example by overriding malloc with a version
that randomly fails. You will find bugs quickly, and often they will be very
annoying to fix (if you can even reproduce them).
In addition, a clear indication that something went wrong may be missing. On
error your program may exhibit "degraded" behavior by design. Consider a video
encoder dropping frames somewhere in the middle of a video due to temporary
allocation failures, instead of just exiting with an errors. In other cases, it
may open conceptual security holes. Failing fast may be better.
mpv uses GPU APIs, which may be break on allocation errors (because driver
authors will have the same issues as described here), or don't even have a real
concept for dealing with OOM (OpenGL).
libmpv is often used by GUIs, which I predict always break if OOM happens.
Last but not least, OSes like Linux use "overcommit", which basically means that
your program may crash any time OOM happens, even if it doesn't use malloc() at
all!
But still, don't just assume malloc() always succeeds. Use MP_HANDLE_OOM(). The
ta* APIs do this for you. The reason for this is that dereferencing a NULL
pointer can have security relevant consequences if large offsets are involved.
Also, a clear error message is better than a random segfault.
Some big memory allocations are checked anyway. For example, all code must
assume that allocating video frames or packets can fail. (The above example
of dropping video frames during encoding is entirely possible in mpv.)
Undefined behavior
------------------
Undefined behavior (UB) is a concept in the C language. C is famous for being a
language that makes it almost impossible to write working code, because
undefined behavior is so easily triggered, compilers will happily abuse it to
generate "faster" code, debugging tools will shout at you, and sometimes it
even means your code doesn't work.
There is a lot of literature on this topic. Read it.
(In C's defense, UB exists in other languages too, but since they're not used
for low level infrastructure, and/or these languages are at times not rigorously
defined, simply nobody cares. However, the C standard committee is still guilty
for not addressing this. I'll admit that I can't even tell from the standard's
gibberish whether some specific behavior is UB or not. It's written like tax
law.)
In mpv, we generally try to avoid undefined behavior. For one, we want portable
and reliable operation. But more importantly, we want clean output from
debugging tools, in order to find real bugs more quickly and effectively.
Avoid the "works in practice" argument. Once debugging tools come into play, or
simply when "in practice" stops being true, this will all get back to you in a
bad way.
Global state, library safety
----------------------------
Mutable global state is when code uses global variables that are not read-only.
This must be avoided in mpv. Always use context structs that the caller of
your code needs to allocate, and whose pointers are passed to your functions.
Library safety means that your code (or library) can be used by a library
without causing conflicts with other library users in the same process. To any
piece of code, a "safe" library's API can simply be used, without having to
worry about other API users that may be around somewhere.
Libraries are often not library safe, because they use global mutable state
or other "global" resources. Typical examples include use of signals, simple
global variables (like hsearch() in libc), or internal caches not protected by
locks.
A surprisingly high number of libraries are not library safe because they need
global initialization. Typically they provide an API function, which
"initializes" the library, and which must be called before calling any other
API functions. Often, you are to provide global configuration parameters, which
can change the behavior of the library. If two libraries A and B use library C,
but A and B initialize C with different parameters, something "bad" may happen.
In addition, these global initialization functions are often not thread-safe. So
if A and B try to initialize C at the same time (from different threads and
without knowing about each other), it may cause undefined behavior. (libcurl is
a good example of both of these issues. FFmpeg and some TLS libraries used to be
affected, but improved.)
This is so bad because library A and B from the previous example most likely
have no way to cooperate, because they're from different authors and have no
business knowing each others. They'd need a library D, which wraps library C
in a safe way. Unfortunately, typically something worse happens: libraries get
"infected" by the unsafeness of its sub-libraries, and export a global init API
just to initialize the sub-libraries. In the previous example, libraries A and B
would export global init APIs just to init library C, even though the rest of
A/B are clean and library safe. (Again, libcurl is an example of this, if you
subtract other historic anti-features.)
The main problem with library safety is that its lack propagates to all
libraries using the library.
We require libmpv to be library safe. This is not really possible, because some
libraries are not library safe (FFmpeg, Xlib, partially ALSA). However, for
ideological reasons, there is no global init API, and best effort is made to try
to avoid problems.
libmpv has some features that are not library safe, but which are disabled by
default (such as terminal usage aka stdout, or JSON IPC blocking SIGPIPE for
internal convenience).
A notable, very disgustingly library unsafe behavior of libmpv is calling
abort() on some memory allocation failure. See error checking section.
Logging
-------
All logging and terminal output in mpv goes through the functions and macros
provided in common/msg.h. This is in part for library safety, and in part to
make sure users can silence all output, or to redirect the output elsewhere,
like a log file or the internal console.lua script.
Locking
-------
See generally available literature. In mpv, we use mp_thread 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.
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
thread), document it as well.
Internal mpv APIs are assumed to be not thread-safe by default. If they have
special guarantees (such as being usable by more than one thread at a time),
these should be explicitly documented.
All internal mpv APIs must be free of global state. Even if a component is not
thread-safe, multiple threads can use _different_ instances of it without any
locking.
On a side note, recursive locks may seem convenient at first, but introduce
additional problems with condition variables and locking hierarchies. They
should be avoided.
Locking hierarchy
-----------------
A simple way to avoid deadlocks with classic locking is to define a locking
hierarchy or lock order. If all threads acquire locks in the same order, no
deadlocks will happen.
For example, a "leaf" lock is a lock that is below all other locks in the
hierarchy. You can acquire it any time, as long as you don't acquire other
locks while holding it.
Unfortunately, C has no way to declare or check the lock order, so you should at
least document it.
In addition, try to avoid exposing locks to the outside. Making the declaration
of a lock private to a specific .c file (and _not_ exporting accessors or
lock/unlock functions that manipulate the lock) is a good idea. Your component's
API may acquire internal locks, but should release them when returning. Keeping
the entire locking in a single file makes it easy to check it.
Avoiding callback hell
----------------------
mpv code is separated in components, like the "frontend" (i.e. MPContext mpctx),
VOs, AOs, demuxers, and more. The frontend usually calls "down" the usage
hierarchy: mpctx almost on top, then things like vo/ao, and utility code on the
very bottom.
"Callback hell" is when components call both up and down the hierarchy,
which for example leads to accidentally recursion, reentrancy problems, or
locking nightmares. This is avoided by (mostly) calling only down the hierarchy.
Basically the call graph forms a DAG. The other direction is handled by event
queues, wakeup callbacks, and similar mechanisms.
Typically, a component provides an API, and does not know anything about its
user. The API user (component higher in the hierarchy) polls the state of the
lower component when needed.
This also enforces some level of modularization, and with some luck the locking
hierarchy. (Basically, locks of lower components automatically become leaf
locks.) Another positive effect is simpler memory management.
(Also see e.g.: http://250bpm.com/blog:24)
Wakeup callbacks
----------------
This is a common concept in mpv. Even the public API uses it. It's used when an
API has internal threads (or otherwise triggers asynchronous events), but the
component call hierarchy needs to be kept. The wakeup callback is the only
exception to the call hierarchy, and always calls up.
For example, vo spawns a thread that the API user (the mpv frontend) does not
need to know about. vo simply provides a single-threaded API (or that looks like
one). This API needs a way to notify the API user of new events. But the vo
event producer is on the vo thread - it can't simply invoke a callback back into
the API user, because then the API user has to deal with locking, despite not
using threads. In addition, this will probably cause problems like mentioned in
the "callback hell" section, especially lock order issues.
The solution is the wakeup callback. It merely unblocks the API user from
waiting, and the API user then uses the normal vo API to examine whether or
which state changed. As a concept, it documents what a wakeup callback is
allowed to do and what not, to avoid the aforementioned problems.
Generally, you are not allowed to call any API from the wakeup callback. You
just do whatever is needed to unblock your thread. For example, if it's waiting
on a mutex/condition variable, acquire the mutex, set a change flag, signal
the condition variable, unlock, return. (This mutex must not be held when
calling the API. It must be a leaf lock.)
Restricting the wakeup callback like this sidesteps any reentrancy issues and
other complexities. The API implementation can simply hold internal (and
non-recursive) locks while invoking the wakeup callback.
The API user still needs to deal with locking (probably), but there's only the
need to implement a single "receiver", that can handle the entire API of the
used component. (Or multiple APIs - MPContext for example has only 1 wakeup
callback that handles all AOs, VOs, input, demuxers, and more. It simple re-runs
the playloop.)
You could get something more advanced by turning this into a message queue. The
API would append a message to the queue, and the API user can read it. But then
you still need a way to "wakeup" the API user (unless you force the API user
to block on your API, which will make things inconvenient for the API user). You
also need to worry about what happens if the message queue overruns (you either
lose messages or have unbounded memory usage). In the mpv public API, the
distinction between message queue and wakeup callback is sort of blurry, because
it does provide a message queue, but an additional wakeup callback, so API
users are not required to call mpv_wait_event() with a high timeout.
mpv itself prefers using wakeup callbacks over a generic event queue, because
most times an event queue is not needed (or complicates things), and it is
better to do it manually.
(You could still abstract the API user side of wakeup callback handling, and
avoid reimplementing it all the time. Although mp_dispatch_queue already
provides mechanisms for this.)
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.
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()
(or similar). The "something" in "waiting for something" can be called
predicate (to avoid confusing it with "condition"). Consult literature for the
proper terms.
The very short version is...
Shared declarations:
mp_mutex lock;
mp_cond cond_var;
struct something state_var; // protected by lock, changes signaled by cond_var
Waiter thread:
mp_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
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);
}
// Here you may react to the state change. The state cannot change
// asynchronously as long as you still hold the lock (and didn't release
// and reacquire it).
// ...
mp_mutex_unlock(&lock);
Signaler thread:
mp_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);
// Fun fact: good implementations wake up the waiter only when the lock is
// released, to reduce kernel scheduling overhead.
mp_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
(And only if your predicate failed without releasing the lock..)
4. Always call mp_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
application state or the user predicate (it _only_ wakes up threads
that are at the same time blocking on mp_cond_wait() and friends,
nothing else)
- Changing the predicate, but not updating all mp_cond_broadcast()/
_signal() calls correctly
- Forgetting that mp_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)
- Waiting for a predicate correctly, but unlocking/relocking before acting
on it (unlocking allows arbitrary state changes)
- Confusing which lock/condition var. is used to manage a bit of state
Generally available literature probably has better examples and explanations.
Using condition variables the proper way is generally preferred over using more
messy variants of them. (Just saying because on win32, "SetEvent" exists, and
it's inferior to condition variables. Try to avoid the win32 primitives, even if
you're dealing with Windows-only code.)
Threads
-------
Threading should be conservatively used. Normally, mpv code pretends to be
single-threaded, and provides thread-unsafe APIs. Threads are used coarsely,
and if you can avoid messing with threads, you should. For example, VOs and AOs
do not need to deal with threads normally, even though they run on separate
threads. The glue code "isolates" them from any threading issues.
The file input.conf is actually integrated into the mpv binary by the
build system. It contains the default keybindings.
+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 <http://docs.waf.googlecode.com/git/book_17/single.html>`_.
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.
+13 -12
View File
@@ -1,8 +1,8 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, 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.
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -278,7 +278,7 @@ PROGRAMS), EVEN IF 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 Programs
If you develop a new program, and you want it to be of the greatest
@@ -303,9 +303,10 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
@@ -335,5 +336,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
+9 -9
View File
@@ -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
-1
View File
@@ -1 +0,0 @@
0.39.0
+103 -71
View File
@@ -1,6 +1,8 @@
![mpv logo](https://raw.githubusercontent.com/mpv-player/mpv.io/master/source/images/mpv-logo-128.png)
![http://mpv.io/](https://raw.githubusercontent.com/mpv-player/mpv.io/master/source/images/mpv-logo-128.png)
# mpv
## mpv
--------------
* [External links](#external-links)
@@ -9,9 +11,12 @@
* [Downloads](#downloads)
* [Changelog](#changelog)
* [Compilation](#compilation)
* [FFmpeg vs. Libav](#ffmpeg-vs-libav)
* [FFmpeg ABI compatibility](#ffmpeg-abi-compatibility)
* [Release cycle](#release-cycle)
* [Bug reports](#bug-reports)
* [Contributing](#contributing)
* [Relation to MPlayer and mplayer2](#relation-to-mplayer-and-mplayer2)
* [License](#license)
* [Contact](#contact)
@@ -20,47 +25,36 @@
* [Wiki](https://github.com/mpv-player/mpv/wiki)
* [FAQ][FAQ]
* [Manual](https://mpv.io/manual/master/)
* [FAQ](https://github.com/mpv-player/mpv/wiki/FAQ)
* [Manual](http://mpv.io/manual/master/)
## Overview
**mpv** is a free (as in freedom) media player for the command line. It supports
a wide variety of media file formats, audio and video codecs, and subtitle types.
There is a [FAQ][FAQ].
**mpv** is a media player based on MPlayer and mplayer2. It supports a wide
variety of video file formats, audio and video codecs, and subtitle types.
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,
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.
- A not too crappy GPU. mpv is not intended to be used with bad GPUs. There are
many caveats with drivers or system compositors causing tearing, stutter,
etc. 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
For semi-official builds and third-party packages please see
[mpv.io/installation](https://mpv.io/installation/).
[mpv.io/installation](http://mpv.io/installation/).
## Changelog
@@ -80,63 +74,69 @@ Changes to the default key bindings are indicated in
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. Below is a list of some important requirements.
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
look at the `meson_options.txt` file. Logs are stored in `meson-logs` within
your build directory.
The mpv build system uses [waf](https://waf.io/), but we don't store it in the
repository. The `./bootstrap.py` script will download the latest version
of waf that was tested with the build system.
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 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:
meson setup build
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:
mkdir -p subprojects
git clone https://code.videolan.org/videolan/libplacebo.git --depth=1 --recursive subprojects/libplacebo
./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)
- Lua (optional, required for the OSC pseudo-GUI and youtube-dl integration)
- libjpeg (optional, used for screenshots only)
- uchardet (optional, for subtitle charset detection)
- nvdec and vaapi libraries for hardware decoding on Linux (optional)
- vdpau and vaapi libraries for hardware decoding on Linux (optional)
Libass dependencies (when building libass):
Libass dependencies:
- 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
any platform)
- harfbuzz (optional, required for correct rendering of combining characters,
particularly for correct rendering of non-English text on OSX, and
Arabic/Indic scripts on any platform)
FFmpeg dependencies (when building FFmpeg):
FFmpeg dependencies:
- 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)
- For native DASH playback, FFmpeg needs to be built with --enable-libxml2
(although there are security implications, and DASH support has lots of bugs).
- AV1 decoding support requires dav1d.
(although there are security implications).
- For good nvidia support on Linux, make sure nv-codec-headers is installed
and can be found by configure.
- Libav support is broken. (See section below.)
Most of the above libraries are available in suitable versions on normal
Linux distributions. For ease of compiling the latest git master of everything,
@@ -144,17 +144,41 @@ 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].
## FFmpeg vs. Libav
Generally, mpv should work with the latest release as well as the git version
of FFmpeg. Libav support is currently broken, because they did not add certain
FFmpeg API changes which mpv relies on.
## FFmpeg ABI compatibility
mpv does not support linking against FFmpeg versions it was not built with, even
if the linked version is supposedly ABI-compatible with the version it was
compiled against. Expect malfunctions, crashes, and security issues if you
do it anyway.
The reason for not supporting this is because it creates far too much complexity
with little to no benefit, coupled with absurd and unusable FFmpeg API
artifacts.
Newer mpv versions will refuse to start if runtime and compile time FFmpeg
library versions mismatch.
## 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.
@@ -167,8 +191,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
@@ -180,37 +204,45 @@ changes come and talk to us on IRC before you start working on them. It will
make code review easier for both parties later on.
You can check [the wiki](https://github.com/mpv-player/mpv/wiki/Stuff-to-do)
or the [issue tracker](https://github.com/mpv-player/mpv/issues?q=is%3Aopen+is%3Aissue+label%3Ameta%3Afeature-request)
or the [issue tracker](https://github.com/mpv-player/mpv/issues?q=is%3Aopen+is%3Aissue+label%3A%22feature+request%22)
for ideas on what you could contribute with.
## Relation to MPlayer and mplayer2
mpv is a fork of MPlayer. Much has changed, and in general, mpv should be
considered a completely new program, rather than a MPlayer drop-in replacement.
For details see [FAQ entry](https://github.com/mpv-player/mpv/wiki/FAQ#How_is_mpv_related_to_MPlayer).
If you are wondering what's different from mplayer2 and MPlayer, an incomplete
and largely unmaintained list of changes is located [here][mplayer-changes].
## 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
This software is based on the MPlayer project. Before mpv existed as a project,
the code base was briefly developed under the mplayer2 project. For details,
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`
- **GitHub issue tracker**: [issue tracker][issue-tracker] (report bugs here)
- **User IRC Channel**: `#mpv` on `irc.freenode.net`
- **Developer IRC Channel**: `#mpv-devel` on `irc.freenode.net`
To contact the `mpv` team in private write to `mpv-team@googlegroups.com`. Use
only if discretion is required.
[FAQ]: https://github.com/mpv-player/mpv/wiki/FAQ
[releases]: https://github.com/mpv-player/mpv/releases
[mpv-build]: https://github.com/mpv-player/mpv-build
[homebrew-mpv]: https://github.com/mpv-player/homebrew-mpv
[issue-tracker]: https://github.com/mpv-player/mpv/issues
[discussions]: https://github.com/mpv-player/mpv/discussions
[ffmpeg_vs_libav]: https://github.com/mpv-player/mpv/wiki/FFmpeg-versus-Libav
[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
[mplayer-changes]: https://github.com/mpv-player/mpv/blob/master/DOCS/mplayer-changes.rst
[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
+133 -158
View File
@@ -1,58 +1,90 @@
Release 0.39.0
Release 0.29.1
==============
We are excited to announce the release of mpv 0.39.0, with more than 5 months of development since the last version. This release brings numerous improvements and fixes across nearly all components.
A bug fix release for the 0.29 release branch.
Key highlights:
Fixes and Minor Enhancements
----------------------------
* A new select.lua script, allowing users to easily choose files from playlists, tracks, chapters, output devices, and more.
* A native replacement for autoload.lua has been implemented. See --autocreate-playlist in the manual.
* NVIDIA RTX and Intel VSR scaling are now supported via the d3d11va filter.
* Media controls are now supported on Windows.
* Track selection has been improved, especially for multi-component languages like fr-CA.
* A new fifth page has been added to stats.lua, displaying track information.
* Compatibility with dmabuf-wayland has been significantly enhanced.
* Multi-touch support has been introduced.
- af_rubberband: Fix for A-V drift on seeking.
- ao_alsa: Fixes to remove spam during pausing and end-of-file.
- ao_jack: Fix for mpv attempting to connect to non-standard devices such as MIDI.
- ao_openal: Drop support for Apple's bundled OpenAL due to lack of features to successfully build.
- ao_pulse: Fix for audio buffer length calculation.
- demux_lavf: Fix EDL playback of certain DASH streams.
- demux_lavf: Mark v4l streams as not seekable.
- demux_raw: Fix for gapless playback from raw audio input.
- drm_atomic: Fix to enable video output with devices without a video overlay plane.
- encode: Fix for crashes in case of failure to write to output.
- encode: Fix for encoding when utilizing lavfi-complex.
- Fix to strip HDR peak metadata if attached to SDR video (#6111)
- macOS: Capability to fall back on SW rendering for testing purposes.
- macOS: Fix for issues with the main menu.
- macOS: Fix for side by side split view.
- macOS: Fixes for crashes, most notably those happening on 10.14 (#5908, #6097, #6041, #6062).
- macOS: No longer let older, unsupported versions of the Swift build tools through configure.
- manpage: Misc fixups.
- stream_{smb,file}: Fix for partial writes to buffers.
- stream_libarchive: Fix hang when an out-of-bound seek happens.
- stream_smb: Fix for crashes due to libsmbclient and threading (#5936).
- vo_gpu: Fix for corruption when multiple compute shaders override each others' block sizes (#6083).
- ytdl_hook: Always load "ytdl://" URLs with ytdl_hook first.
- ytdl_hook: Fix audio streams not being picked up for some sites.
This release requires FFmpeg 6.1 or newer and libplacebo 6.338.2 or newer.
Options and Commands
--------------------
Added
~~~~~
- `--cocoa-cb-sw-renderer` to control whether or not to fall back on software rendering on macOS.
Release 0.29.0
==============
This release requires FFmpeg 4.0 or newer.
Features
--------
New
~~~
Added
~~~~~
- vf_d3d11vpp: add support for Intel VSR and NVIDIA RTX scaling modes
- demux: add --autocreate-playlist
- audio: add pitch-shifting feature
- win32: add Media Control support
- various: allow changing GPU API options at runtime
- vo_gpu_next: support --gamma-factor
- vf_vapoursynth: upgrade to VapourSynth API v4
- select.lua: add this script
- console.lua: implement a command parser to complete more things
- demux_mkv: demux Block Additional Mappings
- cocoa-cb: add support for macOS color space transformation (EDR/HDR)
- powershell-completion: add PowerShell command line completion
- input: implement VO dragging deadzone
- win32: support multitouch
- wayland_common: support multitouch
- demux/packet: add support for ITU T.35 metadata in Matroska
- demux: support VVC Matroska demux
- terminal-win: support mouse input events
- x11_common: detect wm support for _NET_WM_STATE_SKIP_TASKBAR
- ao/openal: Add better sample format and channel layout selection
- ao/openal: Add support for direct channels output
- cocoa-cb: initial implementation via opengl-cb API
- context_drm_egl: Introduce 30bpp support (requires Mesa 18.0.0_rc4 or later)
- osx: add some more menu bar items as suggested by Apples's HIG
- vo_gpu: make screenshots use the GL renderer (#5498, #5240)
- x11: support Shift+TAB as an input key bind (#5849)
- ytdl_hook: support native dash demuxer, if present
Changed
~~~~~~~
- loadfile: improve the format of terminal track information
- options: add secondary-{sid,sub-delay} to watch_later_options
- input: map Num 5 to distinct value when numlock is off
- input.conf: make Alt+BS reset panscan
- msg: don't use bold colors and instead use bright ones
- ao_alsa, ao_pulse: reduce requested buffer size
- audio: change format negotiation, remove channel remix fudging
- client API: deprecate opengl-cb API and introduce a replacement API
- demux: lower demuxer cache default sizes from 400MB/400MB to 50MB/150MB
- osx: always deactivate the early opengl flush on macOS
- scripting: change when/how player waits for scripts being loaded
- vo_gpu: various improvements to HDR peak detection
- vo_gpu: various improvements to HDR tone mapping
- wayland_common: update to stable xdg-shell
- ytdl_hook: parse youtube playlist urls to set start index if `--ytdl-raw-option=yes-playlist=` is specified
Deprecated
~~~~~~~~~~
- af_lavrresample: deprecate this filter
Removed
~~~~~~~
- build: drop support for SDL1 (only applied to ao_sdl)
Options and Commands
@@ -61,145 +93,88 @@ Options and Commands
Added
~~~~~
- sub: add ass-video-aspect-override option
- input/keycodes: add KP_ADD/SUBTRACT/MULTIPLY/DIVIDE keycodes
- demux_playlist: use --directory-filter-types for --autocreate-playlist
- options: add --{video,audio,image}-exts
- player: don't decrement --ab-loop-count=N and add remaining-ab-loops
- player: don't decrement --loop-file=N and add remaining-file-loops
- sub: add (sub/osd)-border-style; renaming sub options
- input.conf: add zoom, pan, scale and rotate keybinds for numpad
- wayland: add a --wayland-present option
- mac/menu: add option to disable default shortcuts
- stats.lua: display file tags
- osc.lua: add option to use display fps for update interval
- osc.lua: add option to make rendering smoother
- opengl: add --egl-output-format, --egl-config-id
- vf_vapoursynth: add parameter to pass arbitrary string to script
- options: add --osd-playlist-entry
- {osc,stats}.lua: add 'auto' value to vidscale option
- input/cmd: add nonrepeatable prefix
- player: add option-info/<name>/expects-file
- command: add dolby-vision-profile and dolby-vision-level to track-list
- scripting: add mp.input.select()
- command: add normalize-path command
- OSC: implemented user configurable colors
- ao_wasapi: add `--wasapi-exclusive-buffer` option
- stats.lua: add option to disable scale with video size
- stats.lua: add option to control plot border width
- player/command: add track-list/N/decoder
- sd_ass: add `sub-vsfilter-bidi-compat` to enable vsfilter bidi compat
- {x11,w32}_common: implement --show-in-taskbar option
- add a number of --audio-resample-* options, which should from now on be used instead of --af-defaults=lavrresample:
- ao/openal: --openal-direct-channels
- command: add --osd-on-seek option defaulting to bar
- command: add a change-list command (#5435)
- options: add --http-proxy
- options: add a builtin low-latency profile
- vaapi: add option to select a non-default device path with --vaapi-device (#4320)
- video: add option to reduce latency by 1 or 2 frames
- vo_gpu: introduce --target-peak (#5521)
Changed
~~~~~~~
- sub: merge vsfilter-aspect and vsfilter-blur-compat options
- input.conf: swap the positions of values for `ctrl+h` binding
- video/csputils: remove space from choice option for chroma loc
- input.conf: add KP_DIVIDE/KP_MULTIPLY key bindings
- external_files: allow specifying --cover-art-whitelist filenames
- x11_common: handle runtime keepaspect/keepaspect-window change
- video/out/gpu/context: convert --gpu-api to object settings list
- playlist: let playlist-next go to first item if player is idle
- playlist: let playlist-prev go to last item in playlist
- options: remove deprecated auto choice for --mute
- player/command: alias playback-time to time-pos
- input.conf: change 'u' binding to cycle between 'force' and default
- options: make sub-ass-override default to 'scale'
- sd_ass: only set sub-scale for 'scale', 'force' or 'strip'
- player/command: mark sub-text-ass as deprecated
- player/command: add sub-text/ass-full sub-property
- player/command: move sub-text-ass to a sub-property
- command: change cycle-value command behavior (#5772)
- config: replace config dir lua-settings/ with dir script-opts/
- options: --lavfi-complex now requires uniquely named filter pads.
- options: --ytdl is now always enabled, even for libmpv
- options: make --deinterlace=yes always deinterlace (#5219)
- options: slightly improve filter help output for lavfi bridge
- vo: rename --vo=opengl-cb to --vo=libmpv
Deprecated
~~~~~~~~~~
- encoding: deprecate a bunch of obscure options (--ovoffset, --oaoffset, --ovfirst, --oafirst)
- options: deprecate --vf-defaults and --af-defaults
- osx: --gpu-context=cocoa with --gpu-api=opengl is now deprecated in favour of --vo=libmpv
Removed
~~~~~~~
- command: remove deprecated packet-*-bitrate properties
- console.lua: remove the scale script-opt
- osc.lua: remove scaleforcedwindow
- command: remove an old compatibility hack that allowed CLI aliases to be set as property, deprecated in 0.26.0
- input: remove legacy command handling for MPlayer commands that were deprecated in 2013
- options: drop --opensles-sample-rate, as --audio-samplerate should be used if desired
- options: drop deprecated --videotoolbox-format, --ff-aid, --ff-vid, --ff-sid, --ad-spdif-dtshd, --softvol options
- options: remove --video-stereo-mode
- options: remove deprecated ao/vo auto profiles
- options: remove the following encoding options: --ocopyts (now the default, old timestamp handling is gone), --oneverdrop (now default), --oharddup (you need to use --vf=fps=VALUE), --ofps, --oautofps, --omaxfps
Fixes and Minor Enhancements
----------------------------
- wayland: fix vertical resizing
- stats.lua: don't use ASS tags when use_ass is false
- video/out/wayland_common: set key state only on keyboard_enter keys
- input: add MP_KEY_STATE_SET_ONLY
- vo_gpu: use fallback colorspace for Dolby Vision
- video/out/wayland_common: don't pass mouse inputs on resizing edges
- hwdec_vulkan: allow using multiple decoding family queues
- hwdec_vulkan: update to new libavutil queue family API
- drm_prime: fix use of formats with modifiers
- build: bump minimum Windows version to 10
- input/ipc-win: support fd:// for --input-ipc-client
- player/command: fix --force-window=yes acting like immediate
- sd_ass: fix margin y scale with font size
- sd_ass: fix sub scale with window when use_margins is enabled
- loadfile,select.lua: print bitrates of tracks
- wayland: avoid potential floating point errors while scaling
- vo_dmabuf_wayland: don't use -ve margins in window size calculation
- ytdl_hook.lua: allow changing try_ytdl_first during runtime
- wayland: fix missed int -> double conversion for cursor scaling
- player/loadfile: enable streams in order of types when loading file
- misc/natural_sort: avoid implementation-defined behavior in comparison
- demux: allow refresh seek for non-video streams
- demux_edl: fix infinite loop on empty EDL files
- d3d11: return minimum bitdepth for display output and swapchain
- stats.lua: add page 5 for currently selected tracks information
- autoload.lua: fix options update
- input: prevent MBTN_LEFT conflict with VO dragging
- TOOLS/autoload.lua: fix directory_mode and ext options
- player/video: fix incorrect VO frame duration and frame drops
- x11: correct position coordinates if mpv was launched with --fs
- vo_vaapi: fix use-after-free when quitting
- vo_vaapi: fix use-after-free of current frame
- playloop: don't loop when seeking to the end of cover art while paused
- build: dynamically generate mpv.desktop file protocols
- wayland: use wl->callback_surface for idle inhibitor creation
- wayland: cap xdg_wm_base at 4 if wm_capabilities aren't supported
- {options,player}: fix stream leaks
- console.lua: increase margins from the bottom-left corner
- external_files: detect language tags with hyphens
- player/loadfile: match language and subcodes
- player: normalize paths for resuming playback
- demux_mkv: fix image detection
- demux_mkv: make V_QUICKTIME codec detection generic
- osd: show left arrow when playing backwards
- wayland: set wl->scaling if there is no wl->current_output yet
- sub/osd: fix rounding when rescaling bitmap subtitle rects
- zsh-completion: complete --gpu-context
- stats.lua: show osd-dimensions property
- sub/lavc_conv: don't override style of converted teletext pages
- mac: make display-names unique to allow specific selection
- vo_dmabuf_wayland: use wl_fixed_from_int when setting viewport source
- vo_dmabuf_wayland: fix scaling for subsurface positioning
- demux: also read "CUESHEET" tag from stream metadata
- stats.lua: filter input bindings by typing them
- vo_{tct,sixel,kitty}: implement mouse support
- terminal-unix: ignore unhandled mouse CSI sequences
- terminal-unix: support mouse escape codes
- sd_ass: fix margins for all styles when overriding PlayResX
- stats.lua: inherit OSD styles
- options: fix runtime update of teletext-page
- ytdl_hook: add some more yt-dlp tags
- vulkan: don't tolerate suboptimal swapchain configurations
- vd_lavc: add Vulkan hardware decoding to autoprobe
- sub/osd: add log if osd rendering takes too long time
- vo_gpu_next: allow setting antiring value for cscale
- f_auto_filters: don't set interlaced-only for userdeint
- vo_dmabuf_wayland: reject formats not supported by the GPU
- ytdl_hook: make path and json available to other scripts
- HIDRemote: fix volume buttons on macOS 10.13 (#5721)
- TOOLS/autoload: Fix broken "disabled" option
- TOOLS/autoload: be more robust with slow directory listings (#5618)
- ao_sdl: fix default buffer size
- build: add static libraries to libmpv.pc
- build: bump waf to 2.0.9 (fixes Python 3.7 compatibility)
- build: manually add standard library search paths for linking (#5791)
- common: round all integer times to milliseconds
- demux, player: fix playback of sparse video streams (w/ still images)
- demux: support for some kinds of timed metadata (e.g. ICY)
- demux_mkv: add V_AV1 identifier for AV1
- demux_mkv: support Meridian Lossless Packing in Matroska (#5923)
- display additional metadata tags during video playback
- drm_atomic: Fix memory leaks in drm_atomic_create
- enable cache for FUSE filesystems on OpenBSD and FreeBSD
- gpu: prefer 16bit floating point FBO formats to 16bit integer ones
- hwdec_vaegl: Fix VAAPI EGL interop used with gpu-context=drm
- input.conf: use exact value for [ binding, which does the inverse of ]
- input: add a keybinding to toggle hardware decoding
- input: minor additions to default key bindings (#973)
- osc: fix accidentally skipping files when seeking with slider
- player: fix strange behavior on edition switching
- player: fix track autoselection of external files yet again
- terminal-unix: stop trying to read when terminal disappears (#5842)
- video: actually wait for last frame being rendered on EOF
- video: fix --video-rotate in some cases
- video: fix crash with vdpau when reinitializing rendering (#5447)
- vo_gpu: fix anamorphic screenshots (#5619)
- vo_vdpau: fix resizing and rotation problems
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.38.0..v0.39.0`
A complete changelog can be seen by running `git log v0.28.2..v0.29.0`
in the git repository or by visiting either
https://github.com/mpv-player/mpv/compare/v0.38.0...v0.39.0 or
https://git.srsfckn.biz/mpv/log/?qt=range&q=v0.38.0..v0.39.0
https://github.com/mpv-player/mpv/compare/v0.28.2...v0.29.0 or
https://git.srsfckn.biz/mpv/log/?qt=range&q=v0.28.2..v0.29.0
View File
Whitespace-only changes.
+27
View File
@@ -0,0 +1,27 @@
#!/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 \
--disable-egl-angle-lib \
--enable-crossc \
--enable-d3d-hwaccel \
--enable-d3d11 \
--enable-egl-angle \
--enable-jpeg \
--enable-lcms2 \
--enable-libarchive \
--enable-libass \
--enable-lua \
--enable-rubberband \
--enable-shaderc \
--enable-uchardet \
--enable-vulkan
"$PYTHON" waf build
+72
View File
@@ -0,0 +1,72 @@
#!/usr/bin/bash
set -e
# 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-angleproject-git \
$MINGW_PACKAGE_PREFIX-cmake \
$MINGW_PACKAGE_PREFIX-lcms2 \
$MINGW_PACKAGE_PREFIX-libarchive \
$MINGW_PACKAGE_PREFIX-libass \
$MINGW_PACKAGE_PREFIX-libjpeg-turbo \
$MINGW_PACKAGE_PREFIX-lua51 \
$MINGW_PACKAGE_PREFIX-ninja \
$MINGW_PACKAGE_PREFIX-rubberband \
$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
)
# Compile shaderc
(
git clone --depth=1 https://github.com/google/shaderc && cd shaderc
git clone --depth=1 https://github.com/google/glslang.git third_party/glslang
git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Tools.git third_party/spirv-tools
git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers.git third_party/spirv-headers
mkdir build && cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DSHADERC_SKIP_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX ..
ninja install
cp -f libshaderc/libshaderc_shared.dll $MINGW_PREFIX/bin/
)
# Compile crossc
(
git clone --depth=1 https://github.com/rossy/crossc && cd crossc
git submodule update --init
make -j4 install prefix=$MINGW_PREFIX
)
-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, 'r') 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:
remove(output)
if depfile is not None:
remove(depfile)
sys.exit(1)
sys.exit(proc.returncode)
+96
View File
@@ -0,0 +1,96 @@
#!/usr/bin/env python
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
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 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 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 leafs(libs_dict, processed = []):
result = []
processed = set(processed)
for objfile, libs in libs_dict.items():
if libs <= processed:
result.append(objfile)
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, processed = []):
ls = leafs(libs_dict, processed)
diff = set(ls) - set(processed)
if diff == set([binary]):
return
for src in diff:
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 processed:
if p in libs_dict[src]:
install_name_tool_change(p, lib_name(p), dst)
return ls
def main():
binary = os.path.abspath(sys.argv[1])
if not os.path.exists(lib_path(binary)):
os.makedirs(lib_path(binary))
libs = libraries(binary)
libs_processed = process_libraries(libs, binary)
while libs_processed is not None:
libs_processed = process_libraries(libs, binary, libs_processed)
if __name__ == "__main__":
main()
-268
View File
@@ -1,268 +0,0 @@
#!/usr/bin/env python3
import re
import os
import sys
import shutil
import subprocess
import json
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, rapths):
command = "otool -L '%s' | grep -e '\t' | awk '{ print $1 }'" % objfile
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 = []
command = "otool -l '%s' | grep -A2 LC_RPATH | grep path" % objfile
pathRe = re.compile(r"^\s*path (.*) \(offset \d*\)$")
try:
result = subprocess.check_output(command, shell = True, universal_newlines=True)
except:
return rpaths
for line in result.splitlines():
line_clean = pathRe.search(line).group(1).strip()
# resolve @loader_path
if line_clean.startswith('@loader_path/'):
line_clean = line_clean[len('@loader_path/'):]
line_clean = os.path.normpath(os.path.join(os.path.dirname(objfile), line_clean))
rpaths.append(line_clean)
return rpaths
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(r"^\s*path (.*) \(offset \d*\)$")
output = []
for line in result.splitlines():
output.append(pathRe.search(line).group(1).strip())
return output
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:
result = subprocess.check_output("pkg-config vulkan --max-version=" + version, shell = True)
return True
except:
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, shell=True, stderr=subprocess.DEVNULL).strip()
except:
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 = dict(), result_relative = set(), 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):
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 process_vulkan_loader(binary, loaderName, loaderRelativeFolder, libraryNode):
# 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
loaderSystemSearchFolders = [
os.path.join(os.path.expanduser("~"), ".config", loaderRelativeFolder),
os.path.join("/etc/xdg", loaderRelativeFolder),
os.path.join("/usr/local/etc", loaderRelativeFolder),
os.path.join("/etc", loaderRelativeFolder),
os.path.join(os.path.expanduser("~"), ".local/share", loaderRelativeFolder),
os.path.join("/usr/local/share", loaderRelativeFolder),
os.path.join("/usr/share/vulkan", loaderRelativeFolder),
os.path.join(get_homebrew_prefix(), 'share', loaderRelativeFolder),
]
loaderSystemFolder = ""
for loaderSystemSearchFolder in loaderSystemSearchFolders:
if os.path.exists(loaderSystemSearchFolder):
loaderSystemFolder = loaderSystemSearchFolder
break
if not loaderSystemFolder:
print(">>> could not find loader folder " + loaderRelativeFolder)
return
loaderBundleFolder = os.path.join(resources_path(binary), loaderRelativeFolder)
loaderSystemPath = os.path.join(loaderSystemFolder, loaderName)
loaderBundlePath = os.path.join(loaderBundleFolder, loaderName)
libraryRelativeFolder = "../../../Frameworks/"
if not os.path.exists(loaderSystemPath):
print(">>> could not find loader " + loaderName)
return
if not os.path.exists(loaderBundleFolder):
os.makedirs(loaderBundleFolder)
loaderSystemFile = open(loaderSystemPath, 'r')
loaderJsonData = json.load(loaderSystemFile)
librarySystemPath = os.path.join(loaderSystemFolder, loaderJsonData[libraryNode]["library_path"])
if not os.path.exists(librarySystemPath):
print(">>> could not find loader library " + librarySystemPath)
return
print(">>> modifiying and writing loader json " + loaderName)
loaderBundleFile = open(loaderBundlePath, 'w')
loaderLibraryName = os.path.basename(librarySystemPath)
loaderJsonData[libraryNode]["library_path"] = os.path.join(libraryRelativeFolder, loaderLibraryName)
json.dump(loaderJsonData, loaderBundleFile, indent=4)
print(">>> copying loader library " + loaderLibraryName)
frameworkBundleFolder = os.path.join(loaderBundleFolder, libraryRelativeFolder)
if not os.path.exists(frameworkBundleFolder):
os.makedirs(frameworkBundleFolder)
shutil.copy(librarySystemPath, os.path.join(frameworkBundleFolder, loaderLibraryName))
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])
+11 -8
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# Convert the contents of a file into a C string constant.
# Note that the compiler will implicitly add an extra 0 byte at the end
@@ -22,24 +22,27 @@
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
import os
from __future__ import unicode_literals
import sys
# Indexing a byte string yields int on Python 3.x, and a str on Python 2.x
def pord(c):
return ord(c) if type(c) == str else c
def file2string(infilename, infile, outfile):
outfile.write("// Generated from %s\n\n" % infilename)
conv = ["\\%03o" % c for c in range(256)]
conv = ['\\' + ("%03o" % c) for c in range(256)]
safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" \
"0123456789!#%&'()*+,-./:;<=>[]^_{|}~ "
"0123456789!#%&'()*+,-./:;<=>?[]^_{|}~ "
for c in safe_chars:
conv[ord(c)] = c
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[pord(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)
with open(sys.argv[1], 'rb') as infile:
file2string(sys.argv[1], infile, sys.stdout)
-91
View File
@@ -1,91 +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 not 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 = -1
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 major_version == -1:
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, "r") 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}")
-45
View File
@@ -1,45 +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
from subprocess import check_output
if __name__ == "__main__":
with open(sys.argv[1], "r", 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")
mpv_protocols = check_output([sys.argv[2], "--no-config", "--list-protocols"], encoding="UTF-8")
mpv_protocols = set(line.strip(" :/") for line in mpv_protocols.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(","))
mpv_desktop["X-KDE-Protocols"] = ",".join(sorted(mpv_protocols & protocol_list)) + "\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 } \
+4 -7
View File
@@ -2,7 +2,7 @@
-- filter including key bindings for adjusting parameters.
--
-- See https://ffmpeg.org/ffmpeg-filters.html#acompressor for explanation
-- of the parameters.
-- of the parameteres.
local mp = require 'mp'
local options = require 'mp.options'
@@ -53,10 +53,8 @@ local params = {
}
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.
-- 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
@@ -78,8 +76,7 @@ local function show_osd(filter)
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)
pretty[#pretty+1] = string.format('%s: %g%s', param.name:gsub("^%l", string.upper), value, param.dB)
end
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)
+89 -270
View File
@@ -1,295 +1,114 @@
--[[
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 registers the key-binding "C" (shift+c), which when pressed,
-- inserts the filter vf=lavfi=cropdetect. After 1 second, 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 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 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).
--
-- The default delay between insertion of the cropdetect and
-- crop filters may be overridden by adding
--
-- --script-opts=autocrop.detect_seconds=<number of seconds>
--
-- to mpv's arguments. This may be desirable to allow cropdetect more
-- time to collect data.
require "mp.msg"
It automatically crops the video when playback starts.
script_name = mp.get_script_name()
cropdetect_label = string.format("%s-cropdetect", script_name)
crop_label = string.format("%s-crop", script_name)
You can also manually crop the video by pressing the "C" (shift+c) key.
Pressing it again undoes the crop.
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.
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).
If non-copy-back hardware decoding is in use, hwdec is temporarily disabled for
the duration of cropdetect as the filter would fail otherwise.
These are the default options. They can be overridden by adding
script-opts-append=autocrop-<parameter>=<value> to mpv.conf.
--]]
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,
}
require "mp.options".read_options(options)
local cropdetect_label = mp.get_script_name() .. "-cropdetect"
local 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)
-- Plus 1 second for deviation.
local time_needed = seconds + 1
local playtime_remaining = mp.get_property_native("playtime-remaining")
return playtime_remaining and time_needed < playtime_remaining
-- number of seconds to gather cropdetect data
detect_seconds = tonumber(mp.get_opt(string.format("%s.detect_seconds", script_name)))
if not detect_seconds then
detect_seconds = 1
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 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")
for i,vf in pairs(vfs) do
if vf["label"] == label then
table.remove(vfs, i)
mp.set_property_native("vf", vfs)
return true
end
end
return false
end
local function restore_hwdec()
if hwdec_backup then
mp.set_property("hwdec", hwdec_backup)
hwdec_backup = nil
end
end
local function cleanup()
remove_cropdetect()
-- Kill all timers.
for index, timer in pairs(timers) do
if timer then
timer:kill()
timers[index] = 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)
-- 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))
function autocrop_start()
-- exit if cropdetection is already in progress
if timer then
mp.msg.warn("already cropdetecting!")
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))
end
local function detect_end()
-- Get the metadata and remove the cropdetect filter.
local cropdetect_metadata = mp.get_property_native(
"vf-metadata/" .. cropdetect_label)
remove_cropdetect()
-- Remove the timer of detect crop.
if timers.detect_crop then
timers.detect_crop:kill()
timers.detect_crop = nil
end
restore_hwdec()
local meta
-- Verify the existence of metadata.
if cropdetect_metadata then
meta = {
w = cropdetect_metadata["lavfi.cropdetect.w"],
h = cropdetect_metadata["lavfi.cropdetect.h"],
x = cropdetect_metadata["lavfi.cropdetect.x"],
y = cropdetect_metadata["lavfi.cropdetect.y"],
}
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?")
-- if there's a crop filter, remove it and exit
if del_filter_if_present(crop_label) then
return
end
-- Verify that the metadata meets the requirements and convert it.
if meta.w and meta.h and meta.x and meta.y then
local width = mp.get_property_native("width")
local height = mp.get_property_native("height")
meta = {
w = tonumber(meta.w),
h = tonumber(meta.h),
x = tonumber(meta.x),
y = tonumber(meta.y),
min_w = width * options.detect_min_ratio,
min_h = height * options.detect_min_ratio,
max_w = width,
max_h = height
}
else
mp.msg.error("Got empty crop data.")
mp.msg.info("You might need to increase detect_seconds.")
end
apply_crop(meta)
end
local function detect_crop()
local time_needed = options.detect_seconds
if not is_cropable(time_needed) then
return
end
local hwdec_current = mp.get_property("hwdec-current")
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")
end
-- Insert the cropdetect filter.
local limit = options.detect_limit
local round = options.detect_round
mp.command(
-- insert the cropdetect filter
ret=mp.command(
string.format(
'%s vf pre @%s:cropdetect=limit=%s:round=%d:reset=0',
command_prefix, cropdetect_label, limit, round
'vf add @%s:cropdetect=limit=%f:round=2:reset=0',
cropdetect_label, 24/255
)
)
-- Wait to gather data.
timers.detect_crop = mp.add_timeout(time_needed, detect_end)
-- wait to gather data
timer=mp.add_timeout(detect_seconds, do_crop)
end
local function on_start()
function do_crop()
-- get the metadata
local cropdetect_metadata = mp.get_property_native(
string.format("vf-metadata/%s", cropdetect_label)
)
-- Clean up at the beginning.
cleanup()
-- If auto is not true, exit.
if not options.auto then
return
end
-- If it is the beginning, wait for detect_crop
-- after auto_delay seconds, otherwise immediately.
local playback_time = mp.get_property_native("playback-time")
local is_delay_needed = playback_time
and options.auto_delay > playback_time
if is_delay_needed then
-- Verify if there is enough time for autocrop.
local time_needed = options.auto_delay + options.detect_seconds
if not is_cropable(time_needed) then
return
-- use it to crop if its valid
if cropdetect_metadata then
if cropdetect_metadata["lavfi.cropdetect.w"]
and cropdetect_metadata["lavfi.cropdetect.h"]
and cropdetect_metadata["lavfi.cropdetect.x"]
and cropdetect_metadata["lavfi.cropdetect.y"]
then
mp.command(string.format("vf add @%s:lavfi-crop=w=%s:h=%s:x=%s:y=%s",
crop_label,
cropdetect_metadata["lavfi.cropdetect.w"],
cropdetect_metadata["lavfi.cropdetect.h"],
cropdetect_metadata["lavfi.cropdetect.x"],
cropdetect_metadata["lavfi.cropdetect.y"]))
else
mp.msg.error(
"Got empty crop data. You might need to increase detect_seconds."
)
end
timers.auto_delay = mp.add_timeout(time_needed,
function()
detect_crop()
-- Remove the timer of auto delay.
timers.auto_delay:kill()
timers.auto_delay = nil
end
)
else
detect_crop()
mp.msg.error(
"No crop data. Was the cropdetect filter successfully inserted?"
)
mp.msg.error(
"Does your version of ffmpeg/libav support AVFrame metadata?"
)
end
-- remove the cropdetect filter
del_filter_if_present(cropdetect_label)
timer=nil
end
local function on_toggle()
-- If it is during auto_delay, kill the timer.
if timers.auto_delay then
timers.auto_delay:kill()
timers.auto_delay = nil
end
-- Cropped => Remove it.
if mp.get_property("video-crop") ~= "" then
mp.command(string.format("%s set file-local-options/video-crop ''", command_prefix))
return
end
-- Detecting => Leave it.
if timers.detect_crop then
mp.msg.warn("Already cropdetecting!")
return
end
-- Neither => Detect crop.
detect_crop()
end
mp.add_key_binding("C", "toggle_crop", on_toggle)
mp.register_event("end-file", cleanup)
mp.register_event("file-loaded", on_start)
mp.add_key_binding("C", "auto_crop", autocrop_start)
+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)
+103 -336
View File
@@ -1,339 +1,110 @@
-- 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
-- the internal playlist. (It stops if the it would add an already existing
-- playlist entry at the same position - this makes it "stable".)
-- Add at most 5000 * 2 files when starting a file (before + after).
--[[
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 = {
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 = ""
o = {
disabled = false
}
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 {
'3g2', '3gp', 'avi', 'flv', 'm2ts', 'm4v', 'mj2', 'mkv', 'mov',
'mp4', 'mpeg', 'mpg', 'ogv', 'rmvb', 'webm', 'wmv', 'y4m'
EXTENSIONS = Set {
'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp',
'mp3', 'wav', 'ogm', 'flac', 'm4a', 'wma', 'ogg', 'opus',
}
local EXTENSIONS_AUDIO_DEFAULT = Set {
'aiff', 'ape', 'au', 'flac', 'm4a', 'mka', 'mp3', 'oga', 'ogg',
'ogm', 'opus', 'wav', 'wma'
}
local EXTENSIONS_IMAGES_DEFAULT = Set {
'avif', 'bmp', 'gif', 'j2k', 'jp2', 'jpeg', 'jpg', 'jxl', 'png',
'svg', 'tga', 'tif', 'tiff', 'webp'
}
local EXTENSIONS, EXTENSIONS_VIDEO, EXTENSIONS_AUDIO, EXTENSIONS_IMAGES
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 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)
-- 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
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 extentions list")
return
autoloaded = true
end
local pl = mp.get_property_native("playlist", {})
@@ -341,75 +112,71 @@ 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
return
end
table.filter(files, function (v, k)
if 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
local append = {[-1] = {}, [1] = {}}
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]
local pl_e = pl[pl_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
if pl_e then
-- If there's a playlist entry, and it's the same file, stop.
msg.trace(pl_e.filename.." == "..filepath.." ?")
if pl_e.filename == filepath then
break
end
added_entries[file] = true
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")
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
else
msg.info("Adding " .. file)
table.insert(append[1], filepath)
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)
-129
View File
@@ -1,129 +0,0 @@
-- Test script for some command API details.
local utils = require("mp.utils")
local function join(sep, arr, count)
local r = ""
if count == nil then
count = #arr
end
for i = 1, count do
if i > 1 then
r = r .. sep
end
r = r .. utils.to_string(arr[i])
end
return r
end
mp.observe_property("vo-configured", "bool", function(_, v)
if v ~= true then
return
end
print("async expand-text")
mp.command_native_async({"expand-text", "hello ${path}!"},
function(res, val, err)
print("done async expand-text: " .. join(" ", {res, val, err}))
end)
-- make screenshot writing very slow
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:resume()
print("Slow screenshot command...")
local result = mp.command_native({"screenshot"})
print("done, res: " .. utils.to_string(result))
print("Slow screenshot async command...")
result = 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("Broken screenshot async command...")
mp.command_native_async({"screenshot-to-file", "/nonexistent/bogus.png"},
function(res, val, err)
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
},
function(res, val, err)
print("done subprocess: " .. join(" ", {res, val, err}))
end)
local x = mp.command_native_async({name = "subprocess", args = {"sleep", "inf"}},
function(res, val, err)
print("done sleep inf subprocess: " .. join(" ", {res, val, err}))
end)
mp.add_timeout(15, function()
print("aborting sleep inf subprocess after timeout")
mp.abort_async_command(x)
end)
-- (assuming this "freezes")
local y = mp.command_native_async({name = "sub-add", url = "-"},
function(res, val, err)
print("done sub-add stdin: " .. join(" ", {res, val, err}))
end)
mp.add_timeout(20, function()
print("aborting sub-add stdin after timeout")
mp.abort_async_command(y)
end)
mp.command_native_async({name = "subprocess", args = {"wc", "-c"},
stdin_data = "hello", capture_stdout = true},
function(_, val)
print("Should be '5': " .. val.stdout)
end)
-- blocking stdin by default
mp.command_native_async({name = "subprocess", args = {"cat"},
capture_stdout = true},
function(_, val)
print("Should be 0: " .. #val.stdout)
end)
-- stdin + detached
mp.command_native_async({name = "subprocess",
args = {"bash", "-c", "(sleep 5s ; cat)"},
stdin_data = "this should appear after 5s.\n",
detach = true},
function(_, val)
print("5s test: " .. val.status)
end)
-- This should get killed on script exit.
mp.command_native_async({name = "subprocess", playback_only = false,
args = {"sleep", "inf"}}, function()end)
-- Runs detached; should be killed on player exit (forces timeout)
mp.command_native({_flags={"async"}, name = "subprocess",
playback_only = false, args = {"sleep", "inf"}})
end)
local counter
local function freeze_test(playback_only)
-- This "freezes" the script, should be killed via timeout.
counter = counter and counter + 1 or 0
print("freeze! " .. counter)
local x = mp.command_native({name = "subprocess",
playback_only = playback_only,
args = {"sleep", "inf"}})
print("done, killed=" .. utils.to_string(x.killed_by_us))
end
mp.register_event("shutdown", function()
freeze_test(false)
end)
mp.register_event("idle", function()
freeze_test(true)
end)
+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"..
-37
View File
@@ -1,37 +0,0 @@
-- Test a float property which internally uses NaN.
-- Run with --no-config (or just scale-param1 not set).
local utils = require 'mp.utils'
local prop_name = "scale-param1"
-- internal NaN, return string "default" instead of NaN
local v = mp.get_property_native(prop_name, "fail")
print("Exp:", "string", "\"default\"")
print("Got:", type(v), utils.to_string(v))
v = mp.get_property(prop_name)
print("Exp:", "default")
print("Got:", v)
-- not representable -> return provided fallback value
v = mp.get_property_number(prop_name, -100)
print("Exp:", -100)
print("Got:", v)
mp.set_property_native(prop_name, 123)
v = mp.get_property_number(prop_name, -100)
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)
print("Exp:", nil, "<message>")
print("Got:", st, msg)
-- set default
mp.set_property(prop_name, "default")
v = mp.get_property(prop_name)
print("Exp:", "default")
print("Got:", v)
+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
-35
View File
@@ -1,35 +0,0 @@
local assdraw = require 'mp.assdraw'
local utils = require 'mp.utils'
local things = {}
for i = 1, 2 do
things[i] = {
osd1 = mp.create_osd_overlay("ass-events"),
osd2 = mp.create_osd_overlay("ass-events")
}
end
things[1].text = "{\\an5}hello\\Nworld"
things[2].text = "{\\pos(400, 200)}something something"
mp.add_periodic_timer(2, function()
for i, thing in ipairs(things) do
thing.osd1.data = thing.text
thing.osd1.compute_bounds = true
--thing.osd1.hidden = true
local res = thing.osd1:update()
print("res " .. i .. ": " .. utils.to_string(res))
thing.osd2.hidden = true
if res ~= nil and res.x0 ~= nil then
local draw = assdraw.ass_new()
draw:append("{\\alpha&H80}")
draw:draw_start()
draw:pos(0, 0)
draw:rect_cw(res.x0, res.y0, res.x1, res.y1)
draw:draw_stop()
thing.osd2.hidden = false
thing.osd2.data = draw.text
end
thing.osd2:update()
end
end)
+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
-267
View File
@@ -1,267 +0,0 @@
--[[
Automatically skip in files if video frames with pre-supplied fingerprints are
detected. This will skip ahead by a pre-configured amount of time if a matching
video frame is detected.
This requires the vf_fingerprint video filter to be compiled in. Read the
documentation of this filter for caveats (which will automatically apply to
this script as well), such as no support for zero-copy hardware decoding.
You need to manually gather and provide fingerprints for video frames and add
them to a configuration file in script-opts/skip-logo.conf (the "script-opts"
directory must be in the mpv configuration directory, typically ~/.config/mpv/).
Example script-opts/skip-logo.conf:
cases = {
{
-- Skip ahead 10 seconds if a black frame was detected
-- Note: this is dangerous non-sense. It's just for demonstration.
name = "black frame", -- print if matched
skip = 10, -- number of seconds to skip forward
score = 0.3, -- required score
fingerprint = string.rep("0", 512),
},
{
-- 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),
},
}
This is actually a lua file. Lua was chosen because it seemed less of a pain to
parse. Future versions of this script may change the format.
The fingerprint is a video frame, converted to "gray" (8 bit per pixels), full
range, each pixel concatenated into an array, converted to a hex string. You
can produce these fingerprints by running this manually:
mpv --vf=fingerprint:print yourfile.mkv
This will log the fingerprint of each video frame to the console, along with its
timestamp. You find the fingerprint of a unique-enough looking frame, and add
it as entry to skip-logo.conf.
You can provide a score for "fuzziness". If no score is provided, a default
value of 0.3 is used. The score is inverse: 0 means exactly the same, while a
higher score means a higher difference. Currently, the score is computed as
euclidean distance between the video frame and the pre-provided fingerprint,
thus the highest score is 16. You probably want a score lower than 1 at least.
(This algorithm is very primitive, but also simple and fast to compute.)
There's always the danger of false positives, which might be quite annoying.
It's up to you what you hate more, the logo, or random skips if false positives
are detected. Also, it's always active, and might eat too much CPU with files
that have a high resolution or framerate. To temporarily disable the script,
having a keybind like this in your input.conf will be helpful:
ctrl+k vf toggle @skip-logo
This will disable/enable the fingerprint filter, which the script automatically
adds at start.
Another important caveat is that the script currently disables matching during
seeking or playback initialization, which means it cannot match the first few
frames of a video. This could be fixed, but the author was too lazy to do so.
--]]
local msg = require "mp.msg"
local label = "skip-logo"
local meta_property = string.format("vf-metadata/%s", label)
local config = {}
local cases = {}
local cur_bmp
local seeking = false
local playback_start_pts = nil
-- Convert a hex string to an array. Convert each byte to a [0,1] float by
-- interpreting it as normalized uint8_t.
-- The data parameter, if not nil, may be used as storage (avoiding garbage).
local function hex_to_norm8(hex, data)
local size = math.floor(#hex / 2)
if #hex ~= size * 2 then
return nil
end
local res
if (data ~= nil) and (#data == size) then
res = data
else
res = {}
end
for i = 1, size do
local num = tonumber(hex:sub(i * 2, i * 2 + 1), 16)
if num == nil then
return nil
end
res[i] = num / 255.0
end
return res
end
local function compare_bmp(a, b)
if #a ~= #b then
return nil -- can't compare
end
local sum = 0
for i = 1, #a do
local diff = a[i] - b[i]
sum = sum + diff * diff
end
return math.sqrt(sum)
end
local function load_config()
local conf_file = mp.find_config_file("script-opts/skip-logo.conf")
local conf_fn
local err
if conf_file then
-- luacheck: push
-- luacheck: ignore setfenv
if setfenv then
conf_fn, err = loadfile(conf_file)
if conf_fn then
setfenv(conf_fn, config)
end
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)
err = err2
end
if err then
msg.error("Failed to load config file:", err)
end
if config.cases then
for n, case in ipairs(config.cases) do
err = nil
case.bitmap = hex_to_norm8(case.fingerprint)
if case.bitmap == nil then
err = "invalid or missing fingerprint field"
end
if case.score == nil then
case.score = 0.3
end
if type(case.score) ~= "number" then
err = "score field is not a number"
end
if type(case.skip) ~= "number" then
err = "skip field is not a number or missing"
end
if case.name == nil then
case.name = ("Entry %d"):format(n)
end
if err == nil then
cases[#cases + 1] = case
else
msg.error(("Entry %s: %s, ignoring."):format(case.name, err))
end
end
end
end
load_config()
-- Returns true on match and if something was done.
local function check_fingerprint(hex, pts)
local bmp = hex_to_norm8(hex, cur_bmp)
cur_bmp = bmp
-- If parsing the filter's result failed (well, it shouldn't).
assert(bmp ~= nil, "filter returned nonsense")
for _, case in ipairs(cases) do
local score = compare_bmp(case.bitmap, bmp)
if (score ~= nil) and (score <= case.score) then
msg.warn(("Matching %s: score=%f (required: %f) at %s, skipping %f seconds"):
format(case.name, score, case.score, mp.format_time(pts), case.skip))
mp.commandv("seek", pts + case.skip, "absolute+exact")
return true
end
end
return false
end
local function read_frames()
local result = mp.get_property_native(meta_property)
if result == nil then
return
end
-- Try to get all entries. Out of laziness, assume that there are at most
-- 100 entries. (In fact, vf_fingerprint limits it to 10.)
for i = 0, 99 do
local prefix = string.format("fp%d.", i)
local hex = result[prefix .. "hex"]
local pts = tonumber(result[prefix .. "pts"])
if (hex == nil) or (pts == nil) then
break
end
local skip = false -- blame Lua for not having "continue" or "goto", not me
-- If seeking just stopped, there will be frames before the seek target,
-- ignore them by checking the timestamps.
if playback_start_pts ~= nil then
if pts >= playback_start_pts then
playback_start_pts = nil -- just for robustness
else
skip = true
end
end
if not skip then
if check_fingerprint(hex, pts) then
break
end
end
end
end
mp.observe_property(meta_property, "native", function()
-- Ignore frames that are decoded/filtered during seeking.
if seeking then
return
end
read_frames()
end)
mp.observe_property("seeking", "bool", function(_, val)
seeking = val
if seeking == false then
playback_start_pts = mp.get_property_number("playback-time")
read_frames()
end
end)
local filters = mp.get_property_native("option-info/vf/choices", {})
local found = false
for _, f in ipairs(filters) do
if f == "fingerprint" then
found = true
break
end
end
if found then
mp.command(("no-osd vf add @%s:fingerprint"):format(label))
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
-32
View File
@@ -1,32 +0,0 @@
local utils = require("mp.utils")
local function hardsleep()
os.execute("sleep 1s")
end
local hooks = {"on_before_start_file", "on_load", "on_load_fail",
"on_preloaded", "on_unload", "on_after_end_file"}
for _, name in ipairs(hooks) do
mp.add_hook(name, 0, function()
print("--- hook: " .. name)
hardsleep()
print(" ... continue")
end)
end
local events = {"start-file", "end-file", "file-loaded", "seek",
"playback-restart", "idle", "shutdown"}
for _, name in ipairs(events) do
mp.register_event(name, function()
print("--- event: " .. name)
end)
end
local props = {"path", "metadata"}
for _, name in ipairs(props) do
mp.observe_property(name, "native", function(prop, val)
print("property '" .. prop .. "' changed to '" ..
utils.to_string(val) .. "'")
end)
end
-46
View File
@@ -1,46 +0,0 @@
#!/usr/bin/env python3
# This checks for the sdk path, the sdk version, and
# the sdk build version.
import re
import os
import string
import subprocess
import sys
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')
if not xcrun:
return sdk,sdk_version
if not sdk:
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'],
encoding="UTF-8")
# use xcode tools when installed, still necessary for xcode versions <12.0
try:
sdk_version = check_output([xcodebuild, '-sdk', 'macosx', '-version', 'ProductVersion'],
encoding="UTF-8", stderr=subprocess.DEVNULL)
except:
pass
if not isinstance(sdk_version, str):
sdk_version = '10.10.0'
return sdk.strip(),sdk_version.strip()
if __name__ == "__main__":
sdk_info = find_macos_sdk()
sys.stdout.write(','.join(sdk_info))
-42
View File
@@ -1,42 +0,0 @@
#!/usr/bin/env python3
# Finds the macos swift library directory and prints the full path to stdout.
# First argument is the path to the swift executable.
import os
import sys
from shutil import which
from subprocess import check_output
def find_swift_lib():
swift_lib_dir = os.environ.get('SWIFT_LIB_DYNAMIC', '')
if swift_lib_dir:
return swift_lib_dir
# first check for lib dir relative to swift executable
xcode_dir = os.path.dirname(os.path.dirname(sys.argv[1]))
swift_lib_dir = os.path.join(xcode_dir, "lib", "swift", "macosx")
if os.path.isdir(swift_lib_dir):
return swift_lib_dir
# fallback to xcode-select path
xcode_select = which("xcode-select")
if not xcode_select:
sys.exit(1)
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")
if os.path.isdir(swift_lib_dir):
return swift_lib_dir
# last resort if we still haven't found a path
swift_lib_dir = os.path.join(xcode_path, "usr/lib/swift/macosx")
if not os.path.isdir(swift_lib_dir):
sys.exit(1)
return swift_lib_dir
if __name__ == "__main__":
swift_lib_dir = find_swift_lib()
sys.stdout.write(swift_lib_dir)
+9 -18
View File
@@ -21,6 +21,8 @@ Can also be used to directly parse Matroska files and display their contents.
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
#
# for compatibility with Python 2.x
from __future__ import print_function
elements_ebml = (
'EBML, 1a45dfa3, sub', (
@@ -92,7 +94,6 @@ elements_matroska = (
'MaxBlockAdditionID, 55ee, uint',
'Name, 536e, str',
'Language, 22b59c, str',
'LanguageBCP47, 22b59d, str',
'CodecID, 86, str',
'CodecPrivate, 63a2, binary',
'CodecName, 258688, str',
@@ -106,10 +107,6 @@ elements_matroska = (
'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',
@@ -165,12 +162,6 @@ elements_matroska = (
),
),
),
'BlockAdditionMapping*, 41e4, sub', (
'BlockAddIDValue, 41f0, uint',
'BlockAddIDName, 41a4, str',
'BlockAddIDType, 41e7, uint',
'BlockAddIDExtraData, 41ed, binary',
),
),
),
@@ -213,7 +204,6 @@ elements_matroska = (
'ChapterDisplay*, 80, sub', (
'ChapString, 85, str',
'ChapLanguage*, 437c, str',
'ChapLanguageBCP47*, 437d, str',
'ChapCountry*, 437e, str',
),
),
@@ -232,7 +222,6 @@ elements_matroska = (
'SimpleTag*, 67c8, sub', (
'TagName, 45a3, str',
'TagLanguage, 447a, str',
'TagLanguageBCP47, 447b, str',
'TagString, 4487, str',
'TagDefault, 4484, uint',
),
@@ -287,7 +276,7 @@ class MatroskaElement(object):
def add_subelements(self, subelements):
self.subelements = subelements
self.subids = {x[0].elid for x in subelements}
self.subids = set(x[0].elid for x in subelements)
elementd = {}
elementlist = []
@@ -311,8 +300,8 @@ 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(u' '.join([str(x) for x in args]))
out.write(u'\n')
def generate_C_header(out):
printf(out, '// Generated by TOOLS/matroska.py, do not edit manually')
@@ -473,10 +462,12 @@ if __name__ == "__main__":
parse_one(s, 0, None, 1 << 63)
if sys.argv[1] == '--generate-header':
generate_C_header(open(sys.argv[2], "w"))
generate_C_header(sys.stdout)
elif sys.argv[1] == '--generate-definitions':
generate_C_definitions(open(sys.argv[2], "w"))
generate_C_definitions(sys.stdout)
else:
if sys.version_info.major < 3:
raise Exception("Dumping requires Python 3.")
s = open(sys.argv[1], "rb")
while 1:
start = s.tell()
+1 -1
View File
@@ -22,7 +22,7 @@ OS2Version: 3
OS2_WeightWidthSlopeOnly: 0
OS2_UseTypoMetrics: 0
CreationTime: 1408646554
ModificationTime: 1576096543
ModificationTime: 1492879730
PfmFamily: 81
TTFWeight: 400
TTFWidth: 5
-15
View File
@@ -1,15 +0,0 @@
StartChar: uniE00D
Encoding: 57357 57357 34
Width: 880
Flags: HWO
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
-15
View File
@@ -1,15 +0,0 @@
StartChar: uniE112
Encoding: 57618 57618 30
Width: 768
VWidth: 1176
Flags: HW
LayerCount: 2
Fore
SplineSet
512 40 m 1
0 40 l 1
0 168 l 1
512 168 l 1
512 40 l 1
EndSplineSet
EndChar
-20
View File
@@ -1,20 +0,0 @@
StartChar: uniE113
Encoding: 57619 57619 31
Width: 622
VWidth: 1178
Flags: HW
LayerCount: 2
Fore
SplineSet
768 42 m 5
0 42 l 5
0 746 l 5
768 746 l 5
768 42 l 5
704 106 m 5
704 618 l 5
64 618 l 5
64 106 l 5
704 106 l 5
EndSplineSet
EndChar
-31
View File
@@ -1,31 +0,0 @@
StartChar: uniE114
Encoding: 57620 57620 32
Width: 896
VWidth: 1178
Flags: HW
LayerCount: 2
Fore
SplineSet
768 298 m 1
576 298 l 1
576 42 l 1
0 42 l 1
0 490 l 1
192 490 l 1
192 746 l 1
768 746 l 1
768 298 l 1
704 362 m 1
704 618 l 1
256 618 l 1
256 490 l 1
576 490 l 1
576 362 l 1
704 362 l 1
512 106 m 1
512 362 l 1
64 362 l 1
64 106 l 1
512 106 l 1
EndSplineSet
EndChar
-27
View File
@@ -1,27 +0,0 @@
StartChar: uniE115
Encoding: 57621 57621 33
Width: 844
VWidth: 1112
Flags: HW
LayerCount: 2
Fore
SplineSet
671 40 m 1
575 40 l 1
335 277 l 1
98 40 l 1
-1 40 l 1
-1 136 l 1
236 376 l 1
-1 613 l 1
-1 712 l 1
98 712 l 1
335 475 l 1
575 712 l 1
671 712 l 1
671 613 l 1
434 376 l 1
671 139 l 1
671 40 l 1
EndSplineSet
EndChar
+1 -1
View File
@@ -79,7 +79,7 @@ EOF
video-bitrate
video-codec
video-format
video-params/aspect
video-aspect
container-fps
width
height
+25 -29
View File
@@ -1,11 +1,14 @@
#!/usr/bin/env python3
#!/usr/bin/env python
import os
import shutil
import sys
import fileinput
import dylib_unhell
import subprocess
from optparse import OptionParser
def sh(command):
return os.popen(command).read()
def bundle_path(binary_name):
return "%s.app" % binary_name
@@ -22,11 +25,11 @@ def target_binary(binary_name):
return os.path.join(target_directory(binary_name),
os.path.basename(binary_name))
def copy_bundle(binary_name, src_path):
def copy_bundle(binary_name):
if os.path.isdir(bundle_path(binary_name)):
shutil.rmtree(bundle_path(binary_name))
shutil.copytree(
os.path.join(src_path, 'TOOLS', 'osxbundle', bundle_name(binary_name)),
os.path.join('TOOLS', 'osxbundle', bundle_name(binary_name)),
bundle_path(binary_name))
def copy_binary(binary_name):
@@ -34,27 +37,24 @@ def copy_binary(binary_name):
def apply_plist_template(plist_file, version):
for line in fileinput.input(plist_file, inplace=1):
print(line.rstrip().replace('${VERSION}', version))
print (line.rstrip().replace('${VERSION}', version))
def sign_bundle(binary_name):
sign_directories = ['Contents/Frameworks', 'Contents/MacOS']
for dir in sign_directories:
resolved_dir = os.path.join(bundle_path(binary_name), dir)
for root, _dirs, files in os.walk(resolved_dir):
for f in files:
subprocess.run(['codesign', '--force', '-s', '-', os.path.join(root, f)])
subprocess.run(['codesign', '--force', '-s', '-', bundle_path(binary_name)])
def create_bundle_symlink(binary_name, symlink_name):
os.symlink(os.path.basename(binary_name),
os.path.join(target_directory(binary_name), symlink_name))
def bundle_version(src_path):
version = 'UNKNOWN'
version_path = os.path.join(src_path, 'MPV_VERSION')
if os.path.exists(version_path):
x = open(version_path)
def bundle_version():
if os.path.exists('VERSION'):
x = open('VERSION')
version = x.read()
x.close()
else:
version = sh("./version.sh").strip()
return version
def main():
version = bundle_version().rstrip()
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option("-s", "--skip-deps", action="store_false", dest="deps",
@@ -63,28 +63,24 @@ def main():
(options, args) = parser.parse_args()
if len(args) < 1 or len(args) > 2:
if len(args) != 1:
parser.error("incorrect number of arguments")
else:
binary_name = args[0]
src_path = args[1] if len(args) > 1 else "."
version = bundle_version(src_path).rstrip()
print("Creating macOS application bundle (version: %s)..." % version)
print("Creating Mac OS X application bundle (version: %s)..." % version)
print("> copying bundle skeleton")
copy_bundle(binary_name, src_path)
copy_bundle(binary_name)
print("> copying binary")
copy_binary(binary_name)
print("> create bundle symlink")
create_bundle_symlink(binary_name, "mpv-bundle")
print("> generating Info.plist")
apply_plist_template(target_plist(binary_name), version)
if options.deps:
print("> bundling dependencies")
dylib_unhell.process(target_binary(binary_name))
print("> signing bundle with ad-hoc pseudo identity")
sign_bundle(binary_name)
sh(" ".join(["TOOLS/dylib-unhell.py", target_binary(binary_name)]))
print("done.")
-6
View File
@@ -1,6 +0,0 @@
osxbundle = custom_target('osxbundle',
input: join_paths('mpv.app', 'Contents', 'Resources', 'icon.icns'),
output: 'icon.icns.inc',
command: [file2string, '@INPUT@', '@OUTPUT@', '@SOURCE_ROOT@'],
)
sources += osxbundle
File diff suppressed because it is too large. Load diff
@@ -1,2 +1 @@
player-operation-mode=pseudo-gui
log-file=~/Library/Logs/mpv.log
+59 -69
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
from PyQt6 import QtWidgets
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
import sys
import re
@@ -38,10 +38,9 @@ Currently, the following event types are supported:
class G:
events = {}
start = 0.0
start = None
markers = ["o", "s", "t", "d"]
curveno = {}
sevents = []
def find_marker():
if len(G.markers) == 0:
@@ -51,10 +50,7 @@ def find_marker():
return m
class Event:
name = None
vals = []
type = None
marker = ""
pass
def get_event(event, evtype):
if event not in G.events:
@@ -76,63 +72,60 @@ def mkColor(t):
SCALE = 1e6 # microseconds to seconds
with open(filename, "r") as file:
for line in file:
line = line.split("#")[0].strip()
if not line:
continue
ts, event = line.split(" ", 1)
ts = int(ts) / SCALE
if G.start is None:
G.start = ts
ts -= G.start
match event.split(" ", 1):
case ["start", name]:
e = get_event(name, "event")
e.vals.append((ts, 0))
e.vals.append((ts, 1))
case ["end", name]:
e = get_event(name, "event")
e.vals.append((ts, 1))
e.vals.append((ts, 0))
case ["value", rest]:
val, name = rest.split(" ", 1)
val = float(val)
e = get_event(name, "value")
e.vals.append((ts, val))
case ["event-timed", rest]:
val, name = rest.split(" ", 1)
val = int(val) / SCALE - G.start
e = get_event(name, "event-signal")
e.vals.append((val, 1))
case ["range-timed", rest]:
ts1, ts2, name = rest.split(" ", 2)
ts1 = int(ts1) / SCALE - G.start
ts2 = int(ts2) / SCALE - G.start
e = get_event(name, "event")
e.vals.append((ts1, 0))
e.vals.append((ts1, 1))
e.vals.append((ts2, 1))
e.vals.append((ts2, 0))
case ["value-timed", rest]:
tsval, val, name = rest.split(" ", 2)
tsval = int(tsval) / SCALE - G.start
val = float(val)
e = get_event(name, "value")
e.vals.append((tsval, val))
case ["signal", name]:
e = get_event(name, "event-signal")
e.vals.append((ts, 1))
case _:
e = get_event(event, "event-signal")
e.vals.append((ts, 1))
for line in [line.split("#")[0].strip() for line in open(filename, "r")]:
line = line.strip()
if not line:
continue
ts, event = line.split(" ", 1)
ts = int(ts) / SCALE
if G.start is None:
G.start = ts
ts = ts - G.start
if event.startswith("start "):
e = get_event(event[6:], "event")
e.vals.append((ts, 0))
e.vals.append((ts, 1))
elif event.startswith("end "):
e = get_event(event[4:], "event")
e.vals.append((ts, 1))
e.vals.append((ts, 0))
elif event.startswith("value "):
_, val, name = event.split(" ", 2)
val = float(val)
e = get_event(name, "value")
e.vals.append((ts, val))
elif event.startswith("event-timed "):
_, val, name = event.split(" ", 2)
val = int(val) / SCALE - G.start
e = get_event(name, "event-signal")
e.vals.append((val, 1))
elif event.startswith("range-timed "):
_, ts1, ts2, name = event.split(" ", 3)
ts1 = int(ts1) / SCALE - G.start
ts2 = int(ts2) / SCALE - G.start
e = get_event(name, "event")
e.vals.append((ts1, 0))
e.vals.append((ts1, 1))
e.vals.append((ts2, 1))
e.vals.append((ts2, 0))
elif event.startswith("value-timed "):
_, tsval, val, name = event.split(" ", 3)
tsval = int(tsval) / SCALE - G.start
val = float(val)
e = get_event(name, "value")
e.vals.append((tsval, val))
elif event.startswith("signal "):
name = event.split(" ", 2)[1]
e = get_event(name, "event-signal")
e.vals.append((ts, 1))
else:
e = get_event(event, "event-signal")
e.vals.append((ts, 1))
# deterministically sort them; make sure the legend is sorted too
G.sevents = list(G.events.values())
G.sevents.sort(key=lambda x: x.name)
hasval = False
for e, index in zip(G.sevents, range(len(G.sevents))):
m = len(G.sevents)
if e.type == "value":
@@ -142,23 +135,20 @@ for e, index in zip(G.sevents, range(len(G.sevents))):
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
app = QtWidgets.QApplication([])
win = pg.GraphicsLayoutWidget()
win.show()
app = QtGui.QApplication([])
win = pg.GraphicsWindow()
#win.resize(1500, 900)
ax = [None, None]
plots = 2 if hasval else 1
ax[0] = win.addPlot()
if hasval:
win.nextRow()
ax[1] = win.addPlot()
ax[1].setXLink(ax[0])
for cur in ax:
if cur is not None:
cur.addLegend(offset = (-1, 1))
if cur is not None:
cur.addLegend(offset = (-1, 1))
for e in G.sevents:
cur = ax[1 if e.type == "value" else 0]
if not cur in G.curveno:
@@ -171,6 +161,6 @@ for e in G.sevents:
else:
args['pen'] = pg.mkPen(color, width=0)
G.curveno[cur] += 1
cur.plot(*zip(*e.vals), **args)
n = cur.plot([x for x,y in e.vals], [y for x,y in e.vals], **args)
app.exec()
QtGui.QApplication.instance().exec_()
+139
View File
@@ -0,0 +1,139 @@
#!/usr/bin/ruby
class TravisDepsBuilder
def self.make(name)
instance = klass.new(name)
instance.fill_data
instance.deps
instance.build
end
def self.klass
Module.const_get([self.name, self.os.capitalize].join)
rescue NameError
self
end
def self.os
ENV['TRAVIS_OS_NAME']
end
attr_reader :name, :url, :action, :os
def initialize(name)
@name, @os = name, self.class.os
end
def fill_data
data = build_map.fetch(name)
@url, @action = data[:url], data[:action]
end
def build
send(action)
end
def deps; end
private
def package_manager_update
# yes class variable, you wanna update only once across all instances
@@updated ||= false
return if @@updated
sh({'linux' => 'sudo apt-get update -y', 'osx' => 'brew update'}[os])
@@updated = true
end
def package_install(*packages)
cmd = {
'linux' => 'sudo apt-get install %s -y',
'osx' => 'brew install %s'
}[os] % [packages.join(" ")]
sh cmd
end
def git
sh "git clone --depth=1 #{url} #{name}"
compile name
end
def stable
filename = File.basename(url)
sh "wget #{url}"
sh "tar -xzvf #{filename}"
dirname = File.basename(url, ".tar.gz" )
compile dirname
end
def package
package_install(url)
end
def compile(dirname)
sh "cd #{dirname} && #{configure} && make && sudo make install"
sh "cd $TRAVIS_BUILD_DIR"
end
def configure
"./configure"
end
def sh(command)
`#{command}`
end
end
class Libav < TravisDepsBuilder
def build_map
{
"libav-git" => {
:action => :git,
:url => "git://git.libav.org/libav.git"
},
"ffmpeg-git" => {
:action => :git,
:url => "https://github.com/FFmpeg/FFmpeg.git"
}
}
end
def configure
[super, "--cc=#{ENV['CC']} --disable-asm"].join(" ")
end
end
class LibavOsx < Libav
def build_map
{
"ffmpeg-git" => { :action => :package, :url => 'ffmpeg' },
}
end
end
class Libass < TravisDepsBuilder
def build_map
{
"libass-stable" => {
:action => :stable,
:url => 'https://github.com/libass/libass/releases/download/0.12.1/libass-0.12.1.tar.gz'
}
}
end
end
class Dependencies < TravisDepsBuilder
def deps
packages = {
'linux' => 'pkg-config fontconfig libfribidi-dev yasm libxinerama-dev libxrandr-dev',
'osx' => 'pkg-config fontconfig freetype fribidi yasm'
}
package_manager_update
package_install(packages.fetch(os))
end
end
Dependencies.new(:deps).deps
Libass.make(ARGV[0])
Libav.make(ARGV[1])
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
if [ "x$LIBAV" != "xffmpeg-git" ] || [ "x$TRAVIS_OS_NAME" != "xlinux" ]; then
# trigger build only on one of the matrix nodes
exit;
fi
if [ "x$TRAVIS_BRANCH" != "xmaster" ]; then
# only rebuild website with pushes to master
exit;
fi
TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE:-HEAD^..}
if git diff --quiet --name-only --exit-code "$TRAVIS_COMMIT_RANGE" DOCS/ VERSION; then
exit;
fi
body='{
"request": {
"branch":"master"
}}'
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token $WEBSITE_TRAVIS_TOKEN" \
-d "$body" \
https://api.travis-ci.org/repo/mpv-player%2Fmpv.io/requests
+28 -18
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
"""
This script emulates "unique application" functionality on Linux. When starting
@@ -19,6 +19,10 @@ will typically just fill ~/.xsession-errors with garbage.
mpv will terminate if there are no more files to play, and running the umpv
script after that will start a new mpv instance.
Note that you can control the mpv instance by writing to the command fifo:
echo "cycle fullscreen" > ~/.umpv_fifo
Note: you can supply custom mpv path and options with the MPV environment
variable. The environment variable will be split on whitespace, and the
first item is used as path to mpv binary and the rest is passed as options
@@ -28,11 +32,11 @@ Note: you can supply custom mpv path and options with the MPV environment
import sys
import os
import socket
import errno
import subprocess
import fcntl
import stat
import string
import shlex
files = sys.argv[1:]
@@ -51,36 +55,42 @@ def make_abs(filename):
if not is_url(filename):
return os.path.abspath(filename)
return filename
files = (make_abs(f) for f in files)
files = [make_abs(f) for f in files]
SOCK = os.path.join(os.getenv("XDG_RUNTIME_DIR", os.getenv("HOME")), ".umpv_socket")
FIFO = os.path.join(os.getenv("HOME"), ".umpv_fifo")
sock = None
fifo_fd = -1
try:
sock = socket.socket(socket.AF_UNIX)
sock.connect(SOCK)
except socket.error as e:
if e.errno == errno.ECONNREFUSED:
sock = None
pass # abandoned socket
fifo_fd = os.open(FIFO, os.O_NONBLOCK | os.O_WRONLY)
except OSError as e:
if e.errno == errno.ENXIO:
pass # pipe has no writer
elif e.errno == errno.ENOENT:
sock = None
pass # doesn't exist
else:
raise e
if sock:
if fifo_fd >= 0:
# Unhandled race condition: what if mpv is terminating right now?
fcntl.fcntl(fifo_fd, fcntl.F_SETFL, 0) # set blocking mode
fifo = os.fdopen(fifo_fd, "w")
for f in files:
# escape: \ \n "
f = f.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n")
f = "\"" + f + "\""
sock.send(("raw loadfile " + f + " append\n").encode("utf-8"))
fifo.write("raw loadfile " + f + " append\n")
else:
# Let mpv recreate socket if it doesn't already exist.
# Recreate pipe if it doesn't already exist.
# Also makes sure it's safe, and no other user can create a bogus pipe
# that breaks security.
try:
os.unlink(FIFO)
except OSError as e:
pass
os.mkfifo(FIFO, 0o600)
opts = shlex.split(os.getenv("MPV") or "mpv")
opts.extend(["--no-terminal", "--force-window", "--input-ipc-server=" + SOCK,
opts = (os.getenv("MPV") or "mpv").split()
opts.extend(["--no-terminal", "--force-window", "--input-file=" + FIFO,
"--"])
opts.extend(files)
Executable
+283
View File
@@ -0,0 +1,283 @@
#!/usr/bin/perl
# Generate ZSH completion
#
# 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/>.
#
use strict;
use warnings;
use warnings FATAL => 'uninitialized';
my $mpv = $ARGV[0] || 'mpv';
my @opts = parse_main_opts('--list-options', '^ (\-\-[^\s\*]*)\*?\s*(.*)');
die "Couldn't find any options" unless (@opts);
my @ao = parse_opts('--ao=help', '^ ([^\s\:]*)\s*(.*)');
my @vo = parse_opts('--vo=help', '^ ([^\s\:]*)\s*(.*)');
my @af = parse_opts('--af=help', '^ ([^\s\:]*)\s*(.*)');
my @vf = parse_opts('--vf=help', '^ ([^\s\:]*)\s*(.*)');
my @protos = parse_opts('--list-protocols', '^ ([^\s]*)');
my ($opts_str, $ao_str, $vo_str, $af_str, $vf_str, $protos_str);
$opts_str .= qq{ '$_' \\\n} foreach (@opts);
chomp $opts_str;
$ao_str .= qq{ '$_' \\\n} foreach (@ao);
chomp $ao_str;
$vo_str .= qq{ '$_' \\\n} foreach (@vo);
chomp $vo_str;
$af_str .= qq{ '$_' \\\n} foreach (@af);
chomp $af_str;
$vf_str .= qq{ '$_' \\\n} foreach (@vf);
chomp $vf_str;
$protos_str = join(' ', @protos);
my $runtime_completions = <<'EOS';
profile|show-profile)
local -a profiles
local current
for current in "${(@f)$($words[1] --profile=help)}"; do
current=${current//\*/\\\*}
current=${current//\:/\\\:}
current=${current//\[/\\\[}
current=${current//\]/\\\]}
if [[ $current =~ $'\t'([^$'\t']*)$'\t'(.*) ]]; then
if [[ -n $match[2] ]]; then
current="$match[1][$match[2]]"
else
current="$match[1]"
fi
profiles=($profiles $current)
fi
done
if [[ $state == show-profile ]]; then
# For --show-profile, only one allowed
if (( ${#profiles} > 0 )); then
_values 'profile' $profiles && rc=0
fi
else
# For --profile, multiple allowed
profiles=($profiles 'help[list profiles]')
_values -s , 'profile(s)' $profiles && rc=0
fi
;;
audio-device)
local -a audio_devices
local current
for current in "${(@f)$($words[1] --audio-device=help)}"; do
current=${current//\*/\\\*}
current=${current//\:/\\\:}
current=${current//\[/\\\[}
current=${current//\]/\\\]}
if [[ $current =~ ' '\'([^\']*)\'' \('(.*)'\)' ]]; then
audio_devices=($audio_devices "$match[1][$match[2]]")
fi
done
audio_devices=($audio_devices 'help[list audio devices]')
_values 'audio device' $audio_devices && rc=0
;;
EOS
chomp $runtime_completions;
my $tmpl = <<"EOS";
#compdef mpv
# For customization, see:
# https://github.com/mpv-player/mpv/wiki/Zsh-completion-customization
local curcontext="\$curcontext" state state_descr line
typeset -A opt_args
local -a match mbegin mend
local MATCH MBEGIN MEND
# By default, don't complete URLs unless no files match
local -a tag_order
zstyle -a ":completion:*:*:\$service:*" tag-order tag_order || \
zstyle ":completion:*:*:\$service:*" tag-order '!urls'
local rc=1
_arguments -C -S \\
$opts_str
'*:files:->mfiles' && rc=0
case \$state in
ao)
_values -s , 'audio outputs' \\
$ao_str
&& rc=0
;;
vo)
_values -s , 'video outputs' \\
$vo_str
&& rc=0
;;
af)
_values -s , 'audio filters' \\
$af_str
&& rc=0
;;
vf)
_values -s , 'video filters' \\
$vf_str
&& rc=0
;;
$runtime_completions
files)
compset -P '*,'
compset -S ',*'
_files -r ',/ \\t\\n\\-' && rc=0
;;
mfiles)
local expl
_tags files urls
while _tags; do
_requested files expl 'media file' _files && rc=0
if _requested urls; then
while _next_label urls expl URL; do
_urls "\$expl[@]" && rc=0
compadd -S '' "\$expl[@]" $protos_str && rc=0
done
fi
(( rc )) || return 0
done
;;
esac
return rc
EOS
print $tmpl;
sub parse_main_opts {
my ($cmd, $regex) = @_;
my @list;
my @lines = call_mpv($cmd);
foreach my $line (@lines) {
my ($name, $desc) = ($line =~ /^$regex/) or next;
next if ($desc eq 'removed' || $desc eq 'alias');
if ($desc =~ /^Flag/) {
push @list, $name;
$name =~ /^--(.*)/;
if ($1 !~ /^(\{|\}|v|list-options|really-quiet|no-.*)$/) {
push @list, "--no-$1";
}
} elsif ($desc =~ /^Print/) {
push @list, $name;
} else {
# Option takes argument
my $entry = $name;
$desc =~ s/\:/\\:/g;
$entry .= "=-:$desc:";
if ($desc =~ /^Choices\\: ([^(]*)/) {
my $choices = $1;
$choices =~ s/ +$//; # strip trailing space
$entry .= "($choices)";
# If "no" is one of the choices, it can also be
# negated like a flag (--no-whatever).
if ($choices =~ /\bno\b/) {
$name =~ s/^--/--no-/;
push @list, $name;
}
} elsif ($line =~ /\[file\]/) {
$entry .= '->files';
} elsif ($name =~ /^--(ao|vo|af|vf|profile|show-profile|audio-device)$/) {
$entry .= "->$1";
}
push @list, $entry;
}
}
# Sort longest first, because zsh won't complete an option listed
# after one that's a prefix of it.
@list = sort {
$a =~ /([^=]*)/; my $ma = $1;
$b =~ /([^=]*)/; my $mb = $1;
length($mb) <=> length($ma)
} @list;
return @list;
}
sub parse_opts {
my ($cmd, $regex) = @_;
my @list;
my @lines = call_mpv($cmd);
foreach my $line (@lines) {
if ($line !~ /^$regex/) {
next;
}
my $entry = $1;
if (defined $2) {
my $desc = $2;
$desc =~ s/\:/\\:/g;
$entry .= "[$desc]";
}
push @list, $entry
}
return @list;
}
sub call_mpv {
my ($cmd) = @_;
my $output = `"$mpv" --no-config $cmd`;
if ($? == -1) {
die "Could not run mpv: $!";
} elsif ((my $exit_code = $? >> 8) != 0) {
die "mpv returned $exit_code with output:\n$output";
}
return split /\n/, $output;
}
+1
View File
@@ -0,0 +1 @@
0.29.1
Loaded 100 of 820 files, more files were not shown because too many files have changed in this diff. Show more