1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00
Commit Graph

26228 Commits

Author SHA1 Message Date
Michael Niedermayer
4cc1495aca
avformat/iamf_parse: reject ambisonics mode > 1
ambisonics mode > 1 does not initialize any layer but layer 0
is unconditionally dereferenced

Fixes: poc-2024-11
Fixes: null pointer dereference
Found-by: 苏童 <220235212@seu.edu.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-12-02 02:51:38 +01:00
Marth64
e256761def avformat/dvdvideodec: check return code of ff_dvdclut_yuv_to_rgb()
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-12-01 13:48:51 -06:00
Marth64
a5a899bfcb avformat/dvdvideodec: fix missing last chapter marker due to off-by-one
When using fast chapter marker calculation (default), the last
marker is inadverdently ignored due to an off-by-one.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-12-01 13:48:45 -06:00
Marth64
084d3515ca avformat/libssh: fix credential variables typo
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-26 19:50:49 -06:00
Marton Balint
aea63ea7f5 avformat/framecrc: add AVFMT_NODIMENSIONS flag
Framecrc does not need frame dimensions to work correctly.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-11-25 22:16:34 +01:00
James Almer
19f7dae81a avformat/mov: add missing stts array syncing in mov_build_index
Also fix checks for sc->stts_count that assume it may not be in sync with
sample count.
Missed in 865c73c86f. Fixes parsing durations in
some cases.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-25 14:40:15 -03:00
Peter Ross
4472dec51d avformat/mm: add fallthrough comment
Fixes CID 1634888
2024-11-25 17:58:30 +11:00
Michael Niedermayer
84569b6c22
avformat/icodec: fix integer overflow with nb_pal
Fixes: runtime error: signed integer overflow
Fixes: 42536949/clusterfuzz-testcase-minimized-fuzzer_loadfile-6199846684393472
Found-by: ossfuzz
Reported-by: Kacper Michajlow
Tested-by: Kacper Michajlow
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-25 03:13:33 +01:00
James Almer
8ddbc26ded avformat/mov: don't unconditionally set all audio packets in fragments as key frames
Some audio codecs, like TrueHD, have non key frames.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:24 -03:00
James Almer
f656c00bd9 avformat/matroskadec: set all frames in a keyframe simple box as keyframes
And not just the first, as it was being done for lacing. The spec states that the
flag applies to everything inside the simple box.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:26:17 -03:00
James Almer
f938b2b3f5 avformat/test/movenc: set audio packets as key frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:14:11 -03:00
James Almer
23a1c021f2 avformat/movenc: write stss boxes for xHE-AAC
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:14:11 -03:00
James Almer
4e6d31755b avformat/spdifdec: parse headers for audio codecs
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-24 20:14:11 -03:00
James Almer
ecc7d5db9c avformat/movenc: don't disable edit lists when writing CMAF output
They are needed for audio tracks with priming samples, where negative CTS
offsets can't be used.

Fixes ticket #11031.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 20:50:05 -03:00
Darren Mo
865c73c86f avformat/mov: Populate packet duration using stts atom instead of guessing
Fixes tickets #7855 and #11312.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 20:50:05 -03:00
James Almer
b328bf8f7e avformat/mov: rename MOVCtts.duration to offset
The value is a timestamp offset, not a duration.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 20:50:05 -03:00
Scott Theisen
0dceced45c avformat/mpegts: add DVB descriptor_tag values already in use
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-11-22 21:11:18 +01:00
James Almer
944212acad avformat/movenc: don't write a calculated avgBitrate when the provided one is unset
avgBitrate == 0 is used to signal a VBR track, so if that value is propagated by an
encoder, don't overwrite it with a calculated value based on track size.

Part of a fix for ticket #11303.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:57:03 -03:00
James Almer
5813e5aa34 avformat/hevc: fix writing hvcC when no arrays are provided in hvcC-formatted input
Don't reject extradata with missing PS NALUs if array_completeness is not
requested.

