Originally committed as revision 24526 to svn://svn.ffmpeg.org/ffmpeg/trunk
Måns Rullgård authored on 2010/07/27 08:43:56... | ... |
@@ -15,7 +15,7 @@ OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o |
15 | 15 |
MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes))) |
16 | 16 |
HTMLPAGES = $(addprefix doc/, $(addsuffix -doc.html, $(PROGS-yes))) |
17 | 17 |
TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher)) |
18 |
-HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr) |
|
18 |
+HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr base64) |
|
19 | 19 |
|
20 | 20 |
BASENAMES = ffmpeg ffplay ffprobe ffserver |
21 | 21 |
ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES)) |
... | ... |
@@ -159,7 +159,7 @@ testclean: |
159 | 159 |
$(RM) -r tests/vsynth1 tests/vsynth2 tests/data |
160 | 160 |
$(RM) $(addprefix tests/,$(CLEANSUFFIXES)) |
161 | 161 |
$(RM) tests/seek_test$(EXESUF) tests/seek_test.o |
162 |
- $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr)) |
|
162 |
+ $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr base64)) |
|
163 | 163 |
|
164 | 164 |
clean:: testclean |
165 | 165 |
$(RM) $(ALLPROGS) $(ALLPROGS_G) |
166 | 166 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,53 @@ |
0 |
+/* |
|
1 |
+ * This file is part of FFmpeg. |
|
2 |
+ * |
|
3 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
4 |
+ * modify it under the terms of the GNU Lesser General Public |
|
5 |
+ * License as published by the Free Software Foundation; either |
|
6 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
7 |
+ * |
|
8 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
9 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
11 |
+ * Lesser General Public License for more details. |
|
12 |
+ * |
|
13 |
+ * You should have received a copy of the GNU Lesser General Public |
|
14 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
15 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
16 |
+ */ |
|
17 |
+ |
|
18 |
+/* |
|
19 |
+ * Based on libavutil/base64.c |
|
20 |
+ */ |
|
21 |
+ |
|
22 |
+#include <stdio.h> |
|
23 |
+ |
|
24 |
+int main(void) |
|
25 |
+{ |
|
26 |
+ static const char b64[] = |
|
27 |
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
|
28 |
+ unsigned i_bits = 0; |
|
29 |
+ int i_shift = 0; |
|
30 |
+ int out_len = 0; |
|
31 |
+ int in; |
|
32 |
+ |
|
33 |
+#define putb64() do { \ |
|
34 |
+ putchar(b64[(i_bits << 6 >> i_shift) & 0x3f]); \ |
|
35 |
+ out_len++; \ |
|
36 |
+ i_shift -= 6; \ |
|
37 |
+ } while (0) |
|
38 |
+ |
|
39 |
+ while ((in = getchar()) != EOF) { |
|
40 |
+ i_bits = (i_bits << 8) + in; |
|
41 |
+ i_shift += 8; |
|
42 |
+ while (i_shift > 6) |
|
43 |
+ putb64(); |
|
44 |
+ } |
|
45 |
+ while (i_shift > 0) |
|
46 |
+ putb64(); |
|
47 |
+ while (out_len++ & 3) |
|
48 |
+ putchar('='); |
|
49 |
+ putchar('\n'); |
|
50 |
+ |
|
51 |
+ return 0; |
|
52 |
+} |