summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/3dostr: make probing more robustPaul B Mahol2020-09-17
|
* avformat/mxfdec: Read Apple private Content Light Level from MXFHarry Mallon2020-09-17
| | | | | | * As embedded by Apple Compressor Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avformat/mxfenc: Write Mastering Display Colour Volume to MXFHarry Mallon2020-09-17
| | | | | | Described in Annex B SMPTE ST 2067-21:2020 Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avformat/mxfdec: Read Mastering Display Colour Volume from MXFHarry Mallon2020-09-17
| | | | | | Described in Annex B SMPTE ST 2067-21:2020 Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avformat/argo_asf: initialise file header inlineZane van Iperen2020-09-16
| | | | | | | Garbage was left-over in the ArgoASFFileHeader::name field if the url was too short. This zero-initialises it. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/argo_asf: add missing avformat.h includeJames Almer2020-09-15
| | | | | | Fixes make checkheaders Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet: move AVPacketList definition and function helpers over from ↵James Almer2020-09-15
| | | | | | | | | libavformat And replace the flags parameter with a function callback that can be used to copy the contents of the packet (e.g, av_packet_ref and av_packet_copy_props). Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: add Argonaut Games BRP demuxerZane van Iperen2020-09-14
| | | | | | | | | | Used in FMVs for FX Fighter and Croc. Supports BVID and BASF streams, requests samples for anything else. Due to the way BASF streams are contained in the file, only one is supported. I have yet to see a BRP file with multiple. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/argo_asf: add ASF_MIN_BUFFER_SIZE #defineZane van Iperen2020-09-14
| | | | | | For future use by the argo_brp demuxer Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/argo_asf: split functionality into a headerZane van Iperen2020-09-14
| | | | | | | | | | | | For future use by the argo_brp demuxer. Adds: - void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf); - int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr); - void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf); - int ff_argo_asf_fill_stream(AVStream *st, const ArgoASFChunkHeader *ckhdr); Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/argo_asf: bail if invalid tagZane van Iperen2020-09-14
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat: use av_timecode_make_smpte_tc_string2Marton Balint2020-09-13
| | | | | | WSD format has no frames stored for playback time. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: add Square SVS demuxerPaul B Mahol2020-09-13
|
* avformat/moflex: make seeking more usefulPaul B Mahol2020-09-13
|
* avformat/flic: add support for seeking to startPaul B Mahol2020-09-13
|
* avcodec/cdgraphics: fix decoded output when seeking to start of filePaul B Mahol2020-09-13
| | | | | Also in cdg demuxer do not skip packets data, and remove private context which is not really needed.
* avformat/cdg: Fix integer overflow in duration computationMichael Niedermayer2020-09-13
| | | | | | | | Fixes: signed integer overflow: 8398407 * 300 cannot be represented in type 'int' Fixes: 23914/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4702539290509312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/brstm: remove custom allocation of table to hold coeffsPaul B Mahol2020-09-12
|
* avformat/brstm: fix decoding brstm with custom coeff offsetsPaul B Mahol2020-09-12
|
* lavf/mov: Remove redundant codeJun Zhao2020-09-12
| | | | Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/utils: Avoid duplicating extradata from extract_extradata BSFAndreas Rheinhardt2020-09-11
| | | | | | | | | | | | | Instead move the extradata contained in packet side-data to its destination. This is possible because the side data already has zeroed padding. Notice that the check for FF_MAX_EXTRADATA_SIZE has been dropped, because said constant is from libavcodec/internal.h. If libavcodec wanted to enforce this, it should do so in the extract_extradata BSF instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/brstm: clip timestamp when seeking into acceptable rangePaul B Mahol2020-09-10
|
* avformat/mca: clip timestamp when seeking into acceptable rangePaul B Mahol2020-09-10
|
* avformat: add mca demuxerZixing Liu2020-09-10
| | | | Signed-off-by: liushuyu <liushuyu@aosc.io>
* avformat/segment: Avoid duplicating string when parsing frames listAndreas Rheinhardt2020-09-10
| | | | | Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Fix error messagesAndreas Rheinhardt2020-09-10
| | | | | Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Remove redundant code for freeing in write_trailerAndreas Rheinhardt2020-09-10
| | | | | | | | This code mostly duplicates code in the deinit function; the only exception is av_opt_free(): The options are freed generically lateron. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Free SegmentListEntries in deinit, not write_trailerAndreas Rheinhardt2020-09-10
| | | | | | | This fixes leaks when the trailer is never written. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Fix leak and invalid free of AVIOContextAndreas Rheinhardt2020-09-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | seg_init() and seg_write_header() currently contain a few error paths in which an already opened AVIOContext for the child muxer leaks (namely if there are unrecognized options for the child muxer or if writing the header of the child muxer fails); the reason for this is that this AVIOContext is not closed in the deinit function. If all goes well, it is closed when writing the trailer. From this it also follows that the AVIOContext also leaks when the trailer is never written, even when writing the header succeeds. But simply freeing said AVIOContext in the deinit function is complicated by the fact that the AVIOContext may or may not have been opened via the io_open callback: If options are set to discard header and trailer, said AVIOContext can also be a null context which must not be closed via the io_close callback. This may lead to crashes, as io_close may presume the AVIOContext's opaque to be set. It currently works with the default io_close callback which simply calls avio_close(), because avio_close() doesn't care about opaque being NULL since commit 6e8e8431e15a58aa44cfdd8c11f9ea096837c0fa. Therefore this commit records which of the two kinds of AVIOContext is currently in use to use the right way to close it. Finally there was one instance (namely if initializing the child muxer fails with no unrecognized options) where the AVIOContext was always closed via the io_close callback. The above remark applies to this; it has been fixed, too. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Fix leak of string on errorAndreas Rheinhardt2020-09-10
| | | | | | | | | | | A string containing the segment's filename that the segment muxer allocates got only freed in its write_trailer function. This implies that it leaks if write_trailer is never called, e.g. if initializing the child muxer fails. This commit fixes this by freeing the string in the deinit function instead. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Fix segfault when error happens and segment list is outputAndreas Rheinhardt2020-09-10
| | | | | | | | | | | | | | | | | | | | | | | The segment muxer has an option to output a file containing a list of the segments written. The AVIOContext used for writing this file is opened via the main AVFormatContext's io_open callback; seg_free() meanwhile unconditionally closes this AVIOContext by calling ff_format_io_close() with the child muxer (the one for the actual output format) as AVFormatContext. The problem hereby is that the child AVFormatContext need not exist, even when the AVIOContext does. This leads to a segfault in ff_format_io_close() when the child muxer's io_close callback is called. Situations in which the AVFormatContext can be NULL range from an invalid reference stream parameter to an unavailable/bogus/unsupported output format to inability to allocate the AVFormatContext. The solution is to simply close the AVIOContext with the AVFormatContext that was used to open it: The main AVFormatContext. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Fix segfault on allocation error, avoid allocationAndreas Rheinhardt2020-09-10
| | | | | | | | | | | | | | | If the user has set none of the options specifying the segments' durations, a default value of 2s is used by duplicating a "2" string and using av_parse_time() on it. Yet duplicating the string was unchecked and if the allocation failed, one would get a segfault in av_parse_time(). This commit solves this by turning said option into an option of type AV_OPT_TYPE_DURATION (which also uses av_parse_time() internally), avoiding duplicating the string altogether. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Fix leak of duration/framenumber lists upon errorAndreas Rheinhardt2020-09-10
| | | | | | | | | | | | | | | The code to free them is not in the segment muxer's deinit function, but in its write_trailer function which means that these lists leak if write_trailer isn't called after their allocation. This happens e.g. if the given lists are invalid (e.g. consisting only of ',' (which delimit entries)), so that parsing them fails and so does the muxer's init function; write_trailer is then never called. This has been fixed by moving the code to free them to the deinit function. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: Don't overwrite AVCodecParameters after initAndreas Rheinhardt2020-09-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The segment muxer copies the user-provided AVCodecParameters to the newly created child streams in its init function before initializing the child muxer; and since commit 8e6478b723affe4d44f94d34b98e0c47f6a0b411, it does this again before calling avformat_write_header() if that is called from seg_write_header(). The reason for this is complicated: At that time writing the header was delayed, i.e. it was not triggered by avformat_write_header() (unless the AVFMT_FLAG_AUTO_BSF was unset), but instead by writing the very first packet. The rationale behind this was to allow to run bitstream filters on the packets in the interleavement queue in order to generate missing extradata from them before the muxer's write_header function is actually called. The segment muxer went even further: It initialized the child muxer and ran the child muxer's check_bitstream functions on the packets in its own muxing queue and stole any bitstream filters that got inserted. The reason for this is that the segment muxer has an option to write the header to a separate file and for this it is needed to write the child muxer's header without delay, but with correct extradata. Unsetting AVFMT_FLAG_AUTO_BSF for the child muxer accomplished the first goal and stealing the bitstream filters the second; and in order for the child muxer to actually use the updated extradata, the old AVCodecParameters (set before avformat_init_output()) were overwritten with the new ones. Updating the extradata proceeded as follows: The bitstream filter itself simply updated the AVBSFContext's par_out when processing a packet, in violation of the new BSF API (where par_out may only be set in the init function); the muxing code then simply forwarded the updated extradata, overwriting the par_in of the next BSF in the BSF chain with the fresh par_out of the last one and the AVStream's par with the par_out of the last BSF. This was an API violation, too, of course, but it made remuxing ADTS AAC into mp4/matroska work. But this no longer serves a useful purpose since the aac_adtstoasc BSF was updated to propagate new extradata via packet side data in commit f63c3516577d605e51cf16358cbdfa0bc97565d8; the next commit then removed the code in mux.c passing new extradata along the filter chain. This alone justifies removing the code for setting the AVCodecParameters a second time. But there is even another reason to do so: It is harmful. The ogg muxer parses the extradata of Theora and Vorbis in its init function and keeps pointers to parts of it. Said pointers become dangling when the extradata is overwritten by the segment muxer, leading to use-after-frees as has happened in ticket #8881 which this commit fixes. Ticket #8517 is about another issue caused by this: Immediately after having overwritten the old AVCodecParameters the segment muxer checks whether the codec_tag is ok (the codec_tag is set generically when initializing the child muxer based upon muxer-specific lists). The check used is: If the child output format has such a list and if the codec tag of the non-child stream does not match the codec id given the list of codec tags and if there is a match for the codec id in the codec tag list, then set the codec tag to zero (and not to the existing match), otherwise set the codec tag of the child stream to the codec tag of the corresponding stream of the main AVFormatContext (which is btw redundant given that the child AVCodecParameters have just been overwritten with the AVCodecParameters of the corresponding stream of the main AVFormatContext). Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/electronicarts: change non failure return of read_header() to 0Michael Niedermayer2020-09-08
| | | | | | | This matches the documentation, but makes no functional difference Found-by: James Almer Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/electronicarts: Check if there are any streamsMichael Niedermayer2020-09-07
| | | | | | | | Fixes: Assertion failure (invalid stream index) Fixes: 25120/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6565251898933248 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/argo_asf: fix handling of v1.1 filesZane van Iperen2020-09-07
| | | | | | | | Version 1.1 (FX Fighter) files all have a sample rate of 44100 in the header, but only play back correctly at 22050. Force the sample rate to 22050 when reading, and restrict it when muxing.
* avformat/avidec: Fix io_fsize overflowMichael Niedermayer2020-09-05
| | | | | | | | Fixes: signed integer overflow: 7958120835074169528 * 9 cannot be represented in type 'long long' Fixes: 23382/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6230683226996736 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dashdec: drop arbitrary DASH manifest size limitJan Ekström2020-09-05
| | | | | | | | | | | | | | | | | | | Currently the utilized AVBPrint API is internally limited to unsigned integers, so if we limit the file size as well as the amount to read to UINT_MAX - 1, we do not require additional limiting to be performed on the values. This change is based on the fact that initially the 8*1024 value added in 96d70694aea64616c68db8be306c159c73fb3980 was only for the case where the file size was not known. It was not a maximum file size limit. In 29121188983932f79aef8501652630d322a9974c this was reworked to be a maximum manifest file size limit, while its commit message appears to only note that it added support for larger manifest file sizes. This should enable various unfortunately large MPEG-DASH manifests, such as Youtube's multi-megabyte live stream archives to load up as well as bring back the original intent of the logic.
* lavf/img2dec: Auto-detect Kodak Photo CD image files.Carl Eugen Hoyos2020-09-05
|
* avformat/yuv4mpegenc: Add const where appropriateAndreas Rheinhardt2020-09-04
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/yuv4mpegenc: Simplify writing global and packet headersAndreas Rheinhardt2020-09-04
| | | | | | | | | | | | | | YUV4MPEG writes a string as header for both the file itself as well as for every frame; these strings contain magic strings and these were up until now included in the string to write via %s. Yet they are compile time constants, so one can use the compile-time string concatentation instead of inserting these strings at runtime. Furthermore, the global header has been written via snprintf() to a local buffer first before writing it. This can be simplified by using avio_printf(). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: add PhotoCD decoderPaul B Mahol2020-09-04
|
* avformat/yuv4mpegenc: simplify writing the headerJames Almer2020-09-03
| | | | | | | Actually write it in yuv4_write_header() instead of with the first packet. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: Stash mfra size if we're reading it anywayDerek Buitenhuis2020-09-03
| | | | | | | This also changes a check for mfra_size from < 0 to == 0, since it was always wrong, as avio_rb32 returns an unsigned integer. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat/mov: Only read the mfra size once during sidx parsingDerek Buitenhuis2020-09-03
| | | | | | | | | | | On files with more than one sidx box, like live fragmented MP4 files, it was previously re-reading and seeking on every singl sidx box, leading to extremely poor performance on larger files, especially over the network. Only do it on the first one, and stash its result. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat/mov: Do not try and seek to an mfra if the reader can't seekDerek Buitenhuis2020-09-03
| | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat/mov: Fix return type used for av_seek in mfra codeDerek Buitenhuis2020-09-03
| | | | | | | It should be a 64-bit integer, otherwise it overflows and fails on files greater than 2GB on some systems like x86_64 Linux. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat: add MODS demuxerPaul B Mahol2020-09-03
|
* avformat: add moflex demuxerPaul B Mahol2020-09-03
|