Fixes a regression since a696b28886.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:52:31 -03:00
James Almer
f0051604c7 avformat/movenc: don't write PS NALUs in hvcC for codec tag hvc1
array_completeness shall be 1 for those tracks.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-22 10:49:32 -03:00
Peter Ross
f298507323 avcodec/mm: decode raw chunk type and skip unknown audio chunk type 2024-11-21 19:41:12 +11:00
Peter Ross
ac2442f0a7 avcodec/mm: set audio pts proportionally to audio offset 2024-11-21 19:41:12 +11:00
Marth64
3528bfed45 avformat/smoothstreamingenc: check return value of avcodec_parameters_copy()
Written in the dominant style of the surrounding code block.

Reviewed-by: ePirat <epirat07@gmail.com>
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-20 23:36:13 -06:00
Scott Theisen
be784e95ac avformat/mpegts: add support for ATSC E-AC-3 streams
ATSC A/52:2018 Digital Audio Compression (AC-3, E-AC-3), Annex G
defines stream_type 0x87 for E-AC-3 bit streams.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-11-21 00:59:09 +01:00
Richard Mitic
67c2f80d2c libaformat/mp3dec: Register the MIME type "audio/mpeg" to the mp3 decoder.
Some mp3 files look surprisingly like mpeg PS streams. In order for us
to hint to ffmpeg that the file really is mp3, we can deliver it with a
mime type. The mp3 probe therefore needs to have a mime type registered,
(which is previously did not).
2024-11-20 15:48:19 +01:00
Marth64
1d55f54846 avformat/dvdvideodec: don't allow seeking beyond dvdnav reported duration
There is no reason to accept timestamp values beyond what dvdnav
reported as the duration of the title.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
0912407b9d avformat/dvdvideodec: discard duplicate or partial AC3 samples
Some DVD muxers signal segments to start with duplicate audio samples
when starting extraction from a chapter marker or terminate seamless PGs
on partial audio samples (causing corrupt AC3 frames). Clean up after
these muxers by tracking frames with duplicate PTS and eliminating
partial AC3 frames.

This results in smoother chapter extraction and overall seeking experience,
with linear PTS and AC3 delay within 32ms (1 frame) away from the video.

The issue was not apparent until the flushing pattern was replaced with
a full subdemux reset, as the flushing dropped the frames prematurely,
along side others, as such they were never present to begin with.
2024-11-16 14:40:51 -06:00
Marth64
f2f238c3a4 avformat/dvdvideodec: drop packets with unset PTS or DTS
The packets effectively serve no purpose and we are already
dropping packets with PTS less than 0. This also creates
for a smoother seeking experience after the subdemuxer
reset fix.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
3656379d92 avformat/dvdvideodec: remove unnecessary need_parsing argument
The value is always AVSTREAM_PARSE_HEADERS.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
a2c57e27d6 avformat/dvdvideodec: open subdemuxer after initializing IFO headers
It is wasteful to open the subdemuxer if an error occurs while
initializing streams or reading IFO headers.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
60434b483c avformat/dvdvideodec: remove auto value for menu_lu option
The "auto" mode serves no functional purpose except for logging
a message and setting the value to 1. The documentation clearly
explains what the option is for.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
4a03e95ff4 avformat/dvdvideodec: default menu_vts option to 1 and clarify description
Menu 0 is the VIDEO_TS root menu, which does not appear to be used
commonly for menu segments. Instead, default to the menu of VTS 1.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
afc152f564 avformat/dvdvideodec: check the length of a NAV packet when reading titles
Some discs present titles with bogus NAV packets. We apply this check
for menus and for title MPEG blocks, but we should also apply it
for NAV packets during title demuxing.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
a1ae66c827 avformat/dvdvideodec: reset the subdemuxer on discontinuity instead of flushing
DVDs naturally consist of segmented MPEG-PS blobs within a VOB
(i.e. VOBs are not linear). NAV packs set the segment boundaries.
When switching between segments, discontinuities occur and thus
the subdemuxer needs to be reset. The current approach to manage
this is by invoking ff_read_frame_flush() on the subdemuxer context,
via a callback function which is invoked during the menu or dvdnav
block functions. The same subdemuxer context is used throughout
the demux, with a stretched PTS wrap bits value (64) + disabled
overflow correction, and then flushed on each segment. Eventually,
a play_end context variable is set to declare EOF.

However, this approach causes frame drops. The block read flushes the
demuxer before the frame read is complete, causing frames to drop
on discontinuity. The play_end signal likewise ends playback before
the frame read is complete, causing frames to drop at end of the title.
To compound the issue, the PTS wrap bits value of 64 is wrong;
the VOBU limit is actually 32 and the overflow correction should work.

