summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
...
* Revert "avformat/demux: Make read_frame_internal() return AVERREOR(EAGAIN) ↵Marton Balint2022-07-06
| | | | | | | | on stuck empty input parser" Hides the underlying real problem with a demuxer returning 0 sized packets. This reverts commit 02699490c14e86105104940c009953081f69432c.
* Revert "avformat/demux: Count EAGAIN as 100 bytes in relation to read limit ↵Marton Balint2022-07-06
| | | | | | | | | | in avformat_find_stream_info()" Modifying avformat_find_stream_info() behaviour based on the number of EAGAINs it encounters is a hack which usually only hides the real issue if such thing happen. This reverts commit b0cac7082d8a3ff2d4f039af01b45c48bb578de7.
* avformat/mov: prevent potential use of uninitialized valueMartijn van Beurden2022-07-05
|
* avformat/cafdec: Implement FLAC-in-CAF parsingMartijn van Beurden2022-07-05
| | | | | | | | The afconvert utility shipped with MacOS supports muxing of FLAC in CAF, see afconvert help output on a recent Mac here: https://hydrogenaud.io/index.php?topic=122509.0 A file created with afconvert free of copyright (licensed CC0) can be found here: http://www.audiograaf.nl/misc_stuff/afconvert-FLAC-in-CAF.caf
* avformat/matroskadec: fix setting channel layout using the Channels elementJames Almer2022-07-04
| | | | | | | | | | | | | | If the stream's channel layout is first set into a native layout using codec private parameters, this code here could potentially result in an invalid native layout where popcnt(ch_layout.u.mask) != ch_layout.nb_channels being propagated. Fixes: Timeout printing a billion channels Fixes: 48099/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-6754782204788736 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Tested-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/(mpeg|mpegts|mxf|sup)enc: Use const uint8_t* to access pkt dataAndreas Rheinhardt2022-07-04
| | | | | | | | | The packets muxers receive are not guaranteed to be writable, so they must not be modified. Ergo only access the packet's data via a const uint8_t*. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: add PHM decoder and encoderPaul B Mahol2022-07-03
|
* avformat/mlpdec: Remove unused-but-set variableAndreas Rheinhardt2022-07-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/bintext: Remove set-but-unused variableAndreas Rheinhardt2022-07-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aiffdec: cleanup size handling for extreem casesMichael Niedermayer2022-07-02
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/movenc: Fix invalid checkAndreas Rheinhardt2022-06-30
| | | | | | | | Regression since c9de096851803d45444ae9dfe3a390a2d53ac71b. Fixes Coverity ID 1506839. Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: limit ISOBMFF AC-3 mapping to bsids <=8Jan Ekström2022-06-30
| | | | | | | | | | This leaves out RealAudio DolbyNet, which utilizes bsids 9 and 10, It is not clear whether the interpreted bit rate value (divided by 2 or 4 depending on the variant), or the original bit rate value should be utilized to receive the bit_rate_code index. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: handle OOM situations when parsing AC-3 headersJan Ekström2022-06-30
| | | | Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: utilize existing AC-3 parsing workflow for AC-3Jan Ekström2022-06-30
| | | | Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: move eac3_info definition so that it can be used for AC-3Jan Ekström2022-06-30
| | | | Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: enable handle_eac3 to handle AC-3 tracksJan Ekström2022-06-30
| | | | | | | | | | | Add the AC-3 frame type, as well as early exit from additional packet parsing in case of AC-3, as only a single packet is required to get the required information. Additionally, expose ac3_bit_rate_code via the eac3_info struct as it is required for AC3SpecificBox. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* {configure,avformat/movenc}: enable AC-3 parser for movencJan Ekström2022-06-30
| | | | | | | | | | | | This simplifies the code to no longer have #ifs in a manner which does not require handling avpriv_ac3_parse_header returning ENOSYS. As an existing example, the MPEG-TS muxer already requires the AC-3 parser, and in order to fix existing issues with the current AC-3 movenc code, switching to use the AC-3 parser is required, so this is an enabling change for that. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/mov: Only read the primary item for AVIFVignesh Venkatasubramanian2022-06-29
| | | | | | | | | | | | | | | | | | | | Update the still AVIF parser to only read the primary item. With this patch, AVIF still images with exif/icc/alpha channel will no longer fail to parse. For example, this patch enables parsing of files in: https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles/Microsoft Adding two fate tests: 1) demuxing of still image with 1 item - this test will pass regardless of this patch. 2) demuxing of still image with 2 items - this test will fail without this patch and will pass with patch applied. Partially fixes trac ticket #7621 Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: James Zern <jzern@google.com>
* avformat/hlsenc: Add resend_headers optionhuheng2022-06-29
| | | | | | | | | Add pat and pmt table at start of each segment in single_file mode enhanced compatibility of hls stream. Because some hls clients separate parsing segment of hls stream, the absence of pat/pmt will cause parsing to fail. Reviewed-by: Steven Liu <liuqi05@kuaishou.com> Signed-off-by: huheng <heng.hu.1989@gmail.com>
* avformat/hls: add #EXT-X-START tag support by prefer_x_start optLi Kai2022-06-29
| | | | | Reviewed-by: Steven Liu <liuqi05@kuaishou.com> Signed-off-by: Li Kai <wolfleekay@gmail.com>
* avformat/hlsenc: Use HLS version 2 if rounded durations are enabledLucy2022-06-29
| | | | | | | | | | | | | | | | | This allows for wider compatibility with older devices, such as those running iOS 3. The only difference between HLS version 2 and version 3 is that version 3 supports non-integer EXTINF values, and as such, we can default to version 2 if we're using whole-integer EXTINFs anyways, when `-hls_flags round_durations` is set. As this code seems to otherwise consistently use the lowest compatible version, this seems to fit in properly with existing behavior. Testing confirms with that this patch, HLS output can work all the way back to iOS 3. Reviewed-by: Steven Liu <liuqi05@kuaishou.com> Signed-off-by: Lucy <lucy@absolucy.moe>
* avformat/mov: read PCM audio configuration box ('pcmC') if availableIvan Baykalov2022-06-27
| | | | | | | | | | | | | | For ipcm and fpcm streams, big-endian format is the default, but it can be changed with additional 'pcmC' sub-atom of audio sample description. Details can be found in ISO/IEC 23003-5:2020 Fixes ticket #9763. Fixes ticket #9790. Patch simplified by Marton Balint. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mov: factorize setting little endian PCM streamsMarton Balint2022-06-27
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/movenc: Support alpha channel for AVIFVignesh Venkatasubramanian2022-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AVIF specification allows for alpha channel as an auxiliary item (in case of still images) or as an auxiliary track (in case of animated images). Add support for both of these. The AVIF muxer will take exactly two streams (when alpha is present) as input (first one being the YUV planes and the second one being the alpha plane). The input has to come from two different images (one of it color and the other one being alpha), or it can come from a single file source with the alpha channel extracted using the "alphaextract" filter. Example using alphaextract: ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map "[a]" -still-picture 1 avif_with_alpha.avif Example using two sources (first source can be in any pixel format and the second source has to be in monochrome grey pixel format): ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy avif_with_alpha.avif The generated files pass the compliance checks in Compliance Warden: https://github.com/gpac/ComplianceWarden libavif (the reference avif library) is able to decode the files generated using this patch. They also play back properly (with transparent background) in: 1) Chrome 2) Firefox (only still AVIF, no animation support) Reviewed-by: James Zern <jzern@google.com> Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
* avformat/matroskaenc: Fix use of uninitialized valueAndreas Rheinhardt2022-06-26
| | | | | | | | | Regression since 67eea6cf026a70940ea402d54685d67c660b49cd. Affects only WebVTT when muxing WebM. (This is covered by the webm-webvtt-remux FATE test which fails for several FATE boxes on fate-ffmpeg.org.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: avoid integer overflows in SAR computationMichael Niedermayer2022-06-25
| | | | | | | | | | | | This ignores >64bit Alternatively we could support that if it occurs in reality Fixes: negation of -9223372036854775808 Fixes: integer overflows Fixes: 46072/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5029840966778880 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/http: include version.hJames Almer2022-06-24
| | | | | | | | This is needed to get LIBAVFORMAT_VERSION, used as part of the user agent. Fixes a recent regression. Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/matroskaenc: Reuse dynamic bufferAndreas Rheinhardt2022-06-24
| | | | | | Avoids some allocations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Fix outdated commentAndreas Rheinhardt2022-06-24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Improve handling of AV1 extradataAndreas Rheinhardt2022-06-24
| | | | | | | | | | | | Up until now, only the first four bytes (the ones preceding the OBU) were written because not enough space has been reserved for the complete CodecPrivate. This commit changes this by increasing the space reserved for the CodecPrivate (it is big enough for every sane sequence header plus something extra); the code falls back to writing four bytes in case the increased space turns out to be insufficient. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Split updating CodecPrivate from writing itAndreas Rheinhardt2022-06-24
| | | | | | | | | | | | | | | | | | | | | | Up until now, updating extradata was very ad-hoc: The amount of space reserved for extradata was not recorded when writing the header; instead the AAC code simply presumed that it was enough. This commit changes this by recording how much space is available. This brings with it that the code for writing of and reserving space for the CodecPrivate and for updating it diverges. They are therefore split; this allows to put other common tasks like seeking to right offset as well as writing padding (in case the new extradata did not fill the whole reserved space) to this common function. The code for filling up the reserved space is smarter than the code it replaces; therefore it is no longer necessary to reserve more than necessary just to be sure that one can add an EBML Void element (whose minimum size is two) lateron. This is the reason for the change to the aac-autobsf-adtstoasc test. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Avoid swapping codecpar->extradata temporarilyAndreas Rheinhardt2022-06-24
| | | | | | | | | | Instead pass extradata and extradata_size explicitly. (It is not perfect, as ff_put_(wav|bmp)_header() still uses the extradata embedded in codecpar, but this is not an issue as long as their CodecPrivate isn't updated.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Split assembling CodecPrivate from writing itAndreas Rheinhardt2022-06-24
| | | | | | | This is in preparation for splitting writing and updating extradata more thoroughly later. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: enable compressorname for mp4 modeZhao Zhili2022-06-24
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/hls: Limit start_seq_no to one bit lessMichael Niedermayer2022-06-23
| | | | | | | | | | | This avoids overflow checks on additions with 32bit numbers Fixes: signed integer overflow: 9223372036854775806 + 2 cannot be represented in type 'long' Fixes: 44012/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-4747770734444544 Fixes: 48065/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-5372410355908608 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavformat: Remove MAX_PATH limit and use UTF-8 version of getenv()Nil Admirari2022-06-21
| | | | | | | | | 1. getenv() is replaced with getenv_utf8() across libavformat. 2. New versions of AviSynth+ are now called with UTF-8 filenames. 3. Old versions of AviSynth are still using ANSI strings, but MAX_PATH limit on filename is removed. Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/matroskaenc: Don't check twice whether to write tagsAndreas Rheinhardt2022-06-20
| | | | | | | | | | | | | | | Because not all metadata is written as tags, the Matroska muxer filters out the tags that are not written as tags. Therefore the code first checks whether a Tag master element needs to be opened for a given stream/chapter/attachment/global metadata. If the answer turns out to be yes, it is checked again whether a given AVDictionaryEntry is written as a tag. This commit changes this: The Tag element is opened unconditionally and in case it turns out that it was unneeded, it is discarded again. This is possible because the Tag element is written into its own dynamic buffer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Don't waste bytes to Write Tag length fieldsAndreas Rheinhardt2022-06-20
| | | | | | | This is possible by using a dynamic buffer to write them; said dynamic buffer is (re)used and reset as appropriate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mpegts: remove obsolate hacks for detecting streams with bad PMTsMarton Balint2022-06-20
| | | | | | | | | Ffmpeg/ffprobe/ffplay sets scan_all_pmts to 1 when finding the streams, that should be enough to handle files for which some early PMTs miss some streams. Fixes ticket #9782. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/librist: bump required version to 0.2.7Marton Balint2022-06-18
| | | | | | This is the first version for which fifo size setting actually works. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/aiffdec: avoid integer overflow in get_meta()Michael Niedermayer2022-06-17
| | | | | | | | Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 45891/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6159183893889024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aaxdec: Check for overlaping segmentsMichael Niedermayer2022-06-17
| | | | | | | | Fixes: Timeout Fixes: 45875/clusterfuzz-testcase-minimized-ffmpeg_dem_AAX_fuzzer-6121689903136768 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/demux: Count EAGAIN as 100 bytes in relation to read limit in ↵Michael Niedermayer2022-06-17
| | | | | | | | | | | avformat_find_stream_info() Fixes: Timeout Fixes: 43717/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5206008287330304 Fixes: 45738/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6142535657979904 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/demux: Make read_frame_internal() return AVERREOR(EAGAIN) on stuck ↵Michael Niedermayer2022-06-17
| | | | | | | | | | empty input parser Fixes: read_frame_internal() which does not return even though both demuxer and parser do return Fixes: 43717/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5206008287330304 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/matroskaenc: Convert chapter metadataAndreas Rheinhardt2022-06-16
| | | | | | | | | | | | It is no longer converted since mkv_write_chapters() is called before mkv_write_tags() which happens since commit 4ebfc13c338423cf48f1a1266c890422367f7775. Given the fact that chapters can also be written late, mkv_write_chapters() has to convert the metadata itself. Fixes ticket #9812. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Reset cur_master_element when discarding masterAndreas Rheinhardt2022-06-16
| | | | | | | | | | | | | | Before this patch the muxer writes an invalid file (namely one in which the Projection master is a child of the Colour element) if the following conditions are met: a) The stream contains AVMasteringDisplayMetadata without primaries and luminance (i.e. useless AVMasteringDisplayMetadata). b) The stream contains AV_PKT_DATA_SPHERICAL side data. c) All the colour elements of the stream are equal to default (i.e. unknown). Fortunately these conditions are very unlikely to be met. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: Offload allocating string to av_dict_set()Andreas Rheinhardt2022-06-16
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: Use ff_data_to_hex() for data->hex conversionAndreas Rheinhardt2022-06-16
| | | | | | | | | | In this case it also stops pretending that the length of the output string is somehow checked (which is currently being done by using snprintf that is called with the amount of space needed instead of the amount of space actually available). Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: Don't duplicate av_uuid_unparseAndreas Rheinhardt2022-06-16
| | | | | | | | Also don't allocate the string ourselves, let av_dict_set() do it. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxf: Use AVUUID for uidsAndreas Rheinhardt2022-06-16
| | | | | | | This is in preparation for using av_uuid functions directly. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>