char *av_base64_encode(char * buf, int buf_len, const uint8_t * src, int len)
{
    static const char b64[] =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    char *ret, *dst;
    unsigned i_bits = 0;
    int i_shift = 0;
    int bytes_remaining = len;
    if (len >= UINT_MAX / 4 ||
        buf_len < len * 4 / 3 + 12)
        return NULL;
    ret = dst = buf;
    while (bytes_remaining) {
        i_bits = (i_bits << 8) + *src++;
        bytes_remaining--;
        i_shift += 8;
        do {
            *dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];
            i_shift -= 6;
        } while (i_shift > 6 || (bytes_remaining == 0 && i_shift > 0));
    }
    while ((dst - ret) & 3)
        *dst++ = '=';
    *dst = '\0';
    return ret;
}
['char *av_base64_encode(char * buf, int buf_len, const uint8_t * src, int len)\n{\n    static const char b64[] =\n        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n    char *ret, *dst;\n    unsigned i_bits = 0;\n    int i_shift = 0;\n    int bytes_remaining = len;\n    if (len >= UINT_MAX / 4 ||\n        buf_len < len * 4 / 3 + 12)\n        return NULL;\n    ret = dst = buf;\n    while (bytes_remaining) {\n        i_bits = (i_bits << 8) + *src++;\n        bytes_remaining--;\n        i_shift += 8;\n        do {\n            *dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];\n            i_shift -= 6;\n        } while (i_shift > 6 || (bytes_remaining == 0 && i_shift > 0));\n    }\n    while ((dst - ret) & 3)\n        *dst++ = \'=\';\n    *dst = \'\\0\';\n    return ret;\n}']