summaryrefslogtreecommitdiffstats
path: root/input
Commit message (Collapse)AuthorAgeFilesLines
* options: support parsing values into substructsUoti Urpala2012-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an alternate mode for option parser objects (struct m_config) which is not inherently tied to any particular instance of an option value struct. Instead, this type or parsers can be used to initialize defaults in or parse values into a struct given as a parameter. They do not have the save slot functionality used for main player configuration. The new functionality will be used to replace the separate subopt_helper.c parsing code that is currently used to parse per-object suboptions in VOs etc. Previously, option default values were handled by initializing them in external code before creating a parser. This initialization was done with constants even for dynamically-allocated types like strings. Because trying to free a pointer to a constant would cause a crash when trying to replace the default with another value, parser initialization code then replaced all the original defaults with dynamically-allocated copies. This replace-with-copy behavior is no longer supported for new-style options; instead the option definition itself may contain a default value (new OPTDEF macros), and the new function m_config_initialize() is used to set all options to their default values. Convert the existing initialized dynamically allocated options in main config (the string options --dumpfile, --term-osd-esc, --input=conf) to use this. Other non-dynamic ones could be later converted to use this style of initialization too. There's currently no public call to free all dynamically allocated options in a given option struct because I intend to use talloc functionality for that (make them children of the struct and free with it).
* options: change --input=keylist, cmdlist implementationUoti Urpala2012-05-071-8/+8
| | | | | | | | Change the --input=keylist and --input=cmdlist suboptions to use the "print function" option type. This changes their semantics somewhat, and now some other output can appear after the printed lists (before, they called "exit(0)" directly). I'm not aware of any program parsing the output which could be affected.
* OSX, input: implement wakeup in response to Cocoa eventsStefano Pigozzi2012-04-261-1/+23
| | | | | | | | | Add code to wake up the select() call in input.c when an OSX event is available and a Cocoa OpenGL backend is initialized. Fixes the slow response to input or other events in Cocoa-based VOs during long select() sleeps (e.g., when mplayer2 is paused) introduced by commit 7040968.
* ao_pulse, core: make pulse thread wake up core for more dataUoti Urpala2012-03-262-6/+41
| | | | | | | | | | | | | | | For ao_pulse, the current latency is not a good indicator of how soon the AO requires new data to avoid underflow. Add an internal pipe that can be used to wake up the input loop from select(), and make the pulseaudio main loop (which runs in a separate thread) use this mechanism when pulse requests more data. The wakeup signal currently contains no information about the reason for the wakup, but audio buffers are always filled when the event loop wakes up. Also, request a latency of 1 second from the Pulseaudio server. The default is normally significantly higher. We don't need low latency, while higher latency helps prevent underflows reduces need for wakeups.
* input.c: simplify command definitionsUoti Urpala2012-03-252-145/+152
| | | | | Change command definitions to allow writing the command definition table in more readable format.
* x11: input: add print and menu keyswm42012-03-252-0/+2
|
* input: allow unicode keys and reassign internal key codeswm42012-03-252-26/+44
| | | | | | | | | | | | | | This moves all key codes above the highest valid unicode code point (which is 0x10FFFF). All key codes below MP_KEY_BASE now directly map to unicode (KEY_ENTER is 13, carriage return). Configuration files (input.conf) can contain unicode characters in UTF-8 to map non-ASCII characters/keys. This shouldn't change anything user visible, except that "direct key codes" (as used in input.conf) will change their meaning. Parts of the bstr functions taken from libavutil's GET_UTF8 and slightly modified.
* windows support: unicode filenameswm42012-03-091-5/+10
| | | | | | | | | | | | | | | | | | | Windows uses a legacy codepage for char* / runtime functions accepting char *. Using UTF-8 as the codepage with setlocale() is explicitly forbidden. Work this around by overriding the MSVCRT functions with wrapper macros, that assume UTF-8 and use "proper" API calls like _wopen etc. to deal with unicode filenames. All code that uses standard functions that take or return filenames must now include osdep/io.h. stat() can't be overridden, because MinGW-w64 itself defines "stat" as a macro. Change code to use use mp_stat() instead. This is not perfectly clean, but still somewhat sane, and much better than littering the rest of the mplayer code with MinGW specific hacks. It's also a bit fragile, but that's actually little different from the previous situation. Also, MinGW is unlikely to ever include a nice way of dealing with this.
* core: add screenshot mode for actual VO window contentswm42011-11-251-1/+3
| | | | | | | | | | | | | | The screenshot command normally converts the currently displayed video frame to an image. Add support for an alternative screenshot mode that is supposed to capture the real window contents. Such a screenshot contains a possibly scaled version of the frame, the OSD, and subtitles. Add a default key binding Alt+s for taking screenshots in this mode. This needs special VO support, and might not work with all VOs (this commit does not yet contain an implementation for any VO, only the infrastructure).
* libmenu: remove OSD menu functionality (--menu)Uoti Urpala2011-10-252-66/+0
| | | | | | | | | | Something like the OSD menu functionality could be useful. However the current implementation has several problems and would require a relatively large amount of work to get into good shape. As far as I know there are few users of the existing functionality. Nobody is working on the existing code and keeping it compiling at all while changing other code would require extra work. So delete the menu code and some related code elsewhere that's used by nothing else.
* video, options: implement better YUV->RGB conversion controlwm42011-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite control of the colorspace and input/output level parameters used in YUV-RGB conversions, replacing VO-specific suboptions with new common options and adding configuration support to more cases. Add new option --colormatrix which selects the colorspace the original video is assumed to have in YUV->RGB conversions. The default behavior changes from assuming BT.601 to colorspace autoselection between BT.601 and BT.709 using a simple heuristic based on video size. Add new options --colormatrix-input-range and --colormatrix-output-range which select input YUV and output RGB range. Disable the previously existing VO-specific colorspace and level conversion suboptions in vo_gl and vo_vdpau. Remove the "yuv_colorspace" property and replace it with one named "colormatrix" and semantics matching the new option. Add new properties matching the options for level conversion. Colorspace selection is currently supported by vo_gl, vo_vdpau, vo_xv and vf_scale, and all can change it at runtime (previously only vo_vdpau and vo_xv could). vo_vdpau now uses the same conversion matrix generation as vo_gl instead of libvdpau functionality; the main functional difference is that the "contrast" equalizer control behaves somewhat differently (it scales the Y component around 1/2 instead of around 0, so that contrast 0 makes the image gray rather than black). vo_xv does not support level conversion. vf_scale supports range setting for input, but always outputs full-range RGB. The value of the slave properties is the policy setting used for conversions. This means they can be set to any value regardless of whether the current VO supports that value or whether there currently even is any video. Possibly separate properties could be added to query the conversion actually used at the moment, if any. Because the colorspace and level settings are now set with a single VF/VO control call, the return value of that is no longer used to signal whether all the settings are actually supported. Instead code should set all the details it can support, and ignore the rest. The core will use GET_YUV_COLORSPACE to check which colorspace details have been set and which not. In other words, the return value for SET_YUV_COLORSPACE only signals whether any kind of YUV colorspace conversion handling exists at all, and VOs have to take care to return the actual state with GET_YUV_COLORSPACE instead. To be changed in later commits: add missing option documentation.
* input/ar.c, input/lirc.c: fix changes missing from 1916b95b8Uoti Urpala2011-09-042-1/+3
| | | | | | | | | | | | | 1916b95b8 changed two function types from returning "void" to returning "int", but was missing changes to add "return 0;" to the functions. Fix. The reason for the change in the original commit was that the functions were called through a function pointer returning int anyway, so the missing return probably made things no more likely to fail at runtime than they were before that commit. However, it caused a compilation failure with clang, which treats non-void function not returning a value as a fatal error (in GCC it's just a warning).
* options, subs: add --ass-vsfilter-aspect-compatharklu2011-08-121-0/+1
| | | | | | | | | Add option --ass-vsfilter-aspect-compat and corresponding property ass_vsfilter_aspect_compat. The setting controls whether to enable the emulation of traditional VSFilter behavior where subtitles are stretched if the video is anamorphic (previously always enabled for native SSA/ASS subtitles). Enabled by default. Add 'V' as a new default keybinding to toggle the property.
* commands: parsing: fix string argument quoting/escapingUoti Urpala2011-08-051-38/+26
| | | | | | | | | | | | | | Parsing of commands with string arguments had several problems. First, escape handling modified the original string, which broke keyboard command definitions with strings containing escapes. Second, in an argument like "\\" the second quote was incorrectly considered escaped even though the preceding '\' was itself escaped. Third, an unterminated quoted string resulted in the argument being set to NULL even if this violated the declared the minimum number of arguments to the command type; this could cause a crash in the code executing the parsed commands. Fix by rewriting the string argument parsing. Also change int/float argument parsing so that the whole command is rejected on error.
* bstr: rename BSTR() -> bstr()Uoti Urpala2011-07-271-1/+2
| | | | | | Rename the BSTR() function to bstr(). The former caused a conflict with some Windows OS name, and it's no longer a macro so uppercase naming is less appropriate.
* input: fix input.conf parse errorsUoti Urpala2011-07-201-114/+58
| | | | | | | | | Commit df899f59be removing a write outside a buffer triggered another problem, as for some reason the code did not 0-terminate its read buffer in the specific case that it had encountered an EOF, and as a result could parse contents left in the buffer for a second time. Usually this resulted in parsing error messages. Fix the problem by rewriting the offending code in a less hacky form.
* input: fix problem with key autorepeatUoti Urpala2011-07-181-4/+3
| | | | | | | Recent commit 82b8f89baeaf ("input: rework event reading and command queuing") had a problem in the handling of commands generated by autorepeat code (this code is only used with joystick and Apple IR remote input). Fix (still untested though).
* input: rework event reading and command queuingUoti Urpala2011-07-172-150/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rework much of the logic related to reading from event sources and queuing commands. The two biggest architecture changes are: - The code buffering keycodes in mp_fifo.c is gone. Instead key input is now immediately fed to input.c and interpreted as commands, and then the commands are buffered instead. - mp_input_get_cmd() now always tries to read every available event from every event source and convert them to (buffered) commands. Before it would only process new events until one new command became available. Some relevant behavior changes: - Before commands could be lost when stream code called mp_input_check_interrupt() which read commands (to see if they were of types that triggered aborts during slow IO tasks) and then threw them away. This was especially an issue if cache was enabled and slow to read. Fixed - now it's possible to check whether there are queued commands which will abort playback of the current file without throwing other commands away. - mp_input_check_interrupt() now prints a message if it returns true. This is especially useful because the failures caused by aborted stream reads can trigger error messages from other code that was doing the read; the new message makes it more obvious what the cause of the subsequent error messages is. - It's now possible to again avoid making stdin non-blocking (which caused some issues) without reintroducing extra latency. The change will be done in a subsequent commit. - Event sources that do not support select() should now have somewhat lower latency in certain situations as they will be checked both before and after select()/sleep in input reading; before the sleep always happened first even if such sources already had queued input. Before the key fifo was also handled in this manner (first key triggered select, but if multiple were read then rest could be delayed; however in most cases this didn't add latency in practice as after central code started doing command handling it queried for further commands with a max sleep time of 0). - Key fifo limiting is more accurate now: it now counts actual commands intead of keycodes, and all queued keys are read immediately from input devices so they can be counted correctly. - Since keypresses are now interpreted immediately, commands which change keybindings will no longer affect following keypresses that have already been read before the command is executed. This should not be an issue in practice with current keybinding behavior.
* cleanup: remove some unnecessary input.[ch] typedefsUoti Urpala2011-07-166-115/+83
| | | | | | | | | | | | Remove some unnecessary typedefs and remove pointless mp_ prefix from some internal struct names. Change the type of the "close_func" pointers from "void f(int fd)" to "int f(int fd)" so that using standard close() there is valid. Delete some useless assert() statements. Move internal MP_MAX_KEY_DOWN define from input.h to input.c.
* cosmetics: reformat input.h, fix commentsUoti Urpala2011-07-161-184/+181
|
* input.c: remove write to buffer[-1] in parse_config()Uoti Urpala2011-07-111-1/+0
|
* cleanup: silence most of the clang warningsClément Bœsch2011-07-091-2/+2
|
* Merge branch 'mplayer1_changes'Uoti Urpala2011-06-292-2/+42
|\
| * input: support up to 20 mouse buttonsreimar2011-06-292-2/+42
| | | | | | | | | | | | | | Increase the number of supported mouse buttons from 10 to 20. There really seem to be input devices with at least 12. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33391 b3059339-0415-0410-9bf9-f77b7e298cf2
* | input: clean up messages with button combination namesUoti Urpala2011-06-291-34/+23
|/ | | | | | | | | | | | | | Previously messages that printed key/button names would have extra names in button combinations appended after the main message, resulting in output like: No bind found for key 'MOUSE_BTN1'.-MOUSE_BTN3 Add a function that creates a complete combination name and use that for all such messages. The above example changes to: No bind found for key 'MOUSE_BTN1-MOUSE_BTN3'. Other affected messages are a input.conf parsing error message and a message about a bound command being invalid.
* input: add useful default pointer button bindingsGrigori Goronzy2011-06-141-0/+2
| | | | | | Add two mouse button bindings: 1) left button double click toggles fullscreen 2) right button pauses/unpauses
* input: make slave command file descriptors nonblockingUoti Urpala2011-05-041-2/+2
| | | | | | | Neither fd 0 slave input (-slave) nor additional opened fds (-input file=X) were set to nonblocking mode as they should have been. Fix. Also rename the horribly generic USE_SELECT #define used for a specific slave input detail.
* input/joystick.c: add #include missing from 23cb829072Uoti Urpala2011-05-031-0/+1
| | | | | There was a '#include "keycodes.h"' line missing from commit 23cb829072, which broke build with --enable-joystick.
* cleanup: remove more warningsClément Bœsch2011-05-021-1/+1
|
* input: rewrite -key-fifo-size limiting logicUoti Urpala2011-05-022-2/+14
| | | | | | | | | | | | | | | | | | Instead of strictly limiting the number of total entries in the internal fifo, make the overall buffer bigger and try to limit entries based on how many bound commands they're expected to generate. Now doubleclick and button down events aren't counted for that limit. Normally the sequence down-doubleclick-up generates at most one command, so this better matches the quantity we actually want to limit. Also add a mechanism to clear the button combination state kept by input.c when the fifo is full; this avoids "stuck button" problems due to button release events being dropped. The key combination state clearing is partially based on MPlayer 1 changes by Reimar Döffinger (though overall the effects of this commit are quite different). It still doesn't make "stuck button" problems completely impossible; at least if the VO gets closed while a button was down then nothing will send a button up event or reset state.
* input: modify interpretation of doubleclick eventsUoti Urpala2011-05-021-0/+13
| | | | | | | | | | | | | The code combining button presses into multibutton commands prevented single click commands from triggering if a doubleclick event had been generated from the same button press. As a result using the mouse wheel to seek worked very badly. Special-case doubleclick events in the event interpretation code to avoid this issue. This changes the sequence of generated "keys" for press-release-press-release from MOUSE_BTN0 MOUSE_BTN0-MOUSE_BTN0_DBL MOUSE_BTN0_DBL to MOUSE_BTN0 MOUSE_BTN0_DBL MOUSE_BTN0. "Keys" like MOUSE_BTN0-MOUSE_BTN0_DBL will never be generated now; any existing configuration files using those need to be changed.
* cleanup: input.c: simplify some string handling codeUoti Urpala2011-05-021-17/+11
| | | | Replace manual loops with strspn() / strcspn().
* cleanup: reformat input.cUoti Urpala2011-05-021-921/+957
|
* input: move all key code lists to input/keycodes.hUoti Urpala2011-05-028-101/+200
| | | | | | | | | | | | | Move the definitions of all special key codes (those not passed by ASCII value) to input/keycodes.h. Before they were spread between osdep/keycodes.h, input/joystick.h, input/mouse.h and input/ar.h, plus some special values in input.h. This was especially inconvenient as the codes had to be coordinated to not conflict between the files. The change requires a bit of ugliness as appleir.c includes <linux/input.h> which contains various conflicting KEY_* definitions. Work around this by adding a special preprocessor variable which can be used to avoid defining these in keycodes.h.
* input: don't interrupt processing at unbound eventsUoti Urpala2011-05-011-6/+7
| | | | | | | | | | The input code read at most one event per input or command fd. If this event was not bound to any recognized command then no command was returned, and higher-level code could not distinguish this case from there being no pending events left. As a result unbound events would cause extra latency in event processing. Change the input code to continue reading events until it either finds one that maps to a command or hits EOF/error.
* input: sleep in event loop even if there are no input fdsUoti Urpala2011-04-221-19/+14
| | | | | | | | | The input loop select() call was only run if there was at least one input file descriptor. However other code uses the input loop to wait; this could result in the wait becoming a busy loop when running with -noconsolecontrols (without that there is at least one input fd for terminal input). Make the input loop call select() to sleep even if there are no input file descriptors.
* input: accept Shift modifier for Enter and Tab keysUoti Urpala2011-02-051-1/+2
| | | | | | Enter and Tab are the only named keys (rather than identified by the printable character they produce) with code below 256. Add a special case to recognize the Shift modifier with them.
* input: remove incorrect "CTRL" keyname alias for backspaceUoti Urpala2011-02-051-1/+0
| | | | | | | | | | | The keycodes.h file contains a KEY_CTRL define, then various control keys expressed as "KEY_CTRL + 0" and so on. Back in 2002 when the key name table in input.c was created this KEY_CTRL define was mistakenly interpreted as a key name, apparently confusing it with the Ctrl key (even though the input system didn't handle that key back then). As a result there was an incorrect key name entry with the same key code as backspace and name "CTRL". This incorrect entry was used when printing the name of the key. Delete it.
* Merge branch 'hr-seek'Uoti Urpala2010-12-201-49/+94
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * hr-seek: input: add default keybindings Shift+[arrow] for small exact seeks input: support bindings with modifier keys for X input core: audio: make ogg missing audio timing workaround more complex core: add support for precise non-keyframe-limited seeks core: add struct for queued seek info commands: add generic option -> property wrapper options: add "choice" option type, use for -pts-association-mode core: remove looping in update_video(), modify command handling a bit core: seek: use accurate seek mode with audio-only files core: avoid using sh_video->pts as "current pts" libvo: register X11 connection fd in input event system core: timing: add special handling of long frame intervals core: move central play loop to a separate function Conflicts: DOCS/tech/slave.txt
| * input: add default keybindings Shift+[arrow] for small exact seeksUoti Urpala2010-12-201-0/+4
| |
| * input: support bindings with modifier keys for X inputUoti Urpala2010-12-201-48/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for binding commands to modifier+key combinations like "Shift+Left" or "Ctrl+Alt+x", and support reading such combinations from the output window of X VOs. The recognized modifier names are Shift, Ctrl, Alt and Meta. Any combination of those and then a non-modifier key name, separated by '+', is accepted as a key name in input.conf. For non-special keys that produce characters shift is ignored as a modifier. For example "A" is handled as a key without modifiers even if you use shift to write the capital letter; 'a' vs 'A' already distinguishes the combinations with a normal keymap, and having separate 'a', 'Shift+A' and 'A' (written with caps lock for example) would bring more confusion than benefit. Currently reading the modifier+key combinations is only supported in the output window of those VOs that use x11_common.c event handling. It's not possible to input the key combinations in other VOs or in a terminal window.
| * core: add support for precise non-keyframe-limited seeksUoti Urpala2010-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Add support for seeking to an arbitrary non-keyframe position by decoding video starting from the previous keyframe. Whether to use this functionality when seeking is controlled by the new option -hr-seek and a new third argument to the "seek" command. The default is to use it for absolute seeks (like chapter seeks) but not for relative ones. Because there's currently no support for cutting encoded audio some desync is expected if encoded audio passthrough is used. Currently precise seeks always go to the first frame with timestamp equal to or greater than the target position; there's no support for "matching or earlier" backwards seeks at frame level.
* | cosmetics: remove unused code, small formatting tweaksUoti Urpala2010-12-201-7/+0
| |
* | commands: Allow cycling subtitles backwards with 'J'reimar2010-12-161-0/+1
|/ | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32680 b3059339-0415-0410-9bf9-f77b7e298cf2 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32714 b3059339-0415-0410-9bf9-f77b7e298cf2
* cleanup: remove NULL checks before free() all over the codecboesch2010-11-143-18/+9
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2
* options: add OPT_MAKE_FLAGS macro, creates "opt/noopt" flag pair</