From: Stefano Sabatini <[email protected]>

Signed-off-by: Josh Allmann <[email protected]>
---
 doc/APIchanges      |    3 +++
 libavutil/error.h   |   26 ++++++++++++++++++++++++++
 libavutil/version.h |    2 +-
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cdfcc09..afececf 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2012-10-22
 
 API changes, most recent first:
 
+2013-xx-xx - xxxxxxx - lavu 52.14.0 - error.h
+  Add av_make_error_string() and av_err2str() utilities.
+
 2013-06-xx - xxxxxxx - lavc 55.10.0 - avcodec.h
   Add MPEG-2 AAC profiles
 
diff --git a/libavutil/error.h b/libavutil/error.h
index 3dfd880..7fb52c9 100644
--- a/libavutil/error.h
+++ b/libavutil/error.h
@@ -62,6 +62,8 @@
 #define AVERROR_UNKNOWN            (-0x31b4b1ab) ///< Unknown error, typically 
from an external library
 #define AVERROR_EXPERIMENTAL       (-0x2bb2afa8) ///< Requested feature is 
flagged experimental. Set strict_std_compliance if you really want to use it.
 
+#define AV_ERROR_MAX_STRING_SIZE 64
+
 /**
  * Put a description of the AVERROR code errnum in errbuf.
  * In case of failure the global variable errno is set to indicate the
@@ -77,6 +79,30 @@
 int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
 
 /**
+ * Fill the provided buffer with a string containing an error string
+ * corresponding to the AVERROR code errnum.
+ *
+ * @param errbuf         a buffer
+ * @param errbuf_size    size in bytes of errbuf
+ * @param errnum         error code to describe
+ * @return the buffer in input, filled with the error description
+ * @see av_strerror()
+ */
+static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int 
errnum)
+{
+    av_strerror(errnum, errbuf, errbuf_size);
+    return errbuf;
+}
+
+/**
+ * Convenience macro, the return value should be used only directly in
+ * function arguments but never stand-alone.
+ */
+#define av_err2str(errnum) \
+    av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, 
AV_ERROR_MAX_STRING_SIZE, errnum)
+
+
+/**
  * @}
  */
 
diff --git a/libavutil/version.h b/libavutil/version.h
index fa79e12..62d8bce 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -37,7 +37,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR 13
+#define LIBAVUTIL_VERSION_MINOR 14
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to