1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 12:17:12 +00:00
Commit Graph

1085 Commits

Author SHA1 Message Date
Andreas Klauer
c365e2f7b1 misc/random: seed using libavutil/random_seed
When starting multiple processes of `mpv --shuffle` in parallel,
sometimes the random seed happens to be identical, so files are
played in the same random order.

mp_rand_seed(0) now uses a random seed provided by libavutil,
and only falls back to time in case of failure.
2024-09-28 14:11:56 +02:00
Kacper Michajłow
a73c73255b osdep/timer-win32: remove unnecessary compatibility defines
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
Kacper Michajłow
01383c606c osdep/terminal-win: remove unnecessary compatibility defines
No longer neeeded after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
Kacper Michajłow
4ad3db855a osdep/main-fn-win: remove unnecessary compatibility defines
No longer needed after 9f8b4b38c9.
2024-09-24 00:21:19 +02:00
nanahi
b440821d18 osdep/terminal-win: reset tmp_buffers_key when uninit
To prevent potential undefined results when using a freed value.
2024-09-15 17:03:33 +02:00
Kacper Michajłow
1ecfb29932 osdep/io: redefine off_t for Windows build
off_t is long (4 bytes) on Windows, regardless of _FILE_OFFSET_BITS,
which is not supported there.

Fixes: #14790
2024-09-04 03:51:56 +02:00
nanahi
f3a00ea131 various: handle numpad add/subtract/multiply/divide keycodes 2024-08-11 15:08:42 +02:00
Philip Langdale
7bbf132e20 vo: hwdec: add AVHWDeviceType property to hwdecs
As the first step towards handling scenarios where the are multiple hwdecs for
a given image format but backed by different AVHWDeviceTypes, let us annotate
the hwdecs with their corresponding device types.

From this, we can also see how all the existing hwdecs which match the same
image format also match the same device type.
2024-08-10 14:24:36 -07:00
Kacper Michajłow
6f619d5ef4 vo_libmpv: don't steal pointer provided by the API user
It won't be TA allocated and would fail on header check. Also
documentation doesn't mention that ownership is transfered to mpv, so it
is unexpected.

This will cause existing clients of this API leak this memory, but I
doubt anyone really used it in this broken state.

Fixes: #14633
2024-08-06 20:17:35 +02:00
Kacper Michajłow
6a43514097 win32/smtc: add thumbnail support 2024-07-29 21:38:19 +02:00
Kacper Michajłow
5fed12e025 win32: add Media Control support
Add support for SystemMediaTransportControls interface. This allows to
control mpv from Windows media control ui.
2024-07-29 21:38:19 +02:00
Kacper Michajłow
c430420840 osdep/threads-win32: cast function type directly to avoid warnings 2024-07-29 21:38:19 +02:00
Kacper Michajłow
0aebcbcc19 player/{command,scripting}: log subprocess execution
Useful for debugging purposes and sanity checks.

Remove unused function while at it.
2024-07-12 22:40:02 +02:00
Kacper Michajłow
c505f77dda player/core: add core thread handle to MPContext
This change removes convoluted core thread extraction through dispatch
added in 500ce69a06.

Currently we fully control this thread, create it and join, there is no
reason not to keep the handle of it in the player context.

As a bonus to code simplification this also fixes thread handle leak on
Windows.

