Commit Graph

52210 Commits

Author SHA1 Message Date
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
Kacper Michajłow 0f85a380c3 terminal-win: add more control codes support in non-VT mode
And skip unsupported private sequences, instead of printing them.
2024-04-07 20:18:05 +02:00
Kacper Michajłow 2f76536f62 vulkan: use pl_vk_inst_create
This change is mostly motivated by missing
VK_KHR_portability_enumeration instance extension when enumerating the
devices. Which causes issues with MoltenVK which does not advertise full
Vulkan conformance.

To avoid duplicating code use pl_vk_inst_create() which correctly query
availability and enables the mentioned extension.

While at it fix the VkInstance leaking in vk_validate_dev().
2024-04-07 20:16:50 +02:00
nanahi 0f4f1bcd63 DOCS/man/vo: document vo_caca's hardcoded keybinds
This was in mplayer's documentation, don't know why this got lost.

"Fixes": 504e2336b7
2024-04-07 15:38:57 +02:00
nanahi 48ce438fae DOCS/man/options: mention the impact of --hwdec-codecs on startup time
Probing for hwdec can be very slow: on my setup (Nvidia GPU without
VP9 hwdec capability), this causes 2x hot cache startup time compared
to explicitly disabling VP9 in this list (500 ms -> 1 000 ms).

Also remove --vo=vdpau reference.
2024-04-07 15:38:57 +02:00
nanahi b1ee92ad4a DOCS/man: unify flag option descriptions
In many places, flags options have duplicate descriptions like
--break-player and --no-break-player. This is redundant since the
equivalence of this syntax to --break-player=<yes|no> is already
documented, and the =<yes|no> syntax is more in line with the syntax
of other option types.

This replaces all usage of --no-foobar with --foobar=no, and use
--foobar=<yes|no> when possible.
2024-04-07 15:38:57 +02:00
Shuanglei Tao 3c1e983351 vo: add win32 context menu support 2024-04-06 08:24:06 +02:00
Misaki Kasumi f974382ca0 ao_pipewire: fix delay calculation
A figure from pipewire documentation:

```
           stream time domain           graph time domain
         /-----------------------\/-----------------------------\

 queue     +-+ +-+  +-----------+                 +--------+
 ---->     | | | |->| converter | ->   graph  ->  | kernel | -> speaker
 <----     +-+ +-+  +-----------+                 +--------+
 dequeue   buffers                \-------------------/\--------/
                                     graph              internal
                                    latency             latency
         \--------/\-------------/\-----------------------------/
           queued      buffered            delay
```

We calculate `end_time` in the following steps:

1. get current timestamp in mpv
```
int64_t end_time = mp_time_ns();
```

2. add duration of samples to enqueue
```
end_time += MP_TIME_S_TO_NS(nframes) / ao->samplerate;
```

3. add delay of the pipewire graph
```
end_time += MP_TIME_S_TO_NS(time.delay) * time.rate.num / time.rate.denom;
```

4. add duration of queued and buffered samples.
```
end_time += MP_TIME_S_TO_NS(time.queued) / ao->samplerate;
end_time += MP_TIME_S_TO_NS(time.buffered) / ao->samplerate;
```
New in this commit. `time.queued` is usually zero as `SPA_PARAM_BUFFERS_buffers`
is default to 1; however it is not always.
`time.buffered` is non-zero if there is a resampler involved.

5. add elapsed duration from when `time` is captured
```
end_time -= pw_stream_get_nsec(p->stream) - time.now;
```
New in this commit. `time` is captured at `time.now`.
From then, time has passed so we need to exclude the elapsed time,
by calculating the diff of `pw_stream_get_nsec()` and `time.now`.
2024-04-05 17:22:17 +02:00
der richter 2cbb13db9e mac/remote: use event type as key state for proper mapping in function
instead of using the MP_KEY events (Int32) and using a logical OR to
generate a key event for the mpv core, use the cocoa event type for key
states and pass those to the the function. in the function we properly
map those events to the right MP_KEY events.
2024-04-04 19:39:27 +02:00
der richter 70eba5e831 mac/apphub: fix opening several files at once via Finder or App icon
when dropping more than one file on the App icon or opening via Finder
the open(urls:) event might not pass all files at once in the array, but
may consecutivly call open(urls:) for each of the files or batched in
several arrays.

to fix this append any file passed to the open(urls:) event within 0.1
seconds of each other to the current playlist. the first event uses the
default behaviour.
2024-04-04 19:39:27 +02:00
der richter c555cfccfe mac/common: reuse hidpi window scale frame calculation helper 2024-04-04 19:39:27 +02:00
der richter 5178c5b7d1 mac/window: cleanup unfsContentFrame usage and make it none optional 2024-04-04 19:39:27 +02:00
der richter fc36e5d71e mac/window: fix unfs window size retrieval
the unfsContentFrame wasn't updated when externally resized leading to
a wrong unfs window size afterwards. update it on windowDidResize event
when not in fs, not animating and not live resizing.
2024-04-04 19:39:27 +02:00
Jan Ekström fef04315a1 audio/ad_spdif: utilize defined freeing function for AVIOContext
This has been around since FFmpeg/FFmpeg@b12e4d3bb8
from 2017. Thanks to @mkver for noticing this.
2024-04-04 17:03:48 +03:00
Jan Ekström 951153e733 audio/ad_spdif: specify media type and sample rate in output codecpar
No idea how things previously worked without having these set, but
apparently they did...

