1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

112070 Commits

Author SHA1 Message Date
Andreas Rheinhardt
c1714a483f avcodec/libaribb24,ttmlenc, avutil/tx: Remove redundant init of AVBPrint
An AVBPrint is initialized via av_bprint_init() (or
av_bprint_init_for_buffer()) which expects uninitialized
AVBPrints; it is therefore not necessary to zero them before
the actual initialization.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-14 12:32:02 +02:00
Andreas Rheinhardt
830b5cc35e avformat: Inline raw_codec_id where known
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-14 12:32:02 +02:00
Andreas Rheinhardt
d0b03b4182 avfilter/avfilter: Don't report deprecated pkt_pos
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-14 12:32:01 +02:00
Anton Khirnov
ced62a0c01 fftools/ffmpeg: do not fail on AVERROR(EAGAIN) from choose_output()
This is not an error condition, but would be treated like one if the
program terminates on the next transcode loop iteration because of a
signal or keyboard input.

Fixes #10504
Tested-by: https://github.com/0Ky
2023-09-14 10:44:05 +02:00
Zhao Zhili
a8d9da4c8b avformat/mov: add interleaved_read option
For badly interleaved files, interleave packets from multiple tracks
at the demuxer level can trigger seeking back and forth, which can be
dramatically slow depending on the protocol. Demuxer level interleave
can be useless sometimes, e.g., reading mp4 via http and then
transcoding/remux to DASH. Disable this option when you don't need the
demuxer level interleave, and want to avoid the IO penalizes.

Co-authored-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-14 18:49:51 +08:00
Andreas Rheinhardt
6434e44003 avcodec/thread: Remove ff_thread_get_format define
Unnecessary since FF_API_THREAD_SAFE_CALLBACKS is no more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-13 22:04:22 +02:00
Andreas Rheinhardt
0058f6013f avcodec/av1dec: Don't rely on AV_PIX_FMT_NONE == -1
Since fb548fba04,
this return -1 is in a function returning enum AVPixelFormat
whose caller checks for AV_PIX_FMT_NONE for failure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-13 22:04:22 +02:00
Andreas Rheinhardt
c38693b4b0 avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format()
It indicates to the reader that said function does not modify
any state.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-13 22:04:11 +02:00
Andreas Rheinhardt
654e4b00e2 avformat/wtvdec: Avoid unnecessary allocations
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 23:35:26 +02:00
Andreas Rheinhardt
ea0a41bcaf avformat/wtvdec: Use smaller upper bound for buffer
Every code point in the BMP is representable with at most three bytes
in UTF-8 and every code point not in the BMP takes four bytes.
For each of the latter, the encoding of UTF-16 takes as many
bytes; for each of the former, it takes at most 3/2 as many.
Therefore one can decrease the size of the buffer allocated
here.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 23:35:14 +02:00
Andreas Rheinhardt
78169f397d avformat/wtvdec: Fix signed integer overflow
Happens when length > INT_MAX / 2; use unsigned for the computation,
but restrict the value to INT_MAX, because avio_get_str16le()
accepts an int as buf_len argument. Notice that it can happen
that the string read by avio_get_str16le() is truncated in this case.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 23:35:01 +02:00
Andreas Rheinhardt
197f7e914b avformat/wtvdec: Skip too big tags
get_tag() is not designed with negative length in mind;
in this case, it will allocate a very small buffer
(LEN_PRETTY_GUID + 1) and might call avio_get_str16le()
with a negative maxlen (which relies on these parameters
to be signed).

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 23:34:54 +02:00
Andreas Rheinhardt
c461ee39f9 avformat/wtvdec: Don't truncate GUIDs
Each of the 16 bytes of a GUID is written as a two-character
hex value and three hyphens, leading to a length of 35.
GCC 13 emits a -Wformat-truncation= warning because of this.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 23:34:40 +02:00
Andreas Rheinhardt
b67171893d avformat/avio: Don't use incompatible function pointer type for call
It is undefined behaviour even in cases where it works
(it works because it is only a const uint8_t* vs. uint8_t* difference).

