1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

24983 Commits

Author SHA1 Message Date
Andreas Rheinhardt
7bacef580f avformat/matroskaenc: Only write DiscardPadding if nonzero
It is possible for the trailing padding to be zero, namely
e.g. if the AV_PKT_DATA_SKIP_SAMPLES side data is used
for leading padding. Matroska supports this (use a negative
DiscardPadding), but players do not; at least Firefox refuses
to play such a file. So for now only write DiscardPadding
if it is trailing padding and nonzero.
The fate-matroska-ogg-opus-remux was affected by this.

(I wish CodecDelay would not exist and DiscardPadding would
be used to instead trim the codec delay away (with the Block
timestamp corresponding to the time at which the actually
output audio is output).)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-05 20:33:09 +02:00
Anton Khirnov
693c1e631c lavf/mov: avoid leaks with multiple dv-audio streams 2022-09-05 08:14:36 +02:00
Anton Khirnov
1ef4620290 lavf/dv: do not update AVCodecParameters.sample_rate while demuxing
Demuxers are not allowed to do this and few callers, if any, will handle
this correctly. Send the AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE side data
instead.
2022-09-05 08:13:57 +02:00
Anton Khirnov
6def44128a lavf/dv: set audio bitrate only at stream creation
Demuxers are not supposed to update AVCodecParameters after the stream
was seen by the caller. This value is not important enough to support
dynamic updates for.
2022-09-05 08:13:09 +02:00
Anton Khirnov
000b8d2acc lavf/dv: set non-changing AVStream fields only once 2022-09-05 08:12:26 +02:00
Anton Khirnov
b2e1d1443c lavf/dv: forward errors from avformat_new_stream() 2022-09-05 08:11:48 +02:00
Anton Khirnov
f0283f278a lavf/dv: return a meaningful error code from avpriv_dv_produce_packet() 2022-09-05 08:11:27 +02:00
Anton Khirnov
090f12b157 lavf/dv: make returning the video packet optional
The mov demuxer only returns DV audio, video packets are discarded.

It first reads the data to be parsed into a packet. Then both this
packet and the pointer to its data are passed together to
avpriv_dv_produce_packet(), which parses the data and partially
overwrites the packet. This is confusing and potentially dangerous, so
just pass NULL and avoid pointless packet modification.
2022-09-05 08:10:55 +02:00
Anton Khirnov
f7b3fc4afe lavc/dv: rename constants to follow our naming conventions
CamelCase for enum tags, ALL_CAPS for enum values.
2022-09-05 08:10:26 +02:00
Anton Khirnov
b6196cb2ef lavf/dv: always provide avpriv_dv_* symbols
They are used from libavdevice.
2022-09-05 08:01:17 +02:00
Anton Khirnov
dcc4704a4e lavf/dv: remove DVMuxContext declaration from dv.h
DVMuxContext is only used inside dvenc.c, there is no reason for it to
be visible outside of that file.
2022-09-05 08:00:57 +02:00
Stephen Hutchinson
6195a0ee19 avformat/avisynth: reindent
Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2022-09-04 15:03:32 -04:00
Stephen Hutchinson
adead1ccd6 avformat/avisynth: implement avisynth_flags option
Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2022-09-04 15:03:28 -04:00
Stephen Hutchinson
c49beead19 avformat/avisynth: read _SARNum/_SARDen from frame properties
Initialized to 1:1, but if the script sets these properties, it
will be set to those instead (0:0 disables it, apparently).

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2022-09-04 15:03:23 -04:00
Andreas Rheinhardt
72c601e0f7 avutil/internal: Move avpriv-file API to a header of its own
It is not used by the large majority of files that include
lavu/internal.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:44 +02:00
Andreas Rheinhardt
04b7217872 avutil/dict: Move avpriv_dict_set_timestamp() to a header of its own
It is used almost nowhere, so it needn't be auto-included
almost everywhere.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:44 +02:00
Andreas Rheinhardt
7de9c0e9d7 avcodec/flac: Don't use bytestream API unnecessarily
It makes no sense here, as flac_parse_block_header()
is not even supposed to advance the caller's pointer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:55:22 +02:00
Andreas Rheinhardt
c421000434 avformat/hevc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:42:20 +02:00
Andreas Rheinhardt
8b5d155301 avformat/hevc: Fix crash on allocation failure, avoid allocations
The HEVC code currently uses an array of arrays of NALUs; one such array
contains all the SPS NALUs, one all PPS NALUs etc. The array of arrays
is grown dynamically via av_reallocp_array(), but given that the latter
function automatically frees its buffer upon reallocation error,
it may only be used with PODs, which this case is not. Even worse:
While the pointer to the arrays is reset, the counter for the number
of arrays is not, leading to a segfault in hvcc_close().