Fixes: #14472
2024-07-11 21:55:21 +02:00
der richter
88db2d0b61 mac/menu: add option to disable default shortcuts
Fixes #14305
2024-06-25 20:14:38 +02:00
Kacper Michajłow
7fb7e1dd73 various: add more format specifiers checks 2024-06-25 05:29:46 +02:00
Guido Cella
82ffe8f425 loadfile: update the format of terminal track information
Stop making unselected tracks and editions grey because they can be hard
to read over a dark background (\033[2m would be hard to differentiate
from regular text with a light theme instead), and because there is no
way to not print the escape sequences in --log-file.

Just use the same circles as the OSD and OSC. We need to print the empty
circles for alignment on mlterm with East Asian fonts (we could also
make them invisible with \033[8m but it would still get added to log
files).

Add back the space before tracks and editions when printed after
"Playing..." or "Track switched" and similar, so they look like a
sub-section of it, consistently with the metadata which starts with
space which makes it look like a sub-section of the "File tags" line.

Leave 2 spaces between track columns.

Make the lang options only as long as the longest language.

Place hls-bitrate within the same parentheses as the other data.

Replace the incomprehensible (*) (f) and [P] with textual descriptions
within []. Also place external there.

Stop converting Hz to kHz for consistency with other log messages, e.g.
AO: [pipewire] 48000Hz stereo 2ch floatp

Remove the space in "2 ch" so it doesn't look like 2 separate values (We
considered using mp_chmap_to_str(&s->codec->channels) but it prints
values like "unknown2").
2024-06-24 16:19:31 +02:00
der richter
55241da4ad cocoa-cb: guard color spaces that are only available on 10.15.4 upwards 2024-06-18 19:30:07 +02:00
der richter
e3a290b618 mac/compat: fix broken CGColorSpace declaration on SDK 11 only
seems like apple missed those two colour spaces and didn't add a obj-c
to swift redeclaration of the CFStringRef kCGColorSpace* global
variables.
2024-06-18 19:30:07 +02:00
der richter
0f9630f28d mac/event: remove swift 5.6 language feature that is mandatory with 6.0
this can be tested with -enable-upcoming-feature ExistentialAny
2024-06-18 19:30:07 +02:00
der richter
1364c80e64 mac/compat: add withLock fallback for xcode older than 14
withLock is available for macOS versions starting from 10.10 but can
only be used on xcode 14+. xcode 14 introduced swift 5.7, so we guard it
behind a swift version check.
2024-06-18 19:30:07 +02:00
der richter
b390ade709 mac/log: properly guard logger usage behind platform version check 2024-06-18 19:30:07 +02:00
Kacper Michajłow
b4bbc27d9c input: map Num 5 to distinct value when numlock is off
Until now both numlock on and off were mapped to KP5.
2024-06-13 20:42:24 +02:00
Guido Cella
d49879f1f7 loadfile: improve the format of terminal track information
Print vlang if present.

Make unselected tracks and editions grey instead of adding (+) before
selected tracks. Mark them with the same circles as show-text
${track-list} and script-message osc-tracklist when not outputting to a
TTY.

Don't print a different symbol with --sub-forced-events-only because
nobody uses this option, and subtitles are very unlikely to mix forced
and non-forced events.

Align 2-digit track IDs.

Align languages of up to 7 characters (the length of zh-Hans).

Leave spaces when a track has no language but at least another track
does to align the following track data with the other tracks.

Add a space between values and their units.

Convert Hz to kHz.

Pretty print FPS and kHz with mp_format_double().

Don't print images' FPS because it's just a bogus value taken from
--mf-fps.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2024-06-07 22:24:25 +02:00
Kacper Michajłow
a32674bb29 terminal-win: use proper NTAPI callback for FLS
Fixes crash when FLS data is attempted to be cleared.

This affects only 32-bit build where the calling convention were not
matching the expected one. It has to be __stdcall in this case.

Fixes: 3372e17d
2024-06-06 21:42:12 +02:00
Kacper Michajłow
8e4dcb15ce osdep/endian: add missing byte order defines 2024-06-05 19:07:58 +02:00
Kacper Michajłow
d31543a7e6 osdep/path-win: fix leak of portable_path 2024-05-20 18:18:42 +02:00
Kacper Michajłow
9ffbc1eef9 osdep/io: fix leak of environment strings on win32 2024-05-20 18:18:42 +02:00
nanahi
f11002cef3 various: fix tabs in code 2024-05-07 11:23:08 +02:00
Kacper Michajłow
4d5642887d win32: add WinMain 2024-05-06 22:01:17 +02:00
Kacper Michajłow
9fc2343512 osdep/mpv.rc: fix encoding of MPVCOPYRIGHT
llvm-rc doesn't allow multi-byte codes in narrow utf-8.
2024-05-06 22:01:17 +02:00
Kacper Michajłow
5cf0da2a6a various: remove unused sys/time.h include 2024-05-06 22:01:17 +02:00
Kacper Michajłow
323ed3cb10 osdep/compiler: clang also recognizes those attributes 2024-05-06 22:01:17 +02:00
Kacper Michajłow
041a925ada osdep/main-fn-win: add struct typedef for compatibility 2024-05-06 22:01:17 +02:00
Kacper Michajłow
419898267e osdep/semaphore: don't include files if they are not used 2024-05-06 22:01:17 +02:00
Kacper Michajłow
86abbb89a7 win32: fix platform checks 2024-05-06 22:01:17 +02:00
Kacper Michajłow
b647201795 osdep/dirent: add implementation for Windows SDK build 2024-05-06 22:01:17 +02:00
Kacper Michajłow
18ef834ef4 various: move unistd.h inclusion to common.h 2024-05-06 22:01:17 +02:00
der richter
8a61929eb8 cocoa-cb: add support for macOS color space transformation (EDR/HDR)
by default utilises the color space of the screen on which the window is
located. if a specific value is defined, it will instead be utilised.

depending on the chosen color space the macOS EDR (HDR) support is
activated and that OS's transformation (tone mapping) is used.

Fixes #7341
2024-05-05 19:02:50 +02:00
der richter
4a686dac6f mac: properly handle regular expressions without force unwrap 2024-04-28 20:21:18 +02:00
der richter
8f1189341f mac: code cleanup and consistency changes, fix linting issues 2024-04-28 20:21:18 +02:00
der richter
984c890661 mac/helper: make wakeup callback declaration consistent 2024-04-28 20:21:18 +02:00
der richter
6df06e5dc5 mac/touchbar: use KVO block API instead of old obj-c instance method 2024-04-28 20:21:18 +02:00
der richter
2e03e0305c mac/input: add support for dead key reporting
dead keys like tilde and accents were not reported because they returned
an empty string from the NSEvent.

try to retrieve dead key with alternative Carbon API when an empty key
is reported.
2024-04-24 20:35:53 +02:00
der richter
f7a32b5f29 mac: make display-names unique to allow specific selection
the Screen property localizedName returns a none unique dynamic name
that doesn't allow a specific selection of a Screen on every OS boot.
the name consists of the vendor name and model name (eg DELL U2723QE).
if the same model display is connected to the system several times,
macOS starts to add numbers to the localizedName (eg DELL U2723QE (1)),
that may not be associated to the same Screen on every OS boot or
connecting the display. it also changes the name of the first connected
display by adding that numeration. this makes it impossible specify the
proper screen with the screen-name option every time.

to circumvent this we remove the enumeration from the name and instead
add the serial number to the display-names property. this makes the
actual Screen unique and none dynamic. furthermore the selection of a
screen by name will check for equality for the old localizedName, simple
name without enumeration, serial number and the combined name with
serial number. this makes it possible to select the screen by either of
those names and identifiers, and keeps backwards compatibility with the
old behaviour.

Examples:
localized name (System Settings name): DELL U2723QE, DELL U2723QE (1)
simple name: DELL U2723QE
serial number: 123456789
combined name: DELL U2723QE (123456789)
2024-04-24 20:35:38 +02:00
nanahi
7cfd369ffb terminal-win: support mouse input events
The mouse input information is available from the INPUT_RECORD
with MOUSE_EVENT event type.
2024-04-18 01:03:33 +02:00
nanahi
8a2892a68f terminal-win: implement terminal_get_size2
The size of the console font can be acquired with GetCurrentConsoleFont,
and the terminal size can be calculated from the rols, cols, and font
size.
2024-04-18 01:03:33 +02:00
nanahi
eff18a8a11 terminal-win: implement terminal_set_mouse_input 2024-04-18 01:03:33 +02:00
nanahi
c2ed2e7bc8 terminal: add terminal_set_mouse_input function
This function is used to enable/disable mouse input for win32 and unix.
2024-04-18 01:03:33 +02:00
nanahi
abc0b0e8c9 terminal-unix: style fix 2024-04-18 01:03:33 +02:00