mirror of
https://github.com/mpv-player/mpv
synced 2024-09-05 02:48:21 +02:00
support lenght-quoting of strings in subopt parser.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15734 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
a1d7876900
commit
1d0e6ef7cc
@ -383,6 +383,22 @@ Every 'flag' option has a 'noflag' counterpart, e.g.\& the opposite of the
|
||||
If an option is marked as (XXX only), it will only work in combination with
|
||||
the XXX option or if XXX is compiled in.
|
||||
.PP
|
||||
.I NOTE:
|
||||
.PD 0
|
||||
.RSs
|
||||
The suboption parser (used for example for -ao pcm suboptions) supports
|
||||
a special kind of string-escaping intended for use with external GUIs.
|
||||
.PP
|
||||
It has the following format:
|
||||
.PP
|
||||
%n%string_of_lenght_n
|
||||
.PP
|
||||
Usage example:
|
||||
.PP
|
||||
mplayer -ao pcm:file=%10%C:test.wav test.avi
|
||||
.RE
|
||||
.PD 1
|
||||
.PP
|
||||
You can put all of the options in a configuration file which will be read
|
||||
every time MPlayer is run.
|
||||
The system-wide configuration file 'mplayer.conf' is in your configuration
|
||||
|
@ -247,10 +247,21 @@ static char const * parse_int( char const * const str, int * const valp )
|
||||
return endp;
|
||||
}
|
||||
|
||||
static char const * parse_str( char const * const str, strarg_t * const valp )
|
||||
#define QUOTE_CHAR '%'
|
||||
static char const * parse_str( char const * str, strarg_t * const valp )
|
||||
{
|
||||
char const * match = strchr( str, ':' );
|
||||
|
||||
if (str[0] == QUOTE_CHAR) {
|
||||
int len = 0;
|
||||
str = &str[1];
|
||||
len = (int)strtol(str, (char **)&str, 0);
|
||||
if (!str || str[0] != QUOTE_CHAR || (len > strlen(str) - 1))
|
||||
return NULL;
|
||||
str = &str[1];
|
||||
match = &str[len];
|
||||
}
|
||||
else
|
||||
if ( !match )
|
||||
match = &str[strlen(str)];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user