Instead add a cbuf parameter to pass a const buffer (for writing)
as well as a parameter indicating whether we are reading or writing;
retry_transfer_wrapper() itself then uses the correct function
based upon this information.

Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 23:22:49 +02:00
Paul B Mahol
a18ccbfaeb avformat/aiffdec: improve probe 2023-09-12 19:33:17 +02:00
yethie
aeff5bcba0 avfilter/vf_drawtext: fix text width measurement 2023-09-12 19:33:09 +02:00
Andreas Rheinhardt
da784b81a6 avfilter/vf_framepack: Use dedicated pointer for access
Improves readability.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:42:43 +02:00
Andreas Rheinhardt
423b6a7e49 avutil/imgutils: Add wrapper for av_image_copy() to avoid casts
av_image_copy() accepts const uint8_t* const * as source;
lots of user have uint8_t* const * and therefore either
cast (the majority) or copy the array of pointers.

This commit changes this by adding a static inline wrapper
for av_image_copy() that casts between the two types
so that we do not need to add casts everywhere else.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:42:27 +02:00
Andreas Rheinhardt
5094d1f429 avutil/fifo: Constify AVFifo pointees in peek functions
They do not modify the AVFifo state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:20:49 +02:00
Andreas Rheinhardt
fa4bf5793a avutil/audio_fifo: Constify some pointees
Also constify AVAudioFifo* in the peek functions
besides constifying intermediate pointers (void**->void * const *).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:20:13 +02:00
Andreas Rheinhardt
9bf31f6096 avutil/samplefmt: Constify some pointees
This is the samplefmt analog of the imgutils changes
from the preceding commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:17:28 +02:00
Andreas Rheinhardt
41285890e0 avutil/imgutils: Constify some pointees
This is done immediately without waiting for the next major bump
just as in 9546b3a1cb and
4eaaa38d3d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:14:25 +02:00
Paul B Mahol
8cd2e0c075 avcodec/fraps: remove extra new lines and not needed cast 2023-09-11 22:04:28 +02:00
Paul B Mahol
8042f658f7 avformat/mpjpegdec: remove extra newlines 2023-09-11 22:04:27 +02:00
Paul B Mahol
1735ca3c41 avcodec/8bps: always decode to planar formats directly 2023-09-11 22:04:26 +02:00
Paul B Mahol
1ce1970417 avcodec/8bps: use uint8/uint16 where possible 2023-09-11 22:04:25 +02:00
Andreas Rheinhardt
0c4ac187dc avformat/aviobuf: Fix function pointer equality check
Broken in e8704a8f60
when ffurl_read() has been turned into a static inline function
different from the actually used function ffurl_read2().

Fixes ticket #10562.

Tested-by: Mitzsch01
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 20:27:49 +02:00
Andreas Rheinhardt
58aaa83fa2 avformat/mxfdec: Don't pretend array to be bigger than it is
mxf_match_uid() accepts two const UID and a len parameter.
UID is a typedef for an array of 16 uint8_t, so the const UID
parameter is actually a pointer to const uint8_t.

The point of mxf_match_uid() is to check whether the initial
part of two UIDs match; the length of said part is given
by the len parameter. Once an incomplete UID has been passed
to mxf_match_uid() (albeit with the correct len, so safe),
which makes GCC emit -Wstringop-overread warnings.

