[FFmpeg-cvslog] rtsp: Support multicast source filters (RFC 4570)
Ed Torbett
git at videolan.org
Sat Jul 20 10:48:46 CEST 2013
ffmpeg | branch: master | Ed Torbett <ed.torbett at simulation-systems.co.uk> | Thu Jun 27 08:53:00 2013 +0100| [36fb0d02a1faa11eaee51de01fb4061ad6092af9] | committer: Martin Storsjö
rtsp: Support multicast source filters (RFC 4570)
This supports inclusion of one single IP address for now,
at the media level. Specifying the filter at the session level
(instead of at the media level), multiple source addresses,
exclusion, or using FQDNs instead of plain IP addresses is not
supported (yet at least).
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=36fb0d02a1faa11eaee51de01fb4061ad6092af9
---
libavformat/rtsp.c | 18 ++++++++++++++++++
libavformat/rtsp.h | 1 +
2 files changed, 19 insertions(+)
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 29ef403..7217640 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -495,6 +495,22 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
p += strspn(p, SPACE_CHARS);
if (av_strstart(p, "inline:", &p))
get_word(rtsp_st->crypto_params, sizeof(rtsp_st->crypto_params), &p);
+ } else if (av_strstart(p, "source-filter:", &p) && s->nb_streams > 0) {
+ get_word(buf1, sizeof(buf1), &p);
+ if (strcmp(buf1, "incl"))
+ return;
+
+ get_word(buf1, sizeof(buf1), &p);
+ if (strcmp(buf1, "IN") != 0)
+ return;
+ get_word(buf1, sizeof(buf1), &p);
+ if (strcmp(buf1, "IP4") && strcmp(buf1, "IP6"))
+ return;
+ // not checking that the destination address actually matches
+ get_word(buf1, sizeof(buf1), &p);
+
+ rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
+ get_word(rtsp_st->source_addr, sizeof(rtsp_st->source_addr), &p);
} else {
if (rt->server_type == RTSP_SERVER_WMS)
ff_wms_parse_sdp_a_line(s, p);
@@ -2085,6 +2101,8 @@ static int sdp_read_header(AVFormatContext *s)
"?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port,
rtsp_st->sdp_ttl,
rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0);
+ if (rtsp_st->source_addr[0])
+ av_strlcatf(url, sizeof(url), "&sources=%s", rtsp_st->source_addr);
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, NULL) < 0) {
err = AVERROR_INVALIDDATA;
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 44240c1..eff5aa4 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -425,6 +425,7 @@ typedef struct RTSPStream {
//@{
int sdp_port; /**< port (from SDP content) */
struct sockaddr_storage sdp_ip; /**< IP address (from SDP content) */
+ char source_addr[100]; /**< Source-specific multicast source IP address (from SDP content) */
int sdp_ttl; /**< IP Time-To-Live (from SDP content) */
int sdp_payload_type; /**< payload type */
//@}
More information about the ffmpeg-cvslog
mailing list