summaryrefslogtreecommitdiffstats
path: root/osdep
Commit message (Collapse)AuthorAgeFilesLines
* osdep/mac: make mac naming of files, folders and function consistentder richter2024-02-2828-45/+45
| | | | | rename all macOS namings (osx, macosx, macOS, macos, apple) to mac, to make naming consistent.
* build: fix build when disabling cocoa-cbder richter2024-02-272-2/+2
| | | | | | | | | | the swift obj-c bridging header is only included when cocoa-cb is enabled. cocoa-cb is not the only swift feature anymore and disabling cocoa-cb leads to a runtime error that specific swift classes could not be found. include the swift obj-c bridging header in the case swift features are enabled.
* cocoa-cb: remove pre-allocation and initialise only when usedder richter2024-02-274-9/+24
| | | | | | | | | | | | | | | | | | | | | cocoa-cb was always pre-allocated in the Application itself because libmpv needs to be set up before usage, an opengl context has to be set and because it was decided mac specific code should be kept out of libmpv. this means that a completely working libmpv and opengl renderer was set up even if it wasn't used. leading to unnecessary log message, resources being used or reserved on the system that might not be used, triggering of dedicated GPU unnecessarily and many other things. even if not optimal, this wasn't the biggest problem since we only had that one working vo on macOS. though now that we have a vulkan gpu(-next) backend on macOS that was made the default, we always have that dangling cocoa-cb instance, which is completely unnecessary. move the cocoa-cb initialisation into libmpv preinit function and only init cocoa-cb when we are a standalone App and cocoa-cb support is build into.
* osdep/io: add mp_unlink()nanahi2024-02-252-0/+10
| | | | | | | | unlink() was never wrapped in win32, so all usages of it were referring the ANSI version of the function. This doesn't work properly for Windows versions before 1903 (where the UTF-8 codepage is requested). Fix this by adding mp_unlink() which wraps over _wunlink().
* mac: code consistency changesder richter2024-02-241-4/+0
|
* osdep/io: move I/O utility functions to misc/io_utilsnanahi2024-02-232-58/+0
| | | | | | | The purpose of osdep/io is to provide a wrapper for POSIX I/O functions on Windows. The last 2 functions are utility functions which don't serve this purpose. Move them to a separate file.
* osdep/io: ignore 'x' mode for mp_fopennanahi2024-02-231-2/+1
| | | | | | fopen() with 'x' mode is a non-portable glibc extension, is currently unused, and should not be used in order to maintain POSIX compatibility. Thus there is no need for the Windows wrapper mp_fopen() to support it.
* various: make mentions of macOS consistentder richter2024-02-212-2/+2
| | | | | change all mentions and variations of OSX, OS X, MacOSX, MacOS X, etc consistent. use the official naming macOS.
* osdep/threads-posix: fix headers for OpenBSD buildJose Maldonado aka Yukiteru2024-02-151-0/+5
| | | | | In OpenBSD the compilation fail because osdep/threads-posix.h need include pthread_np.h
* mac/remote: simplify cover retrievalder richter2024-02-151-3/+1
|
* mac/remote: remove unnecessary nowPlayingInfo variableder richter2024-02-151-14/+7
| | | | | no need to keep track of the nowPlayingInfo, MPNowPlayingInfoCenter already provides the current info.
* mac/remote: add album and artist infoder richter2024-02-152-3/+12
|
* mac/remote: add seek supportder richter2024-02-151-2/+14
| | | | Fixes #11233
* mac/remote: add chapter title infoder richter2024-02-153-4/+8
|
* mac/remote: add media-title infoder richter2024-02-152-3/+7
| | | | Fixes #11233
* mac/remote: add playback rate infoder richter2024-02-152-2/+6
| | | | also rate limit the position to update at max once per second.
* mac/remote: add duration and current position infoder richter2024-02-152-8/+26
| | | | Fixes #11233
* mac/remote: remove make current observer when stoppedder richter2024-02-151-0/+6
| | | | | | | | | | the observer is registered on every call of the start function. this could lead to several registered observers for the same event and several calls to the make current function, even though we only need it once per event. properly remove the observer on stop, so we only ever have one observer registered.
* mac/remote: replace command handler with generic handler function configder richter2024-02-151-15/+17
| | | | | preparation for the upcoming changes for new functionality not related to key handling.
* mac/remote: simplify repeatable key logicder richter2024-02-151-6/+2
|
* mac/remote: move configs to initialiser for new MediaPlayer shorthandsder richter2024-02-151-53/+56
|
* mac/remote: move class local struct and enum definition to extensionder richter2024-02-151-1/+3
| | | | | the class local struct and enum are moved to an extension to separate their definition and usage.
* mac/remote: use explicit struct instead of generic array for configsder richter2024-02-151-48/+31
| | | | | making the config explicit gets rid of some optional unwrapping. also rename some variables to better represent their values.
* osdep: fix infinite loop when cancelling subprocesssfan52024-02-111-1/+3
| | | | | Due to the state of the other fds/pipes it cannot safely be assumed that the loop breaks on its own.
* various: replace dead links in commentsnanahi2024-02-111-2/+4
| | | | | Replace various dead links with live replacements or archives. Less friction for anyone who wants to look up these references.
* io: add mp_save_fileKacper Michajłow2024-01-312-0/+30
| | | | Move from vo_gpu_next.c to io.c and return result.
* osdep/timer: update documentation and test for mp_time_nsKacper Michajłow2024-01-261-1/+1
| | | | No longer true after 8bbcc87feea7abf256a6c7f511244d09f5520c17.
* osdep/io: expand path before LoadLibraryKacper Michajłow2024-01-221-3/+17
| | | | | | Fixes compatibility with loading scripts from relative config paths. Fixes #13212
* terminal: don't print escape sequence if not ttyKacper Michajłow2024-01-151-2/+4
|
* terminal-unix: don't install handler before pipeNRK2024-01-151-4/+5
|
* terminal-unix: move all processing out of sighandlerNRK2024-01-151-23/+16
| | | | | | | | | | | | | | | | | | | commit fa9e1f06f tried to move signal unsafe operations out of signal handlers but mistakenly introduced a race. before, sigtstop would process the following in order: 0. do_deactivate_getch2(); 1. raise(SIGTSTP) that commit moved 0 out of the signal handler (due to it being unsafe) but kept 1 in there. this may mess up the ordering of these operations. this commit moves everything out of the handler so that things happen in proper order. since things are now moved out of the handler, SA_RESETHAND is no longer being applied to SIGTSTP. since that can result in races if multiple signals are delivered faster than we can respond to them.
* terminal-unix: don't set `SA_RESETHAND` for SIGTERM/SIGQUITllyyr2024-01-141-2/+2
| | | | | | | | | | | | | | | | | | | | This can cause mpv to abruptly quit without following the proper uninit process when a second `SIGTERM` or `SIGQUIT` is sent and mpv didn't quit on the first one already. This is because the default action for these signals is to terminate the program immediately, similar to `SIGKILL`, and `SA_RESETHAND` resets the `quit_request_sighandler` to `SIG_DFL` for the default action. Also keep the `SA_RESETHAND` flag for SIGINT because the current behavior is to quit after receiving two Ctrl+C no matter what, this is probably convenient and worth keeping. This change is because some tools (e.g. GNU timeout) send SIGTERM twice after the timeout period. An easy way to reproduce is with `timeout 1 mpv [...]` where mpv would quit abruptly anywhere from half the time to once every 50 attempts depending on your luck.
* various: use correct PATH_MAX for win32sfan52023-12-274-11/+28
| | | | | | | | In commit c09245cdf2491211f3e0bfe47f28cc0e0a2e05c8 long-path support was enabled for mpv without actually making sure that there was no code left that used the old limit (260 Unicode chars) for buffer sizes. This commit fixes all but one case.
* osdep: clarify and rename a constant on win32sfan52023-12-271-3/+5
| | | | This is about the maximum filename not path length.
* various: fix capitalization of 'GitHub'Ikko Eltociear Ashimine2023-12-271-1/+1
|
* win32: opt in to the windows segment heapAndarwinux2023-12-221-0/+1
| | | | | | | ref: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests#heaptype Improves demuxer cache recycling speed at the cost of a slight CPU usage increase. SegmentHeap is supported in Windows 10, version 2004 (build 19041) and later.
* win32: support long file pathsstax762023-12-211-0/+1
|
* terminal-unix: enable the cursor after ctrl+zGuido Cella2023-12-181-0/+2
| | | | | | | 24270b8587 disabled the cursor while mpv is running, but if you send mpv to the background, it is not re-enabled until you run bg, and not even after that if mpv is paused. Fix this by enabling the cursor from the SIGTSTP handler.
* mac: add support for drag-and-drop optionder richter2023-12-152-0/+15
|
* win32: properly handle WM_XBUTTONUP and WM_XBUTTONDOWNnanahi2023-12-061-0/+2
| | | | | | | | | | | | | | | | According to MS documentation, an application should return TRUE from WM_XBUTTONUP and WM_XBUTTONDOWN if it processes these messages. DefWindowProc generates the WM_APPCOMMAND message when it processes the WM_XBUTTONUP message, so if an application properly handles WM_XBUTTONUP messages, extra WM_APPCOMMAND messages won't be generated. Because mpv doesn't properly handle these messages, WM_XBUTTONUP causes APPCOMMAND_BROWSER_BACKWARD to be generated, resulting in duplicated keys and improper fix 438ead7a, which prevents the processing of the appcommand from sources other than mouse clicks. Fix this by following the documentation, and the back and forward appcommands can be added.
* mac: report modifier keys on precise scrollingder richter2023-12-021-2/+23
| | | | | | modifier keys weren't reported when using the trackpad to scroll. Fixes #11195
* Reapply "osdep/meson: add libplacebo include dir to swift compile"Dudemanguy2023-11-271-1/+3
| | | | | | | It's not actually related to libplacebo wrap stuff and the swift compile command needs this to get the right libplacebo include path. This reverts commit b9d392ecd9543aecdfd6e6a06aa2f9585950ac27.
* Revert "osdep/meson: add libplacebo include dir to swift compile"Dudemanguy2023-11-271-3/+1
| | | | | | | This is not needed since we removed the libplacebo wrap not too long after this commit. This reverts commit 4de76ce87a545cd86ef493129b4cfeafe10e8e98.
* mac: fix libmpv usage without embeddingder richter2023-11-254-20/+9
| | | | | | | | | | | NSApp is only an Application when initialised from mpv itself. when used via libmpv an Application is never initialised and mpv would always immediately exit. make the retrieval of the vo and mac options static so they can be retrieved in all cases. Fixes #12518
* mac: cleanup some unused and unneeded codeder richter2023-11-251-1/+0
|
* osdep/io: add PRINTF_ATTRIBUTE for printf overridesKacper Michajłow2023-11-251-2/+4
|
* meson: adjust win32 definesKacper Michajłow2023-11-251-0/+1
| | | | | | | | - Don't define _GNU_SOURCE on Windows, no need - Define WIN32_LEAN_AND_MEAN to strip some unneded headers from windows.h - Define NOMINMAX and _USE_MATH_DEFINES as they are common for Windows headers
* osdep/macosx: add default switch cases to suppress WswitchKacper Michajłow2023-11-242-0/+4
|
* mac: add rotation menubar entriesder richter2023-11-201-0/+22
|
* win32: don't jump over variable init with gotoKacper Michajłow2023-11-181-1/+2
| | | | Those variables are accessed after jump.
* osxbundle: remove mpv-bundle symlink to allow code signingDaniel Brookman2023-11-151-5/+4
| | | | | | | | | | | | | | | | | | | Apps on Apple silicon have to be codesigned to run, but you can't codesign bundles that have a symlink for the main executable. The "mpv-bundle" symlink was used as the bundle's main executable because it makes the execution name of the binary different. Launch Services runs the CFBundleExecutable key from Info.plist when launching a bundle, so by comparing the execution name to the name of the symlink, you can check if that's how the binary was launched. This replaces that detection method by moving the MPVBUNDLE environmental variable into Info.plist. Launch Services will set anything in LSEnvironment as environmental variables before launching the bundle, so we're able to check for it instead of needing to differentiate the execution name of the binary. Fixes #12116
* osdep/w32_keyboard: remove duplicated MP_KEY_BACK mappingKacper Michajłow2023-11-111-1/+0
| | | | | | | MP_MBTN_BACK is already mapped, the appcmd duplicates this. Fixes: #12768 Fixes: 8301906
* mac: change display name retrieval to localizedName NSScreen propertyder richter2023-11-101-31/+0
| | | | | | | | | | | | | | | the old displayName property via the IODisplay API is not working anymore on ARM based macs and was broken in at least one other case. instead we use the new localizedName property introduced in 10.15 of the NSScreen. we don't need any backwards compatibility since 10.15 is the oldest version we support now. configs and scripts that use the options and properties fs-screen-name, screen-name or display-names need to be adjusted since the names could differ from the previous implementation via the IODisplay API. Fixes #9697
* osdep/io: implement rename() wrappersfan52023-11-102-0/+16
| | | | | This is needed to provide the POSIX behaviour of transparently overwriting existing paths.
* vo: don't sleep 1ms always when requested time is in the pastKacper Michajłow2023-11-091-2/+9
| | | | | | | | | | | | | | Fixes a899e14b which changed clamp from 0 to 1 ms which effectivelly introduced 1ms sleep always, even if requested until_time_ns is in the past and should request 0 timeout. While at it also fix mp_poll wrapper to respect negative timeout which should mean infinite wait. Also keep the 37d6604 behaviour for very short timeouts, but round only the ones > 100us, anything else is 0. Fixes: a899e14b
* mac: remove runtime checks and compatibility for macOS older than 10.15der richter2023-11-097-129/+5
| | | | | we stopped supporting macOS older than 10.15 and hence can remove all the unnecessary runtime checks and compatibility layers.
* meson: remove several macos-10-* build optionsDudemanguy2023-11-092-25/+0
| | | | | | | | | | | These have been build options since the waf build, but that doesn't really make sense. The build can detect whatever macOS sdk version is available and then use that information to determine whether to enable the features or not. Potentially disabling multiple sdk versions doesn't really make any sense. Because f5ca11e12bc55d14bd6895b619c4abfd470c6452 effectively made macOS 10.15 the minimum supported version, we can drop all of these checks and bump the required sdk version to 10.15. The rest of the build simplifies from there.
* audio: introduce ao_read_data_nonblocking()Thomas Weißschuh2023-11-081-0/+2
| | | | | This behaves similar to ao_read_data() but does not block and may return partial data.
* threads-win32: add comment about local decl of a functionKacper Michajłow2023-11-081-0/+1
|
* threads-win32: support UWP in mp_thread_set_nameKacper Michajłow2023-11-081-3/+7
|
* osdep/threads-posix: use CLOCK_MONOTONIC if supportedKacper Michajłow2023-11-081-10/+56
|
* osdep/timer-linux: check clock availability on initKacper Michajłow2023-11-081-6/+21
|
* threads: unbreak mpv on builds without assertsKacper Michajłow2023-11-063-4/+2
| | | | | | Also remove duplicated macro. Fixes: #12818 #12820
* win32/pthread: remove unused codeKacper Michajłow2023-11-053-529/+0
|
* timer: remove unused codeKacper Michajłow2023-11-052-37/+0
|
* threads: remove unused codeKacper Michajłow2023-11-052-33/+0
|
* threads: rename threads.c to threads-posix.cKacper Michajłow2023-11-051-0/+0
|
* threads: move pthread debug to threads-posix.hKacper Michajłow2023-11-052-61/+61
| | | | And remove redundant define while at it.
* mp_thread: add win32 implementationKacper Michajłow2023-11-054-2/+233
|
* mp_thread: prefer tracking threads with idKacper Michajłow2023-11-051-3/+7
| | | | | | | | | | | | | | This change essentially removes mp_thread_self() and instead add mp_thread_id to track threads and have ability to query current thread id during runtime. This will be useful for upcoming win32 implementation, where accessing thread handle is different than on pthreads. Greatly reduces complexity. Otherweis locked map of tid <-> handle is required which is completely unnecessary for all mpv use-cases. Note that this is the mp_thread_id, not to confuse with system tid. For example on threads-posix implementation it is simply pthread_t.
* ALL: use new mp_thread abstractionKacper Michajłow2023-11-0513-50/+45
|
* threads: add new mp_thread abstractionKacper Michajłow2023-11-052-0/+148
| | | | | | This will allow to avoid hacky pthreads symbols/header override. Inspired by pl_thread from libplacebo.
* various: remove trailing whitespaceGuido Cella2023-10-301-4/+4
|
* timer-linux: fallback to CLOCK_MONOTONIC instead of timespec_getDudemanguy2023-10-271-3/+4
| | | | | | | | | | | | | CLOCK_MONOTONIC_RAW is linux-specific (macOS later supported it but it has its own timer code) and not neccessarily available everywhere like on BSDs. It makes sense to prefer it because mpv does a lot of measurements at small intervals (e.g. every frame) so theoretically it should be more accurate. However if the OS doesn't have it, fallback to CLOCK_MONOTONIC instead which is almost exactly the same and very widely supported across unix-like systems. This clock is technically optional according to POSIX, but any half-decent OS supports it anyway (sorry Solaris users). As a benefit, we now know that the clock from mp_time is always monotonic.