summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/ftp: add support for escaped credentialsMarton Balint2020-02-15
| | | | | | Properly fixes ticket #7816. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/httpauth: do not decode plus sign to space in credentialsMarton Balint2020-02-15
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/urldecode: add the ability to not decode plus sign to spaceMarton Balint2020-02-15
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/http: escape unsafe URL path in HTTP requestMarton Balint2020-02-15
| | | | | | | This avoids generating invalid HTTP requests if the path contains space or other special characters. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/http: use AVBPrint to construct HTTP requestMarton Balint2020-02-15
| | | | | | | v2: Use s->buffer for creating request (as the old code did) instead of the AVBPrint internal buffer. Some minor cosmetics. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/http: make sure URL path contains a slashMarton Balint2020-02-15
| | | | | | | | | It is explicitly required by the HTTP RFC. Without this patch URLs like http://example.com?query will not work. Fixes ticket #8466. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/http: split the fragment part from the HTTP URL before the requestMarton Balint2020-02-15
| | | | | | | | RFC 3986 states that the fragment identifier is separated from the rest of the URI prior to a dereference, and thus the identifying information within the fragment itself is dereferenced solely by the user agent. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/utils: make av_url_split search for hashmark as well to separate ↵Marton Balint2020-02-15
| | | | | | | | | | | hostname RFC 3986 states that the generic syntax uses the slash ("/"), question mark ("?"), and number sign ("#") characters to delimit components that are significant to the generic parser's hierarchical interpretation of an identifier. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/tests/url: add av_url_split testsMarton Balint2020-02-15
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/tests/url: make format more readableMarton Balint2020-02-15
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/utils: Fix memleaks in avformat_open_input()Andreas Rheinhardt2020-02-15
| | | | | | | | | | | | | | | A demuxer might have allocated memory while reading the header. If reading the header was successfull and an error happens before returning (e.g. when queueing the attached pictures), the read_close function would have never been called, so that all those allocations would leak. This commit changes this. Furthermore, there would be even more memleaks if the error level was set to AV_EF_EXPLODE in case there is both metadata and id3v2 metadata. This has been fixed, too. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec: add cdtoons decoderAlyssa Milburn2020-02-15
| | | | | | | This adds a decoder for Broderbund's sprite-based QuickTime CDToons codec, based on the decoder I wrote for ScummVM. Signed-off-by: Alyssa Milburn <amilburn@zall.org>
* avformat/utils: Fix undefined behavior in ff_configure_buffers_for_index()Dale Curtis2020-02-11
| | | | | | | | When e2_pts == INT64_MIN and e1_pts >= 0 the calculation of e2_pts - e1_pts will overflow an int64_t. Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpjpegdec: Remove redundant initializationsAndreas Rheinhardt2020-02-11
| | | | | | | | The AVPacket destined for a demuxer's output has already been initialized before it reaches the demuxer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: Remove unnecessary av_packet_unref()Andreas Rheinhardt2020-02-10
| | | | | | | | | Since bae8844e the packet will always be unreferenced when a demuxer returns an error, so that a lot of calls to av_packet_unref() in lots of demuxers are now redundant and can be removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/tty: fix last timestamp for fatePaul B Mahol2020-02-10
|
* avformat/tty: add seeking supportPaul B Mahol2020-02-10
|
* avformat/tty: make probing strict for first 8 bytesPaul B Mahol2020-02-10
|
* avformat/tty: Fix division by 0 in probeMichael Niedermayer2020-02-09
| | | | | | | | | | Fixes: division by zero Fixes: 20436/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5763229752229888 Fixes: 20503/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4841641154445312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: add demuxer for Simon & Schuster Interactive's VAG formatZane van Iperen2020-02-06
| | | | | | | | | Adds support for the custom VAG container used by some Simon & Schuster Interactive games such as Real War, and Real War: Rogue States. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hlsenc: allow a custom SDT and PAT periodMarton Balint2020-02-05
| | | | | | | The default is not to write SDT and PAT periodically, only in the beginning of every segment. After this patch the user might override this if needed. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/matroskaenc: Check functions that can failAndreas Rheinhardt2020-02-05
| | | | | | | | Sometimes it has not been checked whether opening the dynamic buffer for writing Tags fails; this might have led to segfaults. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/sccdec: use av_sscanf() insteadPaul B Mahol2020-02-04
|
* avformat/dashenc: use AV_OPT_TYPE_DICT for http_optsMarton Balint2020-02-03
| | | | | | | | This changes the separator character from comma to colon, but since this option was only added recently I think it should be done for consistency with other similar options. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: cancel pending IO on win32 manuallyMarton Balint2020-02-02
| | | | | | | | | | | | | recvfrom() is not a cancellation point in pthreads-win32, see https://sourceware.org/pthreads-win32/manual/pthread_cancel.html In order to be able to cancel the reader thread on Win32 properly we first shutdown the socket then call CancelIoEx to abort pending IO. Subsequent recvfrom() calls will fail with WSAESHUTDOWN causing the thread to exit. Fixes ticket #5717. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: remove setting cancel state from the TX threadMarton Balint2020-02-02
| | | | | | Write mode does not use cancellation. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hlsenc: fix hls_ts_options with mpegtsMarton Balint2020-01-31
| | | | | | Was broken since cdbf8847ea97a985dfd55432e1384bb7fe5d2d3b. Signed-off-by: Marton Balint <cus@passwd.hu>
* dashenc: check pts to prevent division by zero errorAlfred E. Heggestad2020-01-31
| | | | | | | | | | | | | | | | | | this usecase will cause a division by zero trap: 1. dashenc has received one frame 2. os->max_pts and os->start_pts have same value 3. delta between max_pts and start_pts is 0 4. av_rescale_q(0, x, y) returns 0 5. this value is used as denominator in division 6. Bang! -> segfault this fix checks that max_pts > start_pts. the fix has been tested and works. Signed-off-by: Alfred E. Heggestad <alfred.heggestad@gmail.com> Reviewed-by: Jeyapal, Karthick <kjeyapal@akamai.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: Check STCO locationMichael Niedermayer2020-01-30
| | | | | | | | | Fixes: bypassing of checks and assertion failure Fixes: asan_1003879.mp4 Found-by: Clusterfuzz + asan Reported-by: Thomas Guilbert <tguilbert@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aviobuf: Remove AVIOInternal and one level of indirectionAndreas Rheinhardt2020-01-30
| | | | | | | | | | | | | | | | | | | | | | | In the Libav commit cae448cf, the opaque of every AVIOContext opened by ffio_fdopen() (which is used internally by avio_open() and avio_open2()) changed: It was a simple pointer to an URLContext before, but now it was a structure (namely AVIOInternal) containing a pointer to an URLContext as its only member. The next commits (namely 8c0ceafb and ec4c4839) added members to AVIOInternal to allow white-/blacklisting of protocols. But these two commits were never merged into FFmpeg (they were only merged as no-ops in 510046c2 and 063b26d3), because FFmpeg chose a different way to implement this (in 93629735); and so our AVIOInternal still has exactly one member. This of course means that it is unnecessary to use AVIOInternal as opaque as it is just adding a level of indirection (not only pointer dereference, but also wrapper functions). Therefore this commit removes AVIOInternal entirely and essentially reverts cae448cf. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/avio: add avio_protocol_get_classSteven Liu2020-01-30
| | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Suggested-by: Hendrik Leppkes <h.leppkes@gmail.com> Suggested-by: Nicolas George <george@nsup.org> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/tty: add probe functionPaul B Mahol2020-01-29
|
* avformat/mov: Don't leak MOVFragmentStreamInfo on errorAndreas Rheinhardt2020-01-28
| | | | | | | Fixes Coverity issue #1441933. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Free encryption data on errorAndreas Rheinhardt2020-01-28
| | | | | | | Fixes memleak and Coverity issue #1439587. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: update extensionsGyan Doshi2020-01-28
| | | | | Added all extensions used by the mov muxer family, except m4v which is also used for raw MPEG-4 Part 2 bitstreams
* avformat/matroskaenc: Remove useless AVIOContextAndreas Rheinhardt2020-01-27
| | | | | | | | | Write a few numbers directly via AV_WB32 instead of using an AVIOContext (that is initialized only for this very purpose) to write these numbers at known offsets into a fixed buffer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskaenc: Improve writing ProjectionAndreas Rheinhardt2020-01-27
| | | | | | | | | | The Matroska Projection master element has such a small maximum length that it can always be written with a length field of length one. So it is unnecessary to first write the element into a dynamic buffer to get the accurate length in order not to waste bytes on the length field. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mux: Don't use av_ prefix for static functionsAndreas Rheinhardt2020-01-27
| | | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mux: Don't unnecessarily zero-initialize AVPacketListAndreas Rheinhardt2020-01-26
| | | | | | | | | If no error occurs and this AVPacketList is used at all, its packet substructure will be overwritten and its next pointer explicitly set, so every field will still be initialized even when using av_malloc. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: Move packet referencesAndreas Rheinhardt2020-01-26
| | | | | | | | | | | | | | | | | | | In the common case that the input packet was already refcounted, ff_interleave_add_packet would allocate a new AVPacketList, use av_packet_ref to create a new reference to the buffer for the AVPacketList's packet, interleave the packet and finally unreference the original input packet. This commit changes this: It uses av_packet_move_ref to transfer the packet to its destination. In case the input packet is refcounted, this saves an allocation and a free (of an AVBufferRef); if not, the packet is made refcounted before moving it. When the input packet has side data, one saves even more than one allocation+free. Furthermore, when the packet is in reality an uncoded frame, a hacky ad-hoc variant of av_packet_move_ref has been employed. Not any more. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/gxfenc: Add deinit functionAndreas Rheinhardt2020-01-26
| | | | | | | | Fixes memleaks when the trailer is never written (e.g. if the call to gxf_write_map_packet() at the end of gxf_write_header() fails). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfenc: Add deinit functionAndreas Rheinhardt2020-01-26
| | | | | | | | Fixes memleaks when allocating the private data of the timecode_track fails or when the trailer is never written. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfenc: Don't free priv_data of AVStreamAndreas Rheinhardt2020-01-26
| | | | | | | It will be freed when the AVStream is freed later anyway. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/audiointerleave: Check before dereferencingAndreas Rheinhardt2020-01-26
| | | | | | | | | | | | | | | | | | In order to use ff_audio_rechunk_interleave() (a special interleavement function for situations where the ordinary "interleave by dts" is not appropriate), the AVStreams must have private data and this private data must begin with an AudioInterleaveContext which contains a fifo that may need to be freed and when ff_audio_interleave_close() was called, it just assumed that everything has been properly set up, i.e. that every streams priv_data exists. This implies that this function can not be called from the deinit function of a muxer, because such functions might be called if the private data has not been successfully allocated. In order to change this, add a check for whether the private data exists before trying to free the fifo in it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dvenc: Don't zero unnecessarilyAndreas Rheinhardt2020-01-26
| | | | | | | | | The muxing context has already been zeroed when it was allocated, hence it is unnecessary to do it again. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dvenc: Replace write_trailer by deinit functionAndreas Rheinhardt2020-01-26
| | | | | | | | | | | The old write_trailer only freed memory, so it is better to make a dedicated deinit function out of it. Given that this function will also be called when writing the header fails, one can also remove code that frees already allocated fifos when allocating another one fails. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/yuv4mpegdec: increase header limitGyan Doshi2020-01-26
| | | | Allows demuxing UHD 30000/1001 fps yuvj420p files
* avformat/yuv4mpegdec: better error loggingGyan Doshi2020-01-26
|
* avformat/av1: Avoid allocation + copying when filtering OBUsAndreas Rheinhardt2020-01-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Certain types of OBUs are stripped away before muxing into Matroska and ISOBMFF; there are two functions to do this: One that outputs by directly writing in an AVIOContext and one that returns a freshly allocated buffer with the units not stripped away copied into it. The latter option is bad for performance, especially when the input does already not contain any of the units intended to be stripped away (this covers typical remuxing scenarios). Therefore this commit changes this by avoiding allocating and copying when possible; it is possible if the OBUs to be retained are consecutively in the input buffer (without an OBU to be discarded between them). In this case, the caller receives the offset as well as the length of the part of the buffer that contains the units to be kept. This also avoids copying when e.g. the only unit to be discarded is a temporal delimiter at the front. For a 22.7mb/s file with average framesize 113 kB this improved the time for the calls to ff_av1_filter_obus_buf() when writing Matroska from 313319 decicycles to 2368 decicycles; for another file with 1.5mb/s (average framesize 7.3 kB) it improved from 34539 decicycles to 1922 decicyles. For these files the only units that needed to be stripped away were temporal unit delimiters at the front. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/av1: Fix nits in the documentation of ff_av1_filter_obus_buf()Andreas Rheinhardt2020-01-26
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>