Fix this by avoiding the allocations of the array of arrays altogether.
This is easily possible because their number is bounded (by five).
Furthermore, as a byproduct we can ensure that the code always
produces the recommended ordering of VPS-SPS-PPS-SEI (which was
not guaranteed before).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-02 11:40:45 +02:00
Michael Niedermayer
1f1a368169
avformat/asfdec_o: limit recursion depth in asf_read_unknown()
The threshold of 5 is arbitrary, both smaller and larger should work fine

Fixes: Stack overflow
Fixes: 50603/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-6049302564175872

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-31 18:03:55 +02:00
Carl Eugen Hoyos
7180416084 lavf/sdp: Add missing version.h include
Fixes lavf version output in SDP, regression since 4eb9232c
2022-08-31 16:24:22 +02:00
Michael Niedermayer
c953baa084
avformat/mov: Check count sums in build_open_gop_key_points()
Fixes: ffmpeg.md
Fixes: Out of array access
Fixes: CVE-2022-2566

Found-by: Andy Nguyen <theflow@google.com>
Found-by: 3pvd <3pvd@google.com>
Reviewed-by: Andy Nguyen <theflow@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:45 +02:00
Michael Niedermayer
bcb4690304
libavformat/iff: Check for overflow in body_end calculation
Fixes: signed integer overflow: -6322983228386819992 - 5557477266266529857 cannot be represented in type 'long'
Fixes: 50112/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-6329186221948928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:44 +02:00
Michael Niedermayer
f3e823c2aa
avformat/avidec: Prevent entity expansion attacks
Fixes: Timeout
Fixes no testcase, this is the same idea as similar attacks against XML parsers

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-28 22:06:31 +02:00
Andreas Rheinhardt
d27c5bce33 avformat/tests/imf: Test ff_imf_parse_cpl_from_xml_dom cleanup on error
Improves the test; also should fix Coverity issue #1512408.

Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 02:16:36 +02:00
Andreas Rheinhardt
61fa1e14e4 avformat/imf_cpl: Check the right variable
Fixes Coverity issue #1512407.

Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-25 23:19:57 +02:00
Paul B Mahol
b347a05f1f avformat/riff: add support for ICMV files 2022-08-25 09:12:07 +02:00
Wujian(Chin)
76cb899f8a avformat/wavdec: fix the ID3 metadata obtained in WAV format's missing
Fixes ticket #9848.

Signed-off-by: wujian_nanjing <wujian2@huawei.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2022-08-24 10:45:33 +08:00
Andreas Rheinhardt
d09dacc197 avformat/os_support: Include stdint.h for int64_t
Fixes checkheaders for Windows targets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-24 03:43:52 +02:00
Michael Niedermayer
58a8e739ef
avformat/subviewerdec: Make read_ts() more flexible
Fixes: signed integer overflow: -1948269928 * 10 cannot be represented in type 'int'
Fixes: 49451/clusterfuzz-testcase-minimized-ffmpeg_dem_SUBVIEWER_fuzzer-6344614822412288

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
2022-08-23 20:03:03 +02:00
Anton Khirnov
14726571dd lavf: deprecate av_stream_get_end_pts()
According to its documentation it returns "pts of the last muxed packet
+ its duration", but the value it actually returns right now is
(possibly guessed) dts after muxer-internal bitstream filtering (if
any).

This function was added for ffmpeg.c, but it is not used there anymore.
Since the value it returns is ill-defined and so inappropriate for any
serious use, deprecate it.
2022-08-22 11:35:43 +02:00
Derek Buitenhuis
e1e981c65e mov: Compare frag times in correct time base when seeking a stream without a corresponding sidx
Some muxers, such as GPAC, create files with only one sidx, but two streams
muxed into the same fragments pointed to by this sidx.

Prevously, in such a case, when we seeked in such files, we fell back
to, for example, using the sidx associated with the video stream, to
seek the audio stream, leaving the seekhead in the wrong place.

We can still do this, but we need to take care to compare timestamps
in the same time base.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2022-08-19 17:02:55 +01:00
Zhao Zhili
1af7797d21 avformat/mov: fix encryption index in the case of multiple trun
frag_stream_info->index_entry isn't the first sample/trun index.
cenc.frag_index_entry_base failed to catch the case since
current_index > 0.

