Commit Graph

53673 Commits

Author SHA1 Message Date
der richter e0f82b1a77 gamma-auto.lua: add this script as replacement for --gamma-auto
also mention this replacement for --gamma-auto.
2024-12-21 16:15:44 +01:00
der richter 2b06728df9 command: add ambient-light property
make it observable to make it usable as a replacement for --gamma-auto.
2024-12-21 16:15:44 +01:00
der richter 811062279e vo: change VOCTRL_GET_AMBIENT_LUX from int to double 2024-12-21 16:15:44 +01:00
der richter 568e2c357b DOCS/contribute.md: add guidelines for Swift and Objective-C 2024-12-21 16:13:08 +01:00
Dudemanguy 96bebf0935 x11: simplify --geometry and --auto-window-resize logic
There were a few pitfalls with the way this was previously implemented
because --geometry implicitly depended on --auto-window-resize being
enabled to operate in a few cases. Instead, let's change the logic a bit
so that instead we choose whether or not to reuse the old rc (i.e. don't
resize) and use the wh_valid and xy_valid fields within the m_geometry
struct instead of using x11->geometry_change. This fixes several edge
cases involving setting the position with --geometry when using
--auto-window-resize=no.
2024-12-20 18:03:30 +00:00
nanahi 8ee1aeaf1a DOCS/man: fix Unicode capitalization 2024-12-20 14:54:35 +00:00
nanahi 298c178f1e input.conf: use capital letters instead of shift modifiers
Follow the suggestion of keyname documentation.

Fixes: b4d9980870
2024-12-20 14:54:35 +00:00
nanahi b174d98042 video/out/wayland_common: make all XF86 special keys mappable
Forgotten in 417869f845.
2024-12-20 14:54:35 +00:00
nanahi 1107bdb62e DOCS/man/input.rst: clarify hexadecimal key names
Document the syntax and mention how it can be used as Unicode
codepoints. ASCII range has worked since the feature was inplemented
in 86a87de590 and Unicode range has
worked since a63e880400.

It also works with known special keys if you know the internal values
of keys because there is no filtering in place, but this should not be
encouraged.
2024-12-20 14:54:35 +00:00
nanahi 269e402579 DOCS/man/input.rst: clarify that caps lock affects produced keycode
Because mpv keycodes are whatever the text the keyboard input produces,
caps lock also affects this.
2024-12-20 14:54:35 +00:00
nanahi 4711e40814 DOCS/man/input.rst: clarify shift modifier behavior
When shift modifier is used with text key names, it is usually
silently ignored, except for ASCII key names, which can be
confusing. Document it clearly.
2024-12-20 14:54:35 +00:00
nanahi f8a5df56cc DOCS/man/input.rst: fix grammar 2024-12-20 14:54:35 +00:00
Guido Cella 38c46e4d89 stats.lua: enable runtime script-opt changes
This doesn't work for changing page key script-opts at runtime because
they are used as the indexes of the pages variable, but nothing actually
breaks if you do, it just uses the initial values. This is still useful
for conditionally changing sizes at runtime or for trying out the
osd-box profile by applying it from the console.
2024-12-20 14:54:20 +00:00
Guido Cella 19537a4996 console.lua: inherit --osd-color and --osd-outline-color
Stop overriding the OSD font and outline color in the console input line
and log, except for the lines already in a different color. This allows
configuring the console color and makes it consistent with the rest of
the OSD, like 51bd00c33a did for stats.
2024-12-20 14:54:08 +00:00
Kilian Evang 5354a50f9f DOCS: fix description of subtitle delay adjustment
Modified the man page.

There were two pairs of key bindings that appeared in one order but
the description of what they do appeared in the reverse order. Modified
the description to match the order in which the keys appear.

Note: I have not tested this change.
2024-12-20 14:53:26 +00:00
Guido Cella 661a380fda console.lua: color the default item with --osd-selected-color
Currently if you change --osd-selected-color the preselected item stays
yellow and can't be changed. Since the default item style was just
chosen from the selected color without the bold, also make the default
item follow --osd-selected-color.

Requested in
https://github.com/Samillion/ModernZ/issues/259#issuecomment-2556608926.
2024-12-20 12:43:34 +01:00
norinoriko 566c3ef367 DOCS/man/console.rst: remove outdated issue
This was fixed for win32.

See-Also: https://github.com/mpv-player/mpv/pull/15355
2024-12-20 12:34:32 +01:00
nanahi 1723f8a9d2 sd_ass: fix fix_margins calculation
Saving old playresx method is incorrect after the first
configure after the subtitle is loaded.

Fixes: f862d3b6cd
2024-12-19 19:43:27 +00:00
llyyr 32d103c580 meson: bump libdrm version to 2.4.109
The previous check was incorrect because drmGetDeviceFromDevId is only
available since 2.4.109.

https://gitlab.freedesktop.org/mesa/drm/-/commit/57e0b0552e11b3f04e6d5704c1c7efea5f83ffe4

