From db522b94e05ba42ebe1ec489d9a61b2e254a9c84 Mon Sep 17 00:00:00 2001 From: cboesch Date: Fri, 3 Dec 2010 19:52:10 +0000 Subject: stream/: delete base64_encode(), use libavutil av_base64_encode() git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32672 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/realrtsp/real.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'stream/realrtsp') 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: -- cgit v1.2.3