[FFmpeg-devel] [PATCH] lavu/avstring: support "'" escaping in sequence of chars enclosed by "'"

Stefano Sabatini stefasab at gmail.com
Tue Sep 4 10:49:00 CEST 2012


On date Tuesday 2012-09-04 09:15:29 +0200, Nicolas George encoded:
> Le nonidi 19 fructidor, an CCXX, Stefano Sabatini a écrit :
> > Make av_get_token() support escaping of ' inside a sequence enclosed by
> > quotes. This allows to specify strings of the kind:
> > '\'this sentence is quoted\''
> > which may be useful when quoting nested literal strings.
> 
> The standard Unix shell behaviour is that single-quotes disable _all_
> special characters except the single quote itself. Singles quotes should be
> escaped by temporarily ending the single quotes:
> 
> 	'That'\''s all folks!'
> 
> or, in the above example:
> 
> 	\''this sentence is quoted'\'
> 
> What is your use-case exactly?

In sendcmd, a filter argument is parsed as a single token:
fontfile=FreeSerif.ttf:text=hello::world

and whitespaces are used as separators, so each space needs to be escaped.

So I thougth it could be useful to write:
'fontfile=FreeSerif.ttf:text=\'hello::world\''

rather than:
'fontfile=FreeSerif.ttf:text='\''hello::world'\'

which is somehow cumbersome.

On the other hand, if this is the standard quoting behavior I'd better
drop this patch.
-- 
FFmpeg = Foolish and Fiendish Miracolous Practical Enlightening Gorilla


More information about the ffmpeg-devel mailing list