If this was a normal encoder to muxer case, we would utilize
`avcodec_parameters_to_context`, but alas this is not.

Fixes: #13794
2024-04-04 17:03:48 +03:00
Jan Ekström e8fb386456 ci/build-mingw64: enable the SPDIF muxer
Useful if we want people to verify bitstreaming related changes
with our PR builds.
2024-04-04 17:03:48 +03:00
Misaki Kasumi 4ce4bf1795 ao_coreaudio: register hotplug_cb in normal init() as well
`hotplug_cb` was registered only in `hotplug_init()`.
This commit make it registered in `init()` as well,
so that the ao can listen for latency change
in playback.
2024-04-03 23:43:24 +02:00
Misaki Kasumi 2407e1b2d0 ao_pipewire: support set_pause 2024-04-03 23:40:05 +02:00
Misaki Kasumi d419cc562d ao_wasapi: support set_pause 2024-04-03 23:40:05 +02:00
Misaki Kasumi dbc1e3a459 ao_avfoundation: support set_pause 2024-04-03 23:40:05 +02:00
Misaki Kasumi 93a924a553 ao: set_pause for pull based ao 2024-04-03 23:40:05 +02:00
Guido Cella 8d85627aad demux: fix seek ranges of images
When a video-reconfig occurs with an image, the cache is not used
because find_cache_seek_range() checks if the start time was
initialized, but for images it stays at MP_NOPTS_VALUE. This makes
rotating large network images slow because they are re-downloaded on
every rotation.

Fix this by setting the timestamps of image cache ranges by altering a
condition.
2024-04-03 14:47:07 +02:00
Dudemanguy 6179995dd7 player/loadfile: set track->forced_select outside of compare_track
This field is used by compare_track when determining if the next track
should be preferred. The only problem is that we were only setting this
in compare_track which isn't used for the very first subtitle track
selection. So if the first subtitle track was a forced track that was
selected, this wasn't marked and the next subtitle track could
mistakenly be detected as preferred. Fix this by setting the field after
we set pick equal to the track in select_default track. Fixes #13804.
2024-04-02 11:19:25 -05:00
der richter fe1de116f3 mac/app: add some verbose logging for app startup and file handling 2024-04-01 22:13:39 +02:00
der richter 9c0fc83f45 mac/apphub: only instantiate log and option when in Application mode
when in libmpv mode there is no need to for logging and reading options.
this also prevents possible race conditions with the usage and deinit of
the mpv_handler.
2024-04-01 22:13:39 +02:00
der richter 67c48ed922 mac/menu: remove redundant quit func and use identical command func 2024-04-01 22:13:39 +02:00
der richter 3c51497954 mac/app: cleanup and optimise App launch and termination
NSApp.terminate() is not a requirement to properly shut down a cocoa
App since it only calls exit() internally. though when not used the
cocoa termination events won't trigger, which we don't need. this
prevented us to exit with a proper exit code.

rework the whole termination logic to end up at one point where we can
return the exit code from the mpv_main function.

Fixes #7456
2024-04-01 22:13:39 +02:00
der richter d6c621b03b mac/apphub: move opening url into AppHub 2024-04-01 22:13:39 +02:00
der richter 2c7e4f5935 mac/app: use new open url App event to simplify open file event handling
this event has several advantages, it unifies the mpv:// url handling,
the dropping of files on the App icon and opening via finder into one
event, and it also lets us remove the file open workaround.

we had to keep track of opened files via the command line because the
event was also triggered by passed files on the command line, leading
to redundant load events.

the new event doesn't trigger from files passed via the command line
anymore.
2024-04-01 22:13:39 +02:00
der richter fc978eb9f2 mac/log: fallback to system logger if no mp_log is yet available
since cocoa is initialising mpv and does several things before the mpv
core does anything and the mpv_handle was passed to the App, this can be
used to log such things before the mpv logging is available. helpful for
debugging especially bundle related things.

the logger mapping looks a bit unintuitive but error is basically yellow
what our warning is and fatal is red what our error is.
2024-04-01 22:13:39 +02:00
der richter 7619cceb87 mac/app: rewrite App c main function, startup and termination in swift
also move main invocation into AppHub and completely delete the old
Application c implementation.
2024-04-01 22:13:39 +02:00
der richter b7c5b26d35 mac/app: rewrite Application class in swift 2024-04-01 22:13:39 +02:00
nanahi a140d2788c wayland_common: set mouse position on pointer enter
At least on some compositors, when the pointer enters a surface,
only a wl_pointer_enter event is generated, but not wl_pointer_motion.
This results in the initial mouse position being lost, which is
especially problematic when input simulation is used.

Fix this by setting the mouse position on pointer enter event.
2024-04-01 01:17:22 +00:00
Guido Cella 0a083eadb5 mpv.desktop: translate to Italian 2024-04-01 01:44:44 +02:00
Misaki Kasumi 7f3ca6c524 ao_pipewire: fix buffer size calculation
`ao->sstride` is alrady initialized to the same value in `init()`
but in addition it can also handle planar formats.
2024-03-31 12:57:52 +02:00