Commit Graph

98880 Commits

Author SHA1 Message Date
Andreas Rheinhardt 6a65449954 avfilter/vf_paletteuse: Fix leaks of AVFilterFormats on error
The paletteuse's query_formats function allocated three AVFilterFormats
before storing them permanently. If allocating one of them failed, the
three AVFilterFormats structures would be freed with av_freep() which
does not free separately allocated subelements (namely the formats
array) which leak.

Furthermore, if storing one of the first two fails, the function simply
returns and the ones not yet stored leak.

These leaks have been fixed by only creating a new AVFilterFormats after
the last one has already been permanently stored. Furthermore, it is
enough to check whether the elements have been properly stored as
ff_formats_ref() by design returns AVERROR(ENOMEM) if it is provided a
NULL AVFilterFormats *.

Fixes Coverity issues #1270818 and #1270819.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 22:05:40 +02:00
Andreas Rheinhardt deb6476fd8 avfilter/graphparser: Fix memleak when linking filters fails
Parsing labeled outputs involves a check for an already known match
(a labeled input with the same name) to pair them together. If yes,
it is attempted to create a link between the two filters; in this case
the AVFilterInOuts have fulfilled their purpose and are freed. Yet if
creating the link fails, these AVFilterInOuts have up until now not been
freed, although they had already been removed from their respective lists
(which means that they are not freed automatically). In other words:
They leak. This commit fixes this.

This fixes ticket #7084. Said ticket contains an example program to
reproduce a leak. It can also be reproduced with ffmpeg alone, e.g. with
the complex filters "[0]null[1],[2]anull[0]" or with "[0]abitscope[0]".
All of these three examples involve media type mismatches which make it
impossible to create the links. The bug could also be triggered by other
means, e.g. failure to allocate the necessary AVFilterLink.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 19:57:42 +02:00
Andreas Rheinhardt 426c16d61a fftools/ffmpeg: Fix leak of AVFilterInOut in case of error
The AVFilterInOuts normally get freed in init_output_filter() when
the corresponding streams get created; yet if an error happens before
one reaches said point, they leak. Therefore this commit makes
ffmpeg_cleanup free them, too.

Fixes ticket #8267.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 19:57:42 +02:00
Andreas Rheinhardt 95b8df687c avfilter/graphparser: Check allocations for success
parse_filter() did not check the return value of av_get_token() for
success; in case name (the name of a filter) was NULL, one got a
segfault in av_strlcpy() (called from create_filter()).

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 19:57:42 +02:00
Andreas Rheinhardt f33faa5b9b avfilter/graphparser: Don't set pointer to one beyond '\0' of string
This happened in parse_link_name() if there was a '[' without matching
']'. While this is not undefined behaviour (pointer arithmetic one
beyond the end of an array works fine as long as there are no accesses),
it is potentially dangerous. It currently isn't (all callers of
parse_link_name() treat this as an error and don't access the string any
more), but making sure that this will never cause trouble in the future
seems nevertheless worthwhile.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 19:57:42 +02:00
Andreas Rheinhardt b3f6dee728 avfilter/graphparser: Fix leaks when parsing inputs fails
parse_inputs() uses a temporary linked list to parse the labeled inputs
of a filter; said linked list owns its elements (and their names). On
success, the list of unlabeled inputs is appened to the end of the list
of labeled inputs and the new list is returned; yet on failures, nothing
frees the already existing elements of the temporary linked list, leading
to a leak.

This can be triggered by e.g. using '-vf [v][' in the FFmpeg
command-line tool.

This leak seems to exist since 4e781c25b7.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 19:57:42 +02:00
Mark Thompson b567cb8d0b cbs_av1: Fix test for presence of buffer_removal_time element
The frame must be in both the spatial and temporal layers for the
operating point, not just one of them.
2020-08-23 18:43:58 +01:00
Andriy Gelman 58b8541330 avcodec/v4l2_m2m_enc: reindent after previous commit
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-08-23 13:42:07 -04:00
Andriy Gelman 8bc7f69cef avcodec/v4l2_m2m_enc: buffer frame if it cannot be enqueued
Currently if the frame buffers are full, the frame is unrefed and
dropped.  Instead buffer the frame so that it is enqueued in the
next v4l2_receive_packet() call.  The behavior was observed on
DragonBoard 410c.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-08-23 13:42:07 -04:00
James Almer 994d2567f1 avcodec/cbs_av1: always store temporal_id and spatial_id in CodedBitstreamAV1Context
Also infer them when not coded in the bitstream.

