summaryrefslogtreecommitdiff
path: root/libavutil/log.h
diff options
context:
space:
mode:
authorAndreas Weis <github@ghulbus-inc.de>2016-04-27 08:15:17 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-04-27 19:23:05 +0200
commitfb9187129c3d07ac6d0f7deaa27f1248394d8f91 (patch)
treeff1ba082a3a820db6543150695468e93ab4d5b56 /libavutil/log.h
parent6f784c158bd56f2cc73354974ceebb04a40e0f52 (diff)
downloadffmpeg-fb9187129c3d07ac6d0f7deaa27f1248394d8f91.tar.gz
avutil/log: added av_log_format_line2 which returns buffer length
The new function behaves the same as av_log_format_line, but also forwards the return value from the underlying snprintf call. This will allow callers to accurately determine the size requirements for the line buffer. Signed-off-by: Andreas Weis <github@ghulbus-inc.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/log.h')
-rw-r--r--libavutil/log.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavutil/log.h b/libavutil/log.h
index 321748cd80..9b1d66f521 100644
--- a/libavutil/log.h
+++ b/libavutil/log.h
@@ -317,6 +317,23 @@ AVClassCategory av_default_get_category(void *ptr);
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
char *line, int line_size, int *print_prefix);
+/**
+ * Format a line of log the same way as the default callback.
+ * @param line buffer to receive the formatted line;
+ * may be NULL if line_size is 0
+ * @param line_size size of the buffer; at most line_size-1 characters will
+ * be written to the buffer, plus one null terminator
+ * @param print_prefix used to store whether the prefix must be printed;
+ * must point to a persistent integer initially set to 1
+ * @return Returns a negative value if an error occured, otherwise returns
+ * the number of characters that would have been written for a
+ * sufficiently large buffer, not including the terminating null
+ * character. If the return value is not less than line_size, it means
+ * that the log message was truncated to fit the buffer.
+ */
+int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
+ char *line, int line_size, int *print_prefix);
+
#if FF_API_DLOG
/**
* av_dlog macros