Commit Graph

104675 Commits

Author SHA1 Message Date
Andreas Rheinhardt
f5e74e8d48 avfilter/vf_paletteuse: Add missing parentheses
Fixes a mistake in dea673d0d5.
GCC emitted a -Wint-in-bool-context warning because of that.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 19:15:19 +01:00
Alex Xu (Hello71)
6fdd7fe0b8 avformat/img2dec: probe JFIF/Exif header
Due to reasons, mpv doesn't pass filename when probing. mpv also sets
default probescore threshold to 26. Since the current jpeg_probe
implementation returns 25 until EOI, it means that the whole image needs
to be probed to succeed. Worse, the whole image is not passed at once;
increasingly large buffers are tried before that. Adding it up together,
if many demuxers are enabled, moderately large JPEG files (few MB) can
take several seconds to open, despite taking less than 1 second to
actually decode.

Therefore, adjust the heuristic to be more optimistic if proper JFIF or
Exif segments are found. While not strictly required, the vast majority
of JPEG-ish files have one or the other or both.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-27 18:24:49 +01:00
Alex Xu (Hello71)
cd0bdce71a avcodec/mjpeg_parser: skip markers after EOI, not by size
The check for m->size >= 0xF000 is intended to avoid skipping too much
garbage data between JPEG frames in test_roman (thus missing next SOI),
but it erroneously also skips valid markers between SOI and SOS. Instead
of this, we should simply skip parsing markers other than SOI after EOI.
That way, we will not accidentally skip over SOI due to some garbage
between frames. There is still a small risk of encountering FFD8 in the
garbage data, but the chance of this is fairly low.

Fixes: https://trac.ffmpeg.org/ticket/8967
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-27 18:24:49 +01:00
Andreas Rheinhardt
2cddb2f7a8 avformat/mpegtsenc: Avoid allocation of AVPacket
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 12:55:41 +01:00
Andreas Rheinhardt
a81e0ee21f avformat/movenc: Avoid allocation of AVPacket
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 12:55:41 +01:00
Andreas Rheinhardt
5e01fc8318 avformat/dashenc: Don't use stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 12:55:41 +01:00
Andreas Rheinhardt
a5ee166327 avformat/avformat: Add AVStream parameter to check_bitstream() sig
For most check_bitstream() functions this just avoids having
to dereference s->streams[pkt->stream_index] themselves; but for
meta-muxers it will allow to forward the packet to stream with
a different stream_index (belonging to a different AVFormatContext)
without using a spare packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 12:55:41 +01:00
Lynne
c90b3661fa
hwcontext_vulkan: use correct return value for allocation failure 2021-11-27 04:46:41 +01:00
Lynne
33be4e6ca9
configure: fix test_pkg_config_cpp after 1e5acc1b59 2021-11-27 04:46:39 +01:00
Limin Wang
7bf4c06809 avformat/rtp: add localaddr for network interface selection
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-27 11:21:17 +08:00
Michael Niedermayer
57adb26d05 avformat/avidec: Check read_odml_index() for failure
Fixes: Timeout
Fixes: 40950/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6478873068437504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-26 21:31:06 +01:00
Michael Niedermayer
ff23cee200 avcodec/txd: Move input size checks before allocation
Fixes: Timeout
Fixes: 40882/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TXD_fuzzer-4893364584054784

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-26 21:31:06 +01:00
Andreas Rheinhardt
7c2b9067d0 avformat/cafdec: Avoid unnecessary avio_tell() calls
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-26 18:55:58 +01:00
Andreas Rheinhardt
81be19b906 fftools/ffmpeg: Take type limitations of AVFifo API into account
The types used by the AVFifo API are inconsistent:
av_fifo_(space|size)() returns an int; av_fifo_alloc() takes an
unsigned, other parts use size_t. This commit therefore ensures
that the size of the muxing_queue FIFO never exceeds INT_MAX.