Instead, EOF the MPEG-PS subdemuxer organically when each VOB segment
ends, and re-open it if needed with the offset after the full frame read
is complete. In doing so, correct the PTS wrap behavior to 32 bits and
remove the play_end/segment_started signals and callback pattern.

Note that the timestamps as reported by the NAV packets are known as
"PTMs", so the fields storing the time prior to adjustment are renamed
accordingly. This makes it more clear when we are offsetting the
NAV packet reported timestamps versus what we present as a demuxer.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
1964faa568 avformat/dvdvideodec: simplify dvdvideo_read_packet()
The function has a few branches where it discards frames via
FFERROR_REDO; consolidate is via a goto block to simplify the
function and improve readability. Logging still maintains
all the relevant details for the reason of the discard.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
c1e4b6c676 avformat/dvdvideodec: enable chapter calculation for menus
Menus are generally segmented by cell, so use them as the
marker delimiters. Requires preindex option to be enabled.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
b38ca20bf2 avformat/dvdvideodec: standardize the NAV packet event signal
This consolidates the FFERROR_REDO handling of NAV packets to
dvdvideo_subdemux_read_data(), is a pre-requisite to calculating
chapter markers for menus, and a pre-requisite to fixing the
frame desync issue when the subdemuxer is flushed.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
6bbaa7db49 avformat/dvdvideodec: move memcpy below missed NAV packet warning
Readability improvement; the warning can be bundled beneath
the preceding validations rather than awkwardly between the memcpy
and return.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
e1ace1d314 avformat/dvdvideodec: remove "auto" value for -pg option, default to 1
The default "auto" mode is effectively useless; the reasonable
default use case is to use the first PG (segment) of the
selected PGC for both menus and standard titles. Just
default the value to 1, since the option is irrelevant
unless -pgc is also set.

Note that this should not break users using this advanced option.
The "auto" mode errored and asked for a PG number regardless
for non-menus, and for menus the mode simply defaulted to 1.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
39c662f541 avformat/dvdvideodec: measure duration of the current menu VOBU in state
This will be a pre-requisite to calculating chapter markers
for menus.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
94346edbbf avformat/dvdvideodec: fix menu PGC number off-by-one in state
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
3ad96243d7 avformat/dvdvideodec: remove unused headers
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Michael Niedermayer
0b8c9cf5b4
avformat/movenc: Fix ffv1 support
Fixes: Ticket9975

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-16 13:24:16 +01:00
Marth64
7332b1700e avformat/sapdec: check return value of avcodec_parameters_copy()
Written in the dominant style of the surrounding code block.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-15 20:18:12 -06:00
James Almer
edc7b67508 avformat/iamf: use the new Binaural channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-13 12:38:04 -03:00
James Almer
e7bdaadce6 avformat/mov: check that items are allocated before accessing them
Fixes NULL pointer dereferences introduced in 2e338152a2

Fixes: clusterfuzz-testcase-fuzzer_loadfile-4753810267897856
Fixes: clusterfuzz-testcase-minimized-fuzzer_loadfile-6042587212873728
Fixes: clusterfuzz-testcase-minimized-fuzzer_loadfile-6536211629408256

Reported-by: kasper93
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-12 12:23:32 -03:00
Michael Niedermayer
96d45c3b21
avformat/vividas: Check avio_read() for failure
Fixes: use of uninitialized value (untested)
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_loadfile_direct-5505802505355264

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-11 01:28:06 +01:00
Michael Niedermayer
e30d957a9b
avformat/ilbc: Check avio_read() for failure
Fixes: use of uninitialized value
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-6656646223298560-cut

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-11 01:28:06 +01:00
Michael Niedermayer
898f6582eb
avformat/nistspheredec: Clear buffer
Fixes: use-of-uninitialized-value
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-6515855798632448-cut

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-11 01:28:05 +01:00
Michael Niedermayer
bf8e43083f
avformat/mccdec: Initialize and check rate.den
Fixes: Assertion c > 0 failed at libavutil/mathematics.c:61
Fixes: use-of-uninitialized-value
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-5939605805793280

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-11-11 01:28:05 +01:00