Mercurial > mplayer.hg
comparison stream/realrtsp/real.c @ 32585:be61988fb5c4
Drop MPlayer base64_encode for av_base64_encode.
author | cboesch |
---|---|
date | Fri, 03 Dec 2010 19:52:10 +0000 |
parents | 8fa2f43cb760 |
children |
comparison
equal
deleted
inserted
replaced
32584:bec4b99cda2a | 32585:be61988fb5c4 |
---|---|
36 #include "asmrp.h" | 36 #include "asmrp.h" |
37 #include "sdpplin.h" | 37 #include "sdpplin.h" |
38 #include "xbuffer.h" | 38 #include "xbuffer.h" |
39 #include "libavutil/md5.h" | 39 #include "libavutil/md5.h" |
40 #include "libavutil/intreadwrite.h" | 40 #include "libavutil/intreadwrite.h" |
41 #include "libavutil/base64.h" | |
41 #include "stream/http.h" | 42 #include "stream/http.h" |
42 #include "mp_msg.h" | 43 #include "mp_msg.h" |
43 | 44 |
44 /* | 45 /* |
45 #define LOG | 46 #define LOG |
489 } | 490 } |
490 if (!strstr(authreq, "Basic")) { | 491 if (!strstr(authreq, "Basic")) { |
491 mp_msg(MSGT_STREAM, MSGL_ERR, "realrtsp: authenticator not supported (%s)\n", authreq); | 492 mp_msg(MSGT_STREAM, MSGL_ERR, "realrtsp: authenticator not supported (%s)\n", authreq); |
492 goto autherr; | 493 goto autherr; |
493 } | 494 } |
494 authlen = strlen(username) + (password ? strlen(password) : 0) + 2; | 495 authlen = strlen(username) + 1 + (password ? strlen(password) : 0); |
495 authstr = malloc(authlen); | 496 authstr = malloc(authlen + 1); |
496 sprintf(authstr, "%s:%s", username, password ? password : ""); | 497 sprintf(authstr, "%s:%s", username, password ? password : ""); |
497 authfield = malloc(authlen*2+22); | 498 b64_authlen = AV_BASE64_SIZE(authlen); |
499 authfield = malloc(21 + b64_authlen); | |
498 strcpy(authfield, "Authorization: Basic "); | 500 strcpy(authfield, "Authorization: Basic "); |
499 b64_authlen = base64_encode(authstr, authlen, authfield+21, authlen*2); | 501 av_base64_encode(authfield + 21, b64_authlen, authstr, authlen); |
500 free(authstr); | 502 free(authstr); |
501 if (b64_authlen < 0) { | |
502 mp_msg(MSGT_STREAM, MSGL_ERR, "realrtsp: base64 output overflow, this should never happen\n"); | |
503 goto autherr; | |
504 } | |
505 authfield[b64_authlen+21] = 0; | |
506 goto rtsp_send_describe; | 503 goto rtsp_send_describe; |
507 } | 504 } |
508 autherr: | 505 autherr: |
509 | 506 |
510 free(authfield); | 507 free(authfield); |