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

104152 Commits

Author SHA1 Message Date
Andreas Rheinhardt
2b2e9afdd2 avformat/(lrc|scc)enc: Use avio_w8() to write a single char
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:16:34 +02:00
Andreas Rheinhardt
8766361fc1 avformat/subtitles: Honour ff_subtitles_read_line() documentation
It claims to always zero-terminate its buffer like snprintf(),
yet it does it not on EOF. Because of this the mcc demuxer
used uninitialized values when reading an empty input file.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:16:29 +02:00
Andreas Rheinhardt
2004d8d36d avformat/sccdec: Avoid zero-terminating unnecessarily
ff_subtitles_queue_insert() does not require its events to be
zero-terminated as it has a parameter for the length.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:16:21 +02:00
Andreas Rheinhardt
ac42b60441 avformat/sccdec: Make constants more intelligible
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:16:02 +02:00
Andreas Rheinhardt
6795ebb2ea avformat/sccdec: Fix position of returned subtitle packets
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:15:43 +02:00
Andreas Rheinhardt
e1d2a208a9 avformat/sccdec: Remove redundant check
The av_sscanf() will filter lines like "Scenarist_SCC V1.0" out.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:14:34 +02:00
Andreas Rheinhardt
60e12318bb avformat/sccdec: Don't use uninitialized data, fix crash, simplify logic
Up until now, the scc demuxer not only read the line that it intends
to process, but also the next line, in order to be able to calculate
the duration of the current line. This approach leads to unnecessary
complexity and also to bugs: For the last line, the timing of the
next subtitle is not only logically indeterminate, but also
uninitialized and the same applies to the duration of the last packet
derived from it.* Worse yet, in case of e.g. an empty file, it is not
only the duration that is uninitialized, but the whole timing as well
as the line buffer itself.** The latter is used in av_strtok(), which
could lead to crashes. Furthermore, the current code always outputs
at least one packet, even for empty files.

This commit fixes all of this: It stops using two lines at a time;
instead only the current line is dealt with and in case there is
a packet after that, the duration of the last packet is fixed up
after having already parsed it; consequently the duration of the
last packet is left in its default state (meaning "unknown/up until
the next subtitle"). If no further line could be read, processing
is stopped; in particular, no packet is output for an empty file.

*: Due to stack reuse it seems to be zero quite often; for the same
reason Valgrind does not report any errors for a normal input file.
**: While ff_subtitles_read_line() claims to always zero-terminate
the buffer like snprintf(), it doesn't do so if it didn't read anything.
And even if it did, it would not necessarily help here: The current
code jumps over 12 bytes that it deems to have read even when it
hasn't.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:14:20 +02:00
Andreas Rheinhardt
03a0dbaff3 avutil/md5: Avoid av_unused variable
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:13:57 +02:00
Andreas Rheinhardt
5d10e21809 libpostproc/postprocess_template: Don't reimplement FFSWAP
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 17:13:42 +02:00
Andreas Rheinhardt
a412b5e792 avcodec/bmpenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
eec5a45f05 avcodec/dnxhdenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
30c802f3ae avcodec/dpxenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
39d28ea4d5 avcodec/magicyuvenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
c10a2959c0 avcodec/proresenc_anatoliy: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
be6da2f252 avcodec/snowenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
4b1aa74de3 avcodec/magicyuvenc: Use immediate when known
It allows the compiler to optimize the bytestream2 checks away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
1f387ae4cb avfilter/af_afade: Remove impossible branch
Also don't call ff_inlink_queued_samples() unnecessarily often.

Fixes Coverity issue 1427665.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:29:11 +02:00
Andreas Rheinhardt
797fefa2e5 avfilter/formats: Update outdated comment
Forgotten in 06754f7bbf.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:29:11 +02:00
Andreas Rheinhardt
e1ddaf229d avfilter/formats: Don't unnecessarily reget pixfmt descriptor
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:29:11 +02:00
Andreas Rheinhardt
3a82bb8128 avfilter/f_reverse: Don't use redundant query_formats function
Said function did exactly what ff_default_query_formats() does
for audio; so just remove it, so that ff_default_query_formats()
will be called.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:21:58 +02:00
Andreas Rheinhardt
c1f7e62810 avfilter/avfilter: Remove unused buffer
Unused since the removal of ff_get_ref_perms_string() in
a05a44e205.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:20:42 +02:00
Andreas Rheinhardt
e1874cd3c4 avfilter/avfiltergraph: Remove always-true check
Always true since bc1a985ba0.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:20:21 +02:00
Andreas Rheinhardt
0615a39fed avfilter/avfiltergraph: Free AVFilterGraph options properly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:20:21 +02:00
Andreas Rheinhardt
22c4f33991 avfilter/avfiltergraph: Simplify adding filter to graph
By reallocating the array of pointers to the AVFilterContexts
before allocating the new AVFilterContext one can avoid freeing
the new AVFilterContext in case the array could not be reallocated.

Also switch to av_realloc_array() while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:20:21 +02:00
Derek Buitenhuis
68815d6791 lavf/movenc: Write 'dby1' minor brand if Dolby content is being muxed to MP4
This is as per:
   * mp4ra: http://mp4ra.org/#/brands
   * Dolby Vision muxing spec (which is public):
       https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2021-10-01 20:29:25 +01:00
Limin Wang
da5497a1a2 avfilter/vf_codecview: added new options for block
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-01 07:49:00 +08:00
Michael Niedermayer
9f40b5badb swscale/swscale_internal: Avoid unsigned for slice parameters
Mixing unsigned and signed often leads to unexpected arithmetic results.
Fixes: out of array write
Found-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-30 19:47:15 +02:00
Soft Works
35d784aca9 libavformat/asfdec: Add braces to define
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-30 14:02:27 +02:00
Soft Works
c8cdf641c7 libavformat/asfdec: Use predefined constants
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-30 14:02:27 +02:00
Arif Driessen
3ee4502753 doc/filters: note values for afftflt window function 2021-09-30 16:13:10 +05:30
Paul B Mahol
a7fc78c1a6 avfilter/vf_avgblur: switch to faster algorithm 2021-09-30 01:22:57 +02:00
Paul B Mahol
a673761ce8 avfilter/vf_blend: add few more modes 2021-09-30 01:22:48 +02:00
Michael Niedermayer
1ad4782d2a avcodec/siren: Improve the bits left threshold in decode_envelope()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-29 19:52:10 +02:00
Michael Niedermayer
109113b54f avcodec/siren: Check available bits in decode_envelope()
Fixes: Timeout
Fixes: 39089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSNSIREN_fuzzer-6677219854909440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-29 19:52:10 +02:00
Paul B Mahol
df163487d0 avfilter/vf_blend: add harmonic mode 2021-09-29 19:33:59 +02:00
Paul B Mahol
8ebcff9111 avfilter/vf_blend: add geometric mode 2021-09-29 19:33:59 +02:00
Paul B Mahol
f3b07b8b12 avfilter/vf_morpho: add tophat and blackhat operations 2021-09-29 18:02:26 +02:00
Paul B Mahol
b4626da92b avfilter/vf_morpho: add gradient operation type 2021-09-29 18:02:25 +02:00
Andreas Rheinhardt
d619e82e97 avcodec/zmbvenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-29 17:02:03 +02:00
James Almer
04e9b9e514 avfilter/vf_floodfill: constify the AVFrame parameter in is_same() and pick_pixel() functions
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-29 11:46:20 -03:00
James Almer
272c293c02 fate/checkasm: add missing tests to FATE
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-29 11:46:20 -03:00
Limin Wang
c5f3143090 avcodec/libsvtav1: properly enforce CQP mode when set in wrapper
SVT-AV1 seems to have switched their default from CQP to CRF in February,
so enforce the controlling option accordingly.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:01:16 +08:00
Limin Wang
ed89be1e02 doc/encoders: add available values for libsvtav1 options
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:01:16 +08:00
Limin Wang
0f5e1877ba avformat/hlsenc: add const for filename argument
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:00:14 +08:00
Limin Wang
4be3f6d2d2 avformat/utils: add const for argument passed to ff_is_http_proto()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:00:14 +08:00
Limin Wang
31831b611b avfilter/vf_guided: Fix indention
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:00:13 +08:00
Limin Wang
e99be1735a avcodec: remove the unused low_delay
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:00:13 +08:00
Andreas Rheinhardt
b2538ce578 avfilter/vf_morpho: Rename functions to unbreak MSVC
MSVC's headers include function-like macros min and max which
collide with function pointers in vf_morpho.c, leading to
compilation failures. Fix this by renaming said function pointers.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-29 09:17:46 +02:00
Andreas Rheinhardt
09408539f4 checkasm/hevc_pel: Fix stack buffer overreads
This patch increases several stack buffers in order to fix
stack-buffer-overflows (e.g. in put_hevc_qpel_uni_hv_9 in
line 814 of hevcdsp_template.c) detected with ASAN in the hevc_pel
checkasm test.
The buffers are increased by the minimal amount necessary
in order not to mask potential future bugs.

Reviewed-by: Martin Storsjö <martin@martin.st>
Reviewed-by: "zhilizhao(赵志立)" <quinkblack@foxmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-29 04:35:31 +02:00
Andreas Rheinhardt
ff80090374 avutil/utils: Remove racy check from avutil_version()
avutil_version() currently performs several checks before
just returning the version. There is a static int that aims
to ensure that these tests are run only once. The reason is that
there used to be a slightly expensive check, but it has been removed
in 92e3a6fdac. Today running only
once is unnecessary and can be counterproductive: GCC 10 optimizes
all the actual checks away, but the checks_done variable and the code
setting it has been kept. Given that this check is inherently racy
(it uses non-atomic variables), it is best to just remove it.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-29 02:58:07 +02:00