summaryrefslogtreecommitdiffstats
path: root/osdep
Commit message (Collapse)AuthorAgeFilesLines
* switch the build system to wafStefano Pigozzi2013-11-211-1/+0
| | | | | | | | | | | | | | | | | | | | | | | This commit adds a new build system based on waf. configure and Makefile are deprecated effective immediately and someday in the future they will be removed (they are still available by running ./old-configure). You can find how the choice for waf came to be in `DOCS/waf-buildsystem.rst`. TL;DR: we couldn't get the same level of abstraction and customization with other build systems we tried (CMake and autotools). For guidance on how to build the software now, take a look at README.md and the cross compilation guide. CREDITS: This is a squash of ~250 commits. Some of them are not by me, so here is the deserved attribution: - @wm4 contributed some Windows fixes, renamed configure to old-configure and contributed to the bootstrap script. Also, GNU/Linux testing. - @lachs0r contributed some Windows fixes and the bootstrap script. - @Nikoli contributed a lot of testing and discovered many bugs. - @CrimsonVoid contributed changes to the bootstrap script.
* osdep/io.c: include config.hwm42013-11-201-0/+2
| | | | | This possibly enables code that has never been tested before (accidentally), so let's hope this works out ok.
* stream: split out pthread helper functionwm42013-11-172-0/+66
| | | | Also split the function itself into 3.
* osdep: handle SIGTERMwm42013-11-061-0/+2
| | | | | | There's no reason why we should e.g. handle SIGQUIT, but not SIGTERM. Note that sending SIGTERM twice still kills the player.
* osx: fix -Wshadow warnings on platform specific codeStefano Pigozzi2013-11-041-4/+4
|
* configure: uniform the defines to #define HAVE_xxx (0|1)Stefano Pigozzi2013-11-033-16/+17
| | | | | | | | | | | | | | | | | | | | | The configure followed 5 different convetions of defines because the next guy always wanted to introduce a new better way to uniform it[1]. For an hypothetic feature 'hurr' you could have had: * #define HAVE_HURR 1 / #undef HAVE_DURR * #define HAVE_HURR / #undef HAVE_DURR * #define CONFIG_HURR 1 / #undef CONFIG_DURR * #define HAVE_HURR 1 / #define HAVE_DURR 0 * #define CONFIG_HURR 1 / #define CONFIG_DURR 0 All is now uniform and uses: * #define HAVE_HURR 1 * #define HAVE_DURR 0 We like definining to 0 as opposed to `undef` bcause it can help spot typos and is very helpful when doing big reorganizations in the code. [1]: http://xkcd.com/927/ related
* getch2: assume EOF when input file descriptor is invalidwm42013-10-281-2/+5
| | | | | | | | | | | | | When starting mpv with nohup, file descriptor 0 seems to be invalid for some reason. (I'm not quite sure why it should be... /proc/pid/fd/0 seems to indicate it's just /dev/null, and using /dev/null explicitly shows that it works just fine.) select() will always immediately return, and this causes mpv to burn CPU without reason. Fix this by treating it as EOF when read() returns EBADF. Also add EINVAL to this condition, because it seems like a good idea.
* getch2: move global state to file scope variableswm42013-10-281-6/+5
| | | | | Using static variables for mutable state inside functions is a bad idea, because it's not immediately obvious that it is what it is.
* cocoa: fix opening quarantined files on 10.9 with the bundle [2]Stefano Pigozzi2013-10-251-2/+2
| | | | Fixup commit for bbc146927
* cocoa: fix opening quarantined files on 10.9 with the bundleStefano Pigozzi2013-10-241-2/+7
| | | | | | | It looks like on Mavericks the Finder is passing different arguments to mpv depending on whether the opened file is quarantined or not. Fixes #285
* cocoa: fix race condition with input context creationStefano Pigozzi2013-10-242-0/+14
| | | | | | | | | | This seems to be a problem only in OS X 10.9. I guess they improved the general speed of the Cocoa startup and suddenly mpv core takes more time than the Cocoa thread to initialize. Fixes #285 (hopefully!)
* getch2: remove pointless ifdefferywm42013-10-171-8/+0
| | | | | Apparently this was for MorphOS. If you really want to use that, ask the devs to provide dummy headers and declarations for ioctl() instead.
* Copyright, LICENSE: switch to GPL version 2 or laterwm42013-10-131-1/+1
| | | | | | | | | | | | | | | Now that talloc has been removed, the license can be switched back to GPLv2+. Actually, there never was a GPLv2+ licensed MPlayer (fork or not) until now, but removal of some GPLv2-only code makes this possible now. Rewrite the Copyright file to explain the reasons for the licenses MPlayer and forks use. The old Copyright file didn't contain anything interesting anymore, and all information it contained is available at other places in the source tree. The reason for the license change itself is that it should improve interoperability with differently licensed code in general. This essentially reverts commit 1752808.
* osx: fix buildwm42013-09-271-2/+2
| | | | | | Or at least I hope it fixes it, since I can't test. Broken by commit 0d90dd0.
* win32: edit resource files, in particular set CompanyNamewm42013-09-232-5/+5
| | | | | | | Setting CompanyName (probably) helps with issue #256. Update some other fields as well, because why not. (They're full of MPlayer remnants.)
* macosx_application: fix regression causing crashStefano Pigozzi2013-09-191-2/+11
| | | | | 95a2151d1 introduced a crash on systems lower than 10.9 when opening files with a single argument.
* osdep/path: remove ifdefswm42013-09-181-6/+0
| | | | They're not really needed, so kill them.
* macosx: move bundle path stuff to path-macosx.mStefano Pigozzi2013-09-183-33/+14
| | | | This makes the code uniform to how stuff was handled for Windows in 1cb55ceb.
* path, win32: redo user configfile path handlingwm42013-09-183-2/+86
| | | | | | | | | | | | | | | | | Remove the ifdef hell from mp_find_user_config_file(). Move the win32 specific code (for MinGW and Cygwin) to path-win.c. The behavior should be about the same, but I can't be sure due to lack of testing and because the old path.c code was hard to follow. (I expect those who care about windows will fix things, should issues pop up - sorry.) One difference is that the new code will always force MPV_HOME. It looks like the old code preferred the mpv config dir in the exe dir if it exists. Also, make sure MP_PATH_MAX has enough space, even if the equivalent wchar_t string is not 0-terminated with PATH_MAX (because apparently the winapi doesn't require this). (Actually, maybe we should just kill all uses of PATH_MAX/MP_PATH_MAX.)
* win32: add getenv() UTF-8 variantwm42013-09-182-0/+62
| | | | | | | This is a bit "hard", because getenv() returns a static string, and we can't just return an allocated string. We also want getenv() to be thread-safe if possible. (If the mpv core is going to be more threaded, we sure do want the lower layers to be thread-safe as well.)
* HIDRemote: remove OS X version checksStefano Pigozzi2013-09-171-44/+1
| | | | | | Turns out that these checks were for versions of OS X that mpv doesn't even support anymore. So just remove the checks since they cause a deprecation warning.
* macosx_application: remove deprecation warning on OS X 10.9Nyx0uf2013-09-161-15/+29
| | | | | | | | | | | | GetCurrentProcess() is deprecated on 10.9. Make a universal solution by checking OS version number. get_system_version() function is the recommended Apple way of getting the OS version, since Gestalt is also deprecated (and does pretty much the same thing anyway) Updating HIDRemote.m to use a similar function would allow to get rid of the 2 other warnings.
* macosx_application: fix file opening on 10.9 (for real this time)Stefano Pigozzi2013-09-131-1/+1
| | | | | | | | I did commit 86c05655d by thinking `mpv` already removed the `mpv` from argc/argv. It actually is still there, so the argc must be 1 to check for no arguments. Thanks to @Nyx0uf for pointing out the bug and for testing on 10.9!
* macosx_application: fix file opening on OS X 10.9 (hopefully)Stefano Pigozzi2013-09-121-1/+10
| | | | | | | | File opening through Finder, apparently drops `--psn` arguments on Mavericks and just uses no args. Modify the code to account for that case. This wasn't tested on 10.9 itself (I don't have a paid dev account), but it *should* work if I understood the problem correctly.
* macosx_application: handle mpv:// linksStefano Pigozzi2013-09-071-0/+7
| | | | | | | Pretty useful for people writing userscripts for web browsers. Links starting with 'mpv://' are forwarded to the mpv OSX bundle. The leading 'mpv://' is stripped from the recived url and the rest of the string is inserted as is in the playlist.
* macosx_application: handle URL events as fileopen eventsStefano Pigozzi2013-09-071-0/+30
| | | | | This allows to open URLs directly with mpv. This is useful for streaming and libquvi supported sites.
* macosx_events: fix modifiers handling with media keysStefano Pigozzi2013-09-051-1/+1
| | | | | | This was caused by a typo. Regression from add7c2955df. Fixes #213
* macosx_events: send a `release all` after key up eventsStefano Pigozzi2013-09-021-0/+2
| | | | | | | | This prevents keys to become stuck due to changing keyboard modifiers during the key down. Not the prettiest approach but event `x11_common` does it like this. Fixes #210
* macosx_events: remove duplicationStefano Pigozzi2013-09-021-29/+33
| | | | refactoring: extract method `handleMPKey:withMask:`
* cocoa: enqueue events only if input context is presentStefano Pigozzi2013-09-011-1/+2
|
* osx: use MP_KEY_* instead of MK_* for media keysStefano Pigozzi2013-09-011-3/+3
| | | | | In 213ad5d6c I added `MK_*` key bindings overlooking the fact that mpv already has `MP_KEY_*` for media keys.
* cocoa: let the core handle key repeatsStefano Pigozzi2013-08-303-6/+17
| | | | | Report key down and key up modifiers to the core so that it can issue it's own key repeats (instead of relying on Cocoa's ones).
* macosx: remove platform specific input queueStefano Pigozzi2013-08-134-65/+3
| | | | | Since last commit the input queue in the core is thread safe, so there is no need for all this platform specific stuff anymore.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-068-14/+14
| | | | Followup commit. Fixes all the files references.
* mpv.rc: update Windows iconJames Ross-Gowan2013-07-301-1/+1
| | | | Based on the OSX bundle icon.
* getch2: Load the "ce", "ks" and "ke" caps into a static bufferDiogo Franco (Kovensky)2013-07-261-3/+6
| | | | | | Fixes reports of printing of garbage (or anything else) other than clearing the status line to the end of line: the buffer returned by termcap_get could get moved, and if that happened then these 3 caps pointed to garbage.
* getch2: Deactivate getch2 on SIGINT; also handle SIGQUITDiogo Franco (Kovensky)2013-07-261-0/+4
|
* getch2: Only send ESC if it was typed twiceDiogo Franco (Kovensky)2013-07-261-3/+5
| | | | Avoids quitting mpv if any unknown escape is entered.
* getch2: Handle setupterm errorsDiogo Franco (Kovensky)2013-07-261-1/+18
| | | | | | setupterm abort()s if it can't initialize the terminal and the last parameter is NULL; handle setupterm errors and retry with "ansi" if the TERM env var was unset.
* getch2: fix compilationwm42013-07-261-1/+1
|
* getch2: Support ESC keypresses againDiogo Franco (Kovensky)2013-07-251-1/+9
| | | | | | Due to the termcap matching and the hardcoded fallbacks, the ESC keypress has to be followed by another non-matching keypress (such as another ESC) for it to be accepted. We drop the second ESC in case it was typed twice.
* getch2: Doing it right this timeDiogo Franco (Kovensky)2013-07-251-1/+1
| | | | | getch2_pos should be set to 1, not 0, when backtracking. Avoids the possible infinite loop but correctly.
* Revert "getch2: Avoid possible infinite loop"Diogo Franco (Kovensky)2013-07-251-4/+4
| | | | This reverts commit ba95aed6f1067dc577d8813625233982157167d9.
* getch2: Avoid possible infinite loopDiogo Franco (Kovensky)2013-07-251-4/+4
| | | | | | If the first character is not a valid UTF-8 start code nor is in termcap, getch2 would enter an infinite loop. Always walk 1 byte in the UTF-8 case unless it's a valid start code.
* getch2, mplayer: Always call load_termcapDiogo Franco (Kovensky)2013-07-251-0/+5
| | | | | getch2 now deals with the cases where we don't have termcap. Add a dummy load_termcap to getch2-win so we don't get linking errors on mingw.
* getch2: Remove unused function, fix possible crashDiogo Franco (Kovensky)2013-07-251-25/+19
| | | | | | | | | If we still haven't read the full key from the input but it's regardless a unique match in the database, we could receive a NULL keycode from keys_search (it's not a full match after all) and proceed to use it. Don't disable the keycode matching code if we don't have termcap as we can still match against the hardcoded sequences.
* getch2: Refactor/rewriteDiogo Franco (Kovensky)2013-07-251-192/+344
| | | | | | | | | | | | | | | | | | | | | | Still uses termcap, but uses terminfo for loading the termcap database if possible. Adds configure test to find terminfo; skips the termcap test if terminfo is found since terminfo provides termcap. Use termcap completely for special keys; if we can't get it from termcap and it isn't one of the known fallbacks, we ignore its specialness and treat as a sequence of UTF-8 codes. Further hardcoded fallbacks can be added by calling keys_push_once in load_termcap; there is no limit to the amount of keys pushed. Uses the "ke" and "ks" capabilities to start / exit application mode, which is necessary on vt100 emulators (including screen, xterm and all terminals that emulate either of those) to correctly receive arrow keys. It's now possible to compile getch2 even without termcap, though it won't be of much use since it'll be unable to detect special keys. Converted to 4 spaces per tab, prettified some statements.
* cocoa_common: handle keyboard modifiers for mouse eventsStefano Pigozzi2013-07-213-13/+24
|
* w32: update manifest for high DPI and Windows 8.1James Ross-Gowan2013-07-141-0/+18
| | | | | | | | | | | | | | | | | Since Windows Vista, when running at 144 DPI or higher with composition switched on, applications that don't declare themselves to be DPI aware are stretched by the window manager, kind of like low resolution apps in OSX. To avoid this, declare DPI awareness in the manifest. Since mpv is practically resolution independent this shouldn't cause any trouble. The 'True/PM' value declares per-monitor DPI awareness in Windows 8.1, so that the mpv isn't shrunk when moved from a high DPI screen to one with a lower DPI. Also, avoid compatibility shims by declaring compatibility with all Windows versions from Vista to 8.1 and add the missing uiAccess attribute to the requestedExecutionLevel element.
* getch2-win: uncrustifywm42013-07-141-116/+118
|
* osdep: remove unused mmap compatibility hackswm42013-07-073-168/+0
| | | | | | | Not sure how this worked. Only af_export.c and tvi_v4l2.c were using mmap, but they didn't include osdep/mmap.h or mmap_anon.h. In any case, we trust that the target system is sufficiently POSIX compliant if mmap is actually defined (as checked by configure).
* cocoa: remove usage of mp_fifoStefano Pigozzi2013-07-034-11/+2
| | | | | | Update Cocoa parts to remove usage of the mp_fifo internal API to send events to the core and use the input context directly. This is to follow commits the work in commits 70a8079c and d603e73c.
* core: cleanup more mp_fifo leftoverswm42013-07-023-8/+6
| | | | Now only the OSX and Wayland parts are using this.
* OSX: fix compilation with 10.7 SDKStefano Pigozzi2013-06-193-1/+61
| | | | | | | | | | | | | | | | | | | | | | | | Recent work in the OS X parts of the code started using clang's support for Obj-C's support for Literals and Subscripting. These particular language features remove a lot of boilerplate code and allow to interact with collections as consicely as one would do in scripting languages like Ruby or Python. Even if these are compiler features, Subscripting needs some runtime support. This is provided with libarclite (coming with the compiler), but we need to add the proper method definitions since the 10.7 SDK headers do not include them. That is because 10.7 shipped before this language features. This will cause some warnings when compiling with the 10.7 SDK because the commit also redefines BOOL to make autoboxing/unboxing of BOOL literals to work. If you need to test this for whatever reason on 10.8, just pass in the correct SDK to configure's extra cflags: ./configure --extra-cflags='-mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' Fixes #117
* osdep: remove shmem wrapperwm42013-06-182-164/+0
| | | | This is unused now that the cache is always threaded.
* macosx_events: handle key modifiers with media keysStefano Pigozzi2013-06-062-27/+56
| | | | | | This was overlooked in the previous inplementation. Adding it required some refactoring of the `handleKeyDown:` method in order to extract common parts with `handleMediaKey:`.
* macosx_events: DRY up key lookup over dictionaryStefano Pigozzi2013-06-051-10/+12
| | | | | Two methods duplicated very similar behaviour. Extract method with the common behaviour.
* macosx_events: make remote property an instance variableStefano Pigozzi2013-06-052-7/+8
| | | | There was no reason for it to be public.
* osx: improve Media Keys supportStefano Pigozzi2013-06-044-31/+109
| | | | | | | | | | | | | | | | | | | | | | | This commit addresses some issues with the users had with the previous implementation in commit c39efb9. Here's the changes: * Use Quartz Event Taps to remove Media Key events mpv handles from the global OS X queue. This prevents conflicts with iTunes. I did this on the main thread since it is mostly idling. It's the playloop thread that actually does all the work so there is no danger of blocking the event tap callback. * Introduce `--no-media-keys` switch so that users can disable all of mpv's media key handling at runtime (some prefer iTunes for example). * Use mpv's bindings so that users can customize what the media keys do via input.conf. Current bindings are: MK_PLAY cycle pause MK_PREV playlist_prev MK_NEXT playlist_next An additional benefit of this implementation is that it is completly handled by the `macosx_events` file instead of `macosx_application` making the project organization more straightforward.
* osx: add Apple Remote supportStefano Pigozzi2013-06-035-3/+2512
| | | | | | | | | | | | | | | | | After killing the non functional AR support in c8fd9e5 I got much complaints so this adds AR support back in (and it works). I am using the HIDRemote class by Felix Schwarz and that part of the code is under the BSD license. I slightly modified it replacing [NSApplication sharedApplication] with NSApp. The code of the class is quite complex (probably because it had to deal with all the edge cases with IOKit) but it works nicely as a black box. In a later commit I'll remove the deprecation warnings caused by HIDRemote's usage of Gestalt. Check out `etc/input.conf` for the default bindings. Apple Remote functionality is automatically compiled in when cocoa is enabled. It can be disabled at runtime with the `--no-ar` option.
* osx: implement media keysStefano Pigozzi2013-06-033-1/+33
| | | | | | | | | | | | | | | Media keys are pretty handy if you use mpv as a music player (yes I'm one of those people that do). These are the bindings (which lead to the same behaviour as iTunes): * NX_KEYTYPE_PLAY -> MP_KEY_PLAY * NX_KEYTYPE_FAST -> MP_KEY_NEXT * NX_KEYTYPE_REWIND -> MP_KEY_PREV I just handled these ones as the volume one would be pretty invasive. I could maybe change it to increase the application's volume instead of system volume only when mpv is frontmost (iTunes does this), but some users would probably hate it.
* macosx_events: send all queued eventsStefano Pigozzi2013-06-031-2/+3
| | | | | Seeking feels a little faster or it may be self suggestion. There's really no reason to just send only one event at a time.
* osx: cocoa_common: use default wakeup periodStefano Pigozzi2013-06-031-0/+8
| | | | | Now that Cocoa's input handling is done on a separate thread from the playloop it is ridicolously simple to have longer asynchronous sleeps when paused.
*