summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-01 17:06:11 +0200
committerwm4 <wm4@nowhere>2013-09-01 20:17:50 +0200
commitead525e17a0e81bdac915dccbb0503f07cb426bf (patch)
treea17cc671ec407eb0cb56d4e21dbf3cf67ebe321c
parent3ad7b9419eb37b452b7b08e71d68da6b6cf0428e (diff)
downloadmpv-ead525e17a0e81bdac915dccbb0503f07cb426bf.tar.bz2
mpv-ead525e17a0e81bdac915dccbb0503f07cb426bf.tar.xz
input: comment all default bindings in input.conf
I suspect most users will just copy etc/input.conf when they want to remap some default bindings. But usually this means the user even copies bindings he doesn't care about, and it's better if the user maps only the bindings in his input.conf the user intends to remap. Comment all bindings in etc/input.conf. Since this file also defines the builtin defaults and is baked into the mpv binary, we have to do something to get them anyway, even though they are commented. Do this by having input.c "uncomment" the bindings in the baked in input.conf. (Of course this is done only for the builtin config, not configs loaded from disk.)
-rw-r--r--etc/input.conf282
-rw-r--r--mpvcore/input/input.c10
2 files changed, 154 insertions, 138 deletions
diff --git a/etc/input.conf b/etc/input.conf
index e18dbc5383..9c50ddad1a 100644
--- a/etc/input.conf
+++ b/etc/input.conf
@@ -27,171 +27,179 @@
# key combinations is only supported through the video windows of certain
# output drivers (not in output windows of other drivers or in a terminal).
-MOUSE_BTN0 ignore # don't do anything
-MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off
-MOUSE_BTN2 cycle pause # toggle pause on/off
-MOUSE_BTN3 seek 10
-MOUSE_BTN4 seek -10
-MOUSE_BTN5 add volume 1
-MOUSE_BTN6 add volume -1
+# All lines in this file are commented. If you want to remap a key, copy the
+# file to ~/.mpv/input.conf, and uncomment and edit the binding you want to
+# change.
+
+# Developer note: this file is baked into the mpv binary, and internally,
+# entries are uncommented and added as default bindings. Lines that have a
+# space after the '#' are ignored.
+
+#MOUSE_BTN0 ignore # don't do anything
+#MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off
+#MOUSE_BTN2 cycle pause # toggle pause on/off
+#MOUSE_BTN3 seek 10
+#MOUSE_BTN4 seek -10
+#MOUSE_BTN5 add volume 1
+#MOUSE_BTN6 add volume -1
# Mouse wheels, touchpad or other input devices that have axes
# if the input devices supports precise scrolling it will also scale the
# numeric value accordingly
-AXIS_UP seek 10
-AXIS_DOWN seek -10
-AXIS_LEFT seek 5
-AXIS_RIGHT seek -5
+#AXIS_UP seek 10
+#AXIS_DOWN seek -10
+#AXIS_LEFT seek 5
+#AXIS_RIGHT seek -5
-# Seek units are in seconds, but note that these are limited by keyframes
-RIGHT seek 10
-LEFT seek -10
-UP seek 60
-DOWN seek -60
+## Seek units are in seconds, but note that these are limited by keyframes
+#RIGHT seek 10
+#LEFT seek -10
+#UP seek 60
+#DOWN seek -60
# Do smaller, always exact (non-keyframe-limited), seeks with shift.
# Don't show them on the OSD (no-osd).
-Shift+RIGHT no-osd seek 1 - exact
-Shift+LEFT no-osd seek -1 - exact
-Shift+UP no-osd seek 5 - exact
-Shift+DOWN no-osd seek -5 - exact
-PGUP seek 600
-PGDWN seek -600
-+ add audio-delay 0.100 # this changes audio/video sync
-- add audio-delay -0.100
-[ speed_mult 0.9091 # scale playback speed
-] speed_mult 1.1
-{ speed_mult 0.5
-} speed_mult 2.0
-BS set speed 1.0 # reset speed to normal
-q quit
-Q quit_watch_later
-q {encode} quit
-ESC quit
-p cycle pause # toggle pause/playback mode
-. frame_step # advance one frame and pause
-, frame_back_step # go back by one frame and pause
-SPACE cycle pause
-> playlist_next # skip to next file
-ENTER playlist_next force # skip to next file or quit
-< playlist_prev # skip to previous file
-o osd # cycle through OSD mode
-I show_text "${filename}" # display filename in osd
-P show_progress
-z add sub-delay -0.1 # subtract 100 ms delay from subs
-x add sub-delay +0.1 # add
-9 add volume -1
-/ add volume -1
-0 add volume 1
-* add volume 1
-( add balance -0.1 # adjust audio balance in favor of left
-) add balance 0.1 # right
-m cycle mute
-1 add contrast -1
-2 add contrast 1
-3 add brightness -1
-4 add brightness 1
-5 add gamma -1
-6 add gamma 1
-7 add saturation -1
-8 add saturation 1
-d cycle framedrop # cycle through framedrop modes
+#Shift+RIGHT no-osd seek 1 - exact
+#Shift+LEFT no-osd seek -1 - exact
+#Shift+UP no-osd seek 5 - exact
+#Shift+DOWN no-osd seek -5 - exact
+#PGUP seek 600
+#PGDWN seek -600
+#+ add audio-delay 0.100 # this changes audio/video sync
+#- add audio-delay -0.100
+#[ speed_mult 0.9091 # scale playback speed
+#] speed_mult 1.1
+#{ speed_mult 0.5
+#} speed_mult 2.0
+#BS set speed 1.0 # reset speed to normal
+#q quit
+#Q quit_watch_later
+#q {encode} quit
+#ESC quit
+#p cycle pause # toggle pause/playback mode
+#. frame_step # advance one frame and pause
+#, frame_back_step # go back by one frame and pause
+#SPACE cycle pause
+#> playlist_next # skip to next file
+#ENTER playlist_next force # skip to next file or quit
+#< playlist_prev # skip to previous file
+#o osd # cycle through OSD mode
+#I show_text "${filename}" # display filename in osd
+#P show_progress
+#z add sub-delay -0.1 # subtract 100 ms delay from subs
+#x add sub-delay +0.1 # add
+#9 add volume -1
+#/ add volume -1
+#0 add volume 1
+#* add volume 1
+#( add balance -0.1 # adjust audio balance in favor of left
+#) add balance 0.1 # right
+#m cycle mute
+#1 add contrast -1
+#2 add contrast 1
+#3 add brightness -1
+#4 add brightness 1
+#5 add gamma -1
+#6 add gamma 1
+#7 add saturation -1
+#8 add saturation 1
+#d cycle framedrop # cycle through framedrop modes
# toggle deinterlacer; requires either vdpau output, -vf yadif or kerndeint
-D cycle deinterlace
-c cycle colormatrix
+#D cycle deinterlace
+#c cycle colormatrix
# Next 3 currently only work with --no-ass
-r add sub-pos -1 # move subtitles up
-t add sub-pos +1 # down
-v cycle sub-visibility
+#r add sub-pos -1 # move subtitles up
+#t add sub-pos +1 # down
+#v cycle sub-visibility
# stretch SSA/ASS subtitles with anamorphic videos to match historical
-V cycle ass-vsfilter-aspect-compat
-j cycle sub # cycle through subtitles
-J cycle sub down # ...backwards
-F cycle sub-forced-only
-SHARP cycle audio # switch audio streams
-_ cycle video
-TAB cycle program
-T cycle ontop # toggle video window ontop of other windows
-f cycle fullscreen # toggle fullscreen
-s screenshot # take a screenshot
-S screenshot video # ...without subtitles
-Alt+s screenshot - each-frame # automatically screenshot every frame
-w add panscan -0.1 # zoom out with -panscan 0 -fs
-e add panscan +0.1 # in
-POWER quit
-MENU cycle osd
-PLAY cycle pause
-PAUSE cycle pause
-PLAYPAUSE cycle pause
-STOP quit
-FORWARD seek 60
-REWIND seek -60
-NEXT playlist_next
-PREV playlist_prev
-VOLUME_UP add volume 1
-VOLUME_DOWN add volume -1
-MUTE cycle mute
-CLOSE_WIN quit
-CLOSE_WIN {encode} quit
-! add chapter -1 # skip to previous chapter
-@ add chapter 1 # next
-E cycle edition # next edition
-A cycle angle
-U stop
+#V cycle ass-vsfilter-aspect-compat
+#j cycle sub # cycle through subtitles
+#J cycle sub down # ...backwards
+#F cycle sub-forced-only
+#SHARP cycle audio # switch audio streams
+#_ cycle video
+#TAB cycle program
+#T cycle ontop # toggle video window ontop of other windows
+#f cycle fullscreen # toggle fullscreen
+#s screenshot # take a screenshot
+#S screenshot video # ...without subtitles
+#Alt+s screenshot - each-frame # automatically screenshot every frame
+#w add panscan -0.1 # zoom out with -panscan 0 -fs
+#e add panscan +0.1 # in
+#POWER quit
+#MENU cycle osd
+#PLAY cycle pause
+#PAUSE cycle pause
+#PLAYPAUSE cycle pause
+#STOP quit
+#FORWARD seek 60
+#REWIND seek -60
+#NEXT playlist_next
+#PREV playlist_prev
+#VOLUME_UP add volume 1
+#VOLUME_DOWN add volume -1
+#MUTE cycle mute
+#CLOSE_WIN quit
+#CLOSE_WIN {encode} quit
+#! add chapter -1 # skip to previous chapter
+#@ add chapter 1 # next
+#E cycle edition # next edition
+#A cycle angle
+#U stop
-l cycle quvi-format 1
-L cycle quvi-format -1
+#l cycle quvi-format 1
+#L cycle quvi-format -1
# TV
-h tv_step_channel 1
-k tv_step_channel -1
-n tv_step_norm
-u tv_step_chanlist
+#h tv_step_channel 1
+#k tv_step_channel -1
+#n tv_step_norm
+#u tv_step_chanlist
# Apple Remote section
-AR_PLAY cycle pause
-AR_PLAY_HOLD quit
-AR_CENTER cycle pause
-AR_CENTER_HOLD quit
-AR_NEXT seek 10
-AR_NEXT_HOLD seek 120
-AR_PREV seek -10
-AR_PREV_HOLD seek -120
-AR_MENU show_progress
-AR_MENU_HOLD cycle mute
-AR_VUP add volume 1
-AR_VUP_HOLD add chapter 1
-AR_VDOWN add volume -1
-AR_VDOWN_HOLD add chapter -1
+#AR_PLAY cycle pause
+#AR_PLAY_HOLD quit
+#AR_CENTER cycle pause
+#AR_CENTER_HOLD quit
+#AR_NEXT seek 10
+#AR_NEXT_HOLD seek 120
+#AR_PREV seek -10
+#AR_PREV_HOLD seek -120
+#AR_MENU show_progress
+#AR_MENU_HOLD cycle mute
+#AR_VUP add volume 1
+#AR_VUP_HOLD add chapter 1
+#AR_VDOWN add volume -1
+#AR_VDOWN_HOLD add chapter -1
# Media Keys section
-MK_PLAY cycle pause
-MK_PREV playlist_prev
-MK_NEXT playlist_next
+#MK_PLAY cycle pause
+#MK_PREV playlist_prev
+#MK_NEXT playlist_next
# Joystick section
# WARNING: joystick support has to be explicitly enabled at
# compiletime with --enable-joystick
#
-JOY_AXIS0_PLUS seek 10
-JOY_AXIS0_MINUS seek -10
-JOY_AXIS1_MINUS seek 60
-JOY_AXIS1_PLUS seek -60
-JOY_BTN0 cycle pause
-JOY_BTN1 cycle osd
-JOY_BTN2 add volume 1
-JOY_BTN3 add volume -1
+#JOY_AXIS0_PLUS seek 10
+#JOY_AXIS0_MINUS seek -10
+#JOY_AXIS1_MINUS seek 60
+#JOY_AXIS1_PLUS seek -60
+#JOY_BTN0 cycle pause
+#JOY_BTN1 cycle osd
+#JOY_BTN2 add volume 1
+#JOY_BTN3 add volume -1
# Mostly for internal purposes
-MOUSE_MOVE ignore
-MOUSE_LEAVE ignore
+#MOUSE_MOVE ignore
+#MOUSE_LEAVE ignore
#
# Not assigned by default
# (not an exhaustive list of unbound commands)
#
-#? add sub-scale +0.1 # increase subtitle font size
-#? add sub-scale -0.1 # decrease subtitle font size
-#? sub_step -1 # immediately display next subtitle
-#? sub_step +1 # previous
+# ? add sub-scale +0.1 # increase subtitle font size
+# ? add sub-scale -0.1 # decrease subtitle font size
+# ? sub_step -1 # immediately display next subtitle
+# ? sub_step +1 # previous
diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c
index 76d157afac..b89b6eecf2 100644
--- a/mpvcore/input/input.c
+++ b/mpvcore/input/input.c
@@ -2169,7 +2169,15 @@ struct input_ctx *mp_input_init(struct MPOpts *opts)
mp_input_enable_section(ictx, NULL, 0);
- parse_config(ictx, true, bstr0(builtin_input_conf), "<builtin>", NULL);
+ // "Uncomment" the default key bindings in etc/input.conf and add them.
+ // All lines that do not start with '# ' are parsed.
+ bstr builtin = bstr0(builtin_input_conf);
+ while (builtin.len) {
+ bstr line = bstr_getline(builtin, &builtin);
+ bstr_eatstart0(&line, "#");
+ if (!bstr_startswith0(line, " "))
+ parse_config(ictx, true, line, "<builtin>", NULL);
+ }
#ifndef __MINGW32__
long ret = pipe(ictx->wakeup_pipe);