ffmpeg / libavutil / base64.h @ 4b2be143
History | View | Annotate | Download (1.63 KB)
1 | 558b86a5 | Luca Barbato | /*
|
---|---|---|---|
2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
|
||
3 | *
|
||
4 | * This file is part of FFmpeg.
|
||
5 | *
|
||
6 | * FFmpeg is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU Lesser General Public
|
||
8 | * License as published by the Free Software Foundation; either
|
||
9 | * version 2.1 of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * FFmpeg is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
14 | * Lesser General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU Lesser General Public
|
||
17 | * License along with FFmpeg; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
19 | */
|
||
20 | |||
21 | 98790382 | Stefano Sabatini | #ifndef AVUTIL_BASE64_H
|
22 | #define AVUTIL_BASE64_H
|
||
23 | 699b3f99 | Måns Rullgård | |
24 | 99545457 | Måns Rullgård | #include <stdint.h> |
25 | |||
26 | 558b86a5 | Luca Barbato | /**
|
27 | bf7e799c | Stefano Sabatini | * Decodes the base64-encoded string in in and puts the decoded
|
28 | * data in out.
|
||
29 | 74afdc55 | Stefano Sabatini | *
|
30 | bf7e799c | Stefano Sabatini | * @param out_size size in bytes of the out buffer, it should be at
|
31 | * least 3/4 of the length of in
|
||
32 | 74afdc55 | Stefano Sabatini | * @return the number of bytes written, or a negative value in case of
|
33 | * error
|
||
34 | 558b86a5 | Luca Barbato | */
|
35 | ac76729c | Stefano Sabatini | int av_base64_decode(uint8_t *out, const char *in, int out_size); |
36 | 558b86a5 | Luca Barbato | |
37 | /**
|
||
38 | bf7e799c | Stefano Sabatini | * Encodes in base64 the data in in and puts the resulting string
|
39 | * in out.
|
||
40 | 74afdc55 | Stefano Sabatini | *
|
41 | bf7e799c | Stefano Sabatini | * @param out_size size in bytes of the out string, it should be at
|
42 | * least ((in_size + 2) / 3) * 4 + 1
|
||
43 | * @param in_size size in bytes of the in buffer
|
||
44 | 74afdc55 | Stefano Sabatini | * @return the string containing the encoded data, or NULL in case of
|
45 | * error
|
||
46 | 558b86a5 | Luca Barbato | */
|
47 | 5118bd44 | Stefano Sabatini | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); |
48 | 558b86a5 | Luca Barbato | |
49 | 98790382 | Stefano Sabatini | #endif /* AVUTIL_BASE64_H */ |