summaryrefslogtreecommitdiff
path: root/libavformat/rtmpproto.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-03-05 22:35:21 +0000
committerMartin Storsjö <martin@martin.st>2010-03-05 22:35:21 +0000
commit57b5555c91a9792e3ac99102b3d1a5c44b45fdd9 (patch)
treee9b6fa60b663ea3dbbf3bebc1c0c2943246293c4 /libavformat/rtmpproto.c
parent780d7897a9c9295b43f1f0e9b49a11f99cd402c3 (diff)
Use ff_url_join for assembling URLs, instead of snprintf
This ensures proper escaping of numerical IPv6 addresses. The RTSP (de)muxer needs its own network initialization, since it isn't a protocol and url_open hasn't been called yet. Originally committed as revision 22226 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtmpproto.c')
-rw-r--r--libavformat/rtmpproto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index b5f419cb7e..7fd0da8144 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -113,7 +113,7 @@ static void gen_connect(URLContext *s, RTMPContext *rt, const char *proto,
ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 4096);
p = pkt.data;
- snprintf(tcurl, sizeof(tcurl), "%s://%s:%d/%s", proto, host, port, rt->app);
+ ff_url_join(tcurl, sizeof(tcurl), proto, NULL, host, port, "/%s", rt->app);
ff_amf_write_string(&p, "connect");
ff_amf_write_number(&p, 1.0);
ff_amf_write_object_start(&p);
@@ -817,7 +817,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
if (port < 0)
port = RTMP_DEFAULT_PORT;
- snprintf(buf, sizeof(buf), "tcp://%s:%d", hostname, port);
+ ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
if (url_open(&rt->stream, buf, URL_RDWR) < 0) {
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot open connection %s\n", buf);