While just at it, also make sure not to call av_fifo_size()
unnecessarily often.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-26 18:55:58 +01:00
Andreas Rheinhardt
71204e8e3d Revert "Disable warnings for casting pointers to integers, there is nothing wrong with that."
This reverts commit 5258f64a14.
The premise of said commit (that conversions from pointer to int
are ok) is wrong: C99/C11 6.3.2.3 5: "Any pointer type may be converted
to an integer type. [...] If the result cannot be represented in the
integer type, the behavior is undefined." (C90 6.3.4 contains a similar
restriction.) So don't disable -Wpointer-to-int-cast.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-26 16:10:24 +01:00
Andreas Rheinhardt
9207dc3b0d avcodec/h263: Fix global-buffer-overflow with noout flag2 set
h263_get_motion_length() forgot to take an absolute value;
as a consequence, a negative index was used to access an array.
This leads to potential crashes, but mostly it just accesses what
is to the left of ff_mvtab (unless one uses ASAN), thereby defeating
the purpose of the AV_CODEC_FLAG2_NO_OUTPUT because the sizes of
the returned packets differ from the sizes the encoder would actually
have produced.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-26 16:10:24 +01:00
Limin Wang
27c9300027 avformat/udp: remove local localaddr array
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-26 17:43:48 +08:00
Wu Jianhua
b3624069f0 avutil/hwcontext_vulkan: fully support customizable validation layers
Validation layer is an indispensable part of developing on Vulkan.

The following commands is on how to enable validation layers:

ffmpeg -init_hw_device vulkan=0,debug=1,validation_layers=VK_LAYER_LUNARG_monitor+VK_LAYER_LUNARG_api_dump

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-26 10:36:39 +01:00
Lynne
1e5acc1b59
configure: do not include -lvulkan to cflags in vulkan's pkg-config check
Also fixes the non-pkg-config check.
2021-11-26 10:35:21 +01:00
Paul B Mahol
e38551180e avfilter/af_biquads: add svf transform type 2021-11-26 00:55:32 +01:00
Marton Balint
0b9dbfab48 avformat/mpegts: fix stream index in verbose log message
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-25 19:11:24 +01:00
Marton Balint
6f10f4a479 avformat/libsrt: add missing version check for snddropdelay
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-25 19:11:24 +01:00
James Almer
b46817d9c3 avformat/http: prevent truncation of sanitized_path
path1 and sanitized_path are both MAX_URL_SIZE bytes long, yet the latter is
copied from the former with the addition of one extra character.

Should fix a -Wformat-truncation warning.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-25 12:06:15 -03:00
Limin Wang
522f577d7e avformat/rtp: support RGB/BGR for rfc4175
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-25 15:07:19 +08:00
Limin Wang
7b55f95f71 avformat: suppport YUV 4:2:2 10-bit for rfc4175
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-25 15:07:15 +08:00
Limin Wang
3436864e68 avcodec: suppport for bitpacked encode
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-25 15:04:35 +08:00
Limin Wang
130250d3af avcodec: rename bitpacked.c to bitpacked_dec.c
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-25 15:04:35 +08:00
Limin Wang
4f5352d5fe avformat/rtpenc: adds partial support for the RFC 4175
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-25 15:04:35 +08:00
Limin Wang
05b0c66313 avformat/rtpdec_rfc4175: support for yuv420p format
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-25 15:04:35 +08:00
Limin Wang
3399bbab4d avformat/rtpdec_rfc4175: use rawvideo for uyvy422
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-25 15:04:35 +08:00
Matt Oliver
1a5930b554 libvpxdec: Correct linking against variables.
Instead link against the function that returns the correct variable. This fixes linking errors with dlls with msvc.
2021-11-25 16:29:25 +11:00
Wu Jianhua
7e9e2cf93b avutil/hwcontext_vulkan: check if created before destroying the instance
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-24 11:09:49 +01:00
Wu Jianhua
c2a356d583 avutil/hwcontext_vulkan: check if created before destroying the device
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-24 11:09:49 +01:00
Anton Khirnov
9dd104f6e2 ffmpeg: drop obsolete rotation API remnants
No demuxers export the "rotate" metadata tag anymore.
2021-11-23 11:36:59 +01:00
Anton Khirnov
823cea5197 ffmpeg: drop -isync, which did nothing since 2012 2021-11-23 11:36:59 +01:00
Anton Khirnov
84cb255c20 ffmpeg: drop -sameq/-samequant options
They did nothing but return an error since 2012.
2021-11-23 11:36:59 +01:00
Anton Khirnov
5ebdf9bb50 ffmpeg: drop the -tvstd option
It is undocumented and has been deprecated since 2012.
2021-11-23 11:36:59 +01:00
Anton Khirnov
a44098152b ffmpeg: drop the -vc option
It is undocumented and has been deprecated since 2012.
2021-11-23 11:36:59 +01:00
Anton Khirnov
d013453caa ffmpeg: drop the -deinterlace option
It is undocumented and has been deprecated since 2013.
2021-11-23 11:36:59 +01:00
Anton Khirnov
9d4e290ec4 ffmpeg: drop the -intra option
It is undocumented and has been marked as deprecated since 2012.
2021-11-23 11:36:59 +01:00
Anton Khirnov
e8380bbae6 ffmpeg: do not copy chroma_sample_location from the input stream
It will be set from the supplied AVFrame later on.
2021-11-23 11:36:59 +01:00
Limin Wang
0e22d2e59b avcodec/libaomenc: remove the redundant initialization
For dst->have_sse will be assigned by ctx->have_sse soon(code line 23).

