mirror of
https://github.com/mpv-player/mpv
synced 2025-03-31 07:51:55 +00:00
Added comments support in input.conf (comments lines with #)
And fixed a possible bug git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4764 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
ac29aba012
commit
8b88d6cbe1
@ -555,6 +555,9 @@ mp_input_read_keys(int time,int paused) {
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(num_key_fd == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if(time >= 0 ) {
|
if(time >= 0 ) {
|
||||||
tv.tv_sec=time/1000;
|
tv.tv_sec=time/1000;
|
||||||
tv.tv_usec = (time%1000)*1000;
|
tv.tv_usec = (time%1000)*1000;
|
||||||
@ -701,6 +704,9 @@ mp_input_read_cmds(int time) {
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(num_cmd_fd == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if(time >= 0) {
|
if(time >= 0) {
|
||||||
tv.tv_sec=time/1000;
|
tv.tv_sec=time/1000;
|
||||||
tv.tv_usec = (time%1000)*1000;
|
tv.tv_usec = (time%1000)*1000;
|
||||||
@ -885,7 +891,7 @@ mp_input_free_binds(mp_cmd_bind_t* binds) {
|
|||||||
static int
|
static int
|
||||||
mp_input_parse_config(char *file) {
|
mp_input_parse_config(char *file) {
|
||||||
int fd;
|
int fd;
|
||||||
int bs = 0,r,eof = 0;
|
int bs = 0,r,eof = 0,comments = 0;
|
||||||
char *iter,*end;
|
char *iter,*end;
|
||||||
char buffer[BS_MAX];
|
char buffer[BS_MAX];
|
||||||
int n_binds = 0, keys[MP_MAX_KEY_DOWN+1] = { 0 };
|
int n_binds = 0, keys[MP_MAX_KEY_DOWN+1] = { 0 };
|
||||||
@ -927,6 +933,23 @@ mp_input_parse_config(char *file) {
|
|||||||
|
|
||||||
iter = buffer;
|
iter = buffer;
|
||||||
|
|
||||||
|
if(comments) {
|
||||||
|
for( ; iter[0] != '\0' && iter[0] != '\n' ; iter++)
|
||||||
|
/* NOTHING */;
|
||||||
|
if(iter[0] == '\0') { // Buffer was full of comment
|
||||||
|
bs = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
iter++;
|
||||||
|
r = strlen(iter);
|
||||||
|
if(r)
|
||||||
|
memmove(buffer,iter,r+1);
|
||||||
|
bs = r+1;
|
||||||
|
if(iter[0] != '#')
|
||||||
|
comments = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Find the wanted key
|
// Find the wanted key
|
||||||
if(keys[0] == 0) {
|
if(keys[0] == 0) {
|
||||||
// Jump beginnig space
|
// Jump beginnig space
|
||||||
@ -936,6 +959,10 @@ mp_input_parse_config(char *file) {
|
|||||||
bs = 0;
|
bs = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(iter[0] == '#') { // Comments
|
||||||
|
comments = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Find the end of the key code name
|
// Find the end of the key code name
|
||||||
for(end = iter; end[0] != '\0' && strchr(SPACE_CHAR,end[0]) == NULL ; end++)
|
for(end = iter; end[0] != '\0' && strchr(SPACE_CHAR,end[0]) == NULL ; end++)
|
||||||
/*NOTHING */;
|
/*NOTHING */;
|
||||||
|
Loading…
Reference in New Issue
Block a user