summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/scd: add demuxerZane van Iperen2021-12-02
| | | | | | | | | | | | | | | | Adds demuxer for Square Enux SCD files. Based off [1] and personal investigation. This has only been tested against Drakengard 3 (PS3) *_SCD.XXX files (big-endian). As it is highly likely that FFXIV (PC) files are little-endian, this demuxer is marked as experimental until this can be confirmed. [1]: http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt Reviewed-by: Peter Ross <pross@xvid.org> Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/matroskaenc: Sort cues entries by ptsAndreas Rheinhardt2021-11-30
| | | | | | | | | | | Currently they are ordered as-written (i.e. by increasing position); in case av_interleaved_write_frame() is used, this is (mostly) the same as ordered by increasing dts. Yet the Matroska specification strongly recommends (SHOULD) that the CuePoints be sorted by CueTime. mkvalidator warns when they are not. Therefore this commit sorts them accordingly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/fifo: avoid repeated scaling of timestamps on failure and recoveryRyoji Gyoda2021-11-29
| | | | | | | | | | | | | | | | | | | If fifo_thread_recover() succeeds immediately after fifo_thread_dispatch_message() fails, the dts of the packet is scaled twice, causing cur_dts to be abnormally large and "Application provided invalid, non monotonically increasing dts to muxer in stream" to occur repeatedly. Steps to reproduce: 1. ffmpeg -f lavfi -i testsrc -c:v libx264 -map 0:v -flags +global_header -f fifo -fifo_format flv -attempt_recovery 1 -recover_any_error 1 rtmp://example.com/livekey 2. set a breakpoint on fifo_thread_recover 3. force disconnect from the rtmp server 4. wait for break 5. reconnect to the rtmp server 6. resume execution of ffmpeg Signed-off-by: Ryoji Gyoda <gy.cft4@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/flvenc: avoid 24bit timestamp truncation for FLV metadataasilvestre2021-11-29
| | | | | | | | | | | | | | | | | FLV AMF tags have a 24bit field for timestamps plus an 8bit for extended timestamps. All FLV AMF tags except when we write metadata handle this correctly using the put_timestamp function. Until now when writing metadata we were only using the first 24 bits and thus the timestamp value was wraping around 4 hours 40 minutes (16,800,000 ms, max 24 bit value 16,777,216) of playback. This commit fixes this applying this same function put_timestamp for the metadata FLV tag. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mov: Check channels for mov_parse_stsd_audio()Michael Niedermayer2021-11-29
| | | | | | | | Fixes: signed integer overflow: -776522110086937600 * 16 cannot be represented in type 'long' Fixes: 40563/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644829447127040 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/img2dec: probe JFIF/Exif headerAlex Xu (Hello71)2021-11-27
| | | | | | | | | | | | | | | | | Due to reasons, mpv doesn't pass filename when probing. mpv also sets default probescore threshold to 26. Since the current jpeg_probe implementation returns 25 until EOI, it means that the whole image needs to be probed to succeed. Worse, the whole image is not passed at once; increasingly large buffers are tried before that. Adding it up together, if many demuxers are enabled, moderately large JPEG files (few MB) can take several seconds to open, despite taking less than 1 second to actually decode. Therefore, adjust the heuristic to be more optimistic if proper JFIF or Exif segments are found. While not strictly required, the vast majority of JPEG-ish files have one or the other or both. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpegtsenc: Avoid allocation of AVPacketAndreas Rheinhardt2021-11-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: Avoid allocation of AVPacketAndreas Rheinhardt2021-11-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/dashenc: Don't use stack packetAndreas Rheinhardt2021-11-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Add AVStream parameter to check_bitstream() sigAndreas Rheinhardt2021-11-27
| | | | | | | | | | For most check_bitstream() functions this just avoids having to dereference s->streams[pkt->stream_index] themselves; but for meta-muxers it will allow to forward the packet to stream with a different stream_index (belonging to a different AVFormatContext) without using a spare packet. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rtp: add localaddr for network interface selectionLimin Wang2021-11-27
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/avidec: Check read_odml_index() for failureMichael Niedermayer2021-11-26
| | | | | | | | Fixes: Timeout Fixes: 40950/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6478873068437504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/cafdec: Avoid unnecessary avio_tell() callsAndreas Rheinhardt2021-11-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/udp: remove local localaddr arrayLimin Wang2021-11-26
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/mpegts: fix stream index in verbose log messageMarton Balint2021-11-25
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/libsrt: add missing version check for snddropdelayMarton Balint2021-11-25
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/http: prevent truncation of sanitized_pathJames Almer2021-11-25
| | | | | | | | | path1 and sanitized_path are both MAX_URL_SIZE bytes long, yet the latter is copied from the former with the addition of one extra character. Should fix a -Wformat-truncation warning. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/rtp: support RGB/BGR for rfc4175Limin Wang2021-11-25
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat: suppport YUV 4:2:2 10-bit for rfc4175Limin Wang2021-11-25
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtpenc: adds partial support for the RFC 4175Limin Wang2021-11-25
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtpdec_rfc4175: support for yuv420p formatLimin Wang2021-11-25
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/rtpdec_rfc4175: use rawvideo for uyvy422Limin Wang2021-11-25
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/mov: make STTS duration unsigned intGyan Doshi2021-11-22
| | | | | | | | | | As per 8.6.1.2.2 of ISO/IEC 14496-12:2015(E), STTS sample offsets are to be always stored as uint32_t. So far, they have been signed ints which led to desync in files with very large offsets. The MOVStts struct was used to store CTTS offsets as well. These can be negative in version 1. So a new struct MOVCtts was created and all declarations for CTTS usage changed to MOVCtts.
* avformat/utils: Remove duplicated AV_DISPOSITION_FOO <-> "foo" tableAndreas Rheinhardt2021-11-19
| | | | | | | Instead reuse stream_options. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfenc: Remove redundant DNXHD frame size checksAndreas Rheinhardt2021-11-19
| | | | | | | | | | | The actual frame_size is no longer used since commit 3d38e45eb85c7a2420cb48a9cd45625c28644b2e; and the check for "< 0" is equivalent to the CID being valid. But this is already checked by avpriv_dnxhd_get_interlaced() (and is actually already ensured by mxf_dnxhd_codec_uls containing this CID). Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfenc: Store locally whether DNXHD profile is interlacedAndreas Rheinhardt2021-11-19
| | | | | | | | It is just a flag per supported CID. So there is no reason to use an avpriv function for this purpose. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/nullenc: Use ff_interleave_packet_passthrough()Andreas Rheinhardt2021-11-19
| | | | | | | | | | It avoids the overhead of the packet list; furthermore, using ff_interleave_packet_per_dts() is wrong for the null muxer anyway, because said muxer accepts packets without timestamps, which ff_interleave_packet_per_dts() can't handle. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mux: Avoid overhead of packet list in case of single streamsAndreas Rheinhardt2021-11-19
| | | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mux: Store pointer to interleavement func in FFFormatContextAndreas Rheinhardt2021-11-19
| | | | | | | It avoids branches lateron and will allow to easily avoid the overhead of the linked list currently in use in case there is only one stream. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/librist: correctly initialize logging_settingsGijs Peskens2021-11-18
| | | | | | Correct solution as suggested by Marton Balint on ffmpeg-devel Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/utils: Remove unused shorthand feature for auto-inserted BSFAndreas Rheinhardt2021-11-18
| | | | | | | | Besides being unused it should not be used at all: The order of options of bitstream filters is not guaranteed to be stable at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfenc: Make init function out of write_headerAndreas Rheinhardt2021-11-18
| | | | | | | | | The MXF muxers only write the header after they have received a packet; the actual write_header function does not write anything. So make an init function out of it. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfenc: Remove redundant checkAndreas Rheinhardt2021-11-18
| | | | | | | | None of the muxers here has the AVFMT_NOSTREAMS flag set, so it is checked generically that there are streams. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hlsenc: Only write something if there is something to writeAndreas Rheinhardt2021-11-18
| | | | | | | | | | This is especially important in case avio_write() would be switched to an unsigned type like size_t, then a potential error from avio_read() (with negative return value) would no longer be handled gracefully by avio_write(). Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/hlsenc: Remove nonsense memsetAndreas Rheinhardt2021-11-18
| | | | | | | | | | | The memset here is both unnecessary (avio_read() ignores the previous content of the destination buffer) as well as nonsense (for a char buf[BUFSIZE] sizeof(buf) and sizeof(BUFSIZE) are not the same; the latter is sizeof(int)). Fixes Coverity issue #1465863. Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/http: Add short_seek_size optionDerek Buitenhuis2021-11-17
| | | | | | | | | | | | | | | In 45bfe8b838275235412777dd430206d9a24eb3ee, short_seek_threshold was removed from the public AVIO struct. Although this option was private and not intended to be used by public API users, it was nonetheless, because it provided functionality that could otherwise not be gained via public API. This was especially important for networked I/O like HTTP, where the internal size for lavf could be way to small depending on the specifics of a user's usecase, such as reading interlavd media files from cloud storage. Add an AVOption to make this functionality accessible to the HTTP client. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavf: add "disposition" AVOption to AVStream AVClassAnton Khirnov2021-11-16
| | | | Use it to remove custom disposition parsing code from ffmpeg.c
* lavf: add public functions converting dispositions to/from stringsAnton Khirnov2021-11-16
|
* lavf: add an AVClass to AVStream on next major bumpAnton Khirnov2021-11-16
| | | | | | | Also add a function to retrieve that class, analogously to avformat_get_class(). This will be useful for adding an AVOption for dispositions.
* lavf: improve AV_DISPOSITION_* doxyAnton Khirnov2021-11-16
| | | | | Also switch the values definition to the (1 << N) style, which is easier to read.
* */version.h: define FF_API macros unconditionallyAnton Khirnov2021-11-15
| | | | | | | There is no reason to wrap them in #ifndef guards, they should only be defined here and nowhere else. The define guards just add the possibility to accidentally use the same FF_API name in different libraries.
* avformat/concatdec: fix NEEDS_UNSAFE flag valueGoogleplex2021-11-14
| | | | | | | | NEEDS_UNSAFE has the same value as NEEDS_FILE, causing "duration not allowed if safe" error while duration directive doesn't require unsafe mode. Signed-off-by: Googleplex <yyoung2001@gmail.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/dhav: Limit get_duration() iterationsMichael Niedermayer2021-11-14
| | | | | | | | | Fixes: Timeout Fixes: 39971/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5756969890217984 Fixes: 39977/clusterfuzz-testcase-minimized-ffmpeg_dem_DHAV_fuzzer-5327123053674496 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hls_sample_encryption: Fix precedenceAndreas Rheinhardt2021-11-09
| | | | | | | Fixes Coverity ticket #1492869. Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/apngenc: Use UINT16_MAX instead of USHRT_MAXAndreas Rheinhardt2021-11-09
| | | | | | The latter needn't be 16 bits. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Don't unnecessarily reduce aspect ratioAndreas Rheinhardt2021-11-07
| | | | | | | Fixes ticket #9497. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mpegtsenc: do not include adaptation field in teletext TS packetsAlex Shumsky2021-11-06
| | | | | | | | | | | | | | | From ETSI EN 300 472 V1.3.1 (2003-05) Specification for conveying ITU-R System B Teletext in DVB bitstreams: 4.1 Transport Stream (TS) packet format The standard TS packet syntax and semantics are followed, noting the following constraint: - adaptation_field_control only the values "01" and "10" are permitted. Some set top boxes (Motorola, Arris, Zyxel) refuse non-conforming packets. Signed-off-by: Alex Shumsky <alexthreed@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegtsenc: fix first_pcr initial updateMaksym Veremeyenko2021-11-06
| | | | | | | | | | | | | | | Commit 6f36eb0da71d22aadf8f056f0966bd86656ea57e claim it fixes endless loop on package generation if muxrate specified and copyts used. But actually it does not work properly if -mpegts_copyts 1 is specified: ffmpeg -y -copyts -i loewe.ts -c:v libx264 -x264opts nal-hrd=cbr:force-cfr=1 -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 1000k -c:a mp2 -f mpegts -mpegts_copyts 1 -muxrate 4500k -vframes 1000 test.ts ffmpeg generate huge file until it reach zero-based pcr value equal to first dts. Attached patch fixes it. Reviewed-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/dashenc: enabling streaming and hls_playlist for lhlsZhao Zhili2021-11-05
| | | | | | | Try to make the feature easier to use, especially since the user have enabled -strict experimental manually. The user shouldn't be surprised that hls_playlist is enabled for lhls automatically, so change the log level from warning to info for that.