0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00
Commit Graph

52096 Commits

Author SHA1 Message Date
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
Misaki Kasumi
3086f8fa3e ao_pipewire: fix nframes calculation
`buf` contains a `struct spa_data` for each channel.
Therefore the number of channels does not matter to calculate the frame capacity of one `struct spa_data`.
In practice this shouldn't make a difference as `b->requested` would reduce nframes even more.
2024-03-31 12:57:52 +02:00
nanahi
765a43a0ff ao_alsa: fix snd_config memory leak
During AO init, snd_pcm_open() is called, which calls snd_config_update()
to allocate a global config node and stores it in the snd_config global
variable. This is never freed on uninit.

Fix this by freeing the global config node on uninit.
2024-03-30 10:09:37 +01:00
llyyr
cb82ad73f2 video: also reset video-sync state when resetting video state
Fixes #13790
2024-03-30 09:46:48 +01:00
der richter
92cb47338f mac/view: fix cursor visibility when toggling fullscreen
this broke with the recent refactor of the input handling. one of the
edge cases was not considered, where not every mouse down event has a
corresponding mouse up event, eg all double clicks or more only have one
up event after the first down event.

this was handled correctly previously.

Fixes #13777
2024-03-29 14:20:40 +01:00
der richter
ba45f2004f mac: cleanup swift bridge header imports and unify them 2024-03-29 14:20:40 +01:00
der richter
7c86074a15 mac/apphub: make DnD behaviour on bundle icon configurable
we just need to add a OptionHelper to the AppHub, options were already
tried to read from the optional OptionHelper.
2024-03-29 14:20:40 +01:00
der richter
ed0587692f mac/log: rename log functions and cleanup class 2024-03-29 14:20:40 +01:00
der richter
ceaabb7b98 mac: use LogHelper directly instead of mp_log 2024-03-29 14:20:40 +01:00
der richter
e7df95b10d mac: rename mpvHandle to mpv 2024-03-29 14:20:40 +01:00
der richter
e71e340b77 mac: remove now unnecessary objective-c forwarding 2024-03-29 14:20:40 +01:00
der richter
6debb22a0c mac/apphub: move cocoa-cb into AppHub 2024-03-29 14:20:40 +01:00
der richter
1bc680d32a mac/apphub: move menu bar into AppHub 2024-03-29 14:20:40 +01:00
der richter
e2bc1e5f9b mac/app: remove unused Application flag 2024-03-29 14:20:40 +01:00
der richter
23db34dd6d mac/apphub: move mac options into AppHub 2024-03-29 14:20:40 +01:00