From d440798f5747143f02557e735c574a2c42e29931 Mon Sep 17 00:00:00 2001 From: James Lumsden Date: Sat, 6 Sep 2014 15:40:43 +0200 Subject: Add support for transport protocol specific RTSP URL handlers Fixes issue 480. Signed-off-by: Hendrik Leppkes --- demuxer/Demuxers/LAVFDemuxer.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'demuxer') diff --git a/demuxer/Demuxers/LAVFDemuxer.cpp b/demuxer/Demuxers/LAVFDemuxer.cpp index 56c2ca03..c601b9c6 100644 --- a/demuxer/Demuxers/LAVFDemuxer.cpp +++ b/demuxer/Demuxers/LAVFDemuxer.cpp @@ -204,6 +204,25 @@ STDMETHODIMP CLAVFDemuxer::OpenInputStream(AVIOContext *byteContext, LPCOLESTR p memcpy(fileName, "http", 4); } + const char * rtsp_transport = nullptr; + // check for rtsp transport protocol options + if (_strnicmp("rtsp", fileName, 4) == 0) { + if (_strnicmp("rtspu:", fileName, 6) == 0) { + rtsp_transport = "udp"; + } else if (_strnicmp("rtspm:", fileName, 6) == 0) { + rtsp_transport = "udp_multicast"; + } else if (_strnicmp("rtspt:", fileName, 6) == 0) { + rtsp_transport = "tcp"; + } else if (_strnicmp("rtsph:", fileName, 6) == 0) { + rtsp_transport = "http"; + } + + // replace "rtsp[u|m|t|h]" protocol by rtsp + if (rtsp_transport != nullptr) { + memmove(fileName + 4, fileName + 5, strlen(fileName) - 4); + } + } + AVIOInterruptCB cb = {avio_interrupt_cb, this}; trynoformat: @@ -250,6 +269,10 @@ trynoformat: AVDictionary *options = nullptr; av_dict_set(&options, "icy", "1", 0); // request ICY metadata + if (rtsp_transport != nullptr) { + av_dict_set(&options, "rtsp_transport", rtsp_transport, 0); + } + m_timeOpening = time(nullptr); ret = avformat_open_input(&m_avFormat, fileName, inputFormat, &options); av_dict_free(&options); -- cgit v1.2.3