Commit Graph

98796 Commits

Author SHA1 Message Date
Michael Bradshaw
c5b20cfe19 avformat/movenc: write the colr atom by default
The write_colr flag has been marked as experimental for over 5 years.
It should be safe to enable its behavior by default as follows:

  - Write the colr atom by default for mp4/mov if any of the following:
     - The primaries/trc/matrix are all specified, OR
     - There is an ICC profile, OR
     - The user specified +write_colr
  - Keep the write_colr flag for situations where the user wants to
    write the colr atom even if the color info is unspecified (e.g.,
    http://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/259334.html)

This fixes https://trac.ffmpeg.org/ticket/7961

Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
2020-08-21 10:01:58 -07:00
Andreas Rheinhardt
242ba4d74c avfilter/formats: Remove unused functions
This commit removes ff_parse_sample_format(), ff_parse_time_base() and
ff_query_formats_all_layouts() from libavfilter/formats.c. All of these
functions were completely unused. ff_parse_time_base() has not been used
at all since it had been added in 3448404a707b6e236a2ffa7b0453b3300de41b7b;
the last caller of ff_parse_sample_format has been removed in commit
d1c49bcae9. And the one and only caller of
ff_query_formats_all_layouts() (the asyncts filter) has been removed in
commit a8fe8d6b4a.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-21 18:28:40 +02:00
Andreas Rheinhardt
2e0fd50319 avfilter/audio: Remove unused array, move used-only-once array
ff_planar_sample_fmts_array is unused (and was unused since it was added
in 4d4098da00) and therefore this commit
removes it; ff_packed_sample_fmts_array meanwhile is used only once (in
the amerge filter) and therefore it has been moved to this place.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-21 18:18:08 +02:00
Andreas Rheinhardt
128e6df1cd dnn_backend_native_layer_avgpool: Fix invalid assignment, use av_assert
dnn_execute_layer_avg_pool() contains the following line:

assert(avgpool_params->padding_method = VALID);

This statement contains an assignment where obviously a comparison was
intended. Furthermore, *avgpool_params is const, so that the attempted
assignment leads to a compilation failure if asserts are enabled
(i.e. if DEBUG is defined which leads libavutil/internal.h to not define
NDEBUG). Moreover, the enumeration constant VALID actually has the value 0,
so that the assert would be triggered if a compiler compiles this with
asserts enabled. Finally, the statement uses assert() directly instead
of av_assert*().

All these errors have been fixed.

Thanks to ubitux for providing a FATE-box [1] where DEBUG is defined.

[1]: http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-ddebug

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2020-08-21 22:12:39 +08:00
Paul B Mahol
d2206f0c5b avcodec/qdmc: reduce insanely huge tables 2020-08-21 13:55:50 +02:00
Andreas Rheinhardt
c5e204c84f avfilter/vf_overlay: Remove superfluous ;
In a function body, a redundant ; is just a null statement that does
nothing. Yet outside a function body, a superfluous ';' like one that
exists if one adds a ';' immediately after a function body's closing
brace is actually invalid C that compilers happen to accept. Yet when
compiled in -pedantic mode, both GCC as well as Clang emit warnings for
this like "ISO C does not allow extra ‘;’ outside of a function
[-Wpedantic]".

The scenario described above existed in vf_overlay.c as a result of
macro expansion. This commit fixes it.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-21 13:52:44 +02:00
Andreas Rheinhardt
bbe92ed9b1 doc/APIchanges: Remove version conflict separator
Added in 06f2651204.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-21 12:41:32 +02:00
Andreas Rheinhardt
d4e29d9c5e avfilter/fifo: Remove unused functions and headers
The functions were forgotten in 03c8fe49ea3f2a2444607e541dff15a1ccd7f0c2;
removing them also means that the avassert.h and samplefmt.h headers are
no longer used any more, so they have been removed, too.

Moreover, video.h is unused since b077d8d908
and channel_layout.h is since fdd9663781.
Both headers have therefore been removed, too.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-21 12:24:06 +02:00
Nicolas George
2b71cd3e0b lavu/buffer: forward av_buffer_realloc() error code.
Fix CID 1457235.
2020-08-21 11:44:30 +02:00
Nicolas George
06f2651204 lavu/avstring: deprecate av_d2str().
It is no longer used in our code base and does not seem
to be used much in other projects.
2020-08-21 11:01:39 +02:00
Harry Mallon
412d63fe72 avfilter/libvmaf: mention csv as available log format
Signed-off-by: Harry Mallon <harry.mallon@codex.online>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
2020-08-21 10:48:27 +05:30
Ting Fu
a6e830ae7f dnn/native: rename struct ConvolutionalNetwork to NativeModel
Signed-off-by: Ting Fu <ting.fu@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2020-08-21 10:39:00 +08:00
Andreas Rheinhardt
b2266961c0 avfilter/formats: Cosmetics
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-21 00:28:51 +02:00
Andreas Rheinhardt
06754f7bbf avfilter/formats: Factor checking for mergeability out of ff_merge_*
The callers of the ff_merge_*() functions fall into two categories with
quite different needs:

One caller is can_merge_formats() which only wants to test for mergeability
without it merging anything. In order to do so, it duplicates the lists
it intends to test and resets their owners so that they are not modified
by ff_merge_*(). It also means that it needs to receive the merged list
(and not only an int containing whether the lists are mergeable) to
properly free it.

The other callers want the lists to be actually merged. But given the
fact that ff_merge_*() automatically updates the owners of the lists,
they only want the information whether the merge succeeded or not; they
don't want a link to the new list.

Therefore this commit splits these functions in two: ff_merge_*() for
the latter callers and ff_can_merge_*() for the former.
ff_merge_*() doesn't need to return a pointer to the combined list at all
and hence these functions have been modified to return an int, which
allows to distinguish between incompability and memory allocation failures.

ff_can_merge_*() meanwhile doesn't modify its arguments at all obviating
the need for copies. This in turn implies that there is no reason to
return a pointer to the new list, as nothing needs to be freed. These
functions therefore return an int as well. This allowed to completely
remove can_merge_formats() in avfiltergraph.c.

Notice that no ff_can_merge_channel_layouts() has been created, because
there is currently no caller for this. It could be added if needed.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-20 22:01:45 +02:00
Andreas Rheinhardt
363f93460f avfilter/formats: Avoid code duplication when merging samplerates
Right now, ff_merge_samplerates() contains three instances of the
MERGE_REF() macro, a macro which reallocates an array, updates some
pointers in a loop and frees several buffers. This commit makes it
possible to contain only one instance of said macro in the function,
thereby reducing codesize.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-20 21:31:01 +02:00
James Almer
621e2625e0 swscale/x86/output: add missing AVX2 support preprocessor wrappers
Fixes compilation with old yasm

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-20 15:14:56 -03:00
Nicolas George
03c8fe49ea lavfi: remove request_samples.
Filters can use min_samples/max_samples if the number is constant
or activate and ff_inlink_consume_samples().
2020-08-20 18:55:19 +02:00
Nicolas George
4ca1fb9d2a lavfi: remove needs_fifo. 2020-08-20 18:55:19 +02:00
Nicolas George
29e0c30b1c lavfi/vaf_spectrumsynth: switch to activate.
Preserve the original workings, that does not use frames timestamps
and therefore is very fragile.

Allow to remove needs_fifo.
2020-08-20 18:55:19 +02:00
Nicolas George
7c1fbf7cf3 lavfi/vf_overlay_qsv: remove needs_fifo.
It is not relevant when using activate and framesync.
2020-08-20 18:55:19 +02:00
James Almer
23bbb01077 avcodec/h2645_parse: reset the H2645NAL type value before parsing a NAL header
This will prevent reporting a bogus value in the log message when
the header parsing fails.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-20 13:50:11 -03:00
James Almer
1e41a9be34 avcodec/h2645_parse: skip empty NAL units earlier
No point in trying to parse nonexistent header bits.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-20 13:50:01 -03:00
James Almer
a4d28ea030 avcodec/h2645_parse: always return 0 on successful h{264,evc}_parse_nal_header() calls
HEVC NALs are no longer being skipped based on their nuh_layer_id
value since ad326379c6.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-20 13:17:50 -03:00
James Almer
c56d787fe3 avcodec/decode: move the ff_decode_frame_props() prototype to the proper header
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-20 13:17:50 -03:00
Nicolas Sugino
86f5fd471d avformat/libsrt: close listen fd in listener mode
In listener mode the first fd is not closed when libsrt_close() is called
because it is overwritten by the new accept fd.  Added the listen_fd to the
context to properly close it when libsrt_close() is called.

Fixes trac ticket #8372.

Signed-off-by: Nicolas Sugino <nsugino@3way.com.ar>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-08-20 16:24:46 +02:00
Michael Niedermayer
8931c55789 avformat/siff: Reject audio packets without audio stream
Fixes: Assertion failure
Fixes: 24612/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6600899842277376.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-20 13:27:22 +02:00
Thierry Foucu
36f7b83568 libavformat/r3d.c: Fix Use-of-uninitialized-value in filename.
While reading the filename tag, it may return a EOF and we are still
copying the file with uninitialized value.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-20 13:27:22 +02:00
Harry Mallon
a606e3b339 libavcodec/proresdec2: Setup qmat_chroma according to RDD36
Signed-off-by: Harry Mallon <harry.mallon@codex.online>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-20 13:21:20 +02:00
Nicolas George
973540118a ffplay: do not set redundant channel count on abuffersink. 2020-08-20 12:49:08 +02:00
Nicolas George
f103731e21 lavfi/buffersink: add a summary documentation of the API. 2020-08-20 12:49:08 +02:00
Nicolas George
1f12b7b1d3 lavfi/buffersink: clearly document that the Params struct are unused. 2020-08-20 12:49:08 +02:00
leozhang
3b7036bc1d avutil/video_enc_params: fix code comment
Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: leozhang <leozhang@qiyi.com>
2020-08-20 17:45:00 +08:00
Jun Zhao
d5abb11738 lavc/libkvazaar: export encoded frame stats
Export choosen pict_type and qp.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-08-20 15:06:14 +08:00
Andreas Rheinhardt
c0aa3dfaa8 avfilter/formats: Avoid allocations when merging formats and samplerates
This is the analogue of cfc6552032 for
formats and samplerates; in contrast to said commit, one can avoid
allocating a new array for formats as well (the complications of the
generic channel layouts made this impossible for channel layouts).

This commit also starts to move the line continuation '\' chars to the
left to keep them in line with MERGE_REF() as well as with the 80 lines
limit.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-20 01:35:26 +02:00
Andreas Rheinhardt
55eb24a92f avfilter/formats: Make check for buffer overflow redundant
and remove the redundant check.

This check for whether the allocated buffer is sufficient has been added
in commit 1cbf7fb434 (merging commit
5775a1832c). It is not sufficient to
detect invalid input lists (namely lists with duplicates); its only use
is to avoid buffer overflows. And this can be achieved by simpler means:
Make sure that one allocates space for so many elements as the outer loop
ranges over and break out of the inner loop if a match has been found.
For valid input without duplicates, no further match will be found anyway.

This change will temporarily make the allocated formats array larger
than before and larger than necessary; this will be fixed in a later
commit that avoids the allocation altogether.

If a check for duplicates in the lists is deemed necessary, it should be
done properly somewhere else.

Finally, the error message that is removed in this commit used
__FUNCTION__, which is a GCC extension (C99 added __func__ for this).
So this commit removes a warning when compiling in -pedantic mode.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-20 01:33:06 +02:00
Andreas Rheinhardt
3a0f080ffa avfilter/af_afir: Fix leak of AVFilterChannelLayout in case of error
If an error happens between the allocation of an AVFilterChannelLayout
and its usage (which involves attaching said object to a more permanent
object), the channel layout array leaks. This can simply be fixed by
making sure that nothing is between the allocation and the
aforementioned usage.

Fixes Coverity issue #1250334.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-20 00:24:03 +02:00
Jan Ekström
1c7e55dd50 swresample/rematrix: handle 22.2 as a 9 channel layout
This is as far as 22.2 follows the same channel order as
WaveFormatExtensible's channel mask (and the AV_CH_* defines).

After LFE2 the side channels would follow, but that offset of
one stops us from utilizing them without further tweaks.

This change was verified by using swresample to downmix to 5.1,
and then feeding that to WASAPI.
2020-08-18 22:47:35 +03:00
Jan Ekström
c820c2d4bf avformat/mpegts: only reset timestamps to NOPTS for DVB teletext
While having the possibility of non-NOPTS values that can suddenly
jump in time due to adjustments to match PCR is not nice for DVB
subtitles, apparently the parser for this format bases its behavior on
whether the packets' timestamps are NOPTS or not. Thus while we can
adjust timestamps, we should exclude DVB subtitles from the timestamp
unsetting logic.

Fixes #8844
2020-08-18 22:29:22 +03:00
Michael Niedermayer
e8a88a16f7 avformat/mpeg: Check avio_read() return value in get_pts()
Found-by: Thierry Foucu <tfoucu@gmail.com>
Fixes: Use-of-uninitialized-value
Reviewed-by: Thierry Foucu <tfoucu@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-18 14:56:04 +02:00
Michael Niedermayer
d08c3f56ec tools/target_dec_fuzzer: Adjust threshold for DST
Fixes: Timeout (too long -> 3sec)
Fixes: 24239/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5189061015502848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-18 14:56:04 +02:00
Andreas Rheinhardt
d661cfc184 avformat/mlvdec: Only store dimensions after having validated them
Otherwise it might happen that invalid dimensions are used when reading
a video packet; this might lead to undefined overflow.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 14:26:40 +02:00
Andreas Rheinhardt
0d560873da avformat/mlvdec: Don't leak open AVIOContexts on error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 14:25:30 +02:00
Andreas Rheinhardt
6e0dd41fa3 avformat/mlvdec: Check for existence of AVIOContext before using it
The mlv demuxer supports input split into multiple files; if invalid
data is encountered when parsing one of the subsequent files, that file
is closed. But at this point some index entries belonging to this file
might already have been added. In this case, the read_packet function
might try to use the AVIOContext (which is NULL) to read data which will
of course crash. This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 14:18:18 +02:00
Andreas Rheinhardt
97d8029149 avformat/hls: Use av_init_pkt() directly
and remove reset_packet(). The packet's data pointer is already zeroed,
so the only thing that reset_packet() does that av_init_pkt() doesn't is
redundant.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 07:03:00 +02:00
Andreas Rheinhardt
8c91b5c48a avformat/hls: Remove redundant resetting of AVPacket
av_read_frame() already returns blank packets on error.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 07:02:52 +02:00
Andreas Rheinhardt
dfc6a9f075 avformat/hls: Fix memleak when url is empty
Fixes Coverity ID 1465888.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-18 07:02:43 +02:00
Limin Wang
ab384d289d FATE: fix copy & paste for minterpolate test
Reported-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-18 08:32:02 +08:00
Gautam Ramakrishnan
642404f28d doc/encoders: Add all options for JPEG2000 encoder
This patch updates the documentation by adding all options
for JPEG2000 encoder.

Revised-by: Gyan Doshi <ffmpeg@gyani.pro>
2020-08-17 15:30:25 +05:30
Andriy Gelman
5df9724e42 avcodec/v4l2_context: return EAGAIN to signal full buffers
Return proper error when frame buffers are full. This path is triggered
on the DragonBoard 410c since the encoding API change in commit
827d6fe73d.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
2020-08-16 17:39:13 -04:00
Limin Wang
d7af6d1469 avcodec/utils: calculate frame number of HEVC if the framerate > 30FPS
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-16 22:51:11 +08:00