Commit Graph

50681 Commits

Author SHA1 Message Date
Kacper Michajłow 826ce82cad vd_lavc: disable cropping by decoder
Cropping by decoder has limitations with regards to aligment and hwdec.
It doesn't work to offset top left corner with hwdec and even with
software decoding it don't crop fully when resulting data would not be
aligned.

VO cropping is way more robust.
2023-09-08 02:27:08 +00:00
Kacper Michajłow 4d853c5545 mp_image: add missing crop initialization
This enabled cropping of container signaled rect.
2023-09-08 02:27:08 +00:00
Kacper Michajłow 37d0deadd4 video: allow overriding container crop if it is present
Setting `--video-crop=0x0+0+0` applies full frame crop, ignoring the
container one. Setting --video-crop=0 disables manual crop and restores
container one if it is available.
2023-09-08 02:27:08 +00:00
Kacper Michajłow ff7da2f5c0 stats.lua: don't display full frame crop
It is valid to have 0x0+w+h crop, but no need to print that.
2023-09-08 02:27:08 +00:00
Kacper Michajłow 96c1662574 player/command: mark video-params/crop- unavailable if empty 2023-09-08 02:27:08 +00:00
Kacper Michajłow fb6f92af7f m_option: return empty rect when no width/height is available 2023-09-08 02:27:08 +00:00
Kacper Michajłow 10708c13fb autocrop.lua: enable vo_crop mode by default
It is just better way of cropping things. Can be disabled with
script-opts if needed.
2023-09-08 02:27:08 +00:00
Kacper Michajłow f4dd90aa90 autocrop.lua: don't remove crop on startup/exit
No need to remove/clean crop unlike with filters. Allows using autocrop
with auto=false and custom --video-crop.
2023-09-08 02:27:08 +00:00
Kacper Michajłow e234fc0ee5 autocrop.lua: detect if crop is enabled based on prop
Now we can have full frame crop, so to avoid checking that, just check
property.
2023-09-08 02:27:08 +00:00
Kacper Michajłow fef4481bfe m_option: make m_rect_apply center based
This makes it easier to apply crops without need to manually calc the
offset. I wanted for it to be top-left corner based, but maybe it was
not that good idea in retrospect.

Also rename scrw/scrh, since they don't refer to screen. It was copied
form m_geometry apply.
2023-09-08 02:27:08 +00:00
Dudemanguy b47a58516a sub: add auto option to --sub-fix-timing
Third try is the charm? I stupidly missed that this option already
existed in my previous commits. Instead, add an auto value to it and
enable it by default for sd_lavc but not sd_ass. On my limited samples,
it seems to fix the gaps issue that can occur but without regressing
some duration timings for sub_lavc subtitles. Well hopefully anyway.
Fixes #12327.
2023-09-07 09:27:31 -05:00
Dudemanguy a7185fbb60 Revert "sd_lavc: use SUB_GAP_THRESHOLD for overlaps/gaps"
Yet another bad idea. It turns out that there's already a sub-fix-timing
option which logic for this exact thing (overlaps/gaps) fixing. Also it
works better than this since it doesn't appear to artifically increase
sub duration either. Fixes #12327.

This reverts commit 725b631ec3.
2023-09-07 09:27:15 -05:00
Dudemanguy 499dce5ba1 path-{darwin,unix}: save cache to subdir when using non-XDG path
mpv saves cache by default nowadays, but vo_gpu is pretty spammy and
saves a bunch of files per shader. If someone is using the non-XDG
config directory, this all gets dumped directly into ~/.mpv which isn't
so nice. Save it to a sub directory called "cache" instead (or
alternatively submit to your XDG overlords). For unfortunate reasons,
macOS uses XDG_CONFIG_HOME and has the same legacy fallback mechanism,
so this applies to it too.
2023-09-07 13:59:49 +00:00
Kacper Michajłow bced1eec4e meson: add -Bsymbolic for libmpv
This is required when linking ffmpeg statically and generally good
practice to have on shared libraries anyway.

