[FFmpeg-cvslog] lavu/base64: add AV_BASE64_DECODE_SIZE() macro

Stefano Sabatini git at videolan.org
Sat Apr 2 16:24:45 CEST 2016


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sun Mar 20 15:59:47 2016 +0100| [e8a9b644107a16473a6f8d9ae5a02b8444e3796e] | committer: Stefano Sabatini

lavu/base64: add AV_BASE64_DECODE_SIZE() macro

This is consistent with the AV_BASE64_SIZE macro and avoids the literal
use of constants in the code.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e8a9b644107a16473a6f8d9ae5a02b8444e3796e
---

 doc/APIchanges      |    3 +++
 libavutil/base64.h  |    9 +++++++--
 libavutil/version.h |    2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 8363b05..e02097b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2016-04-02 - xxxxxxx - lavu 55.20.100 - base64.h
+  Add AV_BASE64_DECODE_SIZE(x) macro.
+
 2016-xx-xx - lavc 57.33.0 - avcodec.h
   xxxxxxx - Add AVCodecParameters and its related API.
   xxxxxxx - Add av_get_audio_frame_duration2().
diff --git a/libavutil/base64.h b/libavutil/base64.h
index 514498e..2954c12 100644
--- a/libavutil/base64.h
+++ b/libavutil/base64.h
@@ -29,20 +29,25 @@
  * @{
  */
 
-
 /**
  * Decode a base64-encoded string.
  *
  * @param out      buffer for decoded data
  * @param in       null-terminated input string
  * @param out_size size in bytes of the out buffer, must be at
- *                 least 3/4 of the length of in
+ *                 least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
  * @return         number of bytes written, or a negative value in case of
  *                 invalid input
  */
 int av_base64_decode(uint8_t *out, const char *in, int out_size);
 
 /**
+ * Calculate the output size in bytes needed to decode a base64 string
+ * with length x to a data buffer.
+ */
+#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
+
+/**
  * Encode data to base64 and null-terminate.
  *
  * @param out      buffer for encoded data
diff --git a/libavutil/version.h b/libavutil/version.h
index 53e74bc..f1e9e40 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -64,7 +64,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  55
-#define LIBAVUTIL_VERSION_MINOR  19
+#define LIBAVUTIL_VERSION_MINOR  20
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list