Reviewed-by: James Zern <jzern-at-google.com@ffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-23 09:01:43 +08:00
Timo Rothenpieler
2de6cd4ba4 avutil/hwcontext_cuda: return more useful error codes from init functions 2021-11-22 23:03:21 +01:00
Timo Rothenpieler
b1f1de0844 avutil/hwcontext_cuda: add option to use primary device context 2021-11-22 23:03:21 +01:00
Gyan Doshi
203b0e3561 avformat/mov: make STTS duration unsigned int
As per 8.6.1.2.2 of ISO/IEC 14496-12:2015(E), STTS sample offsets
are to be always stored as uint32_t. So far, they have been signed ints
which led to desync in files with very large offsets.

The MOVStts struct was used to store CTTS offsets as well. These can be
negative in version 1. So a new struct MOVCtts was created and all
declarations for CTTS usage changed to MOVCtts.
2021-11-22 15:18:42 +05:30
Andreas Rheinhardt
18f22bfb27 avcodec/h263: Inline constant
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-21 00:38:56 +01:00
Andreas Rheinhardt
645f705d6a av(codec|device): Don't cast pointers to int
C99/C11 6.3.2.3 5: "Any pointer type may be converted to an integer
type. [...] If the result cannot be represented in the integer type,
the behavior is undefined." So stop casting pointers to int; use
uintptr_t instead.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-21 00:35:30 +01:00
Andreas Rheinhardt
40cf317d09 avcodec/smcenc: Move PutByteContext to stack
This context is transient, so putting it on the stack is more natural.
Also reduces codesize: 24E6->2296 B with GCC 10 and -O3.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-20 14:19:32 +01:00
Lynne
b159975e80
hwcontext_vulkan: check for non-flagged transfer queue families
"All commands that are allowed on a queue that supports transfer
operations are also allowed on a queue that supports either
graphics or compute operations. Thus, if the capabilities of a
queue family include VK_QUEUE_GRAPHICS_BIT or VK_QUEUE_COMPUTE_BIT,
then reporting the VK_QUEUE_TRANSFER_BIT capability separately for
that queue family is optional."
2021-11-20 02:37:41 +01:00
Lynne
135e1c0adf
lavu/vulkan: check for initialization when freeing buffers
What happens on startup is that ffmpeg.c initializes the filter,
then frees it without feeding a single frame through. With no
input frame, the filter lacks a hardware device. The rest of the
uninit code checks if Vulkan objects exist, which they must if there's
a hardware device, but vk->DeviceWaitIdle does not require an object.
So, add a check for it.
2021-11-20 01:48:45 +01:00