Commit Graph

24310 Commits

Author SHA1 Message Date
Gerard Sole
18ad360648 libavformat: add side_data copy in concat demuxer
Adds support for concat demuxer to copy the side data information
from the input file to the resulting file. It will behave like the
metadata copy, where the metadata of the first file is kept in the
the output file.

Extract the current code that already performs the stream side_data
copy into a separate method and reuse the method in the concat demuxer.

Signed-off-by: Gerard Sole <g.sole.ca@gmail.com>
2021-12-22 12:05:41 +01:00
John-Paul Stewart
50bfd5e96e avformat/mvdec: explicitly set duration
Resolves a warning that duration is being innaccurately estimated based
on bitrate.

Signed-off-by: John-Paul Stewart <jpstewart@personalprojects.net>
Reviewed-by: Peter Ross <pross@xvid.org>
2021-12-21 12:01:22 +11:00
John-Paul Stewart
3c9ffbd009 avformat/mvdec: read frame rate from data stream
Prior to this patch, for version 2 of the file format the frame rate was
hard-coded at 15 fps.  This uses the 64-bit floating-point value from
the data stream, similar to what is already done for version 3 of the
file format (around line 206).

Signed-off-by: John-Paul Stewart <jpstewart@personalprojects.net>
Reviewed-by: Peter Ross <pross@xvid.org>
2021-12-21 12:01:17 +11:00
Andreas Rheinhardt
16b1df7541 avformat/wvenc: Make init function out of write_header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-20 14:29:01 +01:00
Andreas Rheinhardt
ba27e248cf avformat/crcenc: Make init function out of write_header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-20 14:29:01 +01:00
Andreas Rheinhardt
631e31773b avformat/sdp: Fix use of uninitialised value
Fixes Coverity ticket #1495831.
Regression since fe31708eaa.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-20 02:37:08 +01:00
Andreas Rheinhardt
bb69b734c7 avformat/mxfenc: Avoid allocation for timecode track
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-19 01:01:47 +01:00
Andreas Rheinhardt
25ddf888d8 avformat/mxfenc: Use smaller types to make struct smaller
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-19 00:49:33 +01:00
Andreas Rheinhardt
69a45b8a49 avcodec/Makefile: Remove superfluous avformat->DNXHD dependencies
There is no mxfenc dependency any more since commit
b9a26b9d55.
Also remove a dnxhddata.h inclusion in mxfenc that was forgotten
in the very same commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-19 00:46:16 +01:00
Pierre-Anthony Lemieux
c8b5f2848d
avformat/aviobuf: ffio_copy_url_options
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-12-19 00:35:24 +10:00
Anton Khirnov
fe31708eaa lavf/sdp: add more thorough error handling
Return error codes when constructing a stream config fails, rather than
just disregarding the failure and continuing.
Propagate the error codes from av_sdp_create().
2021-12-17 10:23:07 +01:00
Anton Khirnov
b0518f9977 lavf/sdp: reindent switch() according to our conventions 2021-12-17 10:22:46 +01:00
Anton Khirnov
230646751d lavf/sdp: add const qualifiers where appropriate
Declares that these structs are read-only for this code.
2021-12-17 10:22:41 +01:00
Michael Niedermayer
dd94912479 avformat/4xm: Check for duplicate track ids
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Michael Niedermayer
0dcd95ef8a avformat/4xm: Consider max_streams on reallocating tracks array
Fixes: OOM
Fixes: 41595/clusterfuzz-testcase-minimized-ffmpeg_dem_FOURXM_fuzzer-6355979363549184

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-16 22:31:13 +01:00
Michael Niedermayer
e22ec484aa avformat/cinedec: Avoid repeatedly allocating packets beyond the input
Fixes: Timeout
Fixes: 41025/clusterfuzz-testcase-minimized-ffmpeg_dem_CINE_fuzzer-5540848285122560

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-16 22:31:13 +01:00
Michael Niedermayer
562021e2fd avformat/mov: Check next offset in mov_read_dref()
Fixes: signed integer overflow: 9223372036200463215 + 1109914409 cannot be represented in type 'long'
Fixes: 41480/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6553086177443840

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-16 22:31:13 +01:00
Michael Niedermayer
bf1e93bdc9 avformat/vivo: Favor setting fps from explicit fractions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Michael Niedermayer
7b24615565 avformat/vivo: Do not use the general expression evaluator for parsing a floating point value
Fixes: Timeout
Fixes: 41564/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVO_fuzzer-6309014024093696

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-16 22:31:13 +01:00
Michael Niedermayer
99b2700f5b avformat/mvdec: Use 64 bit in timestamp computation
Fixes: division by zero
Fixes: 42198/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5054366405492736.fuzz
Fixes: 42222/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-4561249331970048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 21:06:47 +01:00
Steven Liu
3f46ffe956 avformat/aviobuf: fix double free by return early on error
Because the s->buffer has been freed by av_freep in avio_closep.
It should not av_freep the buffer in label fail after avio_closep.
Then just move the av_freep before avio_closep and remove the label fail.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2021-12-16 11:02:57 +08:00
Andreas Rheinhardt
38e5ca9310 avformat/moflex: Don't use uninitialized timebase for data stream
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 03:08:10 +01:00
Andreas Rheinhardt
0a25abdacd avformat/moflex: Free AVPackets via av_packet_free() on error
(This is not a leak as long as av_free() completely frees blank
packets.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 03:06:52 +01:00
Andreas Rheinhardt
97e26937b4 avformat/demux: Remove redundant prevention against infinite loop
This piece of code has been added as FFmpeg's answer to
infinite loops in try_decode_frame() in commit
6072a19b4f. 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>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
52a4d44044 avformat/demux: Remove fake-loop
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>
2021-12-16 02:37:25 +01:00
Limin Wang
2f28f6c4b9 avformat/rtpdec_rfc4175: cosmetic changes
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-14 22:36:40 +08:00
Steven Liu
6cf55b9da2 avformat/hlsenc: deprecate hls_ts_options option
Because the hls_ts_options will be misunderstand by user,
and then user can use hls_segment_options instead of hls_ts_options.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2021-12-13 18:45:37 +08:00
Steven Liu
38fbe6a34c avformat/hlsenc: add hls_segment_options correct the segment options name
Because the hls_ts_options will be misunderstand by user that only can
be used in mpegts segments option. So add this option for segments.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2021-12-13 18:45:33 +08:00
Marton Balint
466441a0d2 avformat/img2enc: do not ignore IO errors
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-12-12 00:32:20 +01:00
Marton Balint
64834bb86a avformat: introduce AVFormatContext io_close2 which returns an int
Otherwise there is no way to detect an error returned by avio_close() because
ff_format_io_close cannot get the return value.

Checking the return value of the close function is important in order to check
if all data was successfully written and the underlying close() operation was
successful.

It can also be useful even for read mode because it can return any pending
AVIOContext error, so the user don't have to manually check AVIOContext->error.

In order to still support if the user overrides io_close, the generic code only
uses io_close2 if io_close is either NULL or the default io_close callback.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-12-12 00:32:20 +01:00
Marton Balint
8a40cfa4da avformat/aviobuf: return stored AVIO context error on avio_close
Otherwise IO errors at avio_flush() before closing may be lost.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-12-12 00:32:20 +01:00
Marton Balint
722d28db12 avformat/file: use proper return value in file_close
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-12-12 00:32:20 +01:00
Michael Niedermayer
4f44a218e5 avformat/mxfdec: Check for duplicate mxf_read_index_entry_array()
Fixes: memleak
Fixes: 41596/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6439060204290048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-09 13:40:54 +01:00
Michael Niedermayer
a4af92d7cb avformat/mxfdec: Check component_depth in mxf_get_color_range()
Fixes: shift exponent 4294967163 is too large for 32-bit type 'int'
Fixes: 41449/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6183636217495552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-09 13:12:45 +01:00
Andreas Rheinhardt
408b974796 avformat/utils: Add const where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-09 11:32:13 +01:00
Andreas Rheinhardt
a33e0ed11e avformat/utils: Fix wrong indentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-09 11:32:13 +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
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
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