diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2020-11-16 09:38:39 +0200 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2021-03-05 19:45:00 +0200 |
commit | 0f6bf94eb71c2d5e996c89c290f1a53660c46c2e (patch) | |
tree | 6786c1885eba8746deceeac4a6ff1816072b735e /tools | |
parent | a272f382d3eb143e9da99537aec25dbbe5778614 (diff) | |
download | ffmpeg-0f6bf94eb71c2d5e996c89c290f1a53660c46c2e.tar.gz |
avutil/{avstring,bprint}: add XML escaping from ffprobe to avutil
Base escaping only escapes values required for base character data
according to part 2.4 of XML, and if additional flags are added
single and double quotes can additionally be escaped in order
to handle single and double quoted attributes.
Co-authored-by: Jan Ekström <jan.ekstrom@24i.com>
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ffescape.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/ffescape.c b/tools/ffescape.c index 0530d28c6d..1ed8daa801 100644 --- a/tools/ffescape.c +++ b/tools/ffescape.c @@ -78,8 +78,10 @@ int main(int argc, char **argv) infilename = optarg; break; case 'f': - if (!strcmp(optarg, "whitespace")) escape_flags |= AV_ESCAPE_FLAG_WHITESPACE; - else if (!strcmp(optarg, "strict")) escape_flags |= AV_ESCAPE_FLAG_STRICT; + if (!strcmp(optarg, "whitespace")) escape_flags |= AV_ESCAPE_FLAG_WHITESPACE; + else if (!strcmp(optarg, "strict")) escape_flags |= AV_ESCAPE_FLAG_STRICT; + else if (!strcmp(optarg, "xml_single_quotes")) escape_flags |= AV_ESCAPE_FLAG_XML_SINGLE_QUOTES; + else if (!strcmp(optarg, "xml_double_quotes")) escape_flags |= AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES; else { av_log(NULL, AV_LOG_ERROR, "Invalid value '%s' for option -f, " @@ -104,6 +106,7 @@ int main(int argc, char **argv) if (!strcmp(optarg, "auto")) escape_mode = AV_ESCAPE_MODE_AUTO; else if (!strcmp(optarg, "backslash")) escape_mode = AV_ESCAPE_MODE_BACKSLASH; else if (!strcmp(optarg, "quote")) escape_mode = AV_ESCAPE_MODE_QUOTE; + else if (!strcmp(optarg, "xml")) escape_mode = AV_ESCAPE_MODE_XML; else { av_log(NULL, AV_LOG_ERROR, "Invalid value '%s' for option -m, " |