summaryrefslogtreecommitdiffstats
path: root/osdep
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright yearwm42017-01-011-1/+1
| | | | What kind of bullshit forces you to do this every year anyway.
* cocoa: cosmetic fixesAkemi2016-12-162-6/+11
|
* cocoa: fullscreen refactoringAkemi2016-12-151-0/+1
| | | | | | | | | | this replaces the old fullscreen with the native macOS fullscreen. additional the --fs-black-out-screens was removed since the new API doesn't support it in a way the old one did. it can possibly be re-added if done manually. Fixes #2857 #3272 #1352 #2062 #3864
* cocoa: support append file to paylist on dropAkemi2016-12-141-1/+4
| | | | | | | | | When dropping a file on mpv, either on the window or the App bundle icon, while holding the shift key the dropped files will be appended to the playlist. Fixes #2166
* osx: update the menu and remove conflicting itemAkemi2016-12-121-7/+5
| | | | | | | | | | | Remove 'Quit mpv & remember playback position' from the menu because it conflicts with the global logout shortcut. add separator between 'Hide' and 'Quit' for consistency with other Apps. also rename the 'Movie' menu to 'Video'. it's a bit more generic. Fixes #3865
* win32: fix some Clang warningsJames Ross-Gowan2016-11-171-3/+3
| | | | | | | | - win32-console-wrapper.c was inconsistently using the explicit Unicode versions of some Windows API functions and structures. - vo.c should use llabs for int64_t, since long is 32-bit on Windows. - vo_direct3d.c had a potential use of an uninitialized variable if it took the first goto error_exit.
* build: fix compilation with mingw-w64/ClangJames Ross-Gowan2016-11-171-1/+1
| | | | | | | | | | This fixes the build in mingw-w64/Clang on MSYS2. It also disables the use of gnu_printf in Clang, which was what was causing most of the warnings. The Clang-compiled mpv binary appears to work, but there are no guarantees yet, since until now mpv has only been tested with mingw-w64/GCC on Windows. Fixes #3800
* terminal-win: support modifier keys in console inputJames Ross-Gowan2016-10-141-2/+14
| | | | | | | | | | | | | | | | | Keyboard input in the console still isn't quite as flexible as it is in the video window. Ctrl+<letter> and Ctrl+LEFT/RIGHT work, but Ctrl+Alt+<letter> and Ctrl+<number> do not. Also, in the new Windows 10 console, a bunch of Ctrl keystrokes including Ctrl+UP/DOWN are handled by the console window and not passed to the application. Unlike in w32_common.c, we can't really translate keyboaard input ourselves because the keyboard layout of the console window (in conhost.exe) doesn't necessarily match the keyboard layout of mpv's console input thread, however, using ToUnicode as a fallback when the console doesn't return a unicode value could be a possible future improvement. Fixes #3625
* terminal-win: clean up console inputJames Ross-Gowan2016-10-141-49/+33
| | | | | | | | | | | | | | | | | | | | | | The original version of this code in getch2-win.c fetched 128 console events at once. This was probably to maximize the chance of getting a key event if there were other events in the buffer, because it returned the value of the first key event it found and ignored all others. Since that code was written, it has been modified to receive console input in an event-based way using an input thread, so it is probably not necessary to fetch so many events at once any more. Also, I'm not sure what it would have done if there were more than 128 events in the console input buffer. It's possible that fetching multiple events at a time also had performance advantages, but I can't find any other programs that do this. Even libuv just fetches one console event at a time. Change read_input() to fetch only one event at a time and to consume all available events before returning to WaitForMultipleObjects. Also remove some outdated comments and pass the console handle through to the input thread instead of calling GetStdHandle multiple times (I think this is theoretically more correct because it is possible for the handles returned by GetStdHandle to be changed by other threads.)
* win32: build with -DINITGUIDJames Ross-Gowan2016-09-281-1/+0
| | | | | | | | | | | | We always want to use __declspec(selectany) to declare GUIDs, but manually including <initguid.h> in every file that used GUIDs was error-prone. Since all <initguid.h> does is define INITGUID and include <guiddef.h>, we can remove all references to <initguid.h> and just compile with -DINITGUID to get the same effect. Also, this partially reverts 622bcb0 by re-adding libuuid.a to the build, since apparently some GUIDs (such as GUID_NULL) are not declared in the source file, even when INITGUID is set.
* player: do not let pseudo-gui override user config settingswm42016-09-231-2/+4
| | | | | | | | Seems like this confused users quite often. Instead of --profile=pseudo-gui, --player-operation-mode=pseudo-gui now has to be used to invoke pseudo GUI mode. The old way still works, and still behaves in the old way.
* cocoa: fix macOS 10.12 deprecation warningsAkemi2016-09-223-9/+42
|
* player: make --terminal freetly settable at runtimewm42016-09-192-4/+3
| | | | | | | | | | | | | | | | | | | So client API users don't have to care about whether to set this before or after mpv_initialize(). We still don't enable terminal at any point before mpv_initialize(), because reasons. This also subtly changes some behavior how terminal options are applied while parsing. This essentially reverts the behavior as it was reported in issue #2588. Originally, I was hoping to get rid of the pre-parse option pass, but it seems this is absolutely not possible due to the way config and command line parsing are entangled. Command line options take priority over configfile options, so they have to be applied later - but we also want to apply logging and terminal options as specified on the command-line, but _before_ parsing the config files. It has to be this way to see config file error messages on the terminal, or to hide them if --no-terminal is used. libmpv considerations also factor into this.
* terminal-unix: don't send quit command on terminal_uninit()wm42016-09-191-4/+8
| | | | | | | | | | | | Until now, the terminal thread always sent a quit command if the terminal thread was torn down (whether it happened via terminal_uninit() or a quit signal). This is not so good if we want to enable toggling terminal use at runtime, since disabling the terminal would always make the player quit. So we want terminal_uninit() not to send quit. This can be easily fixed by using the "death byte" sent to the pipe used for thread tear-down to indicate whether it was caused by a signal or terminal_uninit().
* osdep: rename atomics.h to atomic.hwm42016-09-072-3/+3
| | | | | The standard header is stdatomic.h, so the extra "s" freaks me out every time I look at it.
* atomics: readd some emulationwm42016-09-061-0/+43
| | | | | | | | | | | This time it's emulation that's supposed to work (not just dummied out). Unlike the previous emulation, no mpv code has to be disabled, and everything should work (albeit possibly a bit slowly). On the other hand, it's not possible to implement this kind of emulation without compiler support. We use GNU statement expressions and __typeof__ in this case. This code is inactive if stdatomic.h is available.
* build: always require atomicswm42016-08-051-21/+8
| | | | | | | | | | | | | | | Always require them, instead of just for some components which have hard requirements on correct atomic semantics. They should be widely available, and are supported by all recent gcc and clang compiler versions. We even have the fallbacks builtins, which should keep this working on very old gcc releases. In particular, w32_common.c recently added a hard requirement on atomics, but checking this properly in the build system would have been messy. This commit makes sure it always works. The fallback where weak atomic semantics are always fine is in theory rather questionable as well.
* osdep/io: introduce mp_flush_wakeup_pipe()Rostislav Pehlivanov2016-07-302-0/+9
| | | | Makes a fairly common occurence with wakeup_pipes easier to handle.
* Use - as command-name separator everywhereTimotej Lazar2016-07-141-1/+1
| | | | | | | Old-style commands using _ as separator (e.g. show_progress) were still used in some places, including documentation and configuration files. This commit updates all such instances to the new style (show-progress) so that commands are easier to find in the manual.
* win32: mpv.rc: re-add version infoJames Ross-Gowan2016-07-121-7/+25
| | | | | | | | | | | | | | | | For some reason, the lack of version info was preventing mpv from appearing in the Default Programs dialog. Re-add it, but don't set the string version numbers from version.h, because that's what was causing trouble when the version info was removed. Like the binary version numbers, these are now hardcoded to 2.0.0.0, which probably doesn't matter. The new version info block is also slightly different to the old one. It fills out all the binary VERSIONINFO fields and makes better use of macros. It also removes the \000 line terminators from the string version info, since as far as I can tell, this was just cargo-culting for an old broken version of the Microsoft resource compiler, and binutils' windres terminates the strings properly without them.
* subprocess: add a callback to ignore outputBen Boeckel2016-07-052-0/+6
| | | | This callback is equivalent to shoving data into /dev/null.
* Fix misspellingsstepshal2016-06-262-5/+5
|
* build: silence -Wunused-resultNiklas Haas2016-06-071-3/+3
| | | | | | | | For clang, it's enough to just put (void) around usages we are intentionally ignoring the result of. Since GCC does not seem to want to respect this decision, we are forced to disable the warning globally.
* win32: pthread: use SRW locks by defaultwm42016-05-242-20/+33
| | | | | | | | | SRW locks are available since Windows Vista. They work essentially like Linux futexes. In particular, they can be statically initialized, and do not require deinitialization. This makes them ideal for implementing PTHREAD_MUTEX_INITIALIZER. We still need CRITICAL_SECTION for recursive mutexes.
* mpv.rc: remove most contentswm42016-03-141-21/+0
| | | | In particular remove version.h to deal with my temporary build problem.
* glob-win: relicense to LGPLJames Ross-Gowan2016-02-181-7/+7
| | | | | | This file was rewritten from scratch in 0cef033, so it should be okay. As mentioned in #730, it's a complete rewrite referencing only MSDN and POSIX, rather than the original code.
* windows_utils: try and use FormatMessage for errors.Kevin Mitchell2016-02-172-3/+23
| | | | | | This is useful in particular for GetLastError, unfortunately, it's stil pretty dumb with regards to WASAPI or D3D specific errors, so keep the hresult_to_string switch.
* dxva2: use mp_HESULT_to_str on FAILED(hr)Kevin Mitchell2016-02-161-0/+35
|
* cocoa: fix charcode retrieving for accented charactersAlexis Nootens2016-02-151-1/+2
| | | | | The handler was retrieving an invalid charcode for accented characters, thus ignoring them.
* Initial Android supportJan Ekström2016-02-103-0/+102
| | | | | * Adds an 'android' feature, which is automatically detected. * Android has a broken strnlen, so a wrapper is added from FreeBSD.
* build: make posix_spawn optionalwm42016-02-081-0/+12
| | | | OK, Android doesn't support it.
* Relicense some non-MPlayer source files to LGPL 2.1 or laterwm42016-01-1912-84/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This covers source files which were added in mplayer2 and mpv times only, and where all code is covered by LGPL relicensing agreements. There are probably more files to which this applies, but I'm being conservative here. A file named ao_sdl.c exists in MPlayer too, but the mpv one is a complete rewrite, and was added some time after the original ao_sdl.c was removed. The same applies to vo_sdl.c, for which the SDL2 API is radically different in addition (MPlayer supports SDL 1.2 only). common.c contains only code written by me. But common.h is a strange case: although it originally was named mp_common.h and exists in MPlayer too, by now it contains only definitions written by uau and me. The exceptions are the CONTROL_ defines - thus not changing the license of common.h yet. codec_tags.c contained once large tables generated from MPlayer's codecs.conf, but all of these tables were removed. From demux_playlist.c I'm removing a code fragment from someone who was not asked; this probably could be done later (see commit 15dccc37). misc.c is a bit complicated to reason about (it was split off mplayer.c and thus contains random functions out of this file), but actually all functions have been added post-MPlayer. Except get_relative_time(), which was written by uau, but looks similar to 3 different versions of something similar in each of the Unix/win32/OSX timer source files. I'm not sure what that means in regards to copyright, so I've just moved it into another still-GPL source file for now. screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but they're all gone.
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-115-5/+5
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* ao_wasapi: move out some utility functionswm42016-01-112-0/+126
| | | | | | Note that hresult_to_str() (coming from wasapi_explain_err()) is mostly wasapi-specific, but since HRESULT error codes are unique, it can be extended for any other use.
* win32: fix fd://James Ross-Gowan2016-01-071-0/+7
| | | | | | | | Windows definitely supports Unix-style fd inheritance. This mostly worked when launched from mpv.exe, though mpv should change the file mode to O_BINARY. When launched from mpv.com, the wrapper must pass the list of handles (stored in the undocumented lpReserved2 and cbReserved2 fields) to the mpv process.
* Update copyright yearwm42016-01-011-1/+1
| | | | Merry christmas, or whatever the fuck is going on right now.
* path-win: include initguid.hKevin Mitchell2015-12-201-0/+1
| | | | cygwin was giving undefined reference to `FOLDERID_Desktop' at link time
* win32: add Windows 10 compatibility GUIDJames Ross-Gowan2015-12-201-0/+2
| | | | | This suppresses the Program Compatibility Assistant on Windows 10. mpv is regularly tested on Windows 10, so this should be okay.
* win32: path: use Known Folder IDsJames Ross-Gowan2015-12-201-7/+9
| | | | | | CSIDLs have been deprecated in Windows Vista and are not recommended for use in new code. They have been replaced with Known Folder IDs, which are pretty much the same thing, except they use GUIDs.
* win32: use PIPE_REJECT_REMOTE_CLIENTSJames Ross-Gowan2015-12-201-1/+2
| | | | | This partially reverts c670488. mpv only supports Vista and up, so this flag is fine.
* win32: remove ProcThreadAttributeList dynamic loadingJames Ross-Gowan2015-12-201-36/+6
| | | | | These are always available in supported Windows versions, as is the EXTENDED_STARTUPINFO_PRESENT flag.
* win32: remove SetDllDirectoryW dynamic loadingJames Ross-Gowan2015-12-201-4/+1
| | | | All Windows versions we support have this API.
* win32: fix console output with raw stdio functionsJames Ross-Gowan2015-12-061-8/+7
| | | | | | | | | | | | | | | | reopen_console_handle() was never properly tested because mpv overrides printf in most source files. Turns out that when there's no console on startup, the CRT sets the fds of stdout and stderr to -2, so the old method of using dup2 to manipulate these fds didn't work. As far as I can tell, the only way to give stdout and stderr valid fds is to use freopen, so this uses freopen to set them both to the console output. This also uses dup2 to change STDOUT_FILENO and STDERR_FILENO, so low- level functions like isatty still work. Note that this means fileno(stdout) != STDOUT_FILENO. I don't think this will cause any problems. This should fix MPV_LEAK_REPORT on the Windows console.
* input: add append argument to file drop eventKevin Mitchell2015-08-301-1/+1
| | | | | | This puts in place the machinery to merely append dropped file to the playlist instead of replacing the existing playlist. In this commit, all front-ends set this to false preserving the existing behaviour.
* atomics: cleanup HAVE_ATOMICS definewm42015-08-131-5/+0
| | | | | | | The waf build system generates this already. No point in redoing it in the header file. The legacy build system (which we really should drop) didn't; fix it.
* terminal: disable terminal foreground state pollingwm42015-08-011-2/+1
| | | | | | | This was originally done for zsh; but zsh can manage the terminal state correctly when foregrounding/backgrounding applications if you enable it with "ttyctl -f". So I see no reason to wake up the mpv process once every second anymore.
* win32: revert wchar_t changeswm42015-08-014-21/+21
| | | | | | | | | | | Revert "win32: more wchar_t -> WCHAR replacements" Revert "win32: replace wchar_t with WCHAR" Doing a "partial" port of this makes no sense anymore from my perspective. Revert the changes, as they're confusing without context, maintenance, and progress. These changes were a bit premature anyway, and might actually cause other issues (locale neutrality etc. as it was pointed out).
* win32: more wchar_t -> WCHAR replacementswm42015-07-301-1/+1
| | | | | | | | | | | | | This was essentially missing from commit 0b52ac8a. Since L"..." string literals have the type wchar_t[], we can't use them for UTF-16 strings. Use C11 u"..." string literals instead. These have the type char16_t[], but we simply assume char16_t is the same underlying type as WCHAR. In practice, they're both unsigned short. For this reason use -std=c11 on Windows. Since Windows is a "special" environment (we require either MinGW or Cygwin), we don't need to worry too much about compiler compatibility.
* win32: replace wchar_t with WCHARwm42015-07-293-20/+20
| | | | | | | | | | | | | WCHAR is more portable. While at least MinGW, Cygwin, and MSVC actually use 16 bit wchar_t, Midipix will have 32 bit wchar_t. In that context, using WCHAR instead is more portable. This affects only non-MinGW parts, so not all uses of wchar_t need to be changed. For example, terminal-win.c won't be used on Midipix at all. (Most of io.c won't either, so the search & replace here is more than necessary, but also not harmful.) (Midipix is not useable yet, so this is just preparation.)
* win32: pthread: don't play dirty tricks for mutex initwm42015-07-272-28/+10
| | | | | | | | | | | | | | | | | | | | We used double-checked locking on pthread_mutex_t.requires_init in order to lazily initialize static mutexes (since CRITICAL_SECTION has no native way to do this). This was kind of unclean: we relied on MSVC semantics for volatile (which apparently means all accesses are weakly atomic), which is not such a good idea since mpv can't even be compiled with MSVC. Since it's too much of a pain to get weak atomics, just use INIT_ONCE for initializing the CRITICAL_SECTION. Microsoft most likely implemented this in an extremely efficient way. Essentially, it provides a mechanism for correct double-checked locking without having to deal with the tricky details. We still use an extra flag to avoid calling it at all for normal locks. (To get weak atomics, we could have used stdatomic.h, which modern MinGW provides just fine. But I don't want this wrapper depend on MinGW specifics if possible.)
* win32: add portable config modewm42015-07-271-9/+30
| | | | | | | | | | | See manpage additions. The main reason for adding this is that we can't guess whether the user wants his config in his Windows profile or not. The user basically has to tell mpv what should be done, and the "portable_config" directory does this implicitly. Fixes #2042 (approximately).
* player: use exit code 0 by default for quit, 4 for signals, etc.Philip Sequeira2015-07-111-1/+1
| | | | | | Default key bindings in encoding mode also use code 4, because scripts will probably want to fail if encoding is aborted (leaving an incomplete file).
* timer: fix a corner case on clock changeswm42015-07-041-1/+4
| | | | | | | | | | | | | | | | It's conceivable that the OS time source is subject to clock changes. The time could jump back to before when mpv was started, which would cause mp_time_us() to return values smaller than 1. This is unexpected by the code and could trigger assertions. If there's no monotonic time source there's not much we can do anyway, so just sanitize the return value. It will cause strange behavior until the "lost" time offset has passed, but if you make such huge changes to the system clock while everything is running, you're asking for trouble anyway. (Normally we try to get a monotonic time source, though. This problem sometimes happened on Windows when compiled without winpthreads, when the code was falling back to gettimeofday(). This was already fixed by always using another method.)
* win32: use QueryPerformanceCounter for timingJames Ross-Gowan2015-07-041-13/+11
| | | | | | | | | | | | clock_gettime is implemented in winpthreads, so it's unavailable when mpv is compiled with its internal pthreads implementation. This makes mp_raw_time_us fall back to gettimeofday(), which can cause an assert failure in mp_add_timeout() when the system clock is changed. Use QueryPerformanceCounter instead. The clock_gettime(CLOCK_MONOTONIC) implementation in winpthreads uses QueryPerformanceCounter anyway, so there shouldn't be any change in behaviour.
* subprocess, lua: export whether the process was killed by uswm42015-06-273-3/+13
| | | | | | | | We want to distinguish actual errors, and just aborting the program intentionally. Also be a bit more careful with handling the wait() exit status: do not called WEXITSTATUS() without checking WIFEXITED() first.
* terminal-unix: set terminal mode on initwm42015-06-271-1/+1
| | | | | | | | | | | | | | | mpv usually sets the terminal to non-canonical mode (which in particular disables line buffering). But the old mode is restored if the process is not foregrounded. This is supposed to make mpv behave nicer when it is backgrounded. getch2_poll() enables canonical mode. Unfortunately, this was only called after the poll timeout elapsed, so non-canonical mode is first enabled after about a se