summaryrefslogtreecommitdiffstats
path: root/input/input.c
Commit message (Collapse)AuthorAgeFilesLines
* input: make key binds order-independent againwm42014-04-191-2/+7
| | | | | | | | | | | | | | | This is for the sake of multi-key commands again. This could break: SPACE ignore SPACE-SPACE command while this worked: SPACE-SPACE command SPACE ignore The reason being that if the shorter command was first in the list, it would obviously match, and searching was stopped.
* input: discard key history when a key is mappedwm42014-04-191-3/+7
| | | | | | This is for the sake of multi-key combinations (see github issue #718). Now a multi-key sequence isn't matched if any of the previous keys were actually mapped.
* input: remove minor code duplicationwm42014-04-191-15/+16
|
* input: ignore modifiers on MOUSE_LEAVEwm42014-04-191-2/+2
| | | | Just in case something adds shift/alt/ctrl state to it.
* input: don't wakeup core if key repeat is requested but not possiblewm42014-04-181-7/+5
| | | | There's no need to wakeup the core in this situation.
* input: remove minor redundancywm42014-04-181-10/+2
|
* input: simplify by not tracking key up/down stateswm42014-04-181-53/+30
| | | | | | | | | We only need to track key up/down for a single key. There may be some minor loss of robustness, but this can (probably) happen only if a VO or user sends strange or complicated sequences of events. In the normal case, what we do is more than enough. Most simplification comes from the fact that mpv is not a game console, and users normally execute only one action at once.
* input: rename a variablewm42014-04-181-5/+5
| | | | Squashing this with the following commit would be confusing.
* input: slightly simplify mouse dispatchingwm42014-04-181-13/+1
| | | | | I admit I don't really understand anymore why this was needed. Delete it anyway. It was added with commit 42fa7cbbf.
* input: move a functionwm42014-04-181-11/+11
|
* input: close window when window close button is pressed with --input-testwm42014-04-181-0/+9
| | | | | | | | | | | The window close button is usually mapped to the CLOSE_WIN pseudo-key. Until now, --input-test treated this pseudo-key like any other key (like the rest of the input handling code), so you couldn't close the window in this mode. The manpage had silly instructions and warnings how to deal with this. Just always quit when CLOSE_WIN is received, and improve the instructions.
* input: handle multi-combinations as key sequenceswm42014-04-181-64/+50
| | | | | | | | | | | | | | | | | The input code always supported combinations of multiple keys (even in MPlayer, although there the code was active really only for mouse buttons). This was arcance and also made the code more complicated. I only know of a single person who ever made use of this feature. Remove this feature, and repurpose some of the support code (e.g. parsing, display of key combinations, etc.) to handle such multi- combinations as sequences, instead of keys to be pressed at the same time. This is much simpler and implements the feature requested in github issue #718. This commit will probably cause a bunch of regressions, since the input handling code has some weird corner cases. I couldn't find any problems when testing, though.
* input: deal with playback thread wakeup on windowswm42014-04-151-3/+14
| | | | | | | | | | | | | The recent change of waking up the playback thread using a wakeup pipe doesn't work on windows, because windows is horrible. So use a condition variable instead to wake up the thread. To make things worse, jackaudio is also horrible and "disallows" the use of mutexes, so all we can do is implementing a half-solution that is not race condition free. It would probably better to give up on this lock-free crap in the pull- API audio path. Mostly untested.
* audio: wake up the core when audio buffer is running low (2)wm42014-04-151-0/+6
| | | | | | | | | | | | | | Same change as in e2184fcb, but this time for pull based AOs. This is slightly controversial, because it will make a fast syscall from e.g. ao_jack. And according to JackAudio developers, syscalls are evil and will destroy realtime operation. But I don't think this is an issue at all. Still avoid locking a mutex. I'm not sure what jackaudio does in the worst case - but if they set the jackaudio thread (and only this thread) to realtime, we might run into deadlock situations due to priority inversion and such. I'm not quite sure whether this can happen, but I'll readily follow the cargo cult if it makes hack happy.
* input: allow input.conf bindings to be declared as builtinwm42014-02-251-0/+11
| | | | | | This might be helpful if we ever want cascading config files. Also, we will probably need it if we change the default input.conf bindings, and want to provide compatibility input.conf files.
* input: check for abort cmd in multi-commandswm42014-02-201-2/+2
| | | | | | | | | MP_CMD_COMMAND_LIST commands (used to implement key bindings with multiple commands) were not checked for abort commands. Implement it. Remove the remarks about multi-commands being special from the manpage. Seek coalescing is handled differently now, and the issue with abort commands is fixed with this commit.
* input: ignore modifiers when releasing keysJames Ross-Gowan2014-02-201-2/+2
| | | | | This prevents keys from getting stuck if the modifier is released before the base key.
* input, dvdnav: fix osc stealing input from dvdnavwm42014-02-191-2/+12
| | | | | | | | | | This is a regression introduced from moving Lua scripts (including the OSC) to their own threads. Now OSC and dvdnav can add their bindings at the same time without coordination, which seems to result in the OSC winning most time, and thus overriding the dvdnav menu bindings. Fix this by adding a flag that makes dvdnav menu bindings take priority over all other bindings.
* input: minor simplification for --input-testwm42014-02-191-5/+4
|
* input: debug output for registered bindingswm42014-02-171-0/+7
|
* input: don't let builtin bindings overwrite user bindingswm42014-02-171-2/+6
| | | | | This was already done, except when the bindings were in different input sections. This commit fixed it. Useful for scripts, probably.
* threads: add wrapper for initializing recursive mutexeswm42014-01-311-5/+2
| | | | Damn this overly verbose pthread API.
* input: change mp_input_run_cmd signaturewm42014-01-041-4/+2
| | | | | | | | I don't like this function at all, but it's basically a trick to get the input's mp_log instance in a case the mp_input_parse_cmd_strv() is almost certainly not going to output anything. But still make it somewhat more consistent with mp_input_parse_cmd_strv() - why force the caller to always use MP_ON_OSD_AUTO?
* input: move files drag and drop to a new event.c fileStefano Pigozzi2014-01-041-0/+9
| | | | | event.c will be used to feed the input queue with 'global' events that don't mesh well with the usual check_events path in mpv.
* input: use bstr_xappend()wm42013-12-301-1/+1
| | | | To get rid of mp_append_utf8_buffer().
* input: print an error if reading input.conf failswm42013-12-281-4/+8
| | | | | | stream_read_complete() fails if the file is larger than the requested maximum size. But input.c didn't check for this case, and no indication that something went wrong was printed.
* options: simplify handling of some help optionswm42013-12-261-16/+2
|
* input: cosmetics: move code aroundwm42013-12-261-319/+316
| | | | Rearrange the code in an attempt to make its organization more logical.
* input: split off some code from input.c to separate fileswm42013-12-261-949/+32
| | | | This is mostly just moving code around.
* msg: rename mp_msg_log -> mp_msgwm42013-12-211-2/+2
| | | | Same for companion functions.
* msg: convert defines to enumwm42013-12-211-3/+3
| | | | Also get rid of MSGL_HINT and the many MSGL_DBG* levels.
* path lookup functions: mp_msg conversionswm42013-12-211-2/+2
| | | | | | | | | | | | | | | | | 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.
* stream: mp_msg conversionswm42013-12-211-1/+1
| | | | We also drop some slave mode stuff from stream_vcd.
* m_option, m_config: mp_msg conversionswm42013-12-211-6/+6
| | | | | | | | Always pass around mp_log contexts in the option parser code. This of course affects all users of this API as well. In stream.c, pass a mp_null_log, because we can't do it properly yet. This will be fixed later.
* input: rework how input sources are addedwm42013-12-211-77/+43
| | | | | | | | | | | | | | 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.
* input: make parse_cmd_strv take const argsMartin Herkt2013-12-201-1/+1
|
* input, lua: add functions to take pre-split input commandswm42013-12-201-70/+149
| | | | | | | | | | | | | | So you can pass a command as list of strings (each item is an argument), instead of having to worry about escaping and such. These functions also take an argument for the default command flags. In particular, this allows setting saner defaults for commands sent by program code. Expose this to Lua as mp.send_commandv command (suggestions for a better name welcome). The Lua version doesn't allow setting the default command flags, but it can still use command prefixes. The default flags are different from input.conf, and disable OSD and property expansion.
* Rename getch2....c/h to terminal....c/hwm42013-12-191-9/+2
| | | | | "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.
* command: remove radio commandswm42013-12-191-5/+0
| | | | | | | Remove these because I'm too lazy to convert them to proper STREAM_CTRLs. Considering that probably nobody uses radio://, caring about this is a complete waste of time. I will add these commands back if someone asks for them, but I don't expect this to happen.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-4/+4
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-4/+3
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* Move mpvcore/input/ to input/wm42013-12-171-0/+2560
|
* Rename directories, move files (step 1 of 2) (does not compile)wm42012-11-121-1959/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tis drops the silly lib prefixes, and attempts to organize the tree in a more logical way. Make the top-level directory less cluttered as well. Renames the following directories: libaf -> audio/filter libao2 -> audio/out libvo -> video/out libmpdemux -> demux Split libmpcodecs: vf* -> video/filter vd*, dec_video.* -> video/decode mp_image*, img_format*, ... -> video/ ad*, dec_audio.* -> audio/decode libaf/format.* is moved to audio/ - this is similar to how mp_image.* is located in video/. Move most top-level .c/.h files to core. (talloc.c/.h is left on top- level, because it's external.) Park some of the more annoying files in compat/. Some of these are relicts from the time mplayer used ffmpeg internals. sub/ is not split, because it's too much of a mess (subtitle code is mixed with OSD display and rendering). Maybe the organization of core is not ideal: it mixes playback core (like mplayer.c) and utility helpers (like bstr.c/h). Should the need arise, the playback core will be moved somewhere else, while core contains all helper and common code.
* Merge branch 'osd_changes' into masterwm42012-11-011-4/+5
|\ | | | | | | | | Conflicts: DOCS/man/en/options.rst
| * screenshot: change "screenshot" input commandwm42012-10-241-4/+4
| | | | | | | | | | | | | | "screenshot" now maps to "screenshot subtitles" by default, instead of "screenshot video". Swap the argument order: the more useful argument should come first. Remove the compatibility aliases for numeric choices (e.g. "screenshot 1 0" won't work anymore).
| * screenshot: allow taking screenshots with subtitleswm42012-10-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new screenshot mode "subtitles", which basically takes the video frame as decoded, and renders subtitles into it. This may fail for some pixel formats, because libswscale sucks. If this becomes ever a real problem, the code could be changed to convert the image to RGBA first (or whatever the image writer wants), and then render the subtitles into it. This would avoid the additional image copy needed with vo_xv too. But for now, it seems better to go with the current method in the common case: vo_opengl creates an image copy anyway, and drawing bitmaps to yv12 is better, as no color space conversion is involved in draw_bmp.c's up/downsampling conversion.
* | input: minor simplificationwm42012-11-011-2/+1
| |
* | input: fix off-by-one errorreimar2012-10-311-1/+1
|/ | | | | | | | | | | | Fix off-by-one error in range check. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35302 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: input/input.c This code is already quite different from mplayer-svn, but still the same bug.
* input: fix mp_cmd memory leakwm42012-10-141-0/+3
| | | | | mp_input_feed_key() didn't free the command, if it was discarded due to the queue exceeding its maximum size.
* input: minor simplification to mp_input_get_cmd()wm42012-10-141-13/+8
|
* input: add input test modewm42012-10-141-12/+76
| | | | | | | | | | | In input test mode, key bindings won't be executed, but are shown on the OSD. The OSD includes various information, such as the name of the key, the command itself, whether it's builtin, and the config file location it was defined. The input test mode can be enabled with "--input=test". No effort is spent trying to react to key bindings that normally exit the player; they are treated just like any other binding.
* input: track location info for input commandswm42012-10-141-21/+39
| | | | | | If parsing a command fails, its location is printed. The location is the path to the input.conf, and the line number of the key binding and the associated input command.
* input: don't warn on commands for disabled optional featureswm42012-10-141-6/+5
| | | | | | | | | Always recognize input commands for optional features (like TV commands etc.). If these features are disabled, the commands are parsed, but simply do nothing. This fixes annoying warnings on start with the default/builtin input.conf, if certain optional features are not compiled.
* Merge branch 'input_changes' into masterwm42012-10-121-233/+358
|\ | | | | | | | | | | | | | | Conflicts: DOCS/man/en/vo.rst etc/input.conf input/input.c m_property.c
| * commands: use "up" and "down" as 2nd argument for cycle commandwm42012-10-121-1/+28
| | | | | | | | | | | | | | | | | | | | | | Allow the values "up" and "down" as step argument for the cycle input command. Previously, this argument was a float, which specified an arbitrary step value and direction (similar to the add command). Instead of "1" and "-1", "up" and "down" is to be used. Float values are still accepted. That capability might be removed in the future, as there's probably hardly any actual use for arbitrary step values.
| * commands: add print_text input command to print text on the terminalwm42012-10-121-0/+1
| | | | | | | | | | In theory, this could take over the role of the get_property slave command, and is more general.
| * commands: sub_step takes only one argumentwm42012-10-121-1/+1
| |
| * commands: disable deprecation warningswm42012-10-121-1/+1
| | | | | | | | | | | | | | This disables warning messages when the legacy input command bridge is used. For now, user input.confs should just keep working as if nothing has changed. The deprecation warnings will be enabled again at a later point, and the legacy bridge will be eventually removed.
| * commands: rename show_tracks/chapters_osd commandwm42012-10-121-2/+4
| |
| * commands: more user-control whether a command shows OSD bars/messageswm42012-10-121-0/+8
| | | | | | | | | | | | | | | | | | | | The "no-osd" prefix was introduced earlier to disable OSD selectively based on the key binding. Extend this, and allow the user to force display of an OSD bar ("osd-bar"), OSD message ("osd-msg") or both ("osd-msg-bar"). This changes mainly how property setting functions behave. The default behavior is still the same.
| * commands: add choice type to input commandswm42012-10-121-44/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow using the choice type (as it used for command line) for arguments of input commands. Change the magic integer arguments of some commands (like seek) to use choices instead. The old numeric values are still allowed (but only those which made sense before, not arbitrary integers). In order to do this, remove the input.c specific types (like MP_CMD_ARG_INT) completely and specify commands using the m_option types. Also, add the special choice "-" to some arguments. It's supposed to signify the default value, so arguments can be easily skipped. Maybe the choice option should recognize this and not change the previous value, but we'll leave this for later. For now, leave compatibility integer values for all new choice arguments, e.g. "0" maps to 0. We could let the choice option type do this a