summaryrefslogtreecommitdiff
path: root/libavformat/rtsp.c
Commit message (Collapse)AuthorAge
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-31
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Add FFInputFormat, hide internals of AVInputFormatAndreas Rheinhardt2024-03-07
| | | | | | | | | | | | | | | | | | | | | This commit does for AVInputFormat what commit 59c9dc82f450638a3068deeb1db5c56f6d155752 did for AVOutputFormat: It adds a new type FFInputFormat, moves all the internals of AVInputFormat to it and adds a now reduced AVInputFormat as first member. This does not affect/improve extensibility of both public or private fields for demuxers (it is still a mess due to lavd). This is possible since 50f34172e0cca2cabc5836308ec66dbf93f5f2a3 (which removed the last usage of an internal field of AVInputFormat in fftools). (Hint: tools/probetest.c accesses the internals of FFInputFormat as well, but given that it is a testing tool this is not considered a problem.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: use designated initializers for AVOption.unitAnton Khirnov2024-02-14
| | | | | | | | | | | | | | | | | | | | | | | | Makes it robust against adding fields before it, which will be useful in following commits. Majority of the patch generated by the following Coccinelle script: @@ typedef AVOption; identifier arr_name; initializer list il; initializer list[8] il1; expression tail; @@ AVOption arr_name[] = { il, { il1, - tail + .unit = tail }, ... }; with some manual changes, as the script: * has trouble with options defined inside macros * sometimes does not handle options under an #else branch * sometimes swallows whitespace
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-20
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* avformat/rtsp: Support mode field of Transport header being sent in upper casePaul Orlyk2024-01-16
| | | | | | | Fixes server compatibility issues with rtspclientsink GStreamer plugin Signed-off-by: Paul Orlyk <paul.orlyk@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-22
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rtsp: Use rtsp_st->stream_indexMichael Niedermayer2023-10-27
| | | | | | | | | Fixes: out of array access Fixes: rtpdec_h264.c149/poc Found-by: Hardik Shah of Vehere Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aviobuf: Add ffio_init_(read|write)_context()Andreas Rheinhardt2023-09-07
| | | | | | | | | | | | | | Most users of ffio_init_context() simply want to wrap a buffer into an AVIOContext; they do not provide function pointers at all. Therefore this commit adds shortcuts for these two common operations. This also allows to accept const data when reading (i.e. the const is now cast away at a central place in ffio_init_read_context() instead of at several callers). This also allows to constify the data in ff_text_init_buf(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Don't include avcodec.hAndreas Rheinhardt2022-09-26
| | | | | | | | | | | | | | | The general demuxing API uses parsers and decoders. Therefore FFStream contains pointers to AVCodecContexts and AVCodecParserContext and lavf/internal.h includes lavc/avcodec.h. Yet actually only a few files files really use these; and it is best when this number stays small. Therefore this commit uses opaque structs in lavf/internal.h for these contexts and stops including avcodec.h. This also avoids including lavc/codec_desc.h implicitly. All other headers are implicitly included as now (mostly through codec.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rtsp: break on unknown protocolsMichael Niedermayer2022-07-12
| | | | | | | | | This function needs more cleanup and it lacks error handling Fixes: use of uninitialized memory Fixes: CID700776 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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>