summaryrefslogtreecommitdiffstats
path: root/osdep
Commit message (Collapse)AuthorAgeFilesLines
* cocoa-cb: use new libmpv API instead of opengl-cbAkemi2018-03-042-48/+62
| | | | | a new replacement API was introduced with b037121 and the old one was deprecated. porting cocoa-cb to the new API.
* cocoa-cb: move the GL dummy function to swiftAkemi2018-03-042-6/+3
| | | | | | it's possible to get a function pointer through a closure after all in swift. remove the GL dummy function from the c header and do it in the swift code instead.
* osdep/atomic: add emulation for atomic_exchange()wm42018-02-281-0/+7
|
* osdep/atomic: fix potential shadowing warningswm42018-02-281-8/+8
| | | | | | | The stdatomic emulation adds "_" to each variable used inside the macros, to avoid that compilers print -Wshadow warnings for identifiers that are also used in surrounding code. Do this more consistently, because new warnings have been showing up.
* cocoa-cb: make fullscreen resize animation duration configurableAkemi2018-02-281-0/+7
|
* cocoa-cb: change border and borderless window stylingAkemi2018-02-282-0/+17
| | | | | | | | | | | the title bar is now within the window bounds instead of outside. same as QuickTime Player. it supports several standard styles, two dark and two light ones. additionally we have properly rounded corners now and the borderless window also has the proper window shadow. Also make the earliest supported macOS version 10.10. Fixes #4789, #3944
* cocoa-cb: fix invalid framebuffer operation errorAkemi2018-02-211-1/+5
| | | | | | | | | in certain circumstances the returned fbo for drawing is 0, but that fbo is solely used internally by the CAOpenGLLayer for its drawing and should never be used. in that case we fallback to 1 or the last used fbo instead if it was not 0. Fixes #5546
* lua+js: Implement utils.getpid()sfan52018-02-131-0/+29
| | | | | | | Usable for uniquely identifying mpv instances from subprocesses, controlling mpv with AppleScript, ... Adds a new mp_getpid() wrapper for cross-platform reasons.
* cocoa-cb: initial implementation via opengl-cb APIAkemi2018-02-126-42/+392
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this is meant to replace the old and not properly working vo_gpu/opengl cocoa backend in the future. the problems are various shortcomings of Apple's opengl implementation and buggy behaviour in certain circumstances that couldn't be properly worked around. there are also certain regressions on newer macOS versions from 10.11 onwards. - awful opengl performance with a none layer backed context - huge amount of dropped frames with an early context flush - flickering of system elements like the dock or volume indicator - double buffering not properly working with a none layer backed context - bad performance in fullscreen because of system optimisations all the problems were caused by using a normal opengl context, that seems somewhat abandoned by apple, and are fixed by using a layer backed opengl context instead. problems that couldn't be fixed could be properly worked around. this has all features our old backend has sans the wid embedding, the possibility to disable the automatic GPU switching and taking screenshots of the window content. the first was deemed unnecessary by me for now, since i just use the libmpv API that others can use anyway. second is technically not possible atm because we have to pre-allocate our opengl context at a time the config isn't read yet, so we can't get the needed property. third one is a bit tricky because of deadlocking and it needed to be in sync, hopefully i can work around that in the future. this also has at least one additional feature or eye-candy. a properly working fullscreen animation with the native fs. also since this is a direct port of the old backend of the parts that could be used, though with adaptions and improvements, this looks a lot cleaner and easier to understand. some credit goes to @pigoz for the initial swift build support which i could improve upon. Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739, #2392, #2217
* osx: add some more menu bar items as suggested by Apples's HIGAkemi2018-01-201-0/+35
| | | | | | | | | | | | this adds the standard menu bar items Services, Hide Others, Show All and Close, as suggested by Apple's HIG. https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/#app-menu - Services are useful to add custom actions and shortcuts via the System Preferences to mpv - Close is important since the menu bar can open secondary windows, like About or the Open dialogue. those couldn't be closed with the standard system shortcut before. this is now possible.
* osx: code cleanups and cosmetic fixesAkemi2018-01-205-16/+2
|
* osx: fix macOS 10.13 deprecation warningAkemi2018-01-202-1/+7
| | | | | | | | NSFileHandlingPanelOKButton is deprecated with macOS 10.13, but the replacement NSModalResponseOK is not available on 10.8 and earlier. added a declaration for 10.8 and earlier since i only officially dropped support for 10.7 and earlier. this is untested.
* mpv.rc: readd actual version infoRicardo Constantino2018-01-011-2/+2
|
* build: move copyright statement to a shared locationwm42018-01-012-2/+3
| | | | | | | Now macosx_menubar.m and mpv.rc (win32) use the same copyright string. (This is a bit roundabout, because mpv.rc can't use C constants. Also the C code wants to avoid rebuilding real source files if only version.h changed, so only version.c includes version.h.)
* Update copyright yearwm42018-01-011-1/+1
|
* subprocess-win: don't change the mouse cursor in CreateProcesspavelxdd2017-12-141-1/+1
| | | | | | By default the CreateProcess changes the mouse cursor to IDC_APPSTARTING. The new flag added to STARTUPINFOEXW prevents changing the cursor from default arrow on creating a new process.
* terminal-unix: fix race condition with tty resetDrew DeVault2017-12-091-10/+10
| | | | | | | | | | | | | Calling do_deactivate_getch2 before joining the terminal thread could lead to breakage if the terminal thread got another interation in before it was signaled to stop. This also addresses a minor error with the order in which things are initialized - getch2_poll would previously call tcgetpgrp(tty_in) before tty_in was initialized, which did not lead to broken behavior, but was not correct either. Fixes #5195
* terminal-unix: switch back to poll(3)Drew DeVault2017-12-091-15/+9
| | | | | This leverages the new polldev shim which lets us "poll" device files on macOS with select and use the genuine article on other platforms.
* osdep: add poll shim for macOSDrew DeVault2017-12-092-0/+82
| | | | | | | This implements a poll-compatible interface, backed by select on macOS, suitable for polling on device files - which are not supported by macOS's implementation of poll. This is a (long-standing) bug in macOS, so hopefully we can eventually remove this shim.
* terminal-unix: fix busy looping on LinuxDrew DeVault2017-12-081-2/+1
| | | | | | | POSIX permits select() to modify the timeout, which can happen on the Linux implementation. This can reset the timeout, which spins this into a tight loop. A timeout isn't necessary in the first place, so just use NULL instead.
* Use /dev/tty instead of stdin for terminal inputDrew DeVault2017-12-081-18/+43
| | | | | | | Fixes #4190 This allows you to use terminal input even if you've piped something into mpv.
* build: remove nanosleep() checkwm42017-12-021-9/+0
| | | | Also guaranteed by POSIX.
* build: remove termios checkwm42017-12-021-14/+0
| | | | Also should be fully covered by POSIX.
* ao: simplify hack for float atomicswm42017-11-301-0/+3
| | | | | | | stdatomic.h defines no atomic_float typedef. We can't just use _Atomic unconditionally, because we support compilers without C11 atomics. So just create a custom atomic_float typedef in the wrapper, which uses _Atomic in the C11 code path.
* win32: fix semantics of POSIX 2008 locale stubsJames Ross-Gowan2017-11-192-4/+19
| | | | | | | | | | | | | | | | | This sliences some warnings about unused values and statements with no effect, but it also fixes a logic error with freelocale(), since previously it would not work as expected when used in the body of an if statement without braces. Uses real functions, because with macros, I don't think there is a way to silence the "statement with no effect" warnings in the case where the return value of uselocale() is ignored. As for replacing the these functions with working implementations, I don't think this is possible for mpv's use-case, since MSVCRT does not support UTF-8 locales, or any locale with multibyte characters that are three or more bytes long. See: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale
* stream_libarchive, osdep: use stubs for POSIX 2008 locale on MinGWwm42017-11-121-0/+7
|
* osx: fix the bundle $PATH yet againAkemi2017-11-111-1/+1
| | | | we have 5 parameters for the string but only 4 were being used.
* win32: add more-POSIXy versions of open() and fstat()James Ross-Gowan2017-10-252-39/+296
| | | | | | | | | | | | | | Directory-opening never worked on Windows because MSVCRT's open() doesn't open directories and its fstat() doesn't recognise directory handles. These are just MSVCRT restrictions, and the Windows API itself has no problem with opening directories as file objects, so reimplement mpv's mp_open and mp_stat to use the Windows API directly. This should fix directory playback. This also populates the st_dev and st_ino fields of struct stat, so filesystem loop checking in demux_playlist.c should now work on Windows. Fixes #4711
* osx: add right MacPorts paths to our bundle $PATHAkemi2017-10-071-2/+3
| | | | also add another path for homebrew.
* osx: add some common paths to our $PATH when started from bundleAkemi2017-10-031-0/+8
| | | | | | | | | | | with the previous commit we removed the ability of loading the standard shell environment. this exact behaviour can only be re-added by either invoking the standard shell in a background process and reading it's environment vars or by manually reading all the various shell configs. both ways are kinda dirty and the former was already rejected before. for now we will just add some commonly used paths, when started from the bundle, so it can find the binaries used by mpv again. for example the youtube-dl one for our youtube-dl hook.
* osx: fix bundle on macOS High Sierra (10.13)Akemi2017-10-032-6/+21
| | | | | | | | | | | | | | | | | | | | | | Apple slightly changed the App bundle mechanism which broke wrapper scripts that invoke the actual binary. it caused the bundle to always open a new instance of mpv instead of reusing the currently running one. just removing the wrapper script would lead to several regressions, so it was replaced with a symlink to the bundle binary. detection if mpv was started from the bundle was replaced by comparing the execution name of the binary, eg the name of the symlink "mpv-bundle". additionally, because we load a standard config from the Resources folder of the bundle again, we prevent that config from being loaded if mpv wasn't started via the bundle. the psn argument has to be removed manually again. the ability of loading your standard shell environment has been removed with the wrapper. a substitution will be added with another commit. as a side effect this fixes an issues when zsh was used with common NodeJS configuration scripts. Fixes #4926 #4866
* android: posix_spawn(p) replacementsfan52017-09-224-1/+143
| | | | Signed-off-by: wm4 <wm4@nowhere>
* osdep/io: add android related bullshitJan Ekström2017-09-181-0/+27
| | | | | | | | | | | | | This fixes >2GiB files with at least API level 21. See: https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md for the gritty details. * Based on libavformat's things, except we do not care about API versions or NDKs without unistd.h, which contains all sorts of things that we utilize. * Redefines lseek to always point to the 64bit version. * Redefines fseeko to always point towards an inlined static implementation that utilizes the 64bit version of lseek underneath.
* osx: fix media keys input when other Apps steal the priorityAkemi2017-09-073-0/+27
| | | | | | | | | | | other Apps do the same as mpv and tap into the global event chain. events that are handled are not being propagated down the event chain. that can lead to mpv not getting any media key events anymore when they are held back by other Apps. we will just move mpv back to the top of the event list when mpv is refocused and is not at the top of the list any more. Fixes #4834
* osx: fix build on macOS 10.11 and earlierAkemi2017-08-262-2/+8
| | | | | | | | 98f5579 added a safeguard for the deactivation of the automatic tab bar but it still needs a compile time guard. add a forward declaration for the setAllowsAutomaticWindowTabbing method of NSWindow. Fixes #4783
* win32: fix massive memory corruption (take 2)wm42017-08-211-3/+4
| | | | | | As pointed out by uau on IRC, the pointer to info is still used outside of the lock. An extremely small race condition window, but still a race condition.
* win32: fix massive memory corruptionwm42017-08-211-2/+6
| | | | | | | | | | The struct m_thread_info pointer is part of an array, that will be reallocated if another thread is created while the run_thread is just being called. In previous versions of this code, the pointer was stable (as long as the thread existed), so this was overlooked. Fixes #4770. I'm not sure why this triggers it so reliably, while it remained undetected otherwise.
* osx: remove the standard "Show Tab Bar" menu itemAkemi2017-08-181-0/+3
| | | | | it's unused and added automatically. we need to guard the deactivation since it's a 10.12+ feature.
* osx: code cleanups and cosmetic fixesAkemi2017-08-182-5/+7
| | | | silence build warnings, clean up code style and remove unused code.
* osx: refactor menu bar creationAkemi2017-08-184-81/+686
| | | | | make the menu bar look more like a standard macOS menu bar, with all the standard menu items like About, Help, Open, etc.
* osx: move menu bar creation into its own fileAkemi2017-08-186-142/+211
|
* {demux_mf,osdep/io}: disable glob usage when it is not availableJan Ekström2017-08-051-1/+1
| | | | | | | | This currently is only limited to Android. Its stdlib contains the things that mpv's POSIX check checks for, but unfortunately not glob(). This fixes Android compilation broken in 70a70b9da .
* w32_common: handle media keysJames Ross-Gowan2017-08-052-0/+23
| | | | | | | | | | | | | | | | | This was attempted before in fc9695e63b5b, but it was reverted in 1b7ce759b1f4 because it caused conflicts with other software watching the same keys (See #2041.) It seems like some PCs ship with OEM software that watches the volume keys without consuming key events and this causes them to be handled twice, once by mpv and once by the other software. In order to prevent conflicts like this, use the WM_APPCOMMAND message to handle media keys. Returning TRUE from the WM_APPCOMMAND handler should indicate to the operating system that we consumed the key event and it should not be propogated to the shell. Also, we now only listen for keys that are directly related to multimedia playback (eg. the APPCOMMAND_MEDIA_* keys.) Keys like APPCOMMAND_VOLUME_* are ignored, so they can be handled by the shell, or by other mixer software.
* subprocess-win: fix swprintf usageJames Ross-Gowan2017-07-291-1/+2
| | | | | | | The count parameter refers to the number of wide-characters to write to the buffer (including the terminating NUL character, which is always added,) not the number of bytes. See C99 7.24.2.3 or https://msdn.microsoft.com/en-us/library/ybk95axf.aspx
* subprocess-win: don't leak pipe handle on errorJames Ross-Gowan2017-07-281-1/+3
|
* subprocess-win: remove VLA usageJames Ross-Gowan2017-07-261-2/+4
| | | | This only ever waits on four handles at most anyway.
* Universal Windows Plaform (UWP) supportPedro Pombeiro2017-06-296-3/+89
| | | | | | | | libmpv only. Some things are still missing. Heavily reworked. Signed-off-by: wm4 <wm4@nowhere>
* Avoid calling close(-1)wm42017-06-292-20/+24
| | | | | | | | | | While this is perfectly OK on Unix, it causes annoying valgrind warnings, and might be otherwise confusing to others. On Windows, the runtime can actually abort the process if this is called. push.c part taken from a patch by Pedro Pombeiro.
* build: change how some OS specific source files are selectedwm42017-06-293-10/+40
| | | | | | | | | | | | | | | | | | In a bunch of cases, we emulate highly platform specific APIs on a higher level across all OSes, such as IPC, terminal, subprocess handling, and more. We have source files for each OS, and they implement all the same mpv internal API. Selecting which source file to use on an OS can be tricky, because there is partially overlapping and emulated APIs (consider Cygwin on Windows). Add a pick_first_matching_dep() function to make this slightly easier and more structured. Also add dummy backends in some cases, to deal with APIs not being available. Clarify the Windows dependency identifiers, as these are the most confusing.
* build: replace glob() check and assume it's always in POSIXwm42017-06-291-1/+1
| | | | | POSIX requires glob(), so no need to check for it. Together with the fact that we can emulate glob() on Windows, glob() is always available.
* terminal: remove unused return valuewm42017-06-273-6/+3
|
* osx: change license of OSX and cocoa files to LGPLwm42017-06-2410-71/+71
| | | | All authors of the current code have agreed.
* w32_common, w32_keyboard: change license to LGPLwm42017-06-242-14/+14
| | | | All authors agreed.
* Revert "osdep: NetBSD pthread_setname_np()"wm42017-06-221-6/+0
| | | | | | | | | | This reverts commit 2e81698d2809836d4cd7f754a78598e7bdf96c0b. Seems like this was a patch applied from someone who can't agree to LGPL relicensing (see previous commit), with the author field not properly set. This is not so important anyway, so just revert it.
* win32: pthread: avoid using TLS, simplify pthread_twm42017-06-152-48/+89
| | | | | | | | | | | | | | | | | Don't use __thread, which requires heavy runtime in some cases (such as MinGW-w64, at least under some configurations, forcing you to link to its pthread runtime DLL). The pthread_t struct was needed over a simple thread ID, because pthread_join() needed to access some sort of context from pthread_t. Further, pthread_exit() and pthread_detach() need the context of the current thread, for which we relied on TLS. Replace these uses by a global thread array. This includes all threads created by the thread wrapper. Hopefully the number of threads created by mpv is low (say, below 20), and threads are not that often created or destroyed. So just keeping them in an array with linear search lookup should be reasonable.
* terminal: change license to LGPLwm42017-06-143-32/+25
| | | | | | | | | | | | | | | | All authors of the current code have agreed. The code probably originates from a software named GySmail (as the copyright header indicates). As far as I can tell, it was written by Arpi (who has agreed), possibly with unknown co-authors. This is most likely OK, as none of the original code is around anymore anyway. I could not find a working download of GySmail, that actually contained the original getch2.c code. This also has a wild history of random people adding ifdef guards to control ioctl() vs. tcgetattr() calls. (See for example 2b1310abba4c1.) Later, the ioctl() was removed in favor of the POSIX tcgetattr(), and the ifdeffery was removed. So these people were not contacted.
* mpv.rc, mpv.exe.manifest: change license to LGPLwm42017-06-121-9/+7
| | | | | | | | | All authors have agreed. mpv.exe.manifest probably can't have a copyright header, so it doesn't. These files don't add license info to the executables. And of course the executable license is still GPL.
* win32: pthread: use the new thread naming APIJames Ross-Gowan2017-05-183-1/+27
| | | | | | | Windows, as of the Creators Update, finally has a sane API for giving a name to a thread that can be used by debuggers. This is similar to pthread_setname_np on Linux and some Unixes. Expose it in the pthread wrapper and use it for mpthread_set_name().
* osdep/compiler.h: change license to LGPLwm42017-05-081-14/+8
| | | | | | | | | | | This didn't have a header and this was implied LGPL, but this was not entirely correct. It turns out the printf attribute code was leaked in from talloc, which is "LGPL v3 or later". talloc was added to the mplayer2 code base in 27a30e310e1. This remaining code was an oversight. Since we want to reduce LGPL v3 code, replace this code with the one from ta/ta.h. This code was explicitly written newly to get rid of talloc and its license in 0933f12d28e.
* osdep/timer*: change license to LGPLwm42017-05-053-23/+21
| | | | | | | | | | | | | | All authors have agreed, with the following exceptions: e68d7f6858: wight wasn't asked (I think...), but even if he modified the patch he applied, all code added by it was removed again later. cb7768f9bb: nick could not be reached, but the declarations he added as well as the full timer.c file were deleted again in cff81fe