1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-09-16 08:36:51 +02:00

26737 Commits

Author SHA1 Message Date
Zhao Zhili
07ea3b1787 avformat/flvenc: fix event_flags check
AVFormatContext.event_flags is checked against AVSTREAM_EVENT_FLAG,
which belongs to AVStream.event_flags. There is no real issue since
these two flags have the same value.
2025-09-16 02:52:20 +00:00
Andreas Rheinhardt
8872c0c39d avformat/takdec: Don't truncate return value
This is unlikely to matter for real files.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:21 +02:00
Andreas Rheinhardt
057afba13d avformat/tta: Avoid seek when reading header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:21 +02:00
Andreas Rheinhardt
bd80640cae avformat/oggdec: Don't skip over data whose checksum is used
The behavior of the ffio_*_checksum feature is not well defined
when using avio_skip(). The code in oggdec.c relied on the skipped
data (four bytes) to be checksummed, which is mostly true
because short_seek_threshold is 32768 by default, so that
avio_seek() will normally read data instead of calling the
underlying seek function. Yet this has two problems:

a) It relies on implementation details of avio_seek().
b) There is an exception, namely if the AVIO_FLAG_DIRECT is set.
In this case the underlying seek function (if set) is always
called and the data is skipped, leading to CRC errors.

So don't skip the data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:21 +02:00
Andreas Rheinhardt
987c955cd7 avformat/aviobuf: Keep checksum_ptr consistent in avio_seek()
Otherwise it might be > buf_ptr in which case ffio_get_checksum()
could segfault (s->buf_ptr - s->checksum_ptr would be negative
which would be converted to something very big when converted
to unsigned for the update_checksum callback).

Fixes ticket #11233.

Reported-by: Du4t
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-15 17:52:21 +02:00
Jack Lau
16b8a7805b avformat/whip: enable RTCP NACK for whip
Refer to RFC 4585 4.2,
Add SDP "a=rtcp-fb" so the peer can request rtx
through sending NACKs.

Add basic parsing for NACK packet.
Decrypt into a newly allocated buffer (do not
overwrite whip->buf) so multiple NACKs in a
bundled packet can be parsed in a loop while
keeping whip->buf available for sending rtx

Broken or wrong NACk are logged and skipped.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-09-15 06:40:11 +00:00
dariusz-f
c75439a93b Update libavformat/apvdec.c
Increase au_size limit by 4 times to fit more complex videos.

Signed-off-by: dariusz-f <dariusz-f@noreply.code.ffmpeg.org>
2025-09-08 20:59:31 +00:00
Dariusz Frankiewicz
002a940ca6 avformat/apv: fix range of au_size
Acces unit size is described in documentation as > 0 < 0xFFFFFFFF

Signed-off-by: Dariusz Frankiewicz <d.frankiewic@samsung.com>
2025-09-08 20:59:31 +00:00
Zhao Zhili
742474bc24 avformat/mov: fix unused variable entry in parse_exif_item 2025-09-06 15:11:48 +00:00
Marton Balint
7321e4b950 avformat/img2dec: support arbitrary path lengths
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-09-05 21:05:13 +02:00
Marton Balint
8703dd74bd avformat/img2dec: remove path limits from find_image_range
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-09-05 21:05:13 +02:00
Marton Balint
69d9c074ef avformat/img2dec: do not use av_get_frame_filename result buffer if the call fails
We have no way of knowing if the string was fully processed or got truncated
because of a parse error so it is better to use the original path if finding an
image sequence fails.

We do this by explicitly falling back to the PT_NONE mode if the provided
filename is not a valid pattern but the file exists or if the IO context is
already open.

This also means that filenames no longer need to be escaped even in sequence
mode if an invalid sequence (a sequence without %d) is provided, so a command
line such as ffmpeg -f image2 -i "100%.jpg" will just work, but "100%%.jpg"
will no longer work.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-09-05 21:05:13 +02:00
Marton Balint
8c1301cf9d avformat/webm_chunk: support for arbitrary path lengths
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-09-05 21:05:13 +02:00
Marton Balint
35ceef40ad avformat/segment: support arbitrary path lengths
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-09-05 21:05:13 +02:00
Marton Balint
4b8be1991c avformat/utils: support arbitrary path lengths for av_filename_number_test
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-09-05 21:05:13 +02:00
Marton Balint
9458a6f8ec avformat/utils: add AV_FRAME_FILENAME_FLAGS_IGNORE_TRUNCATION flag
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-09-05 21:05:13 +02:00
Jack Lau
85b5d4adf2 avformat/tls_gnutls: cleanup the pointer name
Pure cleanup, no functional changes
Unify local pointer names to `TLSContext *c` and `TLSShared *s` to
reduce confusion from inconsistent names (e.g. p, s, c)

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-09-05 04:31:07 +00:00
Jack Lau
3c7315c345 avformat/whip: simplify the udp read in whip_write_packet
Reduce nested if statements to make the code structure clearer

