Commit Graph

52194 Commits

Author SHA1 Message Date
sfan5 3b64bf908a test: add an encoding test with libmpv 2024-04-17 20:22:36 +02:00
nanahi 32817198bb player/misc: fix audio-only fallback when video init fails
--stop-playback-on-init-failure=no is documented to continue playback in
audio-only mode if video init fails. However, this does not function
properly after a0804329927904fdeb70d9712ff23baaab161bb4: because video
is initialized first, if video init fails, ao_chain is still null.
As a result, !(mpctx->vo_chain || mpctx->ao_chain) is true, a playback
error is raised, so the playback ends and audio does not play.

Fix this by reverting that change, so it checks the tracks instead.

Fixes: a080432992
2024-04-16 22:19:55 +00:00
Kacper Michajłow d23f641bb3 player/command: remove codec-info and use track-list directly
Turns out that adding more medatata like HDR10+ and Dolby Vision would
produce a lot of duplication and it is better to centralize it around
the track-list property.

Fixes: e720159f72
2024-04-16 21:58:55 +02:00
Dudemanguy 68bcbf66ef player: avoid busy looping during reinit_sub
If the player is paused, switching subtitle track requires us to read
subs packets for an indefinite amount of time in order to actually
display the subtitles. The problem with this is that it puts a blocking
loop in the play thread which can be slow in cases where it takes a long
time to fetch the subtitle (e.g. over a network).

9e27b1f523 alleviates this when a pause
happens because of buffering, but it's not complete. One could encounter
this if the user pauses the video first manually and then switches the
subtitle track.

To solve this better, make it so the loop has a time out (totally
arbitrary number) so the player isn't blocked forever. If subtitles are
not fetched within that time, we flag the track and try again later in
the playloop.
2024-04-16 19:45:00 +00:00
Kacper Michajłow b2836bbaf1 demux_mkv: print chapter timestamp with constant length 2024-04-16 19:51:22 +02:00
Kacper Michajłow ab3b1744b9 demux_mkv: add BCP 47 language tags support
Section 12 of Matroska Media Container Format Specifications says:

If a BCP 47 Language Element and an ISO 639-2 Language Element are used
within the same Parent Element, then the ISO 639-2 Language Element MUST
be ignored and precedence given to the BCP 47 Language Element.

Fixes: #8144
2024-04-16 19:51:22 +02:00
Kacper Michajłow 2babe02f0f github/issue_template: remove question template
For less formal questions GitHub discussions should be used instead.
2024-04-16 19:27:57 +02:00
Kacper Michajłow ab504514b8 stats.lua: add codec profile
May be interesting information for users.

Fixes: #13839
2024-04-15 19:34:40 +02:00
Kacper Michajłow 0bcc33692d player/loadfile: add codec profile to print_stream() 2024-04-15 19:34:40 +02:00
Kacper Michajłow e720159f72 player/command: add video-codec-info and audio-codec-info
Adds support for extracting codec profile. Old properties are redirected
to new one and removed from docs. Likely will stay like that forever as
there is no reason to remove them.

As a effect of unification of properties between audio and video,
video-codec will now print codec (format) descriptive name, not decoder
long name as it were before. In practice this change fixes what docs
says. If you really need decoder name, use the `track-list/N/decoder-desc`.
2024-04-15 19:34:40 +02:00
llyyr 3995cd3714 wayland: fix segfault in surface_handle_enter due to memory read
Fixes: 895f40e150 ("wayland: only perform a rescale if window is on one output")
2024-04-15 16:41:01 +00:00
der richter 919a042833 osxbundle: use arg list instead of a string for signing subprocess call
Fixes #13872
2024-04-15 00:21:59 +02:00
Dudemanguy cb6e7c7a55 wayland: check if scale actually changes in scaling events
The protocol strongly implies that this only happens when the value
changes, and it's also what you would naturally expect. But maybe it's
worth guarding this in cause for some reason the same value twice in a
row happens.
2024-04-14 17:09:31 +00:00
Dudemanguy 895f40e150 wayland: only perform a rescale if window is on one output
The mpv window overlapping multiple outputs with different scale values
can result in some weird behavior when dragging it from one monitor to
another one. This is due to the way some compositors implement
preferred_scale or preferred_buffer_scale (integer scale equivalent).
Depending on the scale values, mpv window has to be resized to match the
new scaling value (due to fractional scaling requiring a viewport). This
can cause the window to become smaller and no longer overlap the monitor
you were just trying to drag it to. Repeat this and the window will
become smaller and smaller. Depending on the layout, the reverse can
also happen (the window becomes larger). This can cause additional
events to fire as the preferred_scale value may change again which does
more weird things.

