summaryrefslogtreecommitdiff
path: root/libavformat/wavdec.c
Commit message (Collapse)AuthorAge
* 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: Avoid allocation for AVFormatInternalAndreas Rheinhardt2021-09-17
| | | | | | | | | | | | | Do this by allocating AVFormatContext together with the data that is currently in AVFormatInternal; or rather: Put AVFormatContext at the beginning of a new structure called FFFormatContext (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVFormatInternal altogether. The biggest simplifications occured in avformat_alloc_context(), where one can now simply call avformat_free_context() in case of errors. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Use ffio_read_size where appropriateAndreas Rheinhardt2021-08-06
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/wavdec: Use 64bit in new_pos computationMichael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: 129 * 16711680 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6742285317439488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: move AVStream.{first,cur}_dts to AVStreamInternalJames Almer2021-06-09
| | | | | | They are private fields, no reason to have them exposed in a public header. Signed-off-by: James Almer <jamrial@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: move AVStream.probe_packets to AVStreamInternalJames Almer2021-05-07
| | | | | | It's a private fields, no reason to have it 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/wavdec: Fix reading files with id3v2 apic before fmt tagAndreas Rheinhardt2021-04-18
| | | | | | | | | | | | | Up until now the cover images will get the stream index 0 in this case, violating the hardcoded assumption that this is the index of the audio stream. Fix this by creating the audio stream first; this is also in line with the expectations of ff_pcm_read_seek() and ff_spdif_read_packet(). It also simplifies the code to parse the fmt and xma2 tags. Fixes #8540; regression since f5aad350d3695b5b16e7d135154a4c61e4dce9d8. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/id3v2: Don't reverse the order of id3v2 APICsAndreas Rheinhardt2021-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When parsing ID3v2 tags, special (non-text) metadata is not applied directly and unconditionally; instead it is stored in a linked list in which elements are prepended. When traversing the list to add APICs (or private tags) at the end, the order is reversed. The same also happens for chapters and therefore the chapter parsing code already reverses the chapters. This commit changes this: By keeping pointers to both head and tail of the linked list one can preserve the order of the entries and remove the reordering code for chapters. Only the pointer to head will be exported: No current caller uses a nonempty list, so exporting both head and tail is unnecessary. This removes the functionality to combine the lists of special metadata read from different ID3v2 tags, but that doesn't make really much sense anyway (and would be trivial to implement if desired) and allows to remove the now unnecessary initializations performed by the callers. The FATE-reference for the id3v2-priv test had to be updated because the order of the tags read into the dict is reversed; for id3v2-priv-remux only the md5 and not the ffprobe output of the remuxed file changes because the order of the private tags has up until now been reversed twice. The references for the aiff/mp3 cover-art tests needed to be updated, because the order of the attached pics is reversed upon reading. It is still not correct, because the muxers write the pics in the order in which they arrive at the muxer instead of the order given by pkt->stream_index. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/wavdec: Share wav and w64 optionsAndreas Rheinhardt2021-02-23
| | | | | | | | The options of the w64 demuxer are a proper subset of the options for the wav demuxer, making it possible to reuse a part of the options for the wav demuxer for the w64 demuxer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/wav: Deduplicate codec tags listsAndreas Rheinhardt2021-02-23
| | | | | | Also saves relocations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/wavdec: Consider AV_INPUT_BUFFER_PADDING_SIZE in set_spdif()Michael Niedermayer2021-02-10
| | | | | | | | | The buffer is read by using the bit reader Fixes: out of array read Fixes: 27539/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5650565572591616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wavdec: Check block_align vs. channels before combining themMichael Niedermayer2021-02-02
| | | | | | | | Fixes: signed integer overflow: 65535 * 65312 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6606935226974208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wavdec: Check avio_get_str16le() for failureMichael Niedermayer2021-01-31
| | | | | | | | | Fixes: out of array access Fixes: 29195/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5037853281222656 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/wavdec: Avoid zeroing written to arrayMichael Niedermayer2021-01-03
| | | | | | | | Fixes: OOM Fixes: 26934/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5996784213819392 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* smvjpegdec: merge into mjpegdecAnton Khirnov2020-12-10
| | | | | | | | | | | | | | | | | | | | | | | SMVJPEG stores frames as slices of a big JPEG image. The decoder is implemented as a wrapper that instantiates a full internal MJPEG decoder, then forwards the decoded frames with offset data pointers. This is unnecessarily complex and fragile, not supporting useful decoder capabilities like direct rendering. Re-implement the decoder inside the MJPEG decoder, which is accomplished by returning each decoded frame multiple times, setting cropping information appropriately on each instance. One peculiar aspect of the previous design is that since - the smvjpeg decoder returns one frame per input packet - there are multiple frames in each packets (the aformentioned slices) the demuxer needs to return each packet multiple times. This is now also eliminated - the demuxer now returns each packet exactly once, with the duration set to the number of frames it decodes to. This also removes one of the last remaining internal uses of the old video decoding API.
* avformat/wavdec: Check for EOF in cues readingMichael Niedermayer2020-12-05
| | | | | | | | Fixes: Timeout (>20sec -> 1ms) Fixes: 26793/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5674966852567040 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wavdec: More complete size check in find_guid()Michael Niedermayer2020-11-21
| | | | | | | | Fixes: signed integer overflow: 9223372036854775807 + 8 cannot be represented in type 'long' Fixes: 27341/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5442833206738944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wavdec: Refuse to read chunks bigger than the filesize in ↵Michael Niedermayer2020-10-30
| | | | | | | | | | | w64_read_header() Fixes: OOM Fixes: 26414/clusterfuzz-testcase-minimized-ffmpeg_dem_FWSE_fuzzer-5070632544632832 Fixes: 26475/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5770207722995712 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: move AVStream.{request_probe,skip_to_keyframe} to AVStreamInternalAnton Khirnov2020-10-28
| | | | | Those are private fields, no reason to have them exposed in a public header.
* avformat/wavdec: add support for chaptersPaul B Mahol2020-09-01
| | | | Support parsing 'cue ' and 'adtl' chunks.
* avformat/wavdec: allow to change max size of single demuxed packetPaul B Mahol2020-09-01
| | | | | Can make demuxing much faster, expecially for files with huge number of channels.
* avformat/wavdec: add support for demuxing Broadcast Wave 64BitPaul B Mahol2020-09-01
|
* avformat/id3v2: Remove unnecessary indirectionAndreas Rheinhardt2020-05-25
| | | | | | | | | ff_id3v2_parse_apic/chapters/priv/priv_dict all had a parameter extra_meta of type ID3v2ExtraMeta ** as if the functions wanted to make *extra_meta point to something else. But they don't, so just use an ID3v2ExtraMeta *. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: Don't free old extradata before ff_alloc/get_extradataAndreas Rheinhardt2019-12-12
| | | | | | | | These functions already free it themselves before they allocate the new extradata. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: Forward errors where possibleAndreas Rheinhardt2019-12-12
| | | | | | | | | | It is not uncommon to find code where the caller thinks to know better what the return value should be than the callee. E.g. something like "if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit changes several instances of this to instead forward the actual error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/adpcm: add support for 5.1 ADPCM MSPaul B Mahol2019-07-26
|
* lafv/wavdec: Fail bext parsing on incomplete readsMatt Wolenetz2019-07-26
| | | | | | | | | | | | | | | | | avio_read can successfully return even when less than the requested amount of input was read. wavdec's bext parsing mistakenly assumed a successful avio_read always read the full amount that was requested. The result could be dictionary tags populated with partially uninitialized values. This change also fixes a broken assertion in wav_parse_bext_string that was off-by-one, though no known current usage of that method hits that broken case. Chromium bug: 987270 Signed-off-by: Matt Wolenetz <wolenetz@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-21
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* avformat/wavdec: add support for 'id3 ' chunkPaul B Mahol2018-12-13
| | | | Fixes #5700.
* avformat/wavdec: make fact chunk parsing for w64 more robustPaul B Mahol2018-01-10
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/wmaprodec: support multichannel XMA stream configurationsbnnm2017-10-09
| | | | | | Signed-off-by: bnnm <bananaman255@gmail.com> Now accepts any combination of 1/2ch streams, described in the RIFF chunks/extradata
* avformat/wavdec: Check chunk_size李赞2017-05-10
| | | | | | Fixes integer overflow and out of array access Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: fix usages of av_get_codec_tag_string()Clément Bœsch2017-03-29
|
* Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-21
|\ | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-30
| | | | | | | | | | | | | | | | It is supposed to be a flag. The only currently defined value is AVIO_SEEKABLE_NORMAL, but other ones may be added in the future. However all the current lavf code treats this field as a bool (mainly for historical reasons). Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
* | avformat/wavdec: enable seeking with XMA2Paul B Mahol2017-01-20
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/wmaprodec: >2 channel support for XMAPaul B Mahol2017-01-19
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avformat/wavdec: add support for decoding 24.0 and 16.8 floating point pcm ↵Paul B Mahol2016-12-22
| | | | | | | | | | | | | | | | formats Fixes #5602 and #5603. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avformat/wavdec: Eliminate goto for clang -O0 DCEMark Harris2016-12-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang is not able to eliminate the reference to ff_spdif_probe() when there is a goto target in the same block and optimization is disabled. This fixes the following build failure on OS X: ./configure --disable-everything --disable-doc \ --enable-decoder=pcm_s16le --enable-demuxer=wav \ --enable-protocol=file --disable-optimizations --cc=clang make ... Undefined symbols for architecture x86_64: "_ff_spdif_probe", referenced from: _set_spdif in libavformat.a(wavdec.o) ld: symbol(s) not found for architecture x86_64 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
* | avformat/wavdec: fix typo with lenMichael Niedermayer2016-04-03
| | | | | | | | | | Found-by: carl Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/wavdec: Remove direct s->pb->buffer accessMichael Niedermayer2016-04-03
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | wavdec: Only set the codec ID in read_headerDerek Buitenhuis2016-04-03
| | | | | | | | | | | | | | | | WAV is not a NOHEADER format, and thus should not be changing stream codec IDs and probing in read_packet. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/wavdec: allow data chunk to be before fmt/xma2 chunkPaul B Mahol2015-11-10
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avformat/wavdec: parse XMA2 tagPaul B Mahol2015-11-10
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avformat/wavdec: use AV_OPT_TYPE_BOOL for ignore_lengthPaul B Mahol2015-09-11
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avformat/wavdec: Detect wrongly interpreted specification about the sample ↵Michael Niedermayer2015-08-13
| | | | | | | | | | | | | | | | value in the fact chunk Fixes Ticket703 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>