1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

104712 Commits

Author SHA1 Message Date
Shiyou Yin
07f8f78a5f configure: Add support for loongarch.
For la464 cpu: ./configure --cpu=la464

With cross-compiler:
./configure --cross-prefix=loongarch64-linux-gnu- \
            --enable-cross-compile --arch=loongarch64 \
            --target-os=linux --cpu=la464

Reviewed-by: 陈昊 <chenhao@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-01 17:44:56 +01:00
Zane van Iperen
12f8293c02
avformat/scd: add demuxer
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>
2021-12-02 01:41:55 +10:00
Andreas Rheinhardt
d1b47f3bfc avcodec/vaapi_encode: Fix segfault upon closing uninitialized encoder
Fixes ticket #9537.
Probably a regression since 2b32068916.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-01 13:58:20 +01:00
Andreas Rheinhardt
8a18db3ec6 avformat/matroskaenc: Sort cues entries by pts
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>
2021-11-30 17:42:18 +01:00
Andreas Rheinhardt
d47a986b79 avcodec/qsvenc: Properly flush the FIFO on close
Freeing the new H.264 specific fields has been forgotten.
(This leak only appears in case the encoder has not been completely
drained.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-30 17:17:52 +01:00
Andreas Rheinhardt
e9e2157dda avcodec/qsvenc: Fix leak of A53 data
Up until now, it has only been freed when the QSVFrame is reused,
so that the last one contained in it leaked at the end.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-30 17:17:23 +01:00
Andreas Rheinhardt
1cdbccaa16 avcodec/qsvenc: Fix leak and crash when encoding H.264 due to A53_CC
Since commit 3bbe0c210b, the Payloads
array of every QSVFrame leaks as soon as the frame is reused;
the leak is small and not very noticeable, but if there is an attempt
to use said array the ensuing crash is much more noticeable.
This happens when encoding H.264 with A53 CC side data.

Furthermore, if said array can not be allocated at all, an AVFrame
leaks.

Fix all of this by not allocating the array separately at all; put it
in QSVFrame instead and restore the Payloads array upon reusing the
frame.

Finally, use av_freep() instead of av_free() to free the payload
entries.

Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-30 17:16:32 +01:00
Andreas Rheinhardt
e22dff43e7 fftools/ffmpeg_opt: Don't set source_index redundantly
It is already set in new_output_stream().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-30 12:06:02 +01:00
Andreas Rheinhardt
4913f05ccf fftools/ffmpeg_opt: Don't duplicate array unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-30 11:53:22 +01:00
Ryoji Gyoda
d9f07a506d avformat/fifo: avoid repeated scaling of timestamps on failure and recovery
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>
2021-11-29 22:20:20 +01:00
softworkz
939711905a fftools/ffprobe: print size of attachment streams (extradata_size)
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-29 21:30:11 +01:00
asilvestre
1c2dae153c avformat/flvenc: avoid 24bit timestamp truncation for FLV metadata
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>
2021-11-29 21:30:09 +01:00
Michael Niedermayer
3809467d4d avcodec/iff: limit written bytes to twice the output array size in decode_delta_l()
Fixes: Timeout
Fixes: 39436/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6624915520880640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-29 17:15:07 +01:00
Michael Niedermayer
76c41a5bfe tools/target_dec_fuzzer: Disable MB debug after a few iterations
This debug code can be quite slow on constructed streams

Fixes: Timeout
Fixes: 38907/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6334628852531200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-29 17:15:07 +01:00
Michael Niedermayer
3a64a4c582 avformat/mov: Check channels for mov_parse_stsd_audio()
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>
2021-11-29 17:15:07 +01:00
Michael Niedermayer
2877ddddda avcodec/vqavideo: Use GetByteContext and check for end
Fixes: out of array access
Fixes: Timeout
Fixes: 40481/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQA_fuzzer-6502647583080448

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-29 17:15:07 +01:00
Limin Wang
86a2123a6e avfilter/src_movie: add format_opts for the opened file
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-29 09:26:40 +08:00
James Almer
0d924d6e5a avcodec/videotoolbox: silence some -Wimplicit-fallthrough warnings
Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-28 20:23:26 -03:00
rcombs
c7e527f7f3 lavc/videotoolbox: fix build on pre-10.14 SDKs
Also fixes handling of future codec tags (needed to bswap)
2021-11-28 17:15:36 -06:00
rcombs
4cedf44aae lavc: bump minor version for new VT hwaccels 2021-11-28 16:41:24 -06:00
rcombs
da0179b262 lavc/proresdec: add videotoolbox hwaccel 2021-11-28 16:40:58 -06:00
rcombs
805bf2ebc9 lavc/proresdec: add scaffolding for hwdec support 2021-11-28 16:40:58 -06:00
rcombs
350eb59f8c videotoolbox: add alpha support 2021-11-28 16:40:58 -06:00
rcombs
a41a2efc85 lavc/videotoolbox: add VP9 hardware acceleration
On M1 Max, this supports profiles 0 and 2, but not 1 and 3.
2021-11-28 16:40:58 -06:00
rcombs
e3c6cc96cf lavc/videotoolbox: call VTRegisterSupplementalVideoDecoderIfAvailable
This is required for VP9 to work.
2021-11-28 16:40:44 -06:00
rcombs
530c4a7ea9 lavc/videotoolbox: expose some functions as lavc-internal 2021-11-28 16:40:44 -06:00
rcombs
2c89443e84 lavc/hevcdec: support all color formats in videotoolbox hwaccel 2021-11-28 16:40:43 -06:00
rcombs
caad1146e2 lavc/h264dec: support all color formats in videotoolbox hwaccel 2021-11-28 16:40:43 -06:00
rcombs
f0952f87bc lavc/videotoolbox: select 4:2:2 and 4:4:4 formats when applicable 2021-11-28 16:40:43 -06:00
rcombs
b0c07f2938 lavc/videotoolbox: fix format computation
Use sw_pix_fmt instead of pix_fmt (consistent with other hwaccels)
2021-11-28 16:40:43 -06:00
rcombs
79e51d6c0f lavc/videotoolbox: escape 0x00000[0-3]s in avcC PSs 2021-11-28 16:40:43 -06:00
rcombs
d2229eca51 lavu/videotoolbox: add 422 and 444 pixel format mappings 2021-11-28 16:40:43 -06:00
rcombs
f0204de47d swscale: add P210/P410/P216/P416 input 2021-11-28 16:40:43 -06:00
rcombs
b2cd1fb2ec lavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats
These are used by VideoToolbox hardware decoders.
2021-11-28 16:40:43 -06:00
rcombs
4b54818981 ffmpeg: remove ffmpeg_videotoolbox
This was almost completely redundant. The only functionality that's no longer
available after this removal is the videotoolbox_pixfmt arg, which has been
obsolete for several years.
2021-11-28 16:40:43 -06:00
Andreas Rheinhardt
5593f5cf24 avcodec/vqavideo: Remove dead code
Fixes Coverity issue #1493344.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-28 07:00:33 +01:00
Andreas Rheinhardt
d6c16c5217 avcodec/mobiclip: Rewrite code to make it clearer
In order to know that the earlier code did not use uninitialized
values one needs to know that the lowest four bits of each used
value of pframe_block4x4_coefficients_tab do not vanish identically.
E.g. Coverity did not get this and warned about it in ticket #1466632.
Fix this by slightly rewriting the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-28 06:59:56 +01:00
Andreas Rheinhardt
f5e74e8d48 avfilter/vf_paletteuse: Add missing parentheses
Fixes a mistake in dea673d0d5.
GCC emitted a -Wint-in-bool-context warning because of that.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 19:15:19 +01:00
Alex Xu (Hello71)
6fdd7fe0b8 avformat/img2dec: probe JFIF/Exif header
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>
2021-11-27 18:24:49 +01:00
Alex Xu (Hello71)
cd0bdce71a avcodec/mjpeg_parser: skip markers after EOI, not by size
The check for m->size >= 0xF000 is intended to avoid skipping too much
garbage data between JPEG frames in test_roman (thus missing next SOI),
but it erroneously also skips valid markers between SOI and SOS. Instead
of this, we should simply skip parsing markers other than SOI after EOI.
That way, we will not accidentally skip over SOI due to some garbage
between frames. There is still a small risk of encountering FFD8 in the
garbage data, but the chance of this is fairly low.

Fixes: https://trac.ffmpeg.org/ticket/8967
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-27 18:24:49 +01:00
Andreas Rheinhardt
2cddb2f7a8 avformat/mpegtsenc: Avoid allocation of AVPacket
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 12:55:41 +01:00
Andreas Rheinhardt
a81e0ee21f avformat/movenc: Avoid allocation of AVPacket
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 12:55:41 +01:00
Andreas Rheinhardt
5e01fc8318 avformat/dashenc: Don't use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 12:55:41 +01:00
Andreas Rheinhardt
a5ee166327 avformat/avformat: Add AVStream parameter to check_bitstream() sig
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>
2021-11-27 12:55:41 +01:00
Lynne
c90b3661fa
hwcontext_vulkan: use correct return value for allocation failure 2021-11-27 04:46:41 +01:00
Lynne
33be4e6ca9
configure: fix test_pkg_config_cpp after 1e5acc1b59 2021-11-27 04:46:39 +01:00
Limin Wang
7bf4c06809 avformat/rtp: add localaddr for network interface selection
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-27 11:21:17 +08:00
Michael Niedermayer
57adb26d05 avformat/avidec: Check read_odml_index() for failure
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>
2021-11-26 21:31:06 +01:00
Michael Niedermayer
ff23cee200 avcodec/txd: Move input size checks before allocation
Fixes: Timeout
Fixes: 40882/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TXD_fuzzer-4893364584054784

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-26 21:31:06 +01:00
Andreas Rheinhardt
7c2b9067d0 avformat/cafdec: Avoid unnecessary avio_tell() calls
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-26 18:55:58 +01:00