1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-28 12:32:17 +02:00

117233 Commits

Author SHA1 Message Date
James Almer
c13a0a2f59 avcodec/libfdk-aacdec: set keyframe flag and profile in output 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>
(cherry picked from commit 281b7fc02e3158ee62c3c1d41267ddebb86578f0)
2024-12-01 12:53:33 -03:00
James Almer
f7d59ab17a avcodec/audiotoolboxnec: set set keyframe flag in output packets
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>
(cherry picked from commit 495c891e3998bdee7e7680390d9aea2efb5c9a5d)
2024-12-01 12:53:33 -03:00
James Almer
07a92c1a64 avcodec/audiotoolboxdec: set set keyframe flag in output 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>
(cherry picked from commit d3dd14bf5b4a7e5ead890b83fc905add9b261cf7)
2024-12-01 12:53:33 -03:00
James Almer
302f1b3882 avcodec/aacenc: set keyframe flag in output packets
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>
(cherry picked from commit ffdace5ad4736ea720f306392ce6bdcb2aea823a)
2024-12-01 12:53:33 -03:00
James Almer
1b5bdce86a avcodec/aac/aacdec: set keyframe flag in output 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>
(cherry picked from commit faea08b722de716391c3f84a265060c643ad6c22)
2024-12-01 12:53:33 -03:00
James Almer
075c6d325a avcodec/aac_parser: set key_frame and profile
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 64bb91fd3b5a00a8849531c7e8dd207f2a626096)
2024-12-01 12:53:33 -03:00
James Almer
dc9d9b8636 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>
(cherry picked from commit 8ddbc26dedcf83962dd3aed90a6bb0a95847d386)
2024-12-01 12:53:33 -03:00
James Almer
f1592a7ff1 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>
(cherry picked from commit f656c00bd953b1dd84c58dfef5dd645db818ba3d)
2024-12-01 12:53:33 -03:00
James Almer
13282e61b8 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>
(cherry picked from commit f938b2b3f51f959de84bc22c75529b77626b2596)
2024-12-01 12:53:33 -03:00
James Almer
33588a3749 avformat/movenc: write stss boxes for xHE-AAC
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 23a1c021f299655d66bcfbd69ed0d6780f68c6fc)
2024-12-01 12:53:33 -03:00
James Almer
e07d7c75db avformat/spdifdec: parse headers for audio codecs
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 4e6d31755bf8d0355418d19725ee947e6c0536c0)
2024-12-01 12:53:33 -03:00
James Almer
8fa5fa1463 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>
(cherry picked from commit ecc7d5db9c8a1aaccc876dc4b549558eadfe140a)
2024-12-01 12:53:33 -03:00
James Almer
cb997ccd09 avcodec/libfdk-aacenc: export CPB properties
Needed to signal the muxer that the stream is VBR.

Finishes fixing ticket #11303.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 46c6ca3ed1651c67faf899776f1922c108093a44)
2024-12-01 12:47:30 -03:00
James Almer
3513ccccb6 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>
(cherry picked from commit 944212acad7c2254d9dc14764b29e0023aaa645a)
2024-12-01 12:47:30 -03:00
Brad Smith
64e2864cb9 libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv
libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv

FreeBSD/OpenBSD riscv have elf_aux_info().

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
(cherry picked from commit f3eca3f387092c596f035a126fba15a30c3a9499)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-11-27 01:34:28 -05:00
Sean McGovern
0c641ee661 libavutil/ppc: defines involving bit shifts should be unsigned
Otherwise, these can overflow at the boundaries of the integer type.

Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit c325f9c619b38614ab6e339cefacd596266db471)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-11-27 01:32:46 -05:00
Brad Smith
ac4c725944 libavutil/ppc: Include the hardware feature flags like the other archs
Also include the hardware feature flags like the other archs do and
clean up the code a bit.

Tested on Linux POWER9.

Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit d6b2d08fc7283da7a5db7a64d9a3047ed1ba0de1)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-11-27 01:32:23 -05:00
Rémi Denis-Courmont
20c8a3f5ff lavu/riscv: fix compilation without Vector support
The half-baked assembler in Clang 16 and earlier can't process our
RISC-V assembler. This adds yet another work around that.

If you must use Clang, please use version 17 or later.

