summaryrefslogtreecommitdiffstats
path: root/stream/realrtsp/real.c
diff options
context:
space:
mode:
authorcboesch <cboesch@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-12-03 19:52:10 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-12-16 05:16:50 +0200
commitdb522b94e05ba42ebe1ec489d9a61b2e254a9c84 (patch)
treecca53310fbdf27024c93d403b23044ab4da50054 /stream/realrtsp/real.c
parent4f1b2d9b182fa422c4dff6aa44f8d45d82218165 (diff)
downloadmpv-db522b94e05ba42ebe1ec489d9a61b2e254a9c84.tar.bz2
mpv-db522b94e05ba42ebe1ec489d9a61b2e254a9c84.tar.xz
stream/: delete base64_encode(), use libavutil av_base64_encode()
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32672 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/realrtsp/real.c')
-rw-r--r--stream/realrtsp/real.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c
index 6f33bc9c6c..6d77157f34 100644
--- a/stream/realrtsp/real.c
+++ b/stream/realrtsp/real.c
@@ -38,6 +38,7 @@
#include "xbuffer.h"
#include "libavutil/md5.h"
#include "ffmpeg_files/intreadwrite.h"
+#include "libavutil/base64.h"
#include "stream/http.h"
#include "mp_msg.h"
@@ -491,18 +492,14 @@ rtsp_send_describe:
mp_msg(MSGT_STREAM, MSGL_ERR, "realrtsp: authenticator not supported (%s)\n", authreq);
goto autherr;
}
- authlen = strlen(username) + (password ? strlen(password) : 0) + 2;
- authstr = malloc(authlen);
+ authlen = strlen(username) + 1 + (password ? strlen(password) : 0);
+ authstr = malloc(authlen + 1);
sprintf(authstr, "%s:%s", username, password ? password : "");
- authfield = malloc(authlen*2+22);
+ b64_authlen = AV_BASE64_SIZE(authlen);
+ authfield = malloc(21 + b64_authlen);
strcpy(authfield, "Authorization: Basic ");
- b64_authlen = base64_encode(authstr, authlen, authfield+21, authlen*2);
+ av_base64_encode(authfield + 21, b64_authlen, authstr, authlen);
free(authstr);
- if (b64_authlen < 0) {
- mp_msg(MSGT_STREAM, MSGL_ERR, "realrtsp: base64 output overflow, this should never happen\n");
- goto autherr;
- }
- authfield[b64_authlen+21] = 0;
goto rtsp_send_describe;
}
autherr: