summaryrefslogtreecommitdiff
path: root/libavformat/avio.c
Commit message (Collapse)AuthorAge
* avformat/avio: Check av_opt_copy() for failureMichael Niedermayer2021-05-27
| | | | | | Fixes: CID1477416 Unchecked return value Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avio: do not export avpriv_io_{move,delete}Anton Khirnov2021-05-22
| | | | | They are private and not used by anything outside of lavf. There is no reason for them to be exported.
* avutil: remove deprecated AVClass.child_class_nextJames Almer2021-04-27
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/avio: Use av_strstart instead of strncmpAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and avoids calculating the length in advance. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/avio: Remove ffurl_openAndreas Rheinhardt2021-02-02
| | | | | | It is only used in commented-out (and nonworking) code in async.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* URLContext: switch to child_class_iterate()Anton Khirnov2020-06-10
|
* remove CHAR_MIN/CHAR_MAX usagePaul B Mahol2020-03-17
| | | | It is not needed at all.
* avformat/avio: fix ff_rename to respect used protocolMarton Balint2020-01-19
| | | | | | | | | | | Also simplify it and make it always log the error. This fixes for example the image2 muxer when used with an URL which also contains the protocol: ffmpeg -f lavfi -i testsrc -vframes 10 -atomic_writing 1 file:out%d.png Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/avio: move ff_rename implementation from internal.h to avio.cMarton Balint2020-01-19
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/avio: Use ffurl_closepAndreas Rheinhardt2019-11-29
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/avio: Print https warning also for avio_find_protocol_name().Carl Eugen Hoyos2019-10-01
| | | | Helps to fix ticket #8197.
* avformat/avio: make the logic simpleJun Zhao2018-05-06
| | | | | | remove the "ret" to make the code simple and generic. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* avformat/avio: check input URLContext value NULLSteven Liu2017-12-28
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Reviewed-by: Karthick Jeyapal <kjeyapal@akamai.com>
* lavf/avio: Print the https warning also for missing tls protocol.Carl Eugen Hoyos2017-10-23
|
* libavformat: not treat 0 as EOFDaniel Kucera2017-10-19
| | | | | | | | | | transfer_func variable passed to retry_transfer_wrapper are h->prot->url_read and h->prot->url_write functions. These need to return EOF or other error properly. In case of returning >= 0, url_read/url_write is retried until error is returned. Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
* avformat/avio: Remove no-op code in url_find_protocol().Wan-Teh Chang2017-07-10
| | | | | | | | | | | | | In url_find_protocol(), proto_str is either "file" or a string consisting of only the characters in URL_SCHEME_CHARS, which does not include ','. Therefore the strchr(proto_str, ',') call always returns NULL. Note: The code was added in commit 6161c41817f6e53abb3021d67ca0f19def682718. Signed-off-by: Wan-Teh Chang <wtc@google.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* lavf/avio: Be more explicit in logging white/black list matchesAlexander Strasser2017-03-14
| | | | | | | | | The current form of the messages indicating matches in the white or black lists seems to be a bit too much relying on context. Make the messages more explicit. Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
* lavf/avio: Remove unnecessary escaping of ' in string literalsAlexander Strasser2017-03-14
| | | | Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
* HTTP: improve performance by reducing forward seeksJoel Cunningham2017-02-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit optimizes HTTP performance by reducing forward seeks, instead favoring a read-ahead and discard on the current connection (referred to as a short seek) for seeks that are within a TCP window's worth of data. This improves performance because with TCP flow control, a window's worth of data will be in the local socket buffer already or in-flight from the sender once congestion control on the sender is fully utilizing the window. Note: this approach doesn't attempt to differentiate from a newly opened connection which may not be fully utilizing the window due to congestion control vs one that is. The receiver can't get at this information, so we assume worst case; that full window is in use (we did advertise it after all) and that data could be in-flight The previous behavior of closing the connection, then opening a new with a new HTTP range value results in a massive amounts of discarded and re-sent data when large TCP windows are used. This has been observed on MacOS/iOS which starts with an initial window of 256KB and grows up to 1MB depending on the bandwidth-product delay. When seeking within a window's worth of data and we close the connection, then open a new one within the same window's worth of data, we discard from the current offset till the end of the window. Then on the new connection the server ends up re-sending the previous data from new offset till the end of old window. Example (assumes full window utilization): TCP window size: 64KB Position: 32KB Forward seek position: 40KB * (Next window) 32KB |--------------| 96KB |---------------| 160KB * 40KB |---------------| 104KB Re-sent amount: 96KB - 40KB = 56KB For a real world test example, I have MP4 file of ~25MB, which ffplay only reads ~16MB and performs 177 seeks. With current ffmpeg, this results in 177 HTTP GETs and ~73MB worth of TCP data communication. With this patch, ffmpeg issues 4 HTTP GETs and 3 seeks for a total of ~22MB of TCP data communication. To support this feature, the short seek logic in avio_seek() has been extended to call a function to get the short seek threshold value. This callback has been plumbed to the URLProtocol structure, which now has infrastructure in HTTP and TCP to get the underlying receiver window size via SO_RCVBUF. If the underlying URL and protocol don't support returning a short seek threshold, the default s->short_seek_threshold is used This feature has been tested on Windows 7 and MacOS/iOS. Windows support is slightly complicated by the fact that when TCP window auto-tuning is enabled, SO_RCVBUF doesn't report the real window size, but it does if SO_RCVBUF was manually set (disabling auto-tuning). So we can only use this optimization on Windows in the later case Signed-off-by: Joel Cunningham <joel.cunningham@me.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/avio: Fix null pointer dereference in case of memleakMichael Niedermayer2016-05-18
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/avio: fix memory leak in url_find_protocolYong Lei2016-05-18
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit 'fab8156b2f30666adabe227b3d7712fd193873b1'Derek Buitenhuis2016-04-21
|\ | | | | | | | | | | | | * commit 'fab8156b2f30666adabe227b3d7712fd193873b1': avio: Copy URLContext generic options into child URLContexts Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * avio: Copy URLContext generic options into child URLContextsMartin Storsjö2016-03-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since all URLContexts have the same AVOptions, such AVOptions will be applied on the outermost context only and removed from the dict, while they probably make sense on all contexts. This makes sure that rw_timeout gets propagated to the innermost URLContext (to make sure it gets passed to the tcp protocol, when opening a http connection for instance). Alternatively, such matching options would be kept in the dict and only removed after the ffurl_connect call. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'ccea588f831906084b8c8235222920e6984beb72'Derek Buitenhuis2016-04-18
|\| | | | | | | | | | | | | * commit 'ccea588f831906084b8c8235222920e6984beb72': avio: Add an option 'rw_timeout' Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * avio: Add an option 'rw_timeout'Andrey Utkin2016-03-24
| | | | | | | | | | | | | | | | | | | | | | If set non-zero, this limits duration of the retry_transfer_wrapper() loop, thus affecting ffurl_read*(), ffurl_write(). As soon as one single byte is successfully received/transmitted, the timer restarts. This has further changes by Michael Niedermayer and Martin Storsjö. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'd44f3e4059506a182f59218b1e967d42b01e097c'Derek Buitenhuis2016-04-18
|\| | | | | | | | | | | | | * commit 'd44f3e4059506a182f59218b1e967d42b01e097c': avio: Apply avoptions on the URLContext itself as well Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * avio: Apply avoptions on the URLContext itself as wellMartin Storsjö2016-03-24
| | | | | | | | | | | | | | Currently the list of avoptions for URLContext is empty though, but such options will be added. Signed-off-by: Martin Storsjö <martin@martin.st>
| * urlprotocol: receive a list of protocols from the callerAnton Khirnov2016-02-22
| | | | | | | | | | This way, the decisions about which protocols are available for use in any given situations can be delegated to the caller.
* | lavf/avio: Remove linebreak from https warning.Carl Eugen Hoyos2016-04-10
| |
* | avformat/avio: Fix unknown protocol handlingMichael Niedermayer2016-03-17
| | | | | | | | | | | | Fixes regression since bb8cc89b2986df6f60831b67cd250da312cce1d0 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat: Add a protocol blacklisting APIDerek Buitenhuis2016-03-04
| | | | | | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | Merge commit '832a202c47a246ed15e3edc6b05dfcfa7d82c4b2'Derek Buitenhuis2016-02-29
|\| | | | | | | | | | | | | * commit '832a202c47a246ed15e3edc6b05dfcfa7d82c4b2': protocols: make the list of protocols static Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * protocols: make the list of protocols staticAnton Khirnov2016-02-22
| | | | | | | | | | Disallow other code to touch it directly, now it's only accessible through a blacklisting/whitelisting function.
* | Merge commit '7d61dc95d741ca134d59b1f34c4e10c4c4e36f56'Derek Buitenhuis2016-02-29
|\| | | | | | | | | | | | | * commit '7d61dc95d741ca134d59b1f34c4e10c4c4e36f56': lavf: move urlcontext_child_class_next() to protocols.c Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: move urlcontext_child_class_next() to protocols.cAnton Khirnov2016-02-22
| | | | | | | | | | It needs to access the list of protocols directly, so it more properly belongs there.
* | Merge commit '0fa00d05911aa8043ecad8dead4a73cab7faadf6'Derek Buitenhuis2016-02-29
|\| | | | | | | | | | | | | * commit '0fa00d05911aa8043ecad8dead4a73cab7faadf6': lavf: move avio_enum_protocols() to protocols.c Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: move avio_enum_protocols() to protocols.cAnton Khirnov2016-02-22
| | | | | | | | It's a more appropriate place for it.
* | Merge commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d'Derek Buitenhuis2016-02-29
|\| | | | | | | | | | | | | | | | | | | | | This commit also disables the async fate test, because it used internal APIs in a non-kosher way, which no longer exists. * commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d': lavf: reorganize URLProtocols Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: reorganize URLProtocolsAnton Khirnov2016-02-22
| | | | | | | | | | | | | | | | | | | | Instead of a linked list constructed at av_register_all(), store them in a constant array of pointers. Since no registration is necessary now, this removes some global state from lavf. This will also allow the urlprotocol layer caller to limit the available protocols in a simple and flexible way in the following commits.
* | avformat: add protocol_whitelistMichael Niedermayer2016-02-02
| | | | | | | | | | | | | | | | | | | | | | | | | | Note to maintainers: update tools Note to maintainers: set a default whitelist for your protocol If that makes no sense then consider to set "none" and thus require the user to specify a white-list for sub-protocols to be opened Note, testing and checking for missing changes is needed Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/avio: free url/avio optionsMichael Niedermayer2016-01-29
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/avio: Limit url option parsing to the documented casesMichael Niedermayer2016-01-20
| | | | | | | | | | | | | | | | | | This feature is not know much or used much AFAIK, and it might be helpfull in exploits. No specific case is known where it can be used in an exploit though subsequent commits depend on this commit though Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/avio: add ffurl_accept and ffurl_handshakeStephan Holljes2015-08-01
| | | | | | | | Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
* | avformat/avio: Move avio_delete() avio_move() to avpriv_ namespaceMichael Niedermayer2015-06-29
| | | | | | | | | | | | | | | | | | This was suggested in the discussion about these functions With this change the functions are available internally but are not part of the public API Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf: set is_connected flag so url can be properly closedMariusz Szczepańczyk2015-06-24
| | | | | | | | | | Reviewed-by: Lukasz Marek <lukasz.m.luki2 at gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf/avio: Extend API with avio_move() and avio_delete()Mariusz Szczepańczyk2015-06-22
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat: clarify what package needs to be compiled with SSL supportwm42015-06-18
| | | | | | | | | | | | Try to reduce user confusion. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf/tls: Support Secure TransportRodger Combs2015-05-29
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf: add directory listing APILukasz Marek2015-03-27
| | | | | | | | | | | | | | | | API allows protocol implementations to provide API that allows to list directory content. API is similar to POSIX opendir/readdir/closedir. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'b97f427fb56bdbf7de8e2d4b72d01114aa6eceda'Michael Niedermayer2015-03-12
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit 'b97f427fb56bdbf7de8e2d4b72d01114aa6eceda': lavf: Explicitly convert types at function pointer assignment Conflicts: libavformat/avio.c libavformat/aviobuf.c libavformat/swfenc.c See: a76a2ffe9d7773d59bb1bc228a6660e23672c490 and others Merged-by: Michael Niedermayer <michaelni@gmx.at>