Fix ticket #9807.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-08-16 18:47:40 +08:00
Zhao Zhili
98dcdd1868 avformat/mov: fix frag_index.current out of sync
frag_index.current is used by cenc_filter, and is updated inside
mov_read_moof. It can out of sync regarding to mov_read_packet.

Partly fix ticket #9807.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-08-16 18:47:33 +08:00
Derek Buitenhuis
412922cc6f ipfsgateway: Remove default gateway
A gateway can see everything, and we should not be shipping a hardcoded
default from a third party company; it's a security risk.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2022-08-15 20:09:13 +01:00
Timo Rothenpieler
b77fff47d0 configure: always enable gnu_windres if available
Use the appropiate Makefile variable to ensure the resource file is
only built into shared libraries instead.
2022-08-13 14:42:36 +02:00
Stephen Hutchinson
f6a36c7cf9 avformat/avisynth: add missing avs_release_video_frame
The AviSynth C API requires using avs_release_video_frame
whenever avs_get_frame has been used, but the recent addition
of frameprop reading to the demuxer was missing this in
avisynth_create_stream_video.

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
2022-08-12 17:21:44 -04:00
Pierre-Anthony Lemieux
d5b46fa07d avformat/imfdec: preserve stream information
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-12 18:55:00 +02:00
Pierre-Anthony Lemieux
f2403d1530 avformat: refactor ff_stream_encode_params_copy() to stream_params_copy()
Addresses http://ffmpeg.org/pipermail/ffmpeg-devel/2022-August/299726.html

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-12 18:54:19 +02:00
Vignesh Venkatasubramanian
d931554f66 avformat/mov: Rework the AVIF parser to handle multiple items
Stores the item ids of all the items found in the file and
processes the primary item at the end of the meta box. This patch
does not change any behavior. It sets up the code for parsing
alpha channel (and possibly images with 'grid') in follow up
patches.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: James Zern <jzern@google.com>
2022-08-09 13:15:55 -07:00
Martijn van Beurden
ed07ba641a avformat/movenc: Remove experimental status of flac-in-MP4 muxing
The fLaC and dfLa box IDs have been registered with the MP4 RA
(they are now listed at https://mp4ra.org/#/codecs) and support
for muxing FLAC in MP4 has been experimental in ffmpeg for
6 years now, since Nov 21, 2016

This patch removes the experimental status and removes the MP4
object type, as none has been registered for FLAC as it was not
deemed necessary.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-08-08 16:19:38 +02:00
Ruben Gonzalez
2d8d7f8592 avformat: allow .ec3 as extension for raw E-AC-3 stream
In addition to .eac3, .ec3 is also commonly used by people to name raw
E-AC-3 streams. Enables automatic recognition of the eac3 format for
the .ac3 extension.

For instance Dolby Digital Plus software only support files with
.ec3. Files with .eac3 are not supported. Check issue #18 in the
public dlb_mp4base repository from DolbyLaboratories.

Signed-off-by: Ruben Gonzalez <rgonzalez@fluendo.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-08-08 16:19:38 +02:00
Stephen Hutchinson
765fc3b943 avformat/avisynth: cosmetics after nb_channels change
Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-07 22:42:27 -03:00
Stephen Hutchinson
dc9843d829 avformat/avisynth: use ch_layout.nb_channels for channel count
Fixes deprecation warning

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-07 22:41:57 -03:00
Michael Niedermayer
e6bbaa1d49 avformat/mxfdec: SMPTE RDD 48:2018 Amd 1:2022 support
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-08-07 22:01:21 +02:00
James Almer
f8c62e32b2 avformat/riff: map AYUV fourcc to RAWVIDEO decoder
There's no need to keep using a custom decoder for this pixel format.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-07 09:33:16 -03:00
Peter Ross
23758380d0 avcodec: WBMP (Wireless Application Protocol Bitmap) image format
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Peter Ross <pross@xvid.org>
2022-08-07 19:18:18 +10:00
Jun Zhao
101e154c28 lavf/hevc: replace the unicode signal quotation with normal quotation
replace the unicode left/right signal quotation mark with normal
signal quotation.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2022-08-05 00:58:49 +08:00
Andreas Rheinhardt
b0e38c7d1e configure: Add msmpeg4(dec|enc) subsystems
The msmpeg4 decoders/encoders share a common set of prerequisites,
ergo it makes sense to use common subsystems for them. This also
allows to remove the CONFIG_MSMPEG4_DECODER/ENCODER ad-hoc defines
(which violated the CONFIG_ namespace).

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-03 21:18:25 +02:00
Zhao Zhili
f56730fb6f avformat/flvenc: fix shadowed variable ts 2022-08-03 17:52:55 +08:00