(cherry picked from commit e29432e6bbb6184d3ff2c7d1e070e9424cb25fe6)
2024-11-18 20:05:47 +02:00
Marton Balint
b016aae662 avfilter/f_loop: fix aloop activate logic
The logic did not follow the documented behaviour and that caused skipping of
some audio in the loop and in the leftover buffer.

Example command line which should produce a smooth sine wave for the whole
duration of the output:

ffmpeg -f lavfi -i "sine=r=48000:f=480:d=4" -af "aloop=loop=4:start=48000:size=48000" out.wav

Fixes ticket #11283.

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit fe18ed3f2a9221af0beaec7b04b7804849db1f2f)
2024-11-17 22:17:42 +01:00
Marton Balint
0a58588ffb avfilter/f_loop: fix length of aloop leftover buffer
If the audio loop stops inside an audio frame, the leftover buffer contains the
end of the frame, which is not looped. The length supposed to be the part which
was not written to the loop buffer, so we need to drain exactly that number of
bytes from the leftover buffer.

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit b33a59416072ad31a5840f33f9975d88acf45add)
2024-11-17 22:17:31 +01:00
James Almer
99f6adce60 avfilter/vf_zscale: align the frame buffers
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit c8e5c684b3db1a3131af5d05a3073114bd87477a)
2024-11-17 12:19:02 -03:00
Pavel Koshevoy
5b461ffb04 lavfi/vf_zscale: fix call to av_pix_fmt_count_planes
realign_frame called av_pix_fmt_count_planes with incorrect parameter.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 00cf3df03f66dca44568b5b5d3e9da35d3597470)
2024-11-17 12:19:02 -03:00
Pavel Koshevoy
85f389520d lavfi/vf_zscale: fix tmp buffer ptr alignment for zimg_filter_graph_process
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 7b302f4db7d335f4dd42cffb461b2b0db6c00749)
2024-11-17 12:19:02 -03:00
James Almer
fa15e3839d avfilter/framepool: align the frame buffers
And not just the linesizes. Use the extra align bytes allocated for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit f15fc27db5b30365f2aec474bae9b8095d6d2197)
2024-11-17 12:19:02 -03:00
James Almer
b9abdd9eaa avcodec/h2645_sei: use the RefStruct API for film_grain_characteristics
And ensure the buffer is synced between threads.
Based on a patch by Dale Curtis <dalecurtis@chromium.org>

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit e33b162c7d8bbbb4838a2af3685fad2bb1ac774a)
2024-11-17 12:16:30 -03:00
James Almer
5f8b02a9ff avcodec/aom_film_grain: allocate film grain metadata dynamically
This removes the ABI breaking use of sizeof(AVFilmGrainParams), and achieves the
same size reduction to decoder structs as 08b1bffa49715a9615acc025dfbea252d8409e1f.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit fd4a2c9b026d8e23301854a500fdfc7bd4a4cbc6)
2024-11-17 12:16:13 -03:00
James Almer
f8fcebae95 avformat/mov: use an array of pointers for heif_item
Pointers to specific entries in the array are stored in other structs, so
in the scenario where heif_item was reallocated when parsing an iloc box after
and iinf one, the pointers may end up referencing freed memory.

Fixes use-after-free with such samples.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-17 12:14:17 -03:00
James Almer
23697c3f02 avformat/mov: split off heif item initialization to its own function
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d5eb0e7fb334b83849a8515d83f8a3acb5a762c6)
2024-11-17 12:14:17 -03:00
James Almer
779b0fe015 avformat/mov: factorize getting the current item
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 58c265d956f4ce2efb0004c398e2c1f030f9398a)
2024-11-17 12:14:17 -03:00
Rémi Denis-Courmont
f686cf77db lavc/h264idct: fix RISC-V group multiplier
After the branch, the expected SEW/LMUL ratio is 1 byte/vector.
So we have to set the same ratio before branching (QEMU does not care,
but real hardware does).

(cherry picked from commit bbb0fdedb78c289f1d3ce3fccb000f031ccfa748)
2024-11-17 16:37:01 +02:00
Rémi Denis-Courmont
4ea558152f lavc/h264dsp: move RISC-V fn pointers to .data.rel.ro
This should fix PIC builds.
2024-11-16 20:44:43 +02:00
Leo Izen
11e8319b8e
avcodec/jpegxl_parser: fix reading lz77-pair as initial entropy symbol
The JPEG XL parser has an entropy decoder inside, which supports LZ77
length-distance pairs. If the first symbol from the entropy stream is an
LZ77 pair, the bitstream is invalid, so we should abort immediately rather
than attempt to read it anyway (which would read from the uninitialized
starting window).

