summaryrefslogtreecommitdiffstats
path: root/osdep
Commit message (Collapse)AuthorAgeFilesLines
* stream_libarchive: Always use LC_CTYPE_MASK for libarchiveJames Hilliard2019-09-211-1/+0
| | | | | | Using LC_ALL_MASK is unnecessary and unreliable on some systems. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
* io: remove Windows tmpfile() emulationwm42019-09-192-37/+0
| | | | | | | | | | | | Unused now. The old stream cache used it, but it was removed. On a side note, the demuxer cache uses mp_mkostemps(). It looks like our Windows open() emulation handles this correctly by using CREATE_NEW, so no functionality gets lost by the "new" approach. On the other hand, the demuxer cache does not set FILE_FLAG_DELETE_ON_CLOSE, but instead tries to delete the file after opening (POSIX style), which probably won't work on Windows. But I'm not sure how to make it use the DELETE_ON_CLOSE flag, so whatever.
* win32: remove -municode from mpv binarywm42019-09-191-7/+5
| | | | | | | | | | | | | If this is used, the runtime expects that wmain() instead of main() is defined. This caused me severe problems in a certain now irrelevant case. I think it's a good idea to avoid this special case. We can just use main() and call GetCommandLineW() instead. This function returns a single string, so use CommandLineToArgvW() to split it, and hope it has the same semantics. Should this ever return NULL, hope that it leaves argc at 0. Untested, I think.
* osdep: add mkostemps() emulationwm42019-09-192-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Supposed to follow the standard function. The standard function is not standard, but a GNU extension. Adding some ifdef mess is pointless too - it has no advantages other than having a mess, and not spotting implementation bugs in the emulation due to running it only on "obscure" platforms (like Windows, so most computers actually, except the developer's platform). There is mkstemp(), which at least is in POSIX 2008. But it's 100% useless, except in some obscure cases: it doesn't set O_CLOEXEC, nor can you pass it to it. Without O_CLOEXEC, we'd leak the temporary file to all child processes. (The fact that the file, which is expected to reach double or tripple digit GB sizes, will be deleted only once all processes unreference the FD, makes this sort of a big deal. You could ftruncate() it, but that doesn't fix all the other problems.) Why did POSIX standardize mkstemp() and O_CLOEXEC apparently at the same time, but provided no way to pass O_CLOEXEC to mkstemp()? With the introduction of O_CLOEXEC, they acknowledged that there's a need to atomically set the FD_CLOEXEC flag when creating file descriptors. (FD_CLOEXEC was standard before that, but setting it with fcntl() is racy.) You're much more likely to need a temp file that is CLOEXEC rather than the opposite, and even if they were somehow opposed to CLOEXEC by default (such as for compat. reasons), surely POSIX could have standardized mkostemp() too or instead. And then there's the fact that this whole O_CLOEXEC mess is stupid. Surely there would have been a better way to handle this, instead of requiring adding O_CLOEXEC to almost ALL instances of open() in all code that has been written ever. The justification for this is that the historic default was wrong, and you can't change it (e.g. this won't work: changing the behavior of exec() and not inherit the FD to the child process, unless a hypothetical O_KEEP_EXEC flag is set). But on the other hand, surely you could have introduced an exec() variant which does close all FDs, except a whitelist of FDs passed to it. Let's call it execve2(). In fact, I'm going to argue that exec() call sites are the most aware of whether (and which) FDs to inherit. Some programs even tried to explicitly iterate over all opened FDs and explicitly close "unwanted" FDs (which of course was problematic for other reasons), and such an execve2() call would have been the ideal solution. Maybe this proposed solution would have had problems too. But surely revisiting and reviewing every exec*() call would have been simpler than reviewing every open() call. And more importantly, having to extend every damn library function that either calls open() or creates FDs in some other way, like mkstemp(). What argument are there going to be against this? That there will be library code that can't keep working correctly with processes that use the "old" exec? Well, what about all my legacy library code that uses open() incorrectly, and that will break no matter what? Well, I'm not going to claim that I can come up with better solutions than POSIX (generally or in this case), but this situation is ABSOLUTELY ATROCIOUS. It makes win32 programming look attractive compared to POSIX, that standard pandering to dead people from the past. (Note: not trying to insult dead people.) I'm not sure what POSIX is even doing. Anything useful? Doesn't look like it to me. Are they paid? Why? They didn't even fix the locale mess, nor do they intend to. I bet they're proud of discussing compatibility to 70ies code day in and day out iwtohut ever producing anything useful. What a load of crap. They seriously got to do better than this. Oh, and my wrapper is probably buggy. Fortunately that doesn't matter. Also I'm dumping this into io.h. Originally, io.h was just supposed to replace broken implementation of standard functions by MinGW (and then by Android), but whatever, just give a dumping ground for shit code.
* cocoa-cb: migrate to swift 5 with swift 4 fallbackder richter2019-07-213-9/+74
| | | | | | | | | | | | | this migrates our current swift code to version 5 and 4. building is support from 10.12.6 and xcode 9.1 onwards. dynamic linking is the new default, since Apple removed static libs from their new toolchains and it's the recommended way. additionally the found macOS SDK version is printed since it's an important information for finding possible errors now. Fixes #6470
* cocoa-cb: conditional compilation for Dark Mode and Material featuresder richter2019-07-211-0/+24
| | | | Fixes #6621
* win32-console-wrapper: silence missing prototype warningsJames Ross-Gowan2019-05-101-2/+4
|
* libarchive: add fallback for systems without C.UTF-8dudemanguy2019-05-041-0/+1
|
* cocoa-cb: remove all force unwrappings of optionalsder richter2019-04-252-25/+37
| | | | | | the force unwrapping of optionals caused many unpredictable segfaults instead of gracefully exiting or falling back. besides that, it is bad practice and the code is a lot more stable now.
* cocoa-cb: add support for custom colored title barder richter2019-04-024-0/+18
|
* cocoa-cb: refactor title bar stylingder richter2019-04-023-3/+20
| | | | | | | | | | | | | half of the materials we used were deprecated with macOS 10.14, broken and not supported by run time changes of the macOS theme. furthermore our styling names were completely inconsistent with the actually look since macOS 10.14, eg ultradark got a lot brighter and couldn't be considered ultradark anymore. i decided to drop the old option --macos-title-bar-style and rework the whole mechanism to allow more freedom. now materials and appearance can be set separately. even if apple changes the look or semantics in the future the new options can be easily adapted.
* cocoa-cb: synchronise the flush with the renderAkemi2019-04-021-1/+4
| | | | | | | this could lead to a crash on deinit when flush was called while the opengl state was cleaned up. Fixes #6323
* cocoa-cb: wakeup vo when new events are availableAkemi2019-04-021-0/+1
| | | | | | | new events were added but not fetched by the vo, because we didn't signal the vo that new events were available. actually wakeup the vo when new events are available.
* macosx_events: fix crash when shutting down during window animationsRodger Combs2019-03-131-1/+3
|
* Merge branch 'master' into pr6360Jan Ekström2019-03-113-1/+67
|\ | | | | | | | | | | Manual changes done: * Merged the interface-changes under the already master'd changes. * Moved the hwdec-related option changes to video/decode/vd_lavc.c.
| * cocoa-cb: add support for VOCTRL_GET_DISPLAY_NAMESAkemi2019-02-102-0/+38
| |
| * cocoa-cb: use Swift Extensions for convenienceAkemi2019-02-101-0/+28
| | | | | | | | preparations for the following commit.
| * mac: add missing semicolon to macosx_compat.hKen2019-01-261-1/+1
| | | | | | | | fixes build on older systems
* | demux, stream: readd cache-speed in some other formwm42018-12-061-0/+3
| | | | | | | | it's more like an input speed rather than a cache speed, but who cares.
* | Merge commit '559a400ac36e75a8d73ba263fd7fa6736df1c2da' into ↵Anton Kindestam2018-12-055-17/+8
|\ \ | |/ |/| | | | | | | wm4-commits--merge-edition This bumps libmpv version to 1.103
| * terminal-unix: stop trying to read when terminal disappearswm42018-05-241-2/+4
| | | | | | | | | | | | | | | | Avoids 100% CPU usage due to terminal code retrying read(). Seems like this was "forgotten" (or there was somehow the assumption poll() would not signal POLLIN anymore). Fixes #5842.
| * osdep: add portable C11-like alignof() macrowm42018-05-241-0/+5
| |
| * timer: remove an unused helper functionwm42018-05-242-16/+0
| | | | | | | | It's also dumb.
| * misc: move mp_cancel from stream.c to thread_tools.cwm42018-05-242-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | It seems a bit inappropriate to have dumped this into stream.c, even if it's roughly speaking its main user. At least it made its way somewhat unfortunately to other components not related to the stream or demuxer layer at all. I'm too greedy to give this weird helper its own file, so dump it into thread_tools.c. Probably a somewhat pointless change.
* | cocoa-cb: use libmpv's advanced rendering control and timingAkemi2018-11-131-2/+22
| | | | | | | | | | | | | | | | this adds support for GPU rendered screenshots, DR (theoretically) and possible other advanced functions in the future that need to be executed from the rendering thread. additionally frames that would be off screen or not be displayed when on screen are being dropped now.
* | {mac,cocoa}: trim trailing null out of macosx_icon when loading itRodger Combs2018-10-021-1/+2
| | | | | | | | | | | | This prevents crashes when loading the application icon image. Suggested-by: Akemi <der.richter@gmx.de>
* | mac: fix crash if we can't get an event tapRodger Combs2018-10-021-9/+12
| | | | | | | | | | | | | | | | without assistive-device permissions the event tap can't be create on 10.14 any more which lead to an assertion. System Preferences > Security & Privacy > Privacy > Accessibility and add mpv or your terminal App to the list.
* | cocoa-cb: add Apple Software Renderer supportAkemi2018-09-302-0/+4
| | | | | | | | | | | | by default the pixel format creation falls back to software renderer when everything fails. this is mostly needed for VMs. additionally one can directly request an sw renderer or exclude it entirely.
* | cocoa-cb: move macOS option retrieval to the earliest point possibleAkemi2018-09-301-0/+6
| | | | | | | | | | | | | | moved the retrieval of the macOS specific options from the backend initialisation to the initialisation of the CocoaCB class, the earliest point possible. this way macOS specific options can be used for the opengl context creation for example.
* | osdep: make use of HAVE_ANDROIDTom Yan2018-08-203-4/+8
| |
* | osx: Fix initialization and access of service menuMichael Hoang2018-08-111-2/+2
| | | | | | | | | | Replace dot syntax with accessor syntax so that clang no longer errors out due to not finding the property servicesMenu on NSApp.
* | cocoa-cb: remove pre-allocation of window, view and layerAkemi2018-06-125-41/+44
| | | | | | | | | | | | | | | | | | | | | | the pre-allocation was needed because the layer allocated a opengl context async itself and we couldn't influence that. so we had to start the core after the context was actually allocated. furthermore a window, view and layer hierarchy had to be created so the layer would create a context. now, instead of relying on the layer to create a context we do this manually and re-use that context later when the layer wants to create one async itself.
* | terminal-unix: stop trying to read when terminal disappearswm42018-05-251-2/+4
|/ | | | | | | | Avoids 100% CPU usage due to terminal code retrying read(). Seems like this was "forgotten" (or there was somehow the assumption poll() would not signal POLLIN anymore). Fixes #5842.
* demux: support for some kinds of timed metadatawm42018-04-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes ICY title changes show up at approximately the correct time, even if the demuxer buffer is huge. (It'll still be wrong if the stream byte cache contains a meaningful amount of data.) It should have the same effect for mid-stream metadata changes in e.g. OGG (untested). This is still somewhat fishy, but in parts due to ICY being fishy, and FFmpeg's metadata change API being somewhat fishy. For example, what happens if you seek? With FFmpeg AVFMT_EVENT_FLAG_METADATA_UPDATED and AVSTREAM_EVENT_FLAG_METADATA_UPDATED we hope that FFmpeg will correctly restore the correct metadata when the first packet is returned. If you seke with ICY, we're out of luck, and some audio will be associated with the wrong tag until we get a new title through ICY metadata update at an essentially random point (it's mostly inherent to ICY). Then the tags will switch back and forth, and this behavior will stick with the data stored in the demuxer cache. Fortunately, this can happen only if the HTTP stream is actually seekable, which it usually is not for ICY things. Seeking doesn't even make sense with ICY, since you can't know the exact metadata location. Basically ICY metsdata sucks. Some complexity is due to a microoptimization: I didn't want additional atomic accesses for each packet if no timed metadata is used. (It probably doesn't matter at all.)
* cocoa-cb: fix a warning with swift 4.1 and slight cleanupAkemi2018-04-171-3/+7
| | | | | | the icc profile data is mutated to an UnsafeMutablePointer and could possibly changed. therefore the size of it should be accessed before a possible change.
* HIDRemote: fix volume buttons on macOS 10.13Akemi2018-04-171-0/+8
| | | | | | | this is a backport of line 1039 to 1046 from https://github.com/iospirit/HIDRemote/commit/33a32ab6136feb8b8220e99ec52c7504c3a82242#diff-8a4d13f0849b3beffa4267954ca28517R1039 Fixes #5721
* cocoa-cb: fix shutdown when fullscreen animation is runningAkemi2018-03-181-1/+4
| | | | | | | | commit 2edf00f changed the MPV_EVENT_SHUTDOWN behaviour slightly, such that it will only be sent once. cocoa-cb relied on it being sent continuously till all mpv_handles are destroyed. now it manually shuts down and destroys the mpv_handle after the animation instead of relying on this removed behaviour.
* all: replace mpv_detach_destroy() with mpv_destroy()wm42018-03-151-2/+2
|
* cocoa-cb: fix usage of wrong fbo when off-screenAkemi2018-03-111-4/+4
| | | | | | | | when we transitioned to the new libmpv API with commit ae29725 i reintroduced an old bug that was fixed with 7f714c6 because of a dumb rebasing error on my part. the branch i based the libmpv changed on was originally without the fbo fix and on rebasing i forgot to change the variable to the proper one, basically deactivating the fix.
* 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