Prerequisit for fixes in mpv-build for:
https://github.com/mpv-player/mpv-build/issues/215
https://github.com/haasn/libplacebo/issues/198
2023-09-07 13:48:13 +00:00
Philip Langdale 02b49458a3 vo: vulkan: allow picking devices by UUID
We currently only allow specifying the Vulkan device to use by name. We
did this to avoid confusion around devices being enumerated in an
unpredictable order. However, there is a valid edge case where a system
may contain multiple devices of the same type - which means they will
have the same name, and so you can't control which one is used.

This change implements picking devices by UUID so that if names don't
work, you have some option available. As Vulkan 1.1 is a hard
requirement for libplacebo, we can just use UUIDs without conditional
checks.

Fixes #10898
2023-09-04 15:22:20 -07:00
Philip Langdale fb5273985c meson: include our local copy of libavutil uuid if ffmpeg is too old
In the previous change, I added the uuid files. In this change, we
check the libavutil version and if it's too old, we compile in our
local copy.

We have to change the include paths of the uuid code to find some other
libavutil headers, but nothing beyond that.
2023-09-04 15:22:20 -07:00
Philip Langdale 64bb9c092a misc: add copy of uuid from ffmpeg
To avoid taking a dependency on ffmpeg 5.1 before we're ready (we need
a newer Ubuntu LTS release to drop ffmpeg 4.x support), ut not force us
to wait to add support for picking Vulkan devices by UUID, I'm copying
the uuid code from ffmpeg into mpv. It's one file with no private
dependencies, so it's easier to copy than to reimplement in any other
way.

Licence is LGPL so matches us.
2023-09-04 15:22:20 -07:00
Philip Langdale a1c8bb2257 {zsh,bash}-completion: use config when autocompleting profiles
We were over-enthusiastic when introducing --no-config into the
autocompletions. When autocompleting profiles, you actually need the
config, because that's where the profiles come from.

zsh is untested - I don't use it.
2023-09-03 13:44:31 +02:00
Oliver Freyermuth f3df6f53ba stream/dvbin: recommend to use specific channels.conf file names
The old mplayer / zap style format is not fully standardized across
channel scanners, so autodetection may fail if the file name
does not indicate the delivery system.
2023-09-03 13:08:58 +02:00
Oliver Freyermuth 2c8db5af8b stream/dvbin: drop too verbose messages
Echoing channel config format detection for each channel
is a bit too noisy.
2023-09-03 13:08:58 +02:00
Oliver Freyermuth ab2c26ddd2 stream/dvbin: add some helpful verbose output
These verbose messages will help in case adapter detection /
channel list parsing fails.
2023-09-03 13:08:58 +02:00
Oliver Freyermuth 420f92629b stream/dvbin: detect ZAP channel configs looking like VDR configs
While ZAP config files should contain strings in most fields,
their field number in the DVB-T / ISDBT case matches the number of fields
for VDR config files, and some channel list writers (namely, dvbv5-scan)
may insert "0" in unused string fields.
To disentangle such config files from real VDR config files,
add a check for the "INVERSION_" field which should always be filled.
2023-09-03 13:08:58 +02:00
Oliver Freyermuth 7021d095b1 stream/dvbin: do not forget channel list for multiply delivery systems
dvb_get_channels is expected to append to an existing channel list.
For adapters supporting many delivery systems, a subsequent channel list
may turn up with a non-existent channel config, and the pointer
to the previously parsed channel list may be lost
(i.e. the list will be leaked and no channels detected).
Fix this by passing through the existing list (which may be NULL)
in case no new channels are found.
2023-09-03 13:08:58 +02:00
Oliver Freyermuth d88e3d105a stream/dvbin: add support for delivery system ISDB-T
This is similar to DVB-T, but requires slightly different treatment
as there is no T/T2 differentiation.
Use a new channels.conf.isdbt file as channels config file.
2023-09-03 13:08:58 +02:00
Niklas Haas 67368ac5d2 vo_gpu_next: don't rotate gamut visualization
Causes bad performance with interpolation because the changing hue angle
invalidates the mixing cache, as a result of libplacebo implementations
(specifically, the fact that this graph is drawn during the color
management process, instead of as a separate overlay).