Reported-by: Kacper Michajłow <kasper93@gmail.com>
Found-by: ossfuzz
Fixes: 368725676/clusterfuzz-testcase-minimized-fuzzer_protocol_file-6022251122589696-cut
Fixes: 42537758/clusterfuzz-testcase-minimized-fuzzer_protocol_file-5818969469026304-cut
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-11-13 10:28:59 -05:00
Kacper Michajłow
03ffd4b3b3
avcodec/jpegxl_parser: check entropy_decoder_read_symbol return value
Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2024-11-13 10:28:50 -05:00
Nuo Mi
1b1ba7d4f2 avcodec/cbs_h266: Fix regression in DVB clip introduced by 93281630a71c06642adfebebb0d4b105a4e02e91
This commit introduced a regression to VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_mosaic.ts.

Root Cause:
The AV_CEIL_RSHIFT(a, b) macro uses bit tricks that work only when -a is a negative value.
However, due to integer promotion rules, this behavior does not extend to the unsigned int type.

See "6.3.1.1 Boolean, characters, and integers" in the "ISO/IEC 9899" for details.

Reported-by: Frank Plowman <post@frankplowman.com>
(cherry picked from commit c49001e338feb9d8537bb00de33b2a5725ea6028)
2024-11-11 12:05:30 -03:00
James Almer
baef55364f avcodec/x86/vvc: add prototypes for OF functions
And wrap the implemtation in preprocessor checks.
Should fix ticket #11282.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 9ec042c1aaa64b5f6dff8be263feff4288c1844e)
2024-11-11 09:52:31 -03:00
Anton Khirnov
5120d30890 Document stream specifier syntax change from 46cbe4ab5c
Fixes #11248.

(cherry picked from commit 9e68b26765ca8396050f4b58d4b4fdc53943d35f)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-11-09 02:52:57 +01:00
Leandro Santiago
367b7b546f fftools/ffplay: fix crash when vk renderer is null
When vulkan rendering is requested by the user and fails, ffplay should
exit graciously instead of crash due to a null pointer deref.

Signed-off-by: Leandro Santiago <leandrosansilva@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit fd0cacc4720c68c58f86e41153444252dbd4e5b6)
2024-11-06 16:50:56 +08:00
Marton Balint
15035aaec0 avutil/wchar_filename: re-introduce explicit cast of void* to char*
Fixes compile error on windows with decklink:

In file included from ./libavformat/os_support.h:175,
                 from ./libavformat/internal.h:30,
                 from libavdevice/decklink_common.cpp:25:
./libavutil/wchar_filename.h: In function 'int wchartocp(unsigned int, const wchar_t*, char**)':
./libavutil/wchar_filename.h:59:32: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   59 |     *filename = av_malloc_array(num_chars, sizeof **filename);
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                |
      |                                void*

Regression since e9e8bea2e79bc3c481a6f81f75f6c871e3e0f367.

Fixes ticket #11103.

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 9b0128aa766221f8a32e13cf3c1d3e6d75a2d829)
2024-10-27 09:58:17 +01:00
Emily
9fbbd924f2 fate/ffmpeg: add samples dependency to fate-ffmpeg-spec-disposition
This test utilizes an MPEG-TS sample from FATE suite, yet was
marked as not requiring samples.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
(cherry picked from commit 3565903c638fb77d600d2983701b12300e695a5d)
2024-10-21 21:23:49 +03:00
Anton Khirnov
87ccf995cb fftools/ffmpeg_filter: treat apad filter as a source
Ideally lavfi should have a dedicated API for detecting this.

Fixes #11168 and #11061

(cherry picked from commit 9e2a231236428c4682c77858c6aabfd74f459b17)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-10-15 10:54:25 +02:00
Anton Khirnov
020d9f2b48 lavc/avcodec: fix global/private option precendence
Broken after 7753a9d62725d5bd8313e2d249acbe1c8af79ab1. Apply only the
whitelist early, and the rest with a single call to av_opt_set_dict2()
with AV_OPT_SEARCH_CHILDREN, which should be equivalent to the original
behaviour.

