1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-03 17:59:59 +02:00
Commit Graph

24734 Commits

Author SHA1 Message Date
Peter Ross
7f534d022e avformat/codec2: remove surplus include 'memory.h' statement
on glibc memory.h drags in string.h, but codec2 does not use any
str* or mem* functions. additionally, memory.h is not part of the
C99 or POSIX standards.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-09 21:05:18 +02:00
TADANO Tokumei
ad063e6e10 avformat/mpegts.c: ignore a section with next flag
'current_next_indicator' of 0 (next) on each section header indicates
the service information is for immediate future one.
ffmpeg doesn't need to parse it but current (1) one.

ref: section 5.1.1 of DVB BlueBook A038 (EN 300 468)

Signed-off-by: TADANO Tokumei <aimingoff@pc.nifty.jp>
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-09 20:23:45 +02:00
TADANO Tokumei
5dcedfcd17 avformat/mpegts.c: fix to check end of each descriptor of SDT
Current code incorrectly check against end of section rather than
end of descriptor.

Signed-off-by: TADANO Tokumei <aimingoff@pc.nifty.jp>
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-09 19:58:53 +02:00
Paul B Mahol
9d20f64f9c avformat/smacker: add better seeking support 2022-04-08 10:02:33 +02:00
James Almer
487b49d8f2 avformat/webmdashenc: fix on-demand profile string
Fixes ticket #9596

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-07 21:57:42 -03:00
Andreas Rheinhardt
a68a6322b7 avformat/mpegenc: Fix ever growing FIFO and infinite loop on error
Since the switch to the new FIFO API in commit
ea511196a6, the FIFO is always
grown by the amount of data intended to be written into it
even in case the FIFO has enough free space. Fix this by
only growing the FIFO if needed and then only by the amount that is
actually needed.

The allocation errors that resulted from this uncovered another bug:
The context is left in an inconsistent state in case the FIFO can't
be grown, because the FIFO does not contain as much data as the sizes
contained in the PacketDesc list claim. This led to an infinite loop
in output_packet() (called from mpeg_mux_end()).

Fix this by growing the FIFO before adding a new PacketDesc element,
thereby preventing the context from becoming inconsistent.

Reported-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-05 21:52:11 +02:00
James Almer
7ccc910803 avformat/movenc: don't use mono layout when a front center label is expected
On output streams where a multichannel stream needs to be stored as one track
per channel, each track will have a channel layout describing the position of
the channel they contain. For the track with front center, the mov muxer was
using the mov layout "mono" instead of the label for the front center position.

Since our channel layout API considers front center == mono, we need to do some
heuristics. To achieve this, we make sure all audio tracks contain streams with
a single channel, and only one of them is front center. In that case, we write
the front center label instead of signaling mono layout.

Fixes the last part of ticket #2865

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-05 09:19:59 -03:00
James Almer
feb3b44c1c avformat/mov_chan: move the definition of MovChannelLayoutTag to the header
Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-05 09:19:59 -03:00
James Almer
c2c5f34843 avformat/movenc: write channel descriptions when a known layout or a bitmap can't be used
Fixes part of ticket #2865

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-05 09:19:59 -03:00
James Almer
b4373bc422 avformat/mov_chan: use a higher log level for a debug message
Trace is too noisy and this line is useful enough to get it printed
at debug level.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-05 09:19:58 -03:00
James Almer
603f2245d4 avformat/mov_chan: add a few missing channel label mappings
Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-05 09:19:58 -03:00
James Almer
90ef712de5 avformat/mov_chan: rename mov_get_channel_label() to better reflect its purpose
This function turns a mov channel label into a lavf native bitmask.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-05 09:19:58 -03:00
Zhao Zhili
3721aaeaaa avformat/libsrt: use a larger buffer for find_info_tag
The upper limit of strlen(streamid) is 512. Use a larger buffer for
future proof, for example, deal with percent-encoding.