Fix it by just hard-coding a particular, relatively interesting plane
(pi/4 approximately maps onto the red-blue axis).
2023-09-02 22:22:54 +02:00
llyyr e6afc53e7c demux_lavf: get total duration from track durations
Before this change, mpv used to get the total duration from
`avformat_find_stream_info` and used the per-track duration as a
fallback. This change reverses this order of preference.

The timestamps returned by `avformat_find_stream_info` are truncated or
rounded or floored (depending on the decoder) at the 6th decimal place.
For e.g. `avformat_find_stream_info` may return us a duration like
44.138667, whereas the duration we get from the per-track struct has a
higher degree of precision like 44.13866666666... and so on.

This caused various problems such as the playback_pts being a bigger
value than the duration, which would cause time-remaining to be a
negative value in some cases. Or cause you to reach a negative starting
timestamp when looping on an audio file with `gapless-audio`.

Moreover, we already skipped calling `avformat_find_stream_info` for
mp4, so we had already been utilizing this per-track fallback method for
finding the duration for mp4 files. It should be noted that while this
change is only required for audio-only formats, there is no harm in
doing this for videos as well.
2023-09-02 19:02:21 +00:00
Niklas Haas 1bf6abc62d {zsh,bash}-completion: add missing --no-config flags
Seemingly forgotten, even though the intent was to add them.

Fixes: 15252e13d5
2023-09-02 20:32:56 +02:00
llyyr a862f4ff10 options: remove unnecessary clamping on video-pan-x/y
This makes panning impossible at zoom level below 0, because it scales
with 2^zoom. Allow using bigger values instead
2023-09-02 16:18:31 +00:00
llyyr f52056b76d Revert "aspect: change --video-pan-x/y to be relative to the destination rect"
There are way too many preexisting scripts that rely on this behavior
for video panning, like for example scripts that allow you to use mpv as
an image viewer. If this behavior is desired then it may be better to
add a new option for panning relative to the destination instead.

The restriction of video-pan-x/y being clamped to {-3, 3} also results
in the video being impossible to pan if it was zoomed in beyond a
certain degree.

This reverts commit 7d6f9e3739.
2023-09-02 16:18:31 +00:00
NRK 022dbfc977 osc: add scrolling to the seekbar
the osc currently allows for changing volume via scrolling when on top
of the volume icon. this does the same thing for the seekbar by allowing
seeking via scroll.
2023-09-02 18:14:02 +02:00
Dudemanguy 0652a0b545 ci/lint: ignore subject length for revert commits
The default revert will always add 9 extra characters which means it
could go over the 72 character soft limit if the commit being reverted
has a long subject. We won't fuss about this so just shut up the lint in
this case.
2023-09-02 01:35:45 +00:00
Niklas Haas b4c98cb04c vo_gpu: remove --tone-mapping-mode
`--vo=gpu-next` no longer uses this option, being replaced entirely by a
luminance-based approach internally. And even for `--vo=gpu`, the values
other than 'hybrid' are universally inferior in quality.