Fixes: 0d7b4d64a5
2024-12-17 23:30:48 +00:00
Guido Cella a6f93ac81e options: add heic and heif to --image-exts 2024-12-17 23:30:32 +00:00
yk 96fad6a0fc ytdl_hook: pass empty proxy value
an empty value to a commandline option usually means that parameter does
not expect anything, but in case of `--proxy`, yt-dlp use an empty value to
disable proxy setting, the empty value need to be passed to `--proxy`
2024-12-17 22:26:46 +02:00
Guido Cella 2756a780b2 demux_lavf: remove obsolete defines
AV_DISPOSITION_TIMED_THUMBNAILS was added in FFmpeg 3.2 and
AV_DISPOSITION_STILL_IMAGE in FFmpeg 4.1, and we require FFmpeg 6.1.
2024-12-17 20:05:20 +00:00
Guido Cella 7715e2e255 demux_lavf: detect heif/heic as images
Like 565e7d906c did for avif, consider 1-frame HEVC as images, as HEVC
videos have nb_frames 0 or > 1.

Specifically, in the FATE suite:

nb_frames = 0 and are images:
cbf_cr_cb_TUDepth_4_circle.h265 food.hevc hdr10_plus_h265_sample.hevc
hdr_vivid_h265_sample.hevc hevc-monochrome.hevc

nb_frames = 0 and are videos:
mv_nuh_layer_id.bit paired_fields.hevc
paramchange_yuv420p_yuv420p10.hevc pir.hevc

nb_frames > 0:
dv84.mov extradata-reload-multi-stsd.mov multiview.mov
two_first_slice.mp4

As with other video codecs, the hevc images with nb_frames = 0 which are
really frames cut from a video are not detected as images, but you will
only find these files in FATE.
2024-12-17 20:05:12 +00:00
Guido Cella e52f975842 osc.lua: simplify track ID retrival
When track IDs are auto mp.get_property_native() returns "auto", but
mp.get_property_number() returns nil.

Follow up to 1a558bf5c2 and 897c04afe1.
2024-12-13 18:46:53 +01:00
Guido Cella 5e4b825a48 select.lua: abort edition selection when there's only 1
MKVs have 1 edition by default so don't show an empty edition selection
in that case.
2024-12-13 03:46:03 +01:00
Guido Cella dbb3291e8e DOCS/man/osc: sort mouse bindings consistently
Always list in the order left shift+L middle right click.
2024-12-12 21:54:44 +01:00
Guido Cella cac6b663c7 osc.lua: show the full path when right clicking the title
Right clicking playlist arrows already opens the playlist selector so
bind something else to right clicking the title. Make it show the full
path which is useful but not bound anywhere on either the keyboard or
the OSC.
2024-12-12 21:54:44 +01:00
Guido Cella 365a33badd osc.lua: open the playlist selector when right clicking playlist arrows
- It makes more sense to select a playlist entry from the buttons that
  navigate the playlist than from the title
- Provides different bindings for right and middle click
- Mirrors chapter button bindings
2024-12-12 21:54:44 +01:00
Guido Cella f4a35a0264 osc.lua: move title mbtn script-opts below playlist_next's
Sort mbtn script-opts according to how they are shown to the user in bar
layout instead of how they are defined in osc_init().
2024-12-12 20:35:55 +01:00
Guido Cella 53554f521b DOCS/man/osc: update track middle-click action
Fixes 92a98f1ce2.
2024-12-12 17:48:53 +01:00
Kacper Michajłow 5897b66454 demux_mkv: limit EBML size to 64 MiB for fuzzing
OSS-Fuzz is limited to 2GiB of process memory, so allocating 512 MiB is
not working well and causing OOMs.
2024-12-12 01:45:19 +01:00
Kacper Michajłow c14af4ebad options: disable playlist and include for fuzzing
Both of this options reads files, so there is not much to test there and
only creates problems with timeouts when too much is read.
2024-12-12 01:45:19 +01:00
Kacper Michajłow 9c81c67e2a m_property: stop processing after 10 properties even in skip cases
For OSS-Fuzz.

See: 2054d872d4
2024-12-12 01:45:19 +01:00
Dudemanguy d33e54250e ao: correctly set state.playing for non-gapless audio after eof
The problem here is likely ao_alsa specific and has the same symptons as
what the previous commit fixed (audio not playing when the file changes
but the details are a bit different here and the sample rate does not
matter. When using gapless audio (the default), the core player
immediately marks the audio status as EOF after it starts draining and
allows the remaining audio buffers to play while it marches on. This
works fine. When not using gapless audio, it doesn't immediately set EOF
and instead waits for the audio to finish playing before it does
anything else. The problem is that ao_is_playing is always true so the
core waits forever thinking audio is still playing when it actually
isn't.

ao_play_data is what is in charge of setting the mp_pcm_state with it
calling out to the backend for additional help. Unfortunately, this
doesn't work for alsa because it's too dumb to signal the desired states
in this edge case so we have to help it a bit. The main thing to notice
here is that even though we can get EOF from a frame, there can still be
additional valid samples that compe after it. So we can't just
immediately quit after EOF is seen. The approach here is to simply save
if we got eof sometime in the past, wait until we get no more samples,
mark state.playing as false and then jump over to the eof code. This
will set p->playing to false as desired which allows the core code to
set EOF and finally we can go through the reset logic and actually play
audio for the next file.
2024-12-11 17:12:22 +00:00
Dudemanguy a7f6460e7e player/audio: get rid of bogus early return in reinit_audio_filters
There is a condition here that is supposed to wait until the ao is
finished playing before it goes through the rest of this function and
actually starts the reinit of the audio chain. This is not needed
however and actually causes a bug. uninit_audio_out already takes the
gapless audio case into account and drains the audio before preceding.
There is no reason to bail here. Additionally, returning early here
actually breaks ao_alsa. ao_alsa is pretty dumb and not able to cope
with changing samplerates. It explictly needs to stop the PCM and then
start it again for it to work. The old code here ensured the ao would
never reinit itself and then would wait forever trying to play samples
with no actual data. Other AOs (pipewire and pulse) seem to be able to
cope with this and reinit themselves in other ways (didn't look in
detail). This change makes no difference for them. Note that in many
cases, this appeared to work on ALSA because there is a high likelihood
that your default audio device will choose a 48 kHz sampling rate and
thus your entire playlist is resampled to 48 kHz which avoids the
bug.

Fixes #15477.
2024-12-11 17:12:22 +00:00
Toad King 9f6faef60d sd_lavc: match video display aspect ratio on SD video in PGS subtitles
Previous fixes in bcc3d72 make subtitles on videos with non-square pixel
aspect ratios appear incorrect. This can happen on subtitles for SD
Blu-rays where the video resolution is 720x480 but the aspect ratio is
4:3. The scaling still applies when the video frame is cropped with
filters so the previous fix will still work.

Fixes #15415.
2024-12-11 18:11:35 +01:00
Guido Cella 2dd5bd4cd1 osc.lua: draw box layout below console
console is drawn below the OSC. This looks bad only with layout=box
because there is no user-data/osc/margins so it overlaps with it. Fix it
by using z -1 with box layout.

Follow up to 86d24b0 and 9c22d6b.
2024-12-11 17:51:16 +01:00
llyyr 7fffaf8557 vo: update base_vsync even for initial samples
This is still used for caclulating a/v sync and delay remaining even
for initial samples, so we should always update it to the actual vsync
for those initial samples so we have something to work with at least.

And if we receive bogus values, also reset it to 0 along with
prev_vsync.

Not having base_vsync set to _some_ value completely breaks
vsync_skip_detection, and mpv stays stuck in a permanent mistimed state
where every frame is marked as delayed and never recovers from it.
2024-12-11 16:42:13 +01:00
llyyr bd915439d0 vo: use display clock to determine frame_end in display synced case 2024-12-11 16:42:13 +01:00
llyyr 84728fb5e9 vo: extract display synced frame end calculation
into get_display_synced_frame_end. Used in next commit.
2024-12-11 16:42:13 +01:00
Jisu Kim e2014fb309 osc.lua: add option to enable fade-in effect
Introduced a new `fadein` option to control the fade-in effect for the OSC.
The default value is `no`, which disables fade-in. This option allows users
to enable a fade-in effect when the OSC appears. Updated documentation
accordingly.
2024-12-10 22:41:40 +01:00
Guido Cella 8d76ff79a3 console.lua: rename dimension variables
These are easier to read with _ between words. Also screenx/y could be
assumed to be display coordinates, so rename them to osd_w/h. They are
not named osd_width/osd_height to avoid Redefined local LSP warnings
with the ones in the upper scope.
2024-12-10 22:21:31 +01:00
nanahi 65328563e7 command: signal unavailable error when clipboard is unavailable
This allows clients to detect if the clipboard is unavailable,
or an error happened.
2024-12-10 14:20:08 +01:00
nanahi e121c092b4 clipboard-vo: make logging verbose when clipboard is unavailable
It now only warns when the clipboard is implemented but get/set
failed. This is consistent with other properties like current-vo.
2024-12-10 14:20:08 +01:00
nanahi e62503cb39 clipboard: add CLIPBOARD_UNAVAILABLE error code
This makes it possible to distinguish between unavailable
or unsupported, and error.
2024-12-10 14:20:08 +01:00
Guido Cella 7bae5b8d37 console.lua: clear completions before searching history 2024-12-10 14:18:51 +01:00
Guido Cella 7253b6c63d console.lua: remove code repetition to initialize matches 2024-12-10 14:18:51 +01:00
Kacper Michajłow 3df8b0b297 video/out/gpu/video: don't pass big structs by value when not needed 2024-12-10 14:14:09 +01:00
Kacper Michajłow c00bd46684 m_option: put UPDATE_ flags at the beginning
Update flags are often updated, so make space for expand them. Reorder
all values to make it easier to add new ones, until there is no more
space.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2024-12-10 13:52:39 +01:00
Guido Cella 5dbaa69138 console.lua: add margin_{x,y} script-opts
Allow configuring the margins from the left bottom indipendently of
--osd-margin-{x,y}.

Fixes #15478.
2024-12-10 13:47:43 +01:00