aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/avstring.h
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2020-11-16 09:38:39 +0200
committerJan Ekström <jeebjp@gmail.com>2021-03-05 19:45:00 +0200
commit0f6bf94eb71c2d5e996c89c290f1a53660c46c2e (patch)
tree6786c1885eba8746deceeac4a6ff1816072b735e /libavutil/avstring.h
parenta272f382d3eb143e9da99537aec25dbbe5778614 (diff)
downloadffmpeg-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 'libavutil/avstring.h')
-rw-r--r--libavutil/avstring.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index ee225585b3..fae446c302 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -324,6 +324,7 @@ enum AVEscapeMode {
AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode.
AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping.
AV_ESCAPE_MODE_QUOTE, ///< Use single-quote escaping.
+ AV_ESCAPE_MODE_XML, ///< Use XML non-markup character data escaping.
};
/**
@@ -344,6 +345,19 @@ enum AVEscapeMode {
#define AV_ESCAPE_FLAG_STRICT (1 << 1)
/**
+ * Within AV_ESCAPE_MODE_XML, additionally escape single quotes for single
+ * quoted attributes.
+ */
+#define AV_ESCAPE_FLAG_XML_SINGLE_QUOTES (1 << 2)
+
+/**
+ * Within AV_ESCAPE_MODE_XML, additionally escape double quotes for double
+ * quoted attributes.
+ */
+#define AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES (1 << 3)
+
+
+/**
* Escape string in src, and put the escaped string in an allocated
* string in *dst, which must be freed with av_free().
*