[FFmpeg-devel] [PATCH] lavu: add escape API
Nicolas George
nicolas.george at normalesup.org
Mon Dec 24 13:13:10 CET 2012
Le duodi 2 nivôse, an CCXXI, Stefano Sabatini a écrit :
> > enum AVEscapeFlags {
> >
>
> > /**
> > * Use backslash escaping only.
> > */
> > AV_ESCAPE_USE_BACKSLASH = 0x1,
> >
> > /**
> > * Use single-quote escaping only.
> > */
> > AV_ESCAPE_USE_SINGLE_QUOTE = 0x2,
>
> These two are in conflict.
They are. Conflicting flags are not uncommon.
> >
> > /* note: the gap between 0x2 and 0x100 can be used to add other USE
> > * flags; they are not really flags, as they are exclusive */
> >
> > /**
> > * Consider spaces special and escape them even in the middle of the
> > * string.
> > * This is equivalent to adding the whitespace characters to the special
> > * characters lists, except it is guaranteed to use the exact same list
> > * of whitespace characters as the rest of libavutil.
> > */
> > AV_ESCAPE_WHITESPACE = 0x100,
> >
> > /**
> > * Escape only specified special characters.
> > * Without this flag, escape also any characters that may be considered
> > * special by av_get_token(), such as the single quote.
> > */
> > AV_ESCAPE_STRICT = 0x200,
>
> Another possibility could be to have both mode and flags, even if more
> complicated.
This is indeed another possibility, but I do not see the point of making
things more complicated (for the API user too).
> > Should we consider making backslash an argument?
> Where/how would be this useful?
I do not know, but I think the question deserves to be raised. Out of the
top of my head: CSV requires quotes to be escaped by quotes, not
backslashes.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121224/c36979c5/attachment.asc>
More information about the ffmpeg-devel
mailing list