summaryrefslogtreecommitdiff
path: root/libavutil/bprint.h
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-12-16 12:17:23 +0100
committerStefano Sabatini <stefasab@gmail.com>2013-03-07 01:12:04 +0100
commit9767ec6b865c35f68cb6642fefeacc009f17e638 (patch)
tree6a887bbb054464e240e17d3d185ba0b2e6b63290 /libavutil/bprint.h
parent38d40ac18a3855620852e6552114caeb413497eb (diff)
downloadffmpeg-9767ec6b865c35f68cb6642fefeacc009f17e638.tar.gz
lavu: add escape API
The escape API will be useful to perform escaping programmatically, which is required when crafting argument strings, and will be used for context printing as well. This is based on the ffescape tool code, with a few extensions and fixes.
Diffstat (limited to 'libavutil/bprint.h')
-rw-r--r--libavutil/bprint.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavutil/bprint.h b/libavutil/bprint.h
index f3915fe7b1..df78916f4a 100644
--- a/libavutil/bprint.h
+++ b/libavutil/bprint.h
@@ -22,6 +22,7 @@
#define AVUTIL_BPRINT_H
#include "attributes.h"
+#include "avstring.h"
/**
* Define a structure with extra padding to a fixed size
@@ -180,4 +181,20 @@ static inline int av_bprint_is_complete(AVBPrint *buf)
*/
int av_bprint_finalize(AVBPrint *buf, char **ret_str);
+/**
+ * Escape the content in src and append it to dstbuf.
+ *
+ * @param dstbuf already inited destination bprint buffer
+ * @param src string containing the text to escape
+ * @param special_chars string containing the special characters which
+ * need to be escaped, can be NULL
+ * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros.
+ * Any unknown value for mode will be considered equivalent to
+ * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without
+ * notice.
+ * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_* macros
+ */
+void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars,
+ enum AVEscapeMode mode, int flags);
+
#endif /* AVUTIL_BPRINT_H */