diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2016-03-20 15:59:47 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2016-04-02 12:48:21 +0200 |
commit | e8a9b644107a16473a6f8d9ae5a02b8444e3796e (patch) | |
tree | de18380bf0055cc1d9505cd83b85934d423b9980 /libavutil/base64.h | |
parent | b4daa2c40fb77974af6814cc0baaeec6a7481101 (diff) | |
download | ffmpeg-e8a9b644107a16473a6f8d9ae5a02b8444e3796e.tar.gz |
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.
Diffstat (limited to 'libavutil/base64.h')
-rw-r--r-- | libavutil/base64.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavutil/base64.h b/libavutil/base64.h index 514498eac8..2954c12d42 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 |