Reviewed-by: jkqxz
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-23 14:34:32 -03:00
Paul B Mahol e2589ac650 avfilter/af_afir: make use of vector_fmac_scalar() too 2020-08-23 17:52:58 +02:00
James Almer 751f2a27f7 avcodec/cbs_av1: fix storage size for render_{width,height}_minus_1
Signed-off-by: James Almer <jamrial@gmail.com>
2020-08-23 12:20:44 -03:00
Paul B Mahol 568b7b2777 avcodec/gif: fix disposal method for first frame and transparent gifs
Fixes #7902
2020-08-23 16:21:56 +02:00
Paul B Mahol 1c3a3a4ec6 avcodec/notchlc: add initial alpha support 2020-08-23 16:21:56 +02:00
Zhao Zhili 26f81e5e83 avfilter: remove useless cast
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 10:40:55 +02:00
Limin Wang 86174197e6 avfilter/f_sidedata: Add SEI_UNREGISTERED frame side data type
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-23 08:12:49 +08:00
Limin Wang 7e61940794 avformat/mpegtsenc: support DVB 6A descriptor for AC-3
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-23 07:19:11 +08:00
Thierry Foucu 5cf439e72e libavformat/ffmetadec.c: Fix Use-of-uninitialized-value
Check the return value of sscanf as it can return -1(EOF), for example
when the first char in the line is 0x00

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-22 22:51:07 +02:00
hax@riseup.net 118e63dff1 libavformat/nut: Support SSA and ASS subtitles
ffmpeg documentation says the NUT container supports SubStation Alpha
This brings actual functionality in line with documentation.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-22 22:51:07 +02:00
Clément Bœsch a469d29c08 avcodec/dvbsubdec: error out on unsupported coding methods 2020-08-22 19:02:01 +02:00
Clément Bœsch b0f96f663c avcodec/dvbsubdec: request samples for missing coding methods 2020-08-22 19:02:01 +02:00
Clément Bœsch eb4d220ae1 avcodec/dvbsubenc: fix onject/object typo 2020-08-22 19:02:01 +02:00
Clément Bœsch 80d2a33d83 avcodec/dvbsubenc: reindent after previous commit 2020-08-22 19:02:01 +02:00
Clément Bœsch 5fc075d53e avcodec/dvbsubenc: merge rectangle encode code blocks 2020-08-22 19:02:01 +02:00
Clément Bœsch 4dbd055d5a avcodec/dvbsub: add "enc" suffix to encoder 2020-08-22 19:02:01 +02:00
Clément Bœsch 346309a795 avcodec/dvbsub: remove useless indirection in dvbsub_encode. 2020-08-22 19:02:01 +02:00
Clément Bœsch 7d8eafab91 fate: add fate-sub-dvb test
The dvbsubtest_filter.ts sample is a filtered version of the Videolan
sample database (samples/sub/dvbsub/dvbsubtest.ts) using Project X. It
originates from ticket #8844.
2020-08-22 19:02:01 +02:00
Andreas Rheinhardt 01a580f141 avcodec/rzpaenc: Remove set-but-unused variable
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-22 09:23:30 +02:00
Derek Buitenhuis 3fc3d712a9 avcodec/libaomdec: Set SAR based on RenderWidth and RenderHeight
This is the same thing we do in libdav1d.c

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-08-21 23:58:10 +01:00
Michael Bradshaw b97eb35308 avcodec/proresenc: infer array lengths
Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
2020-08-21 15:43:52 -07:00
Paul B Mahol 2459c3f8f0 avfilter/af_biquads: add different transform types 2020-08-21 22:46:07 +02:00
Paul B Mahol 999f5160c4 avfilter/af_arnndn: use RNN_COPY macro to copy 2020-08-21 22:46:07 +02:00
Paul B Mahol 6158029dfc avcodec: add RPZA encoder 2020-08-21 22:46:07 +02:00
Michael Bradshaw b30f737f7a avcodec/proresenc: add support for PQ and HLG
Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
2020-08-21 11:09:11 -07:00
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