In the interest of gradually reducing the amount of option bloat here,
remove this mostly-pointless option.
2023-09-01 21:02:19 +02:00
Dudemanguy eca51d8e45 loadfile: fix forced subtitles not respecting slang
fbe8f99194 made it possible for mpv to
autoselect forced subtitles again (it was bugged and would ignore
without slang being specified). Unfortunately, I forgot to take slang
into account here, so it would always autoselect the subtitles if they
are available. Fix this by checking both that it matches the lang and
that the previous track pick wasn't already matched (os_langs being true
is essentially equivalent to there not being any specified slang). This
way, it still respects the order of languages in your slang list.
Probably someone out there will be upset that forced subtitles aren't
always preferred regardless of the order, but that can be another option
for later I guess.
2023-09-01 13:22:03 -05:00
Niklas Haas c9c917c5c3 builtin.conf: add --allow-delayed-peak-detect=no to gpu-hq
Prevents transient brightness spikes on scene transitions at the cost of
sometimes forcing an extra indirect pass (in particular, when
downscaling). But on GPUs powerful enough to run gpu-hq, the extra
indirect pass shouldn't matter too much. This option mostly exists for
weak iGPUs.
2023-09-01 20:03:08 +02:00
Kacper Michajłow 7f7513132f win32: allow heap cache optimization and memory decommit 2023-09-01 16:58:56 +02:00
Kacper Michajłow 4f2a12110f win32: add BASE_SEARCH_PATH_PERMANENT to SetSearchPathMode 2023-09-01 16:58:56 +02:00
Kacper Michajłow 957118864c win32: don't load dynamically always available functions
They are all available on Windows 7 and newer.
2023-09-01 16:58:56 +02:00
Kacper Michajłow 1bf6325e21 win32/displayconfig: remove custom struct redefinition
Those structs in MinGW-w64 are correct. I compared to Windows SDK and
actually our version have not correct alignment.
2023-09-01 16:58:56 +02:00
llyyr 998c3a163c osc: remove toggle for forced only subpictures
DVD/PGS are definitely not common, and ones that make use of the forced
subpictures flag even less so. For this button to be useful, the
subtitle track would need to be DVD or PGS, the track would need to make
use of the forced flag, the user would have to know what forced
subpictures are, and the user would need to have the preference of only
viewing forced subpictures on a subtitle. The function of this button is
too niche to be on the osc, if this behavior is desired the user can
simply bind a key in their input.conf. Moreover, this button only adds
confusion because there's no intuitive way to show what it does, and
there's no explanation for it anywhere in the manuals. osc real-estate
is quite limited as it is, so let's not waste any space on buttons with
highly questionable utility at best and confusing or bad UX at worst.
2023-08-31 17:38:08 +00:00
Kacper Michajłow c865ce9455 stats.lua: display --video-crop values when used 2023-08-31 17:37:42 +00:00
Kacper Michajłow 3726834aaf man/input: remove trailing spaces 2023-08-31 17:37:42 +00:00
Kacper Michajłow c9c9822289 player/command: add video-params/crop-[w,h,x,y] 2023-08-31 17:37:42 +00:00
Kacper Michajłow 817845645f autocrop.lua: use new --video-crop
Gated behind option for backward compatibility.

Note that this will not magically start working with hwdec, as we do not
have crop detection for hwdec.
2023-08-31 17:37:42 +00:00
Kacper Michajłow f3f1a79fe3 vo: add --video-crop
Just cropping by VO that works with hwdec.

Fixes: #12222
2023-08-31 17:37:42 +00:00
Kacper Michajłow f3211db791 player/video: don't copy mp_image_params when not needed 2023-08-31 17:37:42 +00:00
Kacper Michajłow 21048291be m_option: add OPT_RECT
Parsed as WxH+X+Y to mp_rect. Allows also WxH without the offset.
2023-08-31 17:37:42 +00:00
Kacper Michajłow 765b68f971 mp_image: add image crop rect to mp_image_params 2023-08-31 17:37:42 +00:00
Kacper Michajłow 6329f742a6 aspect: don't override src_start/src_end
Rely on caller to set them.
2023-08-31 17:37:42 +00:00
Kacper Michajłow 8920ee5944 common: constify mp_rect_equals 2023-08-31 17:37:42 +00:00
Kacper Michajłow 3ab5401b38 player/command: remove video-aspect property
4 years is enough of deprecation period.
2023-08-31 17:37:42 +00:00