summaryrefslogtreecommitdiffstats
path: root/osdep
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* osx: create macosx_events to deal with keyDown eventsStefano Pigozzi2013-06-035-26/+268
| | | | | | On OSX with Cocoa enabled keyDown events are now handled with addLocalMonitorForEventsMatchingMask:handler:. This allows to respond to events even when there is no VO initialized but the GUI is focused.
* macosx_application: refactor psn matching codeStefano Pigozzi2013-05-301-7/+5
| | | | Objective-C is shorter / more readable than snprintf.
* macosx_application: refactor filename escapeStefano Pigozzi2013-05-301-14/+8
| | | | Use Objective-C's new literal syntax to make the code simpler.
* macosx_application: use @autoreleasepoolStefano Pigozzi2013-05-302-35/+25
| | | | I don't even want to know how this worked. It scares me a lot.
* macosx_application: move escape_loadfile_name in this fileStefano Pigozzi2013-05-301-0/+21
| | | | This allows to move back osx_common to raw C.
* macosx_application: fix menu 'ghosting'Stefano Pigozzi2013-05-261-0/+7
| | | | | | | This fixes a bug that caused the application to never leave it's frontmost position. The idea is stolen from @donmelton who used it in MPlayerShell. Thanks!
* Replace calls to usec_sleep()wm42013-05-262-9/+0
| | | | | | This is just dumb sed replacement to mp_sleep_us(). Also remove the now unused usec_sleep() wrapper.
* Replace all calls to GetTimer()/GetTimerMS()wm42013-05-262-12/+0
| | | | | | | | | | | | | | | | | | | | | | GetTimer() is generally replaced with mp_time_us(). Both calls return microseconds, but the latter uses int64_t, us defined to never wrap, and never returns 0 or negative values. GetTimerMS() has no direct replacement. Instead the other functions are used. For some code, switch to mp_time_sec(), which returns the time as double float value in seconds. The returned time is offset to program start time, so there is enough precision left to deliver microsecond resolution for at least 100 years. Unless it's casted to a float (or the CPU reduces precision), which is why we still use mp_time_us() out of paranoia in places where precision is clearly needed. Always switch to the correct time. The whole point of the new timer calls is that they don't wrap, and storing microseconds in unsigned int variables would negate this. In some cases, remove wrap-around handling for time values.
* timer: use gettimeofday() on Windowswm42013-05-261-1/+4
| | | | | | | MinGW-w64 emulates this via GetSystemTimeAsFileTime(), which has supposedly the best and most stable timer source out of most others. http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-crt/misc/gettimeofday.c
* timer: refactor, add 64 bit timer functionwm42013-05-265-96/+138
| | | | | | | | | | | | | | Make OS specific timer code export a mp_raw_time_us() function, and add generic implementations of GetTimer()/GetTimerMS() using this function. New mpv code is supposed to call mp_time_us() in situations where precision is absolutely needed, or mp_time_s() otherwise. Make it so that mp_time_us() will return a value near program start. We don't set it to 0 though to avoid confusion with relative vs. absolute time. Instead, pick an arbitrary offset. Move the test program in timer-darwin.c to timer.c, and modify it to work with the generic timer functions.
* macosx_application: implement "Quit & remember position"Stefano Pigozzi2013-05-232-7/+20
| | | | | | | Add a menu item to quit and save the current playback position using the code added with commit ce9a854. Fixes #85
* input: do property expansion for all input command string argumentswm42013-05-181-1/+1
| | | | | | Also add a "raw" prefix for commands, which prevents property expansion. The idea is that if the commands are generated by a program, it doesn't have to know whether the command expands properties or not.
* macosx_application: fix crash when quitting playerStefano Pigozzi2013-05-121-1/+5
| | | | | | | | | mpv crashed on quit when it was run using the bundle functionality and started without any files thus waiting for file open events. In that case, since there is no key_fifo initialized yet, short circuit to `terminate_cocoa_application()` which is generally called from `exit_player()` during normal lifecycle. Fixes bug report from user `eng` on IRC.
* macosx_application: add menu item for hide operationStefano Pigozzi2013-05-121-0/+2
| | | | Fixes #35
* OSX: run native event loop in a separate threadStefano Pigozzi2013-05-123-59/+71
| | | | | | | | | | | | | | This commit is a followup on the previous one and uses a solution I like more since it totally decouples the Cocoa code from mpv's core and tries to emulate a generic Cocoa application's lifecycle as much as possible without fighting the framework. mpv's main is executed in a pthread while the main thread runs the native cocoa event loop. All of the thread safety is mainly accomplished with additional logic in cocoa_common as to not increase complexity on the crossplatform parts of the code.
* OSX: use native Cocoa's event loopStefano Pigozzi2013-05-125-126/+446
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Schedule mpv's playloop as a high frequency timer inside the main Cocoa event loop. This has the benefit to allow accessing menus as well as resizing the window without the playback being blocked and allows to remove countless hacks from the code that involved manually pumping the event loop as well simulating manually some of the Cocoa default behaviours. A huge improvement consists in removing NSApplicationLoad. This is a C function defined in the Cocoa header and implements a minimal OSX application under ther hood so that you can use the Cocoa GUI toolkit from C/C++ without having to respect the Cocoa standards in terms of application initialization. This was bad because the behaviour implemented by NSApplicationLoad was hard to customize and had several gotchas especially in the menu department. mpv was changed to be just a nib-less application. All the Cocoa part is still generated in code but the event handling is now not dissimilar to what is present in a stock Mac application. As a part of reviewing the initialization process, I also removed all of `osdep/macosx_finder_args`. The useful parts of the code were moved to `osdep/macosx_appication` which has the broaded responsibility of managing the full lifecycle of the Cocoa application. By consequence the `--enable-macosx-finder` configure switch was killed as well, as this feature is always enabled. Another change the users will notice is that when using a bundle the `--quiet` option will be inserted much earlier in the initializaion process. This results in mpv not spamming mpv.log anymore with all the initialization outputs.
* mp_msg: fix status output disappearing when redirecting INPUT.Rudolf Polzer2013-03-181-2/+2
| | | | | Instead, we now check stderr's destination against the foreground tty for deciding whether we want status output or not.
* Prefix keycode defines with MP_wm42013-02-122-52/+52
| | | | | | | | | | Do this to reduce conflicts with <linux/input.h>, which contains some conflicting defines. This changes the meaning of MP_KEY_DOWN: KEY_DOWN is renamed to MP_KEY_DOWN (cursor down key) MP_KEY_DOWN is renamed to MP_KEY_STATE_DOWN (modifier for key down state)
* cocoa_events: remove this functionalityStefano Pigozzi2013-02-022-167/+0
| | | | | | | | | | | | | This functionality looked smart but created problems with some kinds of multi touch events. Moreover some events coming from the windows server – like hovering a corner for window resize – didn't cause the player to wake up immediately. The "correct" non hacky way to implement async event polling with cocoa would be having the vanilla cocoa event loop driving the player and setting up mpv's terminal FDs as event sources for the cocoa event loop. Fixes #20
* mp_msg, getch2: unix tty background supportRudolf Polzer2013-01-233-17/+104
| | | | | | | | Now, when backgrounded, mpv plays and outputs messages to stdout, but statusline is not output. Background<->foreground transitions are detected by signals and polling the process groups.
* Replace strsep() useswm42013-01-132-88/+0
| | | | | | This function sucks and apparently is not very portable (at least on mingw, the configure check fails). Also remove the emulation of that function from osdep/strsep*, and remove the configure check.
* windows support: fix _wstat misusagewm42013-01-132-2/+2
| | | | | | | I have no idea when or how this broke, but _wstati64() is the function we want anyway (64 bit filesize). Possibly this was a mingw-w64 bug. It's unknown why "wstat()" just doesn't work in this case, as it's not defined by MSDN and could be defined by mingw as it needs.
* osdep: remove gettimeofday() emulationwm42013-01-131-29/+0
| | | | Guaranteed by POSIX, and mingw provides it as well.
* osdep: remove setenv() emulationwm42013-01-131-43/+0
| | | | | mpv doesn't use setenv() anymore. The configure check was actually removed earlier; maybe it was forgotten to remove this completely.
* osdep: remove broken vsscanf() emulationwm42013-01-131-36/+0
| | | | | | vsscanf() is in POSIX, C99, mingw, etc. Further, the implementation in osdep/vsscanf.c was completely broken, and if it worked, it worked only by chance.
* Update copyright yearwm42013-01-041-1/+1
|
* path: add mp_find_config_file and reorganize some of the codeStefano Pigozzi2012-12-152-0/+56
| | | | | | | | | | | | | | Add `mp_find_config_file` to search different known paths and use that in ass_mp to look for the fontconfig configuration file. Some incidental changes spawned by this feature where: * Buffer allocation for the strings containing the paths is now performed with talloc. All of the allocations are done on a NULL context, but it still improves readability of the code. * Move the OSX function for lookup inside of a bundle: this code path was currently not used by the bundle generated with `make osxbundle`. The plan is to use it again in a future commit to get a fontconfig config file.
* Rename directories, move files (step 2 of 2)wm42012-11-129-13/+13
| | | | | | | | | | | | Finish renaming directories and moving files. Adjust all include statements to make the previous commit compile. The two commits are separate, because git is bad at tracking renames and content changes at the same time. Also take this as an opportunity to remove the separation between "common" and "mplayer" sources in the Makefile. ("common" used to be shared between mplayer and mencoder.)
* build: fix compilation on Windows (manifest files)wm42012-10-202-0/+0
|
* Rename to "mpv"wm42012-10-124-10/+10
| | | | | | | | | | | | | | | | | | This changes the name of this project to mpv. Most user-visible mentions of "MPlayer" and "mplayer" are changed to "mpv". The binary name and the default config file location are changed as well. The new default config file location is: ~/.mpv/ Remove etc/mplayer.desktop. Apparently this was for the MPlayer GUI, which has been removed from mplayer2 ages ago. We don't have a logo, and the MS Windows resource files sort-of require one, so leave etc/mplayer.ico/.xpm as-is. Remove the debian and rpm packaging scripts. These contained outdated dependencies and likely were more harmful than useful. (Patches which add working and well-tested packaging are welcome.)
* windows support: include io.h when building on CygwinKovensky2012-09-301-0/+4
|
* getch2: request at least 1 byte of input each readRudolf Polzer2012-09-191-1/+1
| | | | | | | | fixes issue with | less, where mplayer broke less's terminal expectations and made less quit Note this means that read() will be blocking again. Should be ok, as we always check via select() before reading.
* timer: remove timer_namewm42012-09-074-14/+0
| | | | This was unreferenced and useless.
* macosx_finder_args: fix file open orderStefano Pigozzi2012-08-161-1/+3
| | | | | | | When files are double clicked or drag and dropped to the mplayer2 icon they can be in random order. This commit forces alphabetical order. Opening them with command + down arrow already worked correctly.
* macosx_finder_args: make work with recent changesStefano Pigozzi2012-08-162-4/+4
|
* cache2: allow cache sizes up to 4 TBmplayer-svn2012-08-032-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove variable that is only assigned but never used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34791 b3059339-0415-0410-9bf9-f77b7e298cf2 Allow using a cache size of up to 4 TB. Obviously anything close to 4 GB will always fail on 32 bit systems. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34792 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace off_t by int64_t in cache code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34793 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove casts that are no longer necessary. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34794 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix header file after r34793. Patch by Stephen Sheldon, sfsheldo gmail com. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34802 b3059339-0415-0410-9bf9-f77b7e298cf2 Put #include <inttypes.h> into the header file where it should be. Reported by Stephen Sheldon, sfsheldo gmail com. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34798 b3059339-0415-0410-9bf9-f77b7e298cf2 Correct r34798. The header only needs stdint.h while the C file needs inttypes.h. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34799 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar
* osdep:/glob-win.c: reformatmplayer-svn2012-08-031-55/+47
| | | | | | | Use uncrustify on glob-win.c to fix the indentation mess in it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34239 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar
* Remove leftover BeOS support stuffwm42012-08-033-38/+0
| | | | As by mplayer-svn commit 33972. Their BeOS removal was more thorough.
* mplayer: turn playtree into a list, and change per-file option handlingwm42012-07-312-18/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: - There is no playtree anymore. It's reduced to a simple list. - Options are now always global. You can still have per-file options, but these are optional and require special syntax. - The slave command pt_step has been removed, and playlist_next and playlist_prev added. (See etc/input.conf changes.) This is a user visible incompatible change, and will break slave-mode applications. - The pt_clear slave command is renamed to playlist_clear. - Playtree entries could have multiple files. This is not the case anymore, and playlist entries have always exactly one entry. Whenever something adds more than one file (like ASX playlists or dvd:// or dvdnav:// on the command line), all files are added as separate playlist entries. Note that some of the changes are quite deep and violent. Expect regressions. The playlist parsing code in particular is of low quality. I didn't try to improve it, and merely spent to least effort necessary to keep it somehow working. (Especially ASX playlist handling.) The playtree code was complicated and bloated. It was also barely used. Most users don't even know that mplayer manages the playlist as tree, or how to use it. The most obscure features was probably specifying a tree on command line (with '{' and '}' to create/close tree nodes). It filled the player code with complexity and confused users with weird slave commands like pt_up. Replace the playtree with a simple flat playlist. Playlist parsers that actually return trees are changed to append all files to the playlist pre-order. It used to be the responsibility of the playtree code to change per-file config options. Now this is done by the player core, and the playlist code is free of such details. Options are not per-file by default anymore. This was a very obscure and complicated feature that confused even experienced users. Consider the following command line: mplayer file1.mkv file2.mkv --no-audio file3.mkv This will disable the audio for file2.mkv only, because options are per-file by default. To make the option affect all files, you're supposed to put it before the first file. This is bad, because normally you don't need per-file options. They are very rarely needed, and the only reasonable use cases I can imagine are use of the encode backend (mplayer encode branch), or for debugging. The normal use case is made harder, and the feature is perceived as bug. Even worse, correct usage is hard to explain for users. Make all options global by default. The position of an option isn't significant anymore (except for options that compensate each other, consider --shuffle --no-shuffle). One other important change is that no options are reset anymore if a new file is started. If you change settings with slave mode commands, they will not be changed by playing a new file. (Exceptions include settings that are too file specific, like audio/subtitle stream selection.) There is still some need for per-file options. Debugging and encoding are use cases that profit from per-file options. Per-file profiles (as well as per-protocol