annotate ffmpeg/libavutil/base64.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents f445c3017523
children
rev   line source
yading@11 1 /*
yading@11 2 * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
yading@11 3 *
yading@11 4 * This file is part of FFmpeg.
yading@11 5 *
yading@11 6 * FFmpeg is free software; you can redistribute it and/or
yading@11 7 * modify it under the terms of the GNU Lesser General Public
yading@11 8 * License as published by the Free Software Foundation; either
yading@11 9 * version 2.1 of the License, or (at your option) any later version.
yading@11 10 *
yading@11 11 * FFmpeg is distributed in the hope that it will be useful,
yading@11 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@11 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@11 14 * Lesser General Public License for more details.
yading@11 15 *
yading@11 16 * You should have received a copy of the GNU Lesser General Public
yading@11 17 * License along with FFmpeg; if not, write to the Free Software
yading@11 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@11 19 */
yading@11 20
yading@11 21 #ifndef AVUTIL_BASE64_H
yading@11 22 #define AVUTIL_BASE64_H
yading@11 23
yading@11 24 #include <stdint.h>
yading@11 25
yading@11 26 /**
yading@11 27 * @defgroup lavu_base64 Base64
yading@11 28 * @ingroup lavu_crypto
yading@11 29 * @{
yading@11 30 */
yading@11 31
yading@11 32
yading@11 33 /**
yading@11 34 * Decode a base64-encoded string.
yading@11 35 *
yading@11 36 * @param out buffer for decoded data
yading@11 37 * @param in null-terminated input string
yading@11 38 * @param out_size size in bytes of the out buffer, must be at
yading@11 39 * least 3/4 of the length of in
yading@11 40 * @return number of bytes written, or a negative value in case of
yading@11 41 * invalid input
yading@11 42 */
yading@11 43 int av_base64_decode(uint8_t *out, const char *in, int out_size);
yading@11 44
yading@11 45 /**
yading@11 46 * Encode data to base64 and null-terminate.
yading@11 47 *
yading@11 48 * @param out buffer for encoded data
yading@11 49 * @param out_size size in bytes of the out buffer (including the
yading@11 50 * null terminator), must be at least AV_BASE64_SIZE(in_size)
yading@11 51 * @param in input buffer containing the data to encode
yading@11 52 * @param in_size size in bytes of the in buffer
yading@11 53 * @return out or NULL in case of error
yading@11 54 */
yading@11 55 char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
yading@11 56
yading@11 57 /**
yading@11 58 * Calculate the output size needed to base64-encode x bytes to a
yading@11 59 * null-terminated string.
yading@11 60 */
yading@11 61 #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
yading@11 62
yading@11 63 /**
yading@11 64 * @}
yading@11 65 */
yading@11 66
yading@11 67 #endif /* AVUTIL_BASE64_H */