Add logic to check if EOF is received from UDP socket.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-09-05 04:29:39 +00:00
Jack Lau
785a4e0d6c avformat/whip: fix potential 8bit overflow for profile_idc
The profile contains profile_idc and constraint_set*_flag,
throws away high 8 bit flags and then we get profile_idc.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-09-05 04:28:55 +00:00
Jack Lau
6c2768bf8c avformat/whip: fix 8 bits overflow and map constraint_set bits for H264
profile_iop is an 8 bits field. Previous code copied
AVCodecParameters::profile (which can contain bits
beyond 8 bits) into profile_iop, producing overflow
and wrong values.

This patch maps the constrained flags into the proper
profile_iop bits (constraint_set1 / 3)

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-09-05 04:28:55 +00:00
Jack Lau
39a63e3d07 avformat/whip: make time measure more precise
Use av_gettime_relative() replace av_gettime() to get
better measure

Changed the display precision from showing only integers
to showing two decimal places (in milliseconds)

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-09-05 04:28:24 +00:00
Jack Lau
b41f8207c4 avformat/whip: fix SDP ICE candidates parsing
fix issue #20407

Refer to RFC 5245 15.1,
the foundation may be any string up to 32 chars.
The old code could misread foundations as transport("udp").
This patch fully parse all these attr to avoid parsing error.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-09-05 04:27:51 +00:00
Jack Lau
7fd967c2c1 avformat/whip: add PRIORITY and ICE_CONTROLLING for STUN binding request
fix issue #20402

See RFC 8445 7.1,
The PRIORITY and ICE-CONTROLLED or ICE-CONTROLLING must be included
in a Binding request.

FFmpeg is always ICE Controlling role so we use ICE-CONTROLLING attr.

Co-author-by: Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com>
Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-09-05 01:21:28 +00:00
Andreas Rheinhardt
79058e7014 avformat/demux: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-03 21:10:21 +00:00
Andreas Rheinhardt
e6c03711aa avformat/demux: Avoid always-true branch
Since 9d037c54f2 id3v2_extra_meta
can only be != NULL if the input format wants ID3v2 tags to be
read generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-03 21:10:21 +00:00
Andreas Rheinhardt
e918e202e0 avformat/avformat: Make AVFMT_FLAG_ID3V2_AUTO private
This flag governs whether avformat_open_input() reads
ID3v2 tags generically; some demuxers without this flag
read these tags themselves in a non-generic way,
e.g. oma. This makes this flag an implementation detail
that should not be exposed to the user, i.e. an internal flag.

Given that 9d037c54f2
did not bump version and added no APIchanges entry
I deemded it inappropriate to bump version or add
an APIchanges entry for the removal of AVFMT_FLAG_ID3V2_AUTO.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-03 21:10:21 +00:00
nilfm
9d037c54f2 avformat/demux: avoid unconditional ID3v2 tag consumption
ID3v2 headers are now only parsed for formats that explicitly support them,
avoiding premature data consumption that broke demuxing in other formats.

Introduces AVFMT_FLAG_ID3V2_AUTO and applies it to mp3, aac, tta, and wav.

Signed-off-by: nilfm <nil.fons@gmail.com>
2025-09-03 10:44:02 -07:00
Andreas Rheinhardt
cd21fa41c7 avformat/aviobuf: Don't pretend to support avio_context_free(NULL)
It makes no sense to ever call it that way given that
avio_context_free() accepts a pointer to a pointer to an AVIOContext.
Other double-pointer-free functions like av_freep() also do it
that way (and therefore avio_context_free(NULL) still crashes
even with 870cfed231).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-03 15:51:51 +02:00
James Almer
310be1c5a4 avformat/mov: export Exif metadata from HEIF streams
Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-01 12:07:35 -03:00
James Almer
74e430202d avformat/mov: make items referencing items generic
Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-01 12:07:14 -03:00
James Almer
6a115e2066 avformat/mov: reduce code duplication when setting tile group properties
Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-01 12:07:14 -03:00
James Almer
11d9d7b8f3 avformat/dump: print side data type names generically
Based on vf_showinfo behavior.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-01 12:07:14 -03:00
Zhao Zhili
9a34ddc345 avformat/movenc: remove mvex from final mp4 in hybrid_fragmented mode
In hybrid_fragmented mode, the first moov at start should contain
mvex tag, since it's fmp4. When writing the moov at the second time,
it's not fmp4 any more, so mvex should be skipped.
2025-09-01 12:41:38 +00:00
Marton Balint
a8097d32ae avformat/img2dec: remove deprecated glob_sequence pattern type
"glob_sequence" was deprecated since 2012. This also changes the default pattern
to "sequence", because "glob_sequence" was also the default.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-08-26 14:41:44 +00:00
Jack Lau
4811518143 avformat/whip: set the first sequence number for video and audio
simply whip->audio_first_seq + 1 for video could be
faster than generating a new one.

