--- libavutil/bprint.c | 7 +++++++ libavutil/bprint.h | 9 +++++++++ 2 files changed, 16 insertions(+)
diff --git a/libavutil/bprint.c b/libavutil/bprint.c index 64d2ab1..746868b 100644 --- a/libavutil/bprint.c +++ b/libavutil/bprint.c @@ -334,6 +334,13 @@ void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_cha } } +const char *av_xml_escape_str(AVBPrint *dst, const char *src) +{ + av_bprint_clear(dst); + av_bprint_escape(dst, src, NULL, AV_ESCAPE_MODE_XML, 0); + return dst->str; +} + #ifdef TEST #undef printf diff --git a/libavutil/bprint.h b/libavutil/bprint.h index c09b1ac..006fa8c 100644 --- a/libavutil/bprint.h +++ b/libavutil/bprint.h @@ -216,4 +216,13 @@ int av_bprint_finalize(AVBPrint *buf, char **ret_str); void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags); +/** + * Clear the contents of dst, use it to XML-escape a string, and return the result. + * This is a convenience function that escapes only the default XML special characters. + * + * @param dst already inited destination bprint buffer + * @param src string containing the text to escape + */ +const char *av_xml_escape_str(AVBPrint *dst, const char *src); + #endif /* AVUTIL_BPRINT_H */ -- 2.4.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel