1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-15 08:51:38 +02:00
Commit Graph

104822 Commits

Author SHA1 Message Date
Limin Wang
b51d772a50 avcodec/bitpacked_dec: remove AV_CODEC_CAP_EXPERIMENTAL capabilities
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-09 09:10:35 +08:00
Andreas Rheinhardt
cc1251ab81 avcodec/movtextdec: Sanitize style entries
There are three types of style entries which are redundant:
a) Entries with length zero. They are already discarded.
b) Entries that are equivalent to the default style:
They can be safely discarded.
c) Entries that are equivalent to the immediately preceding style
if the start of the current style coincides with the end of the
preceding style. In this case the styles can be merged.

This commit implements discarding/merging in cases b) and c).
This fixes ticket #9548. In said ticket each packet contained
exactly one style entry that covered the complete packet with
the exception of the last character (probably created by a tool
that didn't know that the style's end is exclusive). Said style
coincided with the default style, leading to a superfluous reset,
which is now gone.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 21:00:52 +01:00
Andreas Rheinhardt
cce2765ce9 avcodec/movtextdec: Perform RGB->BGR color conversion early
Reduces the amount of conversions.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 21:00:41 +01:00
Andreas Rheinhardt
4b2bc0b8fe avcodec/movtextdec: Deduplicate parsing of StyleRecords
Both TextSampleEntry and TextSample can contain StyleRecords;
yet both the code as well as the structures for them were duplicated.
This commit changes this.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 21:00:33 +01:00
Andreas Rheinhardt
683bbb75db avcodec/movtextdec: Rename several structure elements
Giving elements of a structure called StyleBox names like
"style_start" or "style_end" is redundant, especially given
that the relevant variables are also called style.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 21:00:14 +01:00
Andreas Rheinhardt
17a93fd377 avformat/mov: Simplify data->hex conversion
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 14:17:39 +01:00
Andreas Rheinhardt
d203f6b4b3 avformat/md5proto: Simplify data->hex conversion
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 14:15:53 +01:00
Andreas Rheinhardt
fbbe7729f0 avutil/aes_ctr: Avoid allocation of AVAES struct
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 14:14:00 +01:00
Andreas Rheinhardt
72745beb44 avformat/aadec: Use smaller scope for variables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 14:12:42 +01:00
Andreas Rheinhardt
e5ba554edf avformat/aadec: Simplify data->hex conversion
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 14:11:14 +01:00
Andreas Rheinhardt
d27b97b043 avformat/aadec: Simplify deriving file key
Don't use different src and dst in av_tea_crypt(); use in-place
modifications instead. Also let av_tea_crypt() encrypt all three
blocks in one call.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 13:55:07 +01:00
Andreas Rheinhardt
c9b3099210 avformat/aadec: Don't unnecessarily reinitialize AVTEA context
We use ECB, not CBC mode here, so one does not need to reinitialize
the context; for the same reason, one can also just let av_tea_crypt()
loop over the blocks, avoiding a loop here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 13:47:04 +01:00
Andreas Rheinhardt
a0900a318a avformat/aadec: Avoid copying data around
Up until now, the packets have been read in blocks of at most
eight bytes at a time; then these blocks have been decrypted
and copied into a buffer on the stack (that was double the size
needed...). From there they have been copied to the dst packet.

This commit changes this: The data is read in one go; and
the decryption avoids temporary buffers, too, by making
use of the fact that src and dst of av_tea_crypt() can coincide.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 13:45:08 +01:00
Andreas Rheinhardt
0a76f8217e avformat/aadec: Don't use the same loop counter in inner and outer loop
Due to this bush.aa (from the FATE suite) exported garbage metadata
with key "_040930".

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 13:30:18 +01:00
Andreas Rheinhardt
e38eaf4749 avformat/utils: Make ff_data_to_hex() zero-terminate the string
Most callers want it that way anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 00:42:48 +01:00
Andreas Rheinhardt
b09ea67b40 avcodec/libkvazaar: Increase array size
av_image_copy() expects an array of four pointers according to its
declaration; although it currently only touches pointers that
are actually in use (depending upon the pixel format) this might
change at any time (as has already happened for the linesizes
in d7bc52bf45).

