aboutsummaryrefslogtreecommitdiffhomepage
path: root/osdep
Commit message (Collapse)AuthorAge
* threads: fix function nameGravatar wm42014-04-23
| | | | Closer to the corresponding standard function pthread_cond_timedwait.
* dispatch: move into its own source fileGravatar wm42014-04-23
| | | | | | | This was part of osdep/threads.c out of laziness. But it doesn't contain anything OS dependent. Note that the rest of threads.c actually isn't all that OS dependent either (just some minor ifdeffery to work around the lack of clock_gettime() on OSX).
* glob-win: support UnicodeGravatar James Ross-Gowan2014-04-21
| | | | | | | | | | | | | | | | glob-win.c wasn't big, so it was easier to rewrite it. The new version supports Unicode, handles directories properly, sorts the output and puts all its allocations in the same talloc context to simplify the implementation of globfree. Notably, the old glob had error checking code, but didn't do anything with the errors since the error reporting code was commented out. The new glob doesn't copy this behaviour. It just treats errors as if there were no more matching files, which shouldn't matter for mpv, since it ignores glob errors too. To match the other Windows I/O helper functions, the definition is moved to osdep/io.h.
* Kill all tabsGravatar wm42014-04-13
| | | | | | | | | | | I hate tabs. This replaces all tabs in all source files with spaces. The only exception is old-makefile. The replacement was made by running the GNU coreutils "expand" command on every file. Since the replacement was automatic, it's possible that some formatting was destroyed (but perhaps only if it was assuming that the end of a tab does not correspond to aligning the end to multiples of 8 spaces).
* client API: add mpv_get_wakeup_pipe convenience functionGravatar wm42014-04-12
| | | | Should make integreating with some event loops easier. Untested.
* terminal-unix: reject overlong termcap stringsGravatar wm42014-04-10
| | | | | | | | Our own tables have size for only 8 chars, so these sequences must be rejected. It seems strings of length 8 are still ok, because the code uses memcmp and not strcmp, so still allow these. Based on mplayer-svn commit r37129.
* timer: reduce ifdef headsplitting-factorGravatar wm42014-03-09
| | | | | I'd rather duplicate some trivial code, rather than split functions in the middle with ifdefs.
* timer: switch to CLOCK_MONOTONICGravatar wm42014-03-09
| | | | | | | | | | | | | | | | | | | | | | | Apparently, this is always _really_ monotonic, despite what the Linux manpages say. So this should be much better than gettimeofday(). (At times there were kernel bugs which broke the monotonic property.) From the perspective of the player, time can still be discontinuous (you could just stop the process with ^Z), but at least it's guaranteed to be monotonic without further hacks required. Also note that clock_gettime() returns the time in nanoseconds. We want microseconds only, because that's the unit we chose internally. Another problem is that nanoseconds can wrap pretty quickly (less than 300 years in 63 bits), so it's just better to use microseconds. The devision won't make the code that much slower (compilers can avoid a real division). Note: this expects that the system provides clock_gettime() as well as CLOCK_MONOTONIC. Both are optional according to POSIX. The only system I know which doesn't have these, OSX, has seperate timer code anyway, but I still don't know whether more obscure (yet supported) platforms have a problem with this, so I'm playing safely. But this still expects that CLOCK_MONOTONIC always works at runtime if it's defined.
* timer: add utility function to get relative timeGravatar wm42014-02-28
|
* threads: fix wait time overflow checkGravatar wm42014-02-26
| | | | | | | | | | | | | When passing a very large timeout to mpthread_cond_timed_wait(), the calculations could overflow, setting tv_sec to a negative value, and making the pthread_cond_timed_wait() call return immediately. This accidentally made Lua support poll and burn CPU for no reason. The existing overflow check was ineffective on 32 bit systems. tv_sec is usually a long, so adding INT_MAX to it will usually not overflow on 64 bit systems, but on 32 bit systems it's guaranteed to overflow. Simply fix by clamping against a relatively high value. This will work until 1 week before the UNIX time wraps around in 32 bits.
* win32: restore support for exe directory as config directoryGravatar elevengu2014-02-14
| | | | | | | | Same rationale as b2c2fe7a but updated to work with path-win.c Signed-off-by: wm4 <wm4@nowhere> Merges/closes #543.
* cocoa: fix deadlock during initialization [2]Gravatar Stefano Pigozzi2014-02-13
| | | | Fixup commit for 20fa191ad.
* cocoa: fix deadlock during initializationGravatar Stefano Pigozzi2014-02-13
| | | | | | Thanks to @wm4 for catching the bug. Fixes #405
* timer: init only onceGravatar wm42014-02-10
| | | | | | | | | | This avoids trouble if another mpv instance is initialized in the same process. Since timeBeginPeriod/timeEndPeriod are hereby not easily matched anymore, use an atexit() handler to call timeEndPeriod, so that we can be sure these calls are matched, even if we allow multiple initializations later when introducing the client API.
* threads: add a dispatch queue thingGravatar wm42014-02-10
| | | | | | Makes working with the (still) single-threaded playback thread easier. Might be reusable for other stuff.
* threads: avoid timeout calculation overflowGravatar wm42014-02-10
| | | | | | | | | It's quite possible to overflow the calculation by setting the timeout to high values. Limit it to INT_MAX, which should be safe. The issue is mainly the secs variable. timespec.tv_sec will normally be 64 bit on sane systems, and we assume it can't overflow by adding INT_MAX to it.
* io: make MP_PATH_MAX private to win32 codeGravatar wm42014-02-03
| | | | | The win32 code is the only thing which actually needs this (and it's used to make emulation of UTF-8 filename APIs easier).
* threads: add function to calculate deadline for timed waitsGravatar wm42014-01-31
| | | | | | | | | | | | Usually, you have to call pthread_cond_timedwait() in a loop (because it can wake up sporadically). If this function is used by another higher level function, which uses a relative timeout, we actually have to reduce the timeout on each iteration - or, simpler, compute the "deadline" at the beginning of the function, and always pass the same absolute time to the waiting function. Might be unsafe if the system time is changed. On the other hand, this is a fundamental race condition with these APIs.
* threads: add wrapper for initializing recursive mutexesGravatar wm42014-01-31
| | | | Damn this overly verbose pthread API.
* cocoa: sort files opened from Finder the same way Finder doesGravatar Bilal Syed Hussain2014-01-20
| | | | Fixes #497
* w32: use the w32_common keymap in terminal-win tooGravatar James Ross-Gowan2014-01-19
|
* io/win32: move mp_attach_console to terminal-win.cGravatar Martin Herkt2014-01-16
| | | | Why didn't I put it there from the start?
* cocoa: add application icon to the Dock when run from CLIGravatar Stefano Pigozzi2014-01-14
| | | | | | | | | | Application icon was added to the Dock only when run inside of a bundle. That was handled automatically by OS X using the Info.plist definition. To add the Application icon when run as a CLI program, I used the samme approach in the X11 code and loaded the icon as a static binary blob inside of mpv's binary. This is the simplest approach as it avoid headackes when relocating the binary and such.
* terminal-unix: fix terminfo/termcap name for cursor upGravatar wm42014-01-14
| | | | | "ku" is for input, not output. This happened to work on urxvt, but broke on xterm (and probably a dozen of other terminals).
* terminal-unix: add fallback for enter keyGravatar wm42014-01-13
| | | | This worked just fine if terminfo or termcap was available.
* terminal-unix: fix fallbacks in case terminfo/termcap are disabledGravatar wm42014-01-13
| | | | | These two escape sequences were swapped. (They are used only if terminfo/termcap are not available.)
* terminal-unix: add termcap/terminfo documentation linksGravatar wm42014-01-13
| | | | | | | Apparently, some people are not clever enough to google this information. Proper googling to find these links done by Kovensky.
* player: redo terminal OSD and status line handlingGravatar wm42014-01-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The terminal OSD code includes the handling of the terminal status line, showing player OSD messages on the terminal, and showing subtitles on terminal (the latter two only if there is no video window, or if terminal OSD is forced). This didn't handle some corner cases correctly. For example, showing an OSD message on the terminal always cleared the previous line, even if the line was an important message (or even just the command prompt, if most other messages were silenced). Attempt to handle this correctly by keeping track of how many lines the terminal OSD currently consists of. Since there could be race conditions with other messages being printed, implement this in msg.c. Now msg.c expects that MSGL_STATUS messages rewrite the status line, so the caller is forced to use a single mp_msg() call to set the status line. Instead of littering print_status() all over the place, update the status only once per playloop iteration in update_osd_msg(). In audio- only mode, the status line might now be a little bit off, but it's perhaps ok. Print the status line only if it has changed, or if another message was printed. This might help with extremely slow terminals, although in audio+video mode, it'll still be updated very often (A-V sync display changes on every frame). Instead of hardcoding the terminal sequences, use terminfo/termcap to get the sequences. Remove the --term-osd-esc option, which allowed to override the hardcoded escapes - it's useless now. The fallback for terminals with no escape sequences for moving the cursor and clearing a line is removed. This somewhat breaks status line display on these terminals, including the MS Windows console: instead of querying the terminal size and clearing the line manually by padding the output with spaces, the line is simply not cleared. I don't expect this to be a problem on UNIX, and on MS Windows we could emulate escape sequences. Note that terminal OSD (other than the status line) was broken anyway on these terminals. In osd.c, the function get_term_width() is not used anymore, so remove it. To remind us that the MS Windows console apparently adds a line break when writint the last column, adjust screen_width in terminal- win.c accordingly.
* terminal: don't initialize termcap etc. if stdout is not a terminalGravatar wm42014-01-07
| | | | | Otherwise, it seems one of the term* libraries will write escape sequences to stdout, for whatever reason.
* Windows: use roaming AppData instead of localGravatar Martin Herkt2014-01-06
| | | | Whatever. Fixes #458.
* win32-console-wrapper: use child process exit codeGravatar Martin Herkt2014-01-06
|
* win32-console-wrapper: remove command line manglingGravatar Martin Herkt2014-01-06
| | | | This wasn't really necessary and caused a lot of problems.
* win32-console-wrapper: Fix heap corruptionGravatar Martin Herkt2014-01-06
| | | | FUCK the Windows API.
* cocoa: handle files drag and drop on the player video viewGravatar Stefano Pigozzi2014-01-04
|
* cocoa: refactor files drag and drop on the Dock iconGravatar Stefano Pigozzi2014-01-04
| | | | | Use the newly added `mp_event_drop_files` core function instead of having logic in the platform dependent code.
* Add Windows console wrapper program (mpv.com)Gravatar Martin Herkt2014-01-02
|
* Windows: use the GUI subsystem, attach to consoleGravatar Martin Herkt2014-01-02
| | | | | | | | This is necessary to start mpv without forcing a console window, but also breaks console usability. A workaround is to call mpv from a wrapper process that uses the console subsystem and helps redirecting the standard streams and WriteConsole output to where they belong.
* osdep/io, mp_vfprintf: split out console detectionGravatar Martin Herkt2014-01-02
|
* Update copyright yearGravatar wm42014-01-01
|
* path-macosx: attempt to fix buildGravatar wm42013-12-22
| | | | Untested... no OSX here.
* macosx_application: replace mp_msg with stderr for semi-fatal errorGravatar wm42013-12-21
| | | | Apparently this should never be run anyway.
* path lookup functions: mp_msg conversionsGravatar wm42013-12-21
| | | | | | | | | | | | | | | | | There's a single mp_msg() in path.c, but all path lookup functions seem to depend on it, so we get a rat-tail of stuff we have to change. This is probably a good thing though, because we can have the path lookup functions also access options, so we could allow overriding the default config path, or ignore the MPV_HOME environment variable, and such things. Also take the chance to consistently add talloc_ctx parameters to the path lookup functions. Also, this change causes a big mess on configfiles.c. It's the same issue: everything suddenly needs a (different) context argument. Make it less wild by providing a mp_load_auto_profiles() function, which isolates most of it to configfiles.c.
* input: rework how input sources are addedGravatar wm42013-12-21
| | | | | | | | | | | | | | Until now, there were two functions to add input sources (stuff like stdin input, slave mode, lirc, joystick). Unify them to a single function (mp_input_add_fd()), and make sure the associated callbacks always have a context parameter. Change the lirc and joystick code such that they take store their state in a context struct (probably worthless), and use the new mp_msg replacements (the point of this refactoring). Additionally, get rid of the ugly USE_FD0_CMD_SELECT etc. ifdeffery in the terminal handling code.
* osdep/priority: drop message output when setting priorityGravatar wm42013-12-21
|
* terminal: abstract terminal color handlingGravatar wm42013-12-20
| | | | | | | | Instead of making msg.c an ifdef hell for unix vs. windows code, move the code to separate functions defined in terminal-unix.c/terminal- win.c. Drop the code that selects random colors for --msgmodule prefixes.
* terminal: move SIGTTOU signal handler setup codeGravatar wm42013-12-19
| | | | | | This comes with a real change in behavior: now the signal handler is set only when the terminal input code is active (e.g. not with --no-consolecontrols), but this should be ok.
* Rename getch2....c/h to terminal....c/hGravatar wm42013-12-19
| | | | | "getch2" really tells nothing about what the heck this code does. It'd be even worse when moving the rest of terminal handling code there.
* Reduce recursive config.h inclusions in headersGravatar wm42013-12-18
| | | | | | In my opinion, config.h inclusions should be kept to a minimum. MPlayer code really liked including config.h everywhere, though, even in often used header files. Try to reduce this.
* stream: move O_BINARY dummy definitionGravatar wm42013-12-18
|
* Fix OSX build; remove all remaining mpvcore referencesGravatar 11rcombs2013-12-17
|