Reviewed-by: Zhao Jun <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2022-03-30 10:30:02 +08:00
Zhao Zhili
397a777aa1 avformat/libsrt: fix deprecated warning
srt_socket was deprecated after 1.4.1.

Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2022-03-30 10:29:52 +08:00
Michael Niedermayer
c2d1597a8a avformat/aqtitledec: Skip unrepresentable durations
Fixes: signed integer overflow: -5 - 9223372036854775807 cannot be represented in type 'long'
Fixes: 45665/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-475618463934054

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:59:52 +02:00
Michael Niedermayer
8173a6c130 avformat/apm: Check channels
Fixes: division by 0
Fixes: 45643/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4957777905188864.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:59:51 +02:00
Michael Niedermayer
7ec28e1d4c avformat/cafdec: Do not store empty keys in read_info_chunk()
Fixes: Timeout
Fixes: 45543/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-5684953164152832

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:59:51 +02:00
Michael Niedermayer
6265f0b4e1 avformat: Do not search through the AVOption table for a option not in it repeatedly on each packet
This search takes alot of time especially when compared with small packets

46631 decicycles -> 15719 decicycles in read_frame_internal() for amr-nb in 3gp

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:58:54 +02:00
Michael Niedermayer
2e069f6b69 avformat/alp: Check num_channels
Fixes: division by 0
Fixes: 45615/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-582660348405350
Fixes: 45625/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-4821437943250944
Fixes: 45839/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5857286998851584.fuzz
Fixes: 45844/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6552705772945408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-27 11:58:54 +02:00
Kevin Wang
8ae15b5655 rtpenc_vp8: Use 15-bit PictureIDs
7-bit PictureIDs are not supported by WebRTC:
https://groups.google.com/g/discuss-webrtc/c/333-L02vuWA

In practice, 15-bit PictureIDs offer better compatibility.

Signed-off-by: Kevin Wang <kevin@muxable.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-26 00:42:00 +02:00
Andreas Rheinhardt
1dcd0adedd avformat: Remove unnecessary inclusions from libavcodec
Also improve the other headers a bit while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:39 +01:00
Andreas Rheinhardt
33df1ba6b2 avcodec, avformat: Remove unnecessary inclusions of lavc/internal.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:39 +01:00
Limin Wang
42f1be4461 avformat/movenc: use warning log level and small adjustment for the log
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-03-22 23:00:53 +08:00
Limin Wang
fc8a6a6f4c avformat/movenc: initialize pts/dts of timecode packet
Fix below error message when timecode packet is written.
"Application provided duration: -9223372036854775808 / timestamp: -9223372036854775808 is out of range for mov/mp4 format"

try to reproduce by:
ffmpeg -y -f lavfi -i color -metadata "timecode=00:00:00:00" -t 1 test.mov

Note although error message is printed, the timecode packet will be written anyway. So
the patch 2/2 will try to change the log level to warning.

Fixes ticket #9488

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-03-22 23:00:53 +08:00
James Almer
e6e86a3907 avformat/test/seek: set ch_layout instead of channels
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00
James Almer
edd26bca60 avformat/dfpwmdec: add support to set channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00
James Almer
e42e54fa4e avformat/pcmdec: add support to set channel layout in sln demuxer
Deprecate the channels option, and ensure ch_layout has priority if set over
channels, until the latter is gone.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00
James Almer
5cd6cb9f05 avformat/pcmdec: deprecate channels option
And ensure ch_layout has priority if set over channels, until the latter is
gone.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:34 -03:00
Michael Niedermayer
7aebdb8bf1 avformat/mxfdec: Do not clear array in mxf_read_strong_ref_array() before writing
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 22:27:14 +01:00
Michael Niedermayer
8d6f49cfc3 avformat/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array()
Fixes: 42827/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4900528511909888

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 22:27:14 +01:00
Michael Niedermayer
3015c556f3 avformat/mxfdec: Check count in mxf_read_strong_ref_array()
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 22:27:14 +01:00
James Almer
37f4440682 avformat/demux: ensure ch_layout is not lost in the stream's internal avctx
This is a workaround until avcodec_close() stops freeing ch_layout through
av_opt_fre(), or the former is removed.