Fix this by using a const uint8_t[] as type; it is more
natural for incomplete UIDs.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 20:27:32 +02:00
Andreas Rheinhardt
740ce93fae avcodec/flicvideo: Remove unnecessary cast
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 20:27:26 +02:00
Andreas Rheinhardt
eb9bfe30a2 avcodec/imc: Fix leak on init error
Since e6afa61be9 an AVFloatDSPContext
would leak on av_tx_init() failure.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 20:27:06 +02:00
Paul B Mahol
86bd0f08d3 avcodec/vmixdec: fix inputs with more than 255 slices 2023-09-11 01:14:50 +02:00
Paul B Mahol
64f538c356 avcodec/shorten: use uint16_t for wave_format 2023-09-11 01:14:49 +02:00
Andreas Rheinhardt
e9bbb39e94 avcodec/truemotion2: Don't check before freeing VLC
ff_vlc_free() is of course compatible with freeing
a blank VLC.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:28:04 +02:00
Andreas Rheinhardt
9cdf82c2c2 avcodec/vlc: Use proper namespace
Therefore use a proper prefix for this API, e.g.
ff_init_vlc_sparse -> ff_vlc_init_sparse
ff_free_vlc        -> ff_vlc_free
INIT_VLC_LE        -> VLC_INIT_LE
INIT_VLC_USE_NEW_STATIC -> VLC_INIT_USE_STATIC
(The ancient INIT_VLC_USE_STATIC has been removed
in 595324e143, so that
the NEW has been dropped.)
Finally, reorder the flags and change their values
accordingly.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:27:45 +02:00
Andreas Rheinhardt
95e876f069 tools/patcheck: Remove test for ancient INIT_VLC_USE_STATIC
The flag has been removed long ago.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
7b98a1875d avcodec/vlc: Add documentation for ff_init_vlc_sparse()
Mostly taken from the documentation for ff_init_vlc_from_lengths();
also remove the documentation in vlc.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
a84fe06112 avcodec/idctdsp: Avoid inclusion of avcodec.h
Not every user of idctdsp.h wants to initialize an IDCTDSPContext;
e.g. the proresdsp only uses ff_init_scantable_permutation()
and the IDCT permutation enum; similarly for cavsdsp and wmv2dsp.
Using a forward declaration here avoids an avcodec.h dependency
in the relevant files.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
7b0b9a25ed avcodec/proresdsp: Pass necessary parameter directly
Only avctx->bits_per_raw_sample is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
489d96ca02 avcodec/proresdec: Include required headers directly
Do not rely on an indirect inclusion of avcodec.h in proresdsp.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-11 00:26:34 +02:00
Andreas Rheinhardt
b0fb8e82dd avcodec/get_bits: Avoid reading multiple times in get_bits_long
Due to non-byte-alignment a read of 32 bits guarantees only
25 usable bits; therefore get_bits_long() (which is used to
potentially read more than 25 bits) performs two reads in case
it needs to read more than 25 bits and combines the result.

Yet this is not necessary: One can just read 64 bits at a time
to get 32 usable bits (57 would be possible). This commit does so.

This reduced the size of .text by 30144B for GCC 11.4 and 5648B
for Clang 14 (both with -O3).

(get_bits_long() is a building block of show_bits_long()
and get_ue_golomb_long(), so this patch affects these, too.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 23:21:05 +02:00
Andreas Rheinhardt
2a68d945cd avformat/avio: Constify data pointees of write callbacks
They are currently non-const for reasons unknown, although
avio_write() accepts a const buffer.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 22:55:42 +02:00
Andreas Rheinhardt
e8704a8f60 avformat/aviobuf: Don't use incompatible function pointer type for call
It is undefined behaviour even in cases where it works
(it works because both are pointers). Instead change
the functions involved to use the type expected by the AVIO-API
and add inline wrappers for our internal callers.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 22:55:42 +02:00
Paul B Mahol
e26506cb3b avcodec/exr: use uint16/uint8 where possible 2023-09-10 22:44:39 +02:00
Paul B Mahol
f95cb3d134 avformat/adxdec: remove unneeded check for channels inside read_packet() 2023-09-10 22:44:39 +02:00
Andreas Rheinhardt
cfa47fd331 all: Use av_frame_replace() where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:22:30 +02:00
Andreas Rheinhardt
0487786ffe avformat/avio: Remove redundant checks
Checking the return value of av_opt_set() is equivalent
to the current checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:22:13 +02:00
Andreas Rheinhardt
ca78dcfb19 avformat/avio: Remove duplicated freeing code
The target of the jump frees this stuff, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:21:30 +02:00
Andreas Rheinhardt
4f98bf9dbd avformat/avio_internal: Don't include url.h
It is only included because two very rarely used functions
use pointers to URLContexts; use struct URLContext instead.
Also move ffio_geturlcontext() so that one can avoid
a forward declaration of struct URLContext (which would be
necessary as soon as FF_API_AVIODIRCONTEXT is no more).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:19:29 +02:00
Andreas Rheinhardt
879178b40d avformat/teeproto: Remove always-false check
Incompatibility of the flags and the protocol's capabilities
are checked generically (see url_alloc_for_protocol()).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:19:11 +02:00
Andreas Rheinhardt
ee77ee77a1 avformat: Remove avformat and avio headers from protocols
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-10 21:17:55 +02:00