diff options
author | Martin Storsjö <martin@martin.st> | 2011-01-06 15:22:58 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-01-06 15:22:58 +0000 |
commit | a92c30d76ef3bc58be47acb8f32a2fd0bfe403e3 (patch) | |
tree | dac66e093e6b393ee38faff0a89b264a67458edc /libavformat/rtsp.c | |
parent | 21a569f3022e968d74bfde4d1bfff8dab5edd41c (diff) | |
download | ffmpeg-a92c30d76ef3bc58be47acb8f32a2fd0bfe403e3.tar.gz |
rtsp: Allow requesting of filtering of source packets
If filtered, only packets from the right source address and port
are received.
To test, play back e.g. some mpeg4 video RTSP stream (where the
video stream is the first stream in the presentation) over UDP.
While receiving this stream, send another stream to the same port:
ffmpeg -re -i <whatever> -vcodec mpeg4 -an -f rtp
rtp://127.0.0.1:5000?localport=1234
Normally, the RTSP playback reports lots of errors at this point.
If the RTSP stream has the ?filter_src option enabled, these
interferring packets are ignored.
Originally committed as revision 26246 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index a38cc42408..b09ebd7642 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1186,16 +1186,18 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port, break; case RTSP_LOWER_TRANSPORT_UDP: { - char url[1024]; + char url[1024], options[30] = ""; + if (rt->filter_source) + av_strlcpy(options, "?connect=1", sizeof(options)); /* Use source address if specified */ if (reply->transports[0].source[0]) { ff_url_join(url, sizeof(url), "rtp", NULL, reply->transports[0].source, - reply->transports[0].server_port_min, NULL); + reply->transports[0].server_port_min, options); } else { ff_url_join(url, sizeof(url), "rtp", NULL, host, - reply->transports[0].server_port_min, NULL); + reply->transports[0].server_port_min, options); } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { @@ -1315,6 +1317,8 @@ redirect: } else if(!strcmp(option, "http")) { lower_transport_mask |= (1<< RTSP_LOWER_TRANSPORT_TCP); rt->control_transport = RTSP_MODE_TUNNEL; + } else if (!strcmp(option, "filter_src")) { + rt->filter_source = 1; } else { /* Write options back into the buffer, using memmove instead * of strcpy since the strings may overlap. */ |