summaryrefslogtreecommitdiff
path: root/libavformat/demux.c
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/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/internal: Move definition of FFStream->info to demux.hAndreas Rheinhardt2022-05-10
| | | | | | It is only used by avformat_find_stream_info(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Add new demux.h headerAndreas Rheinhardt2022-05-10
| | | | | | And move those stuff already in demuxer-only files to it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Use unsigned to check duration vs duration_textMichael Niedermayer2022-04-21
| | | | | | | | | Fixes: signed integer overflow: 9223371898743775808 - -138111000000 cannot be represented in type 'long' Fixes: 46245/clusterfuzz-testcase-minimized-ffmpeg_dem_OGG_fuzzer-5075129786302464 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: Do not search through the AVOption table for a option not in it ↵Michael Niedermayer2022-03-27
| | | | | | | | | | | repeatedly on each packet This search takes alot of time especially when compared with small packets 46631 decicycles -> 15719 decicycles in read_frame_internal() for amr-nb in 3gp Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/demux: ensure ch_layout is not lost in the stream's internal avctxJames Almer2022-03-21
| | | | | | | | | This is a workaround until avcodec_close() stops freeing ch_layout through av_opt_fre(), or the former is removed. Fixes a regression since 327efa66331ebdc0087c6b656059a8df2f404019. Signed-off-by: James Almer <jamrial@gmail.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavc: drop temporary compat wrappers for channel layout API changeAnton Khirnov2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: switch to the new channel layout APIVittorio Giovara2022-03-15
| | | | | | | | Since the request_channel_layout is used only by a handful of codecs, move the option to codec private contexts. Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* lavf: drop the channel layout compat layer for old-style (de)muxersAnton Khirnov2022-03-15
| | | | | | All the (de)muxers have been converted to the new API. Signed-off-by: James Almer <jamrial@gmail.com>
* lavf: convert the generic layer to the new channel layoutAnton Khirnov2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavf: add a temporary compat layer for the channel layout API changeAnton Khirnov2022-03-15
| | | | | | | Mediates between old-style (de)muxers and new-style callers. Will be removed once all the (de)muxers are converted to the new API. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/demux: don't truncate the return value of ts_to_samples()James Almer2022-02-05
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/demux: print skip_samples and discard_padding as unsigned values in ↵James Almer2022-02-05
| | | | | | | | | debug log It's the type they should be interpreted as in the AV_PKT_DATA_SKIP_SAMPLES side data. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/demux: don't propagate unsupported skip samples packet side data valuesJames Almer2022-02-05
| | | | | | Should fix ticket #9622 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet_internal: Add proper PacketList structAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | | | | Up until now, we had a PacketList structure which is actually a PacketListEntry; a proper PacketList did not exist and all the related functions just passed pointers to pointers to the head and tail elements around. All these pointers were actually consecutive elements of their containing structs, i.e. the users already treated them as if they were a struct. So add a proper PacketList struct and rename the current PacketList to PacketListEntry; also make the functions use this structure instead of the pair of pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/raw: Reduce number of avpriv symbolsAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libavcodec currently exports four avpriv symbols that deal with PixelFormatTags: avpriv_get_raw_pix_fmt_tags, avpriv_find_pix_fmt, avpriv_pix_fmt_bps_avi and avpriv_pix_fmt_bps_mov. The latter two are lists of PixelFormatTags, the former returns such a list and the second searches a list for a pixel format that matches a given fourcc; only one of the aforementioned three lists is ever searched. Yet for avpriv_pix_fmt_bps_avi, avpriv_pix_fmt_bps_mov and avpriv_find_pix_fmt the overhead of exporting these functions actually exceeds the size of said objects (at least for ELF; the following numbers are for x64 Ubuntu 20.10): The code size of avpriv_find_pix_fmt is small (GCC 10.2 37B, Clang 11 41B), yet exporting it adds a 20B string for the name alone to the exporting as well as to each importing library; there is more: Four bytes in the exporting libraries .gnu.hash; two bytes each for the exporting as well as each importing libraries .gnu.version; 24B in the exporting as well as each importing libraries .dynsym; 16B+24B for an entry in .plt as well as the accompanying relocation entry in .rela.plt for each importing library. The overhead for the lists is similar: The strings are 23B and the .plt+.rela.plt pair is replaced by 8B+24B for an entry in .got and a relocation entry in .rela.dyn. These lists have a size of 80 resp. 72 bytes. Yet for ff_raw_pix_fmt_tags, exporting it is advantageous compared to duplicating it into libavformat and potentially libavdevice. Therefore this commit replaces all library uses of the four symbols with a single function that is exported for shared builds. It has an enum parameter to choose the desired list besides the parameter for the fourcc. New lists can be supported with new enum values. Unfortunately, avpriv_get_raw_pix_fmt_tags could not be removed, as the fourcc2pixfmt tool uses the table of raw pix fmts. No other user of this function remains. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Remove redundant prevention against infinite loopAndreas Rheinhardt2021-12-16
| | | | | | | | | | | | | | | | | | | This piece of code has been added as FFmpeg's answer to infinite loops in try_decode_frame() in commit 6072a19b4f311cb172d45e90daad90824e40e4b6. There is no loop around try_decode_frame() any more, so this code can be removed. This code is only triggered in case a) the codec parameter could not be determined, b) the decode delay could not be guessed or c) no packet was ever encountered and the encoder has the AV_CODEC_CAP_CHANNEL_CONF. In these cases the new code will no longer emit a "decoding for stream %d failed" message, which is prima facie false. In case a) an additional "Could not find codec parameters" message is (and will be) emitted. No warning will be emitted any more in case b) (this happens e.g. with some h264-conformance FATE-files). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Remove fake-loopAndreas Rheinhardt2021-12-16
| | | | | | | When flushing, try_decode_frame() itself loops until the desired properties have been found or the decoder is drained. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: allow total size of packets in raw_packet_buffer to reach ↵Marton Balint2021-11-14
| | | | | | | | | | | | | | probesize Previously this was hardcoded to 2500000 bytes, so probing of the stream codecs was always limited by this, and not probesize. Also keep track of the actual size of packets in raw_packet_buffer and not the remaining size for simplicity. Fixes ticket #5860. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/demux: preserve AV_PKT_FLAG_CORRUPT in parse_packetAlex Shumsky2021-10-29
| | | | | | | If original packet is corrupted, then parsed packet is probably corrupted too. Let the application decide what to do. Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
* avformat/demux: Use r_frame_rate in compute_frame_duration if ↵Nicolas Gaullier2021-09-23
| | | | | | | codec_framerate is unknown Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/demux: Use av_opt_set_int() where appropriateAndreas Rheinhardt2021-09-18
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Don't free inexistent ID3v2 metadataAndreas Rheinhardt2021-09-17
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move demuxing code out into a new fileAndreas Rheinhardt2021-09-17
libavformat/utils.c has over 4800 lines and is supposed to contain "various utility functions for use within FFmpeg". In reality it contains all that and the whole demuxing core of libavformat. This is especially bad, because said file includes the FFMPEG_VERSION (the git commit sha) so that it is rebuilt whenever the commit HEAD points to changes. Therefore this commit makes it smaller by moving the demuxing code out to a new file, demux.c (in analogy to mux.c for the muxing code). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>