diff options
author | Ed Torbett <ed.torbett@simulation-systems.co.uk> | 2013-07-18 20:04:16 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-07-19 12:00:49 +0300 |
commit | 336353deaad6e4da28665f50a36988b02b55c20c (patch) | |
tree | b8c07261b1452fffa4c7d1596c40464a00799d2f | |
parent | 910042072a88cdf64490e31f0b791caaaaf07a92 (diff) | |
download | ffmpeg-336353deaad6e4da28665f50a36988b02b55c20c.tar.gz |
rtpproto: Support IGMPv3 source specific multicast inclusion
Blocking/exclusion is not supported yet.
The rtp protocol parameter takes the same form as the existing
sources parameter for the udp protocol.
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r-- | libavformat/rtpproto.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 190dff4bd2..20ffdab491 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -99,7 +99,8 @@ static av_printf_format(3, 4) void url_add_option(char *buf, int buf_size, const static void build_udp_url(char *buf, int buf_size, const char *hostname, int port, int local_port, int ttl, - int max_packet_size, int connect) + int max_packet_size, int connect, + const char* sources) { ff_url_join(buf, buf_size, "udp", NULL, hostname, port, NULL); if (local_port >= 0) @@ -110,6 +111,8 @@ static void build_udp_url(char *buf, int buf_size, url_add_option(buf, buf_size, "pkt_size=%d", max_packet_size); if (connect) url_add_option(buf, buf_size, "connect=1"); + if (sources && sources[0]) + url_add_option(buf, buf_size, "sources=%s", sources); } /** @@ -122,6 +125,7 @@ static void build_udp_url(char *buf, int buf_size, * 'connect=0/1' : do a connect() on the UDP socket * deprecated option: * 'localport=n' : set the local port to n + * 'sources=ip[,ip]' : list allowed source IP addresses * * if rtcpport isn't set the rtcp port will be the rtp port + 1 * if local rtp port isn't set any available port will be used for the local @@ -135,7 +139,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags) int rtp_port, rtcp_port, ttl, connect, local_rtp_port, local_rtcp_port, max_packet_size; - char hostname[256]; + char hostname[256], sources[1024] = ""; char buf[1024]; char path[1024]; const char *p; @@ -173,11 +177,14 @@ static int rtp_open(URLContext *h, const char *uri, int flags) if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { connect = strtol(buf, NULL, 10); } + if (av_find_info_tag(buf, sizeof(buf), "sources", p)) { + av_strlcpy(sources, buf, sizeof(sources)); + } } build_udp_url(buf, sizeof(buf), hostname, rtp_port, local_rtp_port, ttl, max_packet_size, - connect); + connect, sources); if (ffurl_open(&s->rtp_hd, buf, flags, &h->interrupt_callback, NULL) < 0) goto fail; if (local_rtp_port>=0 && local_rtcp_port<0) @@ -185,7 +192,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags) build_udp_url(buf, sizeof(buf), hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size, - connect); + connect, sources); if (ffurl_open(&s->rtcp_hd, buf, flags, &h->interrupt_callback, NULL) < 0) goto fail; |