This fixes a -Wstringop-overflow= warning with GCC 11.2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-08 00:36:32 +01:00
Limin Wang
f1c8c25832 avformat/rtsp: fix the error code from ffurl_read_complete()
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-07 20:48:07 +08:00
Limin Wang
6d42af02f5 avformat/rtsp: add error code handling for ff_rtsp_skip_packet()
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-07 20:33:17 +08:00
Limin Wang
f210766a55 avformat/rtsp: free the alloc memory if failed
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-07 20:33:17 +08:00
Limin Wang
130e4c6f4c avformat/rtsp: remove redundant assignment
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-07 20:33:17 +08:00
Gyan Doshi
a454dfacd5 avformat/concatf: ignore trailing whitespaces
The concatf protocol returns an opaque error on open if
concatf list file contains trailing newlines.

Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
Reviewed-by: James Almer <jamrial@gmail.com>
2021-12-07 17:50:55 +05:30
Anton Khirnov
9f717ca92f ffmpeg: handle errors in print_sdp()
Do not continue as if nothing happened.
2021-12-07 11:23:45 +01:00
Anton Khirnov
9145c6d3b2 ffmpeg: move setting video sync method to new_video_stream()
do_video_out() is the wrong place for it, since the necessary
information is already known when creating the stream and its value
should never change.
2021-12-07 11:23:45 +01:00
Anton Khirnov
6ce9546428 ffmpeg: deprecate passing numbers to -vsync
There is never a reason to do this, using symbolic names is always
preferred.
2021-12-07 11:23:45 +01:00
Anton Khirnov
e3833e8a24 FATE: stop using numeric arguments to -vsync
Symbolic names are always preferable.
2021-12-07 11:23:45 +01:00
Anton Khirnov
011114f3e1 ffmpeg: change vsync value to an enum
Stop explicitly defining VSCFR and DROP values, which were never
documented.
2021-12-07 11:23:45 +01:00
Anton Khirnov
bb6f591c49 ffmpeg: drop useless framerate assignments
If the input stream framerate is known, it will be configured on the
relevant filtergraph input and get propagated to the output stream in
the above line. That makes these assignments redundant.
2021-12-07 11:23:45 +01:00
Anton Khirnov
6ebaccf327 lavf/protocols: avoid discarding const in avio_enum_protocols()
Instead of storing the protocol pointer in the opaque iteration state,
store just the index of the next protocol, similarly to how
ff_urlcontext_child_class_iterate() works.
2021-12-07 11:16:14 +01:00
Anton Khirnov
c0e46ad9a9 lavf/img2enc: avoid a useless copy of the url
img2enc keeps a private (and possibly truncated) copy of the url that is
never modified. Just use AVFormatContext.url instead.
2021-12-07 11:16:14 +01:00
Anton Khirnov
7e29e0278f lavf/ftp: check for truncation in snprintf
Silences e.g. the following warning in gcc 10:
src/libavformat/ftp.c: In function ‘ftp_move’:
src/libavformat/ftp.c:1122:46: warning: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4091 [-Wformat-truncation=]
 1122 |     snprintf(command, sizeof(command), "RNTO %s\r\n", path);
      |                                              ^~       ~~~~
src/libavformat/ftp.c:1122:5: note: ‘snprintf’ output between 8 and 4103 bytes into a destination of size 4096
 1122 |     snprintf(command, sizeof(command), "RNTO %s\r\n", path);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-12-07 11:16:14 +01:00
Anton Khirnov
177a328c7c lavfi/vf_subtitles: stop using deprecated ass_set_aspect_ratio()
It has been deprecated in favor of ass_set_pixel_aspect() since version
0.11.0, roughly ~2014. Even Debian oldoldstable (stretch) has 0.13.
2021-12-07 11:16:14 +01:00
Anton Khirnov
877b6a9e82 lavd/v4l2: detect device name truncation
Silences the following warning with gcc 10:
src/libavdevice/v4l2.c: In function ‘v4l2_get_device_list’:
src/libavdevice/v4l2.c:1042:64: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 251 [-Wformat-truncation=]
 1042 |         ret = snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
      |                                                                ^~
src/libavdevice/v4l2.c:1042:15: note: ‘snprintf’ output between 6 and 261 bytes into a destination of size 256
 1042 |         ret = snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Previous patches intending to silence it have proposed increasing the
buffer size, but doing that correctly seems to be tricky. Failing on
truncation is simpler and just as effective (as excessively long device
names are unlikely).
2021-12-07 11:16:14 +01:00
Anton Khirnov
b532ca3d2f lavd/v4l2: reduce variable scope
device and cap are local to the loop iteration, there is no need for
them to retain their values. Especially for device it may be dangerous,
since it points to av_malloc'ed data.
2021-12-07 11:16:14 +01:00
Anton Khirnov
e1151fbf22 lavd/v4l2: do not clobber the context FD in v4l2_get_device_list()
The FD opened here is local to the loop iteration, there is no reason to
store it in the context. Since read_header() may have already been
called, this may ovewrite an existing valid FD.
2021-12-07 11:16:14 +01:00
Anton Khirnov
007819a5bc lavd/jack: increase buffer size for snprintf()
Maximum output size with a 32-bit int is 17 bytes, or 26 with a 64-bit
int.

Silences the following gcc 10 warning:
src/libavdevice/jack.c: In function ‘audio_read_header’:
src/libavdevice/jack.c:171:45: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  171 |         snprintf(str, sizeof(str), "input_%d", i + 1);
      |                                             ^
src/libavdevice/jack.c:171:9: note: ‘snprintf’ output between 8 and 17 bytes into a destination of size 16
  171 |         snprintf(str, sizeof(str), "input_%d", i + 1);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-12-07 11:16:14 +01:00
Andreas Rheinhardt
6fc0fc5441 fftools/ffmpeg_opt: Improve alloc/truncation checks when reading lines
Do this by switching from the dynamic buffer API to the AVBPrint API;
the former has no defined way to check for errors.
This also avoids allocating an AVIOContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-07 10:01:41 +01:00
Andreas Rheinhardt
f3a8d208c0 fftools/ffmpeg_opt: Improve checks for truncation/alloc error
Do this by switching from the dynamic buffer API to the AVBPrint API;
the former has no defined way to check for errors.
This also avoids allocating an AVIOContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-07 10:01:34 +01:00
Lynne
3f3772e444
packet: add description for the AVPacket.time_base field
This description documents the field. Thanks to elenril for
suggesting the phrasing.
2021-12-06 22:16:13 +01:00
Michael Niedermayer
b5ba74053c avformat/mov: Disallow duplicate smdm
Fixes: memleak
Fixes: 39879/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5327819907923968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-06 14:25:55 +01:00
Michael Niedermayer
51d5e90158 avcodec/gemdec: Move all support checks before image allocation
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-06 14:25:55 +01:00
Michael Niedermayer
e901716daf tools/target_dec_fuzzer: Adjust threshold for HQ_HQA
Fixes: Timeout
Fixes: 41120/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-6327761690558464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-06 14:25:55 +01:00
Michael Niedermayer
cd95ac7e33 tools/target_dec_fuzzer: adjust threshold for gem
Fixes: Timeout
Fixes: 42035/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GEM_fuzzer-5033604191748096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-06 14:25:55 +01:00
Michael Niedermayer
235ac7b492 avcodec/avpacket: Perform fewer reallocations in repeated av_grow_packet()
Fixes: Timeout
Fixes: 41446/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4667644540747776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-06 14:25:55 +01:00
Michael Niedermayer
59b4e7cbd8 avformat/mov: Check for EOF in mov_read_glbl()
Fixes: Infinite loop
Fixes: 41351/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5433895854669824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-06 14:25:55 +01:00
Andreas Rheinhardt
b0b90100bf avcodec/libopenh264dec: Increase array sizes, fix stack-buffer overread
av_image_copy() expects an array of four pointers and linesizes
according to its declaration; it currently only pointers that are
actually in use (depending upon the pixel format), but this might
change at any time. It has already happened for the linesizes in
d7bc52bf45 and so increasing their
array fixes a stack-buffer overread.

This fixes a -Wstringop-overflow= and -Wstringop-overread warning
from GCC 11.2.

Reviewed-by: Linjie Fu <linjie.justin.fu@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-06 13:52:00 +01:00
Gyan Doshi
ef00d40e32 doc/filters: note duration range in xfade 2021-12-06 16:35:47 +05:30
Andreas Rheinhardt
228b25ad9b avformat/smoothstreamingenc: Move buffers to the end of structs
This reduces codesize because the offsets of commonly used elements
are now smaller and thus need less bytes to encode in ptr+offset
addressing modes (with GCC 11.2 on x64: 0x1b8b -> 0x1a7b).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt
847d199138 avformat/takdec: Simplify data->hex conversion
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt
6c57e0b4a8 avutil/frame: Treat frame as uninitialized in get_frame_defaults()
Currently, it also tests whether extended_data points to something
different than the AVFrame's data array and frees extended_data
if it is different. Yet this is only necessary for one of its three
callers, namely av_frame_unref(); meanwhile the other two callers
took measures to avoid this (or rather, to make it to an av_free(NULL)).

This commit moves this chunk to av_frame_unref() (so that
get_frame_defaults() now treats its input as uninitialized)
and removes the now superfluous code in the other two callers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt
fc01a703de fftools/ffmpeg: Avoid creating unnecessary reference
The only caller of do_video_out() doesn't need the frame afterwards,
ergo one can replace an av_frame_ref() by av_frame_move_ref().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00