this patch will make whip be able to get the first
rtp seq easily and compute something sequence-based
(e.g. NACK and RTX handling)

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-08-26 02:36:06 +00:00
yangsen5
6c07a4f558 avformat/file: add pkt_size option
The min_packet_size/max_packet_size were hardcoded to 256KB for
performance. The new option makes it possible to configure a
smaller packet size on embedded devices with limited memory
resources.

Signed-off-by: yangsen5 <1441923451@qq.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-08-25 18:15:17 +08:00
Muiz Yusuff
2ffc138e8a mov demuxer: use int64_t for next_ts
d1b96c3808 fixes some hevc seeking issues
but will int overflow when timestamp is >int_max.
2025-08-25 02:25:50 +00:00
Damiano Galassi
b2f5bc7fd3 movenc: ensure chapters track extradata is not null and populated
fix a regression introduced in 4eca8df,
writing chapters failed if chapters where
not available before mov_write_header().
2025-08-24 13:31:53 +00:00
Jack Lau
b3ea558492 avformat/whip: fix ssrc might be same
use audio_ssrc + 1 for video_ssrc to avoid ssrc collision

See RFC 3550 Section 8,
The SSRC identifier carried in the RTP header and in various fields
of RTCP packets is a random 32 bit number that is required to be
globally unique within an RTP session.

simply + 1 also can get an unique ssrc, and faster than generating
new unique ssrc.

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-08-23 17:20:32 +08:00
iddq
4e9a184d5c avformat/tcp: add option for enabling TCP keepalive 2025-08-22 18:20:08 +00:00
Leo Izen
ba2ea285e0 avformat/avidec: use new EXIF metadata API instead of avpriv_
This commit switches avidec to use the new metadata API exposed by
the previous commit instead of relying on the existing avipriv_ function
exposed by lavc.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-08-19 11:26:46 -04:00
Leo Izen
a99fff4e2d avcodec/tiff_common: rename TIFF enum constants
This makes the enum TiffTypes public by moving it to the public header
exif.h and renaming it to AVTiffDataType, as well as adding an AV_
prefix in front of each of the entry names. This allows callers to use
enum AVTiffDataType without pulling in all of tiff_common.h, as that
header is not public.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-08-19 11:26:40 -04:00
Michael Niedermayer
0243cf89b1 avformat/lrcdec: Fix fate-sub-lrc-ms-remux on x86-32
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-18 22:02:47 +00:00
Valerii Zapodovnikov
8426622bb9 avformat/avio: clarify that AVSEEK_FORCE has no effect
avio_seek() never supported SEEK_END and returned AVERROR(EINVAL) when
specified, so the later check "(whence != SEEK_END || force)" was always true.

This also means that AVSEEK_FORCE had no effect since 7a6fe01f99, that is 15
years ago. Rather than changing behaviour, let's document instead that the flag
has no effect.

Also fixed other commit 41ed7ab45f which confused ORing / passing AVSEEK_FORCE
and AVSEEK_SIZE in the docs.

Signed-off-by: Valerii Zapodovnikov <val.zapod.vz@gmail.com>
2025-08-17 20:47:11 +00:00
James Almer
a2cfaf1b91 avformat/mov: pass stream index to sanity_checks on HEIF images
Instead of item_id. Same behavior as with standard video tracks.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-16 21:59:18 -03:00
James Almer
a28e01a6c1 avformat/mov: don't use an allocated array for sample_size with HEIF images
The array is only ever needed for streams where each sample entry may have a
different value. Given that for non animated HEIF there's a single value that
applies to the image, use the field defined for that.

Fixes: NULL pointer dereference
Fixes: 437528618/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6537287645331456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-16 21:59:18 -03:00
Jack Lau
37507c6a78 avformat/whip: remove DTLSState enum
This patch aims to simplify the dtls handshake process
since dtls handshake use force block mode

We can just use the return code instead of DTLSState enum

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2025-08-16 06:25:04 +00:00
Kacper Michajłow
61d0050924 avformat/tls_openssl: simplify fingerprint generation
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-16 00:15:30 +00:00
Kacper Michajłow
4676f97928 avformat/tls_openssl: clean keys serialization
It was unnecessary convoluted, remove not needed memory allocations,
snprintf.

Also fixes posibility to call snprinft with NULL as %s input.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-16 00:15:30 +00:00
Kacper Michajłow
3a8b3dfeca avformat/tls_openssl: use ascii - (0x2D) instead of 0x2010 hyphen
Too much AI is bad for you...

Fixes: 167e343bbe
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-16 00:15:30 +00:00