Reported-by: Cameron Gutman <aicommander@gmail.com>
(cherry picked from commit 9ce63e65d65b303813d4ae677228226d7cd232b9)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-10-15 10:53:50 +02:00
Nicolas Gaullier
32d3e67717 avfilter/framesync: fix forward EOF pts
Note1: when the EOF pts is not accurate enough, the last frame
can be dropped by vf_fps with default rounding.

Note2: vf_scale use framesync since e82a3997cdd6c0894869b33ba42430ac3,
so this is a very commonplace scenario.

For example:
./ffprobe -f lavfi testsrc=d=1,scale,fps -of flat \
  -count_frames -show_entries stream=nb_read_frames

Before:
streams.stream.0.nb_read_frames="24"

After:
streams.stream.0.nb_read_frames="25"

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit de976eaf30df33e86c58c8c9af9905c1d8441934)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-10-15 10:50:23 +02:00
Ingo Brückl
5c59d97e8a avcodec/vaapi_encode: fix compilation without CONFIG_VAAPI_1
This adds VAAPIEncodeContext *ctx that has been removed
in aa82340b0ccdde4955fba41b8de5e45348ecd11d.

Signed-off-by: Ingo Brückl <ib@oddnet.de>
(cherry picked from commit 5557c673ea783a48e8b97c2b740b22eeeca6399b)
2024-10-12 09:13:33 +08:00
Martin Storsjö
0b5559378b libavcodec: x86: Remove an explicit include of config.asm
This file is never included explicitly anywhere else, it's only
included implicitly by passing -Pconfig.asm on the command line.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5c4ede6b4ff6fa8818f0ca3f686aa54c1c2092b8)
2024-10-11 14:40:30 +03:00
Martin Storsjö
c0d19c640a checkasm: lls: Use relative tolerances rather than absolute ones
Depending on the magnitude of the output values, the potential
errors can be larger.

This fixes errors in the lls tests on x86_32 for some seeds,
observed with GCC 11 (on Ubuntu 22.04, with the distro compiler,
with -m32).

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 6668268e16b6d1a6992840dccb12effece2e7202)
2024-10-10 23:56:10 +03:00
Martin Storsjö
794245fa71 arm: Consistently use proper interworking function returns
Use "bx lr", or "pop {lr}", which do proper mode switching
between thumb and arm modes. A plain "mov pc, lr" does not switch
from thumb mode to arm mode (while in arm mode, it does switch
mode for a thumb caller).

This is normally not an issue, as CONFIG_THUMB only is enabled if
the C compiler defaults to thumb; but stick to patterns that can
do mode switching if needed, for consistency.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 77e6293735262b20a86b5047b77991a86cf4e9e1)
2024-10-10 23:56:10 +03:00
Gyan Doshi
63f5c007a7 avcodec/libx265: unbreak build for X265_BUILD >= 213
Earlier, x265 made an API change to support alpha and
other multiple layer pictures. We added guards to accommodate
that in 1f801dfdb5

They have now reverted that API change in
https://bitbucket.org/multicoreware/x265_git/commits/78e5b703b1

Updated our wrapper guards to unbreak build again.
2024-10-05 20:18:14 +05:30
Marvin Scholz
9b061291ad fftools: log unconnected filter output label
(cherry picked from commit f25c9cc213c7e3eb585d3339eb775b16921c4d98)
2024-10-04 11:34:59 -03:00
Marvin Scholz
e14a3a4b11 fftools: do not access out of bounds filtergraph
The log message was logged for `filtergraphs[j]` which would cause a
heap buffer overflow in certain circumstances.

Correctly it should be logged for the current filtergraph, so just
use `fg` here.

(cherry picked from commit 5beeb3a1f97d8f6d4076fe83aaf5e2e5871f945e)
2024-10-04 11:34:59 -03:00
Zhao Zhili
4c0ef3bfae avcodec/mediacodecenc: Fix access of uninitialized value
When crop is skipped, av_strlcatf will access `str` which isn't
initialized properly.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit eff9ed7bff45998ea370e3d6f627529ad47e2e74)
2024-10-04 15:45:43 +08:00