Fixes a regression since 327efa6633.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-21 08:50:28 -03:00
Michael Niedermayer
a8fd3f7fab avformat/hls: Check target_duration
Fixes: signed integer overflow: 77777777777777 * 1000000 cannot be represented in type 'long long'
Fixes: 45545/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-6438101247983616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 09:07:58 +01:00
Zhao Zhili
92053aa260 avformat/hls: add AVFMT_NO_BYTE_SEEK flag
After d6ac6650b9, ffplay failed to seek HLS stream with AVSEEK_FLAG_BYTE
enabled by default.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-21 00:48:30 +01:00
Pierre-Anthony Lemieux
2a1eae2179
avformat/concat: refactor to use ff_rescale_interval()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:34:08 +10:00
Pierre-Anthony Lemieux
f409c78517
avformat/imf: refactor to use ff_rescale_interval()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:34:06 +10:00
Pierre-Anthony Lemieux
8744b103da
avformat/tests: add test for ff_rescale_interval()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:34:04 +10:00
Pierre-Anthony Lemieux
b172c0f8c5
avformat/seek: add ff_rescale_interval() function
Refactors a function used by avformat/concat and avformat/imf.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:34:00 +10:00
Pierre-Anthony Lemieux
22e1175e39
avformat/imf: clean-up and reduce logging
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:33:58 +10:00
Pierre-Anthony Lemieux
32b9f5ac2f
avformat/imf: add support for input seeking
The IMF demuxer did not implement AVInputFormat::read_seek2(), resulting in
inefficient input seeking.

Addresses https://trac.ffmpeg.org/ticket/9648

Byte- and frame-seeking are not supported.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:33:55 +10:00
Pierre-Anthony Lemieux
9ca4d80d6b
avformat/imf: relocate static function imf_time_to_ts()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:33:48 +10:00
Andreas Rheinhardt
9cae7f9450 avcodec/zlib_wrapper: Add wrapper for deflateInit()
The rationale is the same as for the wrappers for inflateInit(),
although the case for it is admittedly not so strong because
there are less users of deflateInit().
Also remove an unnecessary inclusion of config.h in
libavformat/protocols.c in order to trigger a request for reconfigure
(which is needed for CONFIG_DEFLATE_WRAPPER to take effect).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Martin Storsjö
2d368392a5 Keep including the full version.h when headers are included externally
This avoids unnecessary churn and build breakage for users, by
making sure the whole version.h is included like it has been so far,
while keeping the benefit of not needing to rebuild most files in
the ffmpeg tree on minor/micro bumps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-19 00:01:57 +02:00
Paul B Mahol
fce0127642 avformat/pcmdec: add support to set channel layout
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2022-03-18 18:59:03 -03:00
Michael Niedermayer
710e51677a avformat/matroskadec: Check pre_ns
Fixes: division by 0
Fixes: 44615/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6681108677263360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-18 19:56:50 +01:00
Michael Niedermayer
bd3a03db9a avformat/matroskadec: Use rounded down duration in get_cue_desc() check
Floating point is evil, it would be better if duration was not a double

Fixes: Infinite loop
Fixes: 45123/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6725052291219456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-17 22:27:23 +01:00
James Almer
0af06344cd avformat/boadec: fix check for invalid channel count
Regression since 8269fbcb7a.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-17 16:52:08 -03:00
Andreas Rheinhardt
814f806e06 avformat/imfdec: Convert to the new channel layout API
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-17 15:05:20 +01:00
Marton Balint
ffff5bb740 avformat/mxfenc: do not write index tables with the same InstanceUID
Only index tables repeating previous index tables should use the same
InstaceUID. Use the index start position when generating the InstanceUID to fix
this.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-16 21:37:53 +01:00
Marton Balint
4afe4a542e avformat/mxfenc: allow more bits for variable part in uuid generation
Also make sure we do not change the product UID.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-16 21:37:53 +01:00