summaryrefslogtreecommitdiff
path: root/libavformat/rtsp.c
Commit message (Collapse)AuthorAge
* libavformat/rtsp: pkt_size option is not honored in rtspYubo Xie2022-04-27
| | | | | Signed-off-by: xyb <xyb@xyb.name> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtp: convert to new channel layout APIVittorio Giovara2022-03-15
| | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/rtsp: #if unused functions away, fix -O0 compilationAndreas Rheinhardt2022-01-08
| | | | | | | | | | | parse_rtsp_message() is only called if the rtsp demuxer is enabled and so it is normally compiled away if said demuxer is disabled. Yet this does not happen when compiling with -O0 and this leads to a linking failure because parse_rtsp_message() calls functions that may not be available if the rtsp demuxer is disabled. Fix this by properly #if'ing the unused functions away. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rtsp: fix the error code from ffurl_read_complete()Limin Wang2021-12-07
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: add error code handling for ff_rtsp_skip_packet()Limin Wang2021-12-07
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: free the alloc memory if failedLimin Wang2021-12-07
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: remove redundant assignmentLimin Wang2021-12-07
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: load the sdp file with avio_read_to_bprint()Limin Wang2021-12-04
| | | | | | | this allows getting rid of the hardcoded max size of SDP. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* all: Use av_memdup() where appropriateAndreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rtp: add localaddr for network interface selectionLimin Wang2021-11-27
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: Use av_dict_set_int()Andreas Rheinhardt2021-09-19
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Avoid allocation for AVStreamInternalAndreas Rheinhardt2021-09-17
| | | | | | | | | | Do this by allocating AVStream together with the data that is currently in AVStreamInternal; or rather: Put AVStream at the beginning of a new structure called FFStream (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVStreamInternal altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avio: Move internal AVIOContext fields to avio_internal.hAndreas Rheinhardt2021-08-25
| | | | | | | | | | | | | | Currently AVIOContext's private fields are all over AVIOContext. This commit moves them into a new structure in avio_internal.h instead. Said structure contains the public AVIOContext as its first element in order to avoid having to allocate a separate AVIOContextInternal which is costly for those use cases where one just wants to access an already existing buffer via the AVIOContext-API. For these cases ffio_init_context() can't fail and always returned zero, which was typically not checked. Therefore it has been made to not return anything. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavformat/rtsp.c: Reply to GET_PARAMETER requestsHayden Myers2021-07-12
| | | | | | | | | | | | | | Some encoders send GET_PARAMETER requests as a keep-alive mechanism. If the client doesn't reply with an OK message, the encoder will close the session. This was encountered with the impath i5110 encoder, when the RTSP Keep-Alive checkbox is enabled under streaming settings. Alternatively one may set the X-No-Keepalive: 1 header, but this is more of a workaround. It's better practice to respond to an encoder's keep-alive request, than disable the mechanism which may be manufacturer specific. Signed-off-by: Hayden Myers <hmyers@skylinenet.net> Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/rtsp: Include rtcp in port range checkAndriy Gelman2021-07-05
| | | | | | | Currently it is only checked that the rtp port does not exceed rtp_port_max. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat/rtsp: Reindent after previous commitAndriy Gelman2021-07-05
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat/rtsp: Set port_off to zero for low min/max port rangeAndriy Gelman2021-07-05
| | | | | | | | | Fixes: $ ffmpeg -min_port 32000 -max_port 32001 -i rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov -f null - [1] 303871 floating point exception (core dumped) Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat/rtsp: Fix timeout optionAndriy Gelman2021-07-05
| | | | | | | | | | | | | | | | | | | | | | | 92c40ef882be115e72d2aa02f9032b7ce88f8537 added a listen_timeout option for sdp. This allowed a user to set variable timeout which was originally hard coded to 10 seconds. The commit used the initial_timeout variable to store the value. But this variable is shared with rtsp where it's used to infer a "listen" mode. Thus, the timeout value could not be set in rtsp, and the default value (initial_timeout = -1) would give 100ms timeout. This was attempted to be fixed in c8101aabee654f6d147a4d89f77fa73e18908610, which changed the meaning of initial_timeout = -1 to be an infinite timeout. However, it did not address the issue that the timeout could still not be set. Being able to set the timeout is useful because it allows to automatically reconfigure from a udp to tcp connection in the lower transport. In this commit this is fixed by using the stimeout variable to store the timeout value. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat: move AVStream.{parser,need_parsing} to AVStreamInternalJames Almer2021-05-07
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/rtsp: Remove deprecated old options, rename stimeout->timeoutAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in ff46124b0df17a1d35249e09ae8eae9a61f16e04. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/rtsp: support buffer_size and pkt_size options for RTPJiangjie Gao2021-03-19
| | | | | | | | | And forward it to the underlying UDP protocol. Fixes ticket #7517. Signed-off-by: Jiangjie Gao <gaojiangjie@live.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/rtsp: Fix build failure when RTP demuxers are disabledAndreas Rheinhardt2021-02-03
| | | | | | | | | | | | | | | rtsp.c uses a check of the form "if (CONFIG_RTSP_DEMUXER && ...) {}" with the intent to make the code compilable even though the part guarded by this check contains calls to functions that don't exist when the RTSP demuxer is disabled. Yet even then compilers still need a declaration of all the functions in the dead code block and error out if not (due to our usage of -Werror=implicit-function-declaration) and no such declaration exists for a static function in rtsp.c. Simply adding a declaration leads to a "used but never defined" warning, therefore this commit resorts to an #if. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/rtsp: correctly set media control uri with mpegtstpol2021-01-17
| | | | | | | | | | | | | | | | Fixes #1941 Currently the media control uri is not correctly assigned when mpegts is signalled in the media description. The code checks whether at least one AVStream has been setup before assigning to the media's uri. With mpegts the AVStreams are setup when parsing packets and so the media's uri is skipped. This is fixed by using rt->nb_rtsp_streams in the check which counts all medias in the sdp. Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat/rtsp: add satip_raw flag to receive raw mpegts streamAman Karmani2020-12-28
| | | | | | | | | | | | | | | | | | | This can be used to receive the raw mpegts stream from a SAT>IP server, by letting avformat handle the RTSP/RTP/UDP negotiation and setup, but then simply passing the MP2T stream through instead of demuxing it further. For example, this command would demux/remux the mpegts stream: SATIP_URL='satip://192.168.1.99:554/?src=1&freq=12188&pol=h&ro=0.35&msys=dvbs&mtype=qpsk&plts=off&sr=27500&fec=34&pids=0,17,18,167,136,47,71' ffmpeg -i $SATIP_URL -map 0 -c copy -f mpegts -y remux.ts Whereas this command will simply write out the raw stream, with the original PAT/PMT/PIDs intact: ffmpeg -rtsp_flags satip_raw -i $SATIP_URL -map 0 -c copy -f data -y raw.ts Signed-off-by: Aman Karmani <aman@tmm1.net>
* avformat/rtsp: add support for satip://Aman Karmani2020-12-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SAT>IP protocol[1] is similar to RTSP. However SAT>IP servers are assumed to speak only MP2T, so DESCRIBE is not used in the same way. When no streams are active, DESCRIBE will return 404 according to the spec (see section 3.5.7). When streams are active, DESCRIBE will return a list of all current streams along with information about their signal strengths. Previously, attemping to use ffmpeg with a rtsp:// url that points to a SAT>IP server would work with some devices, but fail due to 404 response on others. Further, if the SAT>IP server was already streaming, ffmpeg would incorrectly consume the DESCRIBE SDP response and join an existing tuner instead of requesting a new session with the URL provided by the user. These issues have been noted by many users across the internet[2][3][4]. This commit adds proper spec-compliant support for SAT>IP, including: - support for the satip:// psuedo-protocol[5] - avoiding the use of DESCRIBE - parsing and consuming the com.ses.streamID response header - using "Transport: RTP/AVP;unicast" because the optional "/UDP" suffix confuses some servers This patch has been validated against multiple SAT>IP vendor devices: - Telestar Digibit R2 (https://telestar.de/en/produkt/digibit-r1-2/) - Kathrein EXIP 418 (https://www.kathrein-ds.com/en/produkte/sat-zf-verteiltechnik/sat-ip/227/exip-418) - Kathrein EXIP 4124 (https://www.kathrein-ds.com/en/products/sat-if-signal-distribution/sat-ip/226/exip-4124) - Megasat MEG-8000 (https://www.megasat.tv/produkt/sat-ip-server-3/) - Megasat Twin (https://www.megasat.tv/en/produkt/sat-ip-server-twin/) - Triax TSS 400 (https://www.conrad.com/p/triax-tss-400-mkii-sat-ip-server-595256) [1] https://www.satip.info/sites/satip/files/resource/satip_specification_version_1_2_2.pdf [2] https://stackoverflow.com/questions/61194344/does-ffmpeg-violate-the-satip-specification-describe-syntax [3] https://github.com/kodi-pvr/pvr.iptvsimple/issues/196 [4] https://forum.kodi.tv/showthread.php?tid=359072&pid=2995884#pid2995884 [5] https://www.satip.info/resources/channel-lists/
* avformat/rtsp: set AV_OPT_FLAG_DEPRECATED on deprecated optionsAndriy Gelman2020-12-18
| | | | | Reviewed-by: Zhao Zhili <zhilizhao@tencent.com> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat/rtsp: prefer to use MAX_URL_SIZE for url and command bufferLimin Wang2020-12-05
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: don't forget to call ff_network_close() on errorAndriy Gelman2020-11-21
| | | | | | | | | | | In sdp_read_header() some ff_network_close() calls were missed. Also in rtp_read_header() update comment to explain why a single call to ff_network_close() is enough to cover all cases even if sdp_read_header() returns an error. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat/rtsp: set return variable in error pathAndriy Gelman2020-11-21
| | | | | | | | In this error path ret still stores the number of bytes read in ffurl_read(). Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat/rtsp: av_rescale -> av_rescale_qLimin Wang2020-11-14
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: check return value of ffurl_read_completeLimin Wang2020-11-11
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: prefer to use variable instead of typeLimin Wang2020-11-11
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: move SDP_MAX_SIZE macro definition to header fileLimin Wang2020-11-11
| | | | | | | | | | | | | move comments for the size of SDP_MAX_SIZE here: Some SDP lines, particularly for Realmedia or ASF RTSP streams, contain long SDP lines containing complete ASF Headers (several kB) or arrays of MDPR (RM stream descriptor) headers plus "rulebooks" describing their properties. Therefore, the SDP line buffer is large. The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line in rtpdec_xiph.c. Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: 16384 -> SDP_MAX_SIZELimin Wang2020-11-11
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: support infinite initial_timeout for rtsp optionLimin Wang2020-11-07
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: reuse POLLING_TIME and remove POLL_TIMEOUT_MSLimin Wang2020-10-22
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: support for listen_timeout option for sdpLimin Wang2020-10-22
| | | | | | | | Now the listen timeout is hardcoded(10s). How to test(30s timeout): ./ffprobe -listen_timeout 30 -protocol_whitelist rtp,udp,file -i test.sdp Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtsp: allocate correct max number of pollfdsAndriy Gelman2020-10-08
| | | | | | | There is one general rtsp connection plus two connections per stream (rtp/rtcp). Reviewed-by: Zhao Zhili <zhilizhao@tencent.com> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
* avformat/rtsp: fix parse_rtsp_messageZhao Zhili2020-10-02
| | | | | | | 1. Remove the assumption that the message method is TEARDOWN. 2. Don't ignore the error code of ff_rtsp_parse_streaming_commands. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Fix infinite loop in listen mode with UDP transportMartin Storsjö2020-10-02
| | | | | | | | | | | | | | | | | | | | | | In listen mode with UDP transport, once the sender has sent the TEARDOWN and closed the connection, poll will indicate that one can read from the connection (indicating that the socket has reached EOF and should be closed by the receiver as well). In this case, parse_rtsp_message won't try to parse the command (because it's no longer in state STREAMING), but previously just returned zero. Prior to f6161fccf8c5720ceac1ed1df8ba60ff8fed69f5, this caused udp_read_packet to return zero, which is treated as EOF by read_packet. But after that commit, udp_read_packet would continue if parse_rtsp_message didn't return an explicit error code. To keep the original behaviour from before that commit, more explicitly return an error in parse_rtsp_message when in the wrong state. Fixes: #8840 Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat: Replace ffurl_close() by ffurl_closep() where appropriateAndreas Rheinhardt2020-05-25
| | | | | | | | | | It avoids leaving dangling pointers behind in memory. Also remove redundant checks for whether the URLContext to be closed is already NULL. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/rtsp: Put strings instead of pointers to strings into arrayAndreas Rheinhardt2020-04-20
| | | | | | | | | | | | | In this example, the difference in length between the shortest and longest string is three, so that not using pointers to strings saves space even on 32bit systems. Moreover, there is no need to use a sentinel here; it can be replaced with FF_ARRAY_ELEMS. Reviewed-by: Ross Nicholson <phunkyfish@gmail.com> Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/rtsp: Don't free uninitialized AVBPrintAndreas Rheinhardt2020-04-20
| | | | | | | | Fixes Coverity ID 1462307. Reviewed-by: Marton Balint <cus@passwd.hu> Reviewed-by: Ross Nicholson <phunkyfish@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavformat/rtsp: pass protocol options for udp multicastWolfgang Haupt2020-04-19
| | | | | | | Protocol options like buffer_size need to be passed to the underlying transport implementation for udp multicasts as well. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/rtp: Pass sources and block filter addresses via sdp file for rtpphunkyfish2020-04-19
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* Revert "avformat/rtp: Pass sources and block filter addresses via sdp file ↵Carl Eugen Hoyos2020-04-05
| | | | | | | | | | for rtp" This reverts commit b71685865fe761925feedda3cd0b288224d9a509. The commit lead to the use of an uninitialized variable. Other issues were listed by Andreas Rheinhardt: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/259150.html
* avformat/rtp: Pass sources and block filter addresses via sdp file for rtpphunkyfish2020-03-27
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>