It seems kwin is not affected by this because their implementation of
preferred_scale sends the event only if the window is fully on the new
monitor. Honestly, this is probably more logical anyway but we should at
least deal with the other implementations better. Try to deal with it by
reworking scaling changes so they only occur when the mpv window is
fully on one monitor. If we get a preferred_scale event and there is an
overlap, save it as a pending change to be performed on the next
surface_enter or surface_leave event (whichever results in there being
only one monitor. Some weird rendering glitches can still happen during
overlap but this makes it usable again.
2024-04-14 17:09:31 +00:00
Kacper Michajłow 367d02e971 demux_mkv: don't warn if yaw/pitch projection is set to 0
This case will work fine, even if those are explicitly set.
2024-04-14 18:11:37 +02:00
Kacper Michajłow 7bffdf3c70 demux_mkv: remove not needed v_projection_pose_roll_set 2024-04-14 18:11:37 +02:00
ls-2037 f729bd9e05 demux_mkv: corrected direction of ProjectionPoseRoll rotation
See: ietf-wg-cellar/matroska-specification#822
Fixes: #13830
2024-04-14 18:01:34 +02:00
Christoph Heinrich 6a8b130c6f TOOLS/lua/autoload: fix allow extending ext sets from script-opts
4eedb8710c has broken the normal work of this feature with --same_type=yes

Co-Authored-by: dyphire <qimoge@gmail.com>
2024-04-13 23:09:42 +02:00
Kacper Michajłow 078da37d5c vo_gpu_next: rotate target crop
Turns out libplacebo uses unrotated target crop in relation to source.
Use dst rect from VO, instead of extracting it from pl_frame, to avoid
another unrotating operation.

Fixes: a9354b36ca
2024-04-13 23:07:16 +02:00
Kacper Michajłow 9030e6a7ad msg: use fwrite
No need to recalc string length.
2024-04-13 18:23:16 +02:00
Kacper Michajłow f53e941ba0 msg: use defines for hide/restore cursor code 2024-04-13 18:23:16 +02:00
Dudemanguy 1172c4ead9 wayland: apply keepaspect options to wayland configure bounds
Previously if mpv's size was constrained by the compositor's configure
bounds event, there was no attempt to preserve the aspect ratio of the
given coordinates if --keepaspect (the default) was used. Be sure to
apply keepaspect to the bounded widths and heights if we are using this
event.
2024-04-13 14:33:58 +00:00
Dudemanguy 307255d00d wayland: avoid unneeded calls to xdg_toplevel state functions
The reconfigure event handles setting fullscreen, maximize, etc. We were
implictly relying on the compositor to just ignore mpv if we set a
redundant state (e.g. setting fullscreen when we're already fullscreen),
but kwin actually doesn't and operates again. This causes some subtle
issues when handling geometry on state changes. Rework the state change
calls so they are only executed if wl->geometry_configured isn't set yet
(i.e. the window just opened up for the first time). It's the only time
this is actually needed.
2024-04-13 14:33:58 +00:00
Dudemanguy 4023146a04 wayland: enforce a state change after a reconfigure
If mpv is coming out of some locked size state (fullscreen, maximized,
tiled), the window size given by the reconfigure event should be used
assuming the --auto-window-size option is set.

Fixes 8a9749b8a5
2024-04-13 14:33:58 +00:00
Kacper Michajłow 247ef82a76 msg: don't keep status line in partial
Noticed while looking at this code, we shouldn't append status line to
partial when !print_term.
2024-04-13 13:37:21 +02:00
Kacper Michajłow a9354b36ca vo_gpu_next: set target resolution to crop value
Use rect of the actual image instead of FBO size which includes
margins.
2024-04-13 13:37:12 +02:00
Kacper Michajłow 7a0c8c4619 stats.lua: remove unused variables 2024-04-13 13:37:12 +02:00
Kacper Michajłow 94fbd3683a stats.lua: use '➜' (U+279C) instead '→' (U+2192) 2024-04-13 11:09:10 +02:00
der richter e42a8d537f mac/log: fix use after free when freeing mpv handle
the mp_log is freed when the corresponding mpv_handle (ta_parent) is
freed in the EventHelper, though it could still be used from different
threads. instead don't use a ta_parent and manually free on manual
dereferencing. on app shutdown (memory cleanup) this is not called but
instead is freed by the usual cleanup and freeing.

the LogHelper is only able to be manually dereferenced in the AppHub,
so no race conditions are possible in all other cases (vo).in the AppHub
it's impossible to hit a race condition atm, because of how the init
process works and how/where the log is used. only manually forcing
logging in the exit process itself could theoretically trigger a use
after free.

Fixes #13823
2024-04-12 23:23:16 +02:00
ferreum 096d35dac7 af_scaletempo2: prioritize louder channels for similarity measure
Playback with many audio channels could be distorted when using
scaletempo2. This was most noticeable when there were a lot of quiet
channels and few louder channels.

Fix this by increasing the weight of louder channels in relation to
quieter channels. Each channel's target block energy is factored into
the usual similarity measure.

This should have little effect on very correlated channels (such as most
stereo media), where the factors are very similar for all channels.

See-Also: #8705
See-Also: #13737
2024-04-12 17:40:00 +00:00
Dudemanguy a5269d7a73 test: support format refs for multiple ffmpeg versions
With some small tweaks to the test, we can support multiple ffmpeg
versions. This adds back ffmpeg 6 support that was removed in the
previous commit.
2024-04-12 17:39:34 +00:00
Dudemanguy 05607fed19 test: update format refs for new major ffmpeg version
xvmc was removed and d3d12 was added.

a12cd3be98
142f727b9c
2024-04-12 17:39:34 +00:00
nanahi a6c38b93a2 DOCS/man/mpv: correct description of F8/F9 keybinds
Previous commit fixes showing the list in the terminal, so the mentions
of it can be removed.
2024-04-10 20:47:08 +02:00
nanahi 14462dafe4 command: don't use OSD_ASS_0 when converting lists to strings
When converting a list to string for show-text, since
05c398fb6c the OSD_ASS_0 escape hatch
is used. This usage is problematic because the same format string is
used for print-text, which results in these ASS escape sequences
being printed in the terminal.

Also since d6610a5b2f, the print-text
output to console.lua is no longer escaped if OSD_ASS_0 is present.
This results in abnormally formated text in the console output.

Fix this by not using ASS escape sequences for this. Instead, use the
circle symbols used by the OSC, which also results in the same width
for active and inactive items.
2024-04-10 20:47:08 +02:00
der richter ee6794225d mac/vulkan: add support for frame timing via presentation feedback 2024-04-10 19:14:20 +02:00
der richter 6df07ce90c mac/window: fix window pinch gesture and modify current-window-scale
this will prevent jumping of the window size in the case the window size
was 'externally' modified and not via the window-scale property, when
using the pinch gesture.

Fixes #11594
Fixes #13799
2024-04-10 19:13:00 +02:00
nanahi 9bb7d96bf9 various: make filter internal function names more descriptive
Lots of filters have generic internal function names like "process".
On a stack trace, all of the different filters use this name,
which causes confusion of the actual filter being processed.

This renames these internal function names to carry the filter names.
This matches what had already been done for some filters.
2024-04-10 19:00:22 +02:00
nanahi 06f88dfb3a ao: rename playthread to ao_thread
"playthread" is a confusing name which doesn't describe what it really
is. Rename it to ao_thread, and ao_wakeup_playthread to ao_wakeup,
in the same style as VO threads. This makes call stack function names
less confusing.
2024-04-10 19:00:22 +02:00
Kacper Michajłow 89cc477ef1 vo_gpu_next: keep target params in priv instead of alocating it 2024-04-10 18:35:47 +02:00
nanahi f167d18ec8 player/lua: fix trailing whitespace for mp.log output
Previously it always inserts a whitespace after an arg because
i > 0 is always true.
2024-04-09 20:09:43 +02:00
Christoph Heinrich 58eae25fbf stats.lua: fix scrolling for page 2
Scrolling for page 2 was disabled in 777f69bee8
but the keys were still bound, so this was clearly a mistake.
2024-04-09 17:10:21 +02:00
Dudemanguy 0d250892ba Revert "vo_dmabuf_wayland: assume counter-clockwise rotations"
This commit was originally sparked by a change in sway. When looking at
the wording of the spec, it was believed that the rotation should be
counter-clockwise. But that was interpreted incorrectly. The rotation
direction in the spec is meant for compositors not clients. Clients
should be rotating clockwise and compositors rotate it the opposite
direction. Also see the discussion in upstream wayland*.

*: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/369

This reverts commit 27ef1725e7.
2024-04-09 13:48:08 +00:00
Kacper Michajłow d3941f235a bstr: change bstr0_s to bstr0_lit, restrict it only for string literals
Allows to avoid non-portable strlen usage. Also avoid "initializer
element is not constant" warnings on older GCC that doesn't like
explicit type specification in aggregate initialization.

Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: nanahi <130121847+na-na-hi@users.noreply.github.com>
2024-04-08 02:06:06 +02:00
Kacper Michajłow 2d4fae4f70 vo_tct: reduce lut_item size and generate it without snprintf 2024-04-07 20:23:04 +02:00
Kacper Michajłow 7d2b7fa019 vo_tct: use fwrite when appropriate 2024-04-07 20:23:04 +02:00
Kacper Michajłow c389f9e75e win32: change fputs to fwrite wrapper
Removes mp_puts/mp_fputs and adds mp_fwrite.

In fact I wanted fwrite instead of puts, no need to make it more awkward
with the implicit new lines.

Fixes: fc55f355fc
2024-04-07 20:23:04 +02:00
Kacper Michajłow 6177aa7616 vo_tct: add synchronized output support
See-Also: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036
2024-04-07 20:23:04 +02:00
Kacper Michajłow 5a53fa7cad vo_tct: add --vo-tct-buffering option 2024-04-07 20:23:04 +02:00
Kacper Michajłow fbc5e47e00 misc/bstr: add bstr0_s for static initialization 2024-04-07 20:23:04 +02:00
Kacper Michajłow 39d560676f vo_tct: write frame fully instead of every pixel
This is multiple times faster than just writing every pixel sequence
separately. Especially on slower terminal emulators. In general no need
to stress I/O, while we can just prepare the frame to print and do it
once.
2024-04-07 20:23:04 +02:00