]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavformat/mpegtsenc: support DVB 6A descriptor for AC-3
Limin Wang [Sat, 15 Aug 2020 13:57:03 +0000 (21:57 +0800)]
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>
3 years agolibavformat/ffmetadec.c: Fix Use-of-uninitialized-value
Thierry Foucu [Thu, 20 Aug 2020 19:14:52 +0000 (12:14 -0700)]
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>
3 years agolibavformat/nut: Support SSA and ASS subtitles
hax@riseup.net [Sat, 22 Aug 2020 04:16:52 +0000 (21:16 -0700)]
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>
3 years agoavcodec/dvbsubdec: error out on unsupported coding methods
Clément Bœsch [Tue, 18 Aug 2020 15:22:06 +0000 (17:22 +0200)]
avcodec/dvbsubdec: error out on unsupported coding methods

3 years agoavcodec/dvbsubdec: request samples for missing coding methods
Clément Bœsch [Tue, 18 Aug 2020 15:21:23 +0000 (17:21 +0200)]
avcodec/dvbsubdec: request samples for missing coding methods

3 years agoavcodec/dvbsubenc: fix onject/object typo
Clément Bœsch [Tue, 18 Aug 2020 14:47:53 +0000 (16:47 +0200)]
avcodec/dvbsubenc: fix onject/object typo

3 years agoavcodec/dvbsubenc: reindent after previous commit
Clément Bœsch [Tue, 18 Aug 2020 08:32:50 +0000 (10:32 +0200)]
avcodec/dvbsubenc: reindent after previous commit

3 years agoavcodec/dvbsubenc: merge rectangle encode code blocks
Clément Bœsch [Tue, 18 Aug 2020 08:29:22 +0000 (10:29 +0200)]
avcodec/dvbsubenc: merge rectangle encode code blocks

3 years agoavcodec/dvbsub: add "enc" suffix to encoder
Clément Bœsch [Mon, 17 Aug 2020 14:57:04 +0000 (16:57 +0200)]
avcodec/dvbsub: add "enc" suffix to encoder

3 years agoavcodec/dvbsub: remove useless indirection in dvbsub_encode.
Clément Bœsch [Tue, 1 Oct 2013 19:08:16 +0000 (21:08 +0200)]
avcodec/dvbsub: remove useless indirection in dvbsub_encode.

3 years agofate: add fate-sub-dvb test
Clément Bœsch [Mon, 10 Aug 2020 13:59:26 +0000 (15:59 +0200)]
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.

3 years agoavcodec/rzpaenc: Remove set-but-unused variable
Andreas Rheinhardt [Fri, 21 Aug 2020 22:17:49 +0000 (00:17 +0200)]
avcodec/rzpaenc: Remove set-but-unused variable

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/libaomdec: Set SAR based on RenderWidth and RenderHeight
Derek Buitenhuis [Fri, 21 Aug 2020 15:28:02 +0000 (16:28 +0100)]
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>
3 years agoavcodec/proresenc: infer array lengths
Michael Bradshaw [Fri, 21 Aug 2020 17:08:57 +0000 (10:08 -0700)]
avcodec/proresenc: infer array lengths

Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
3 years agoavfilter/af_biquads: add different transform types
Paul B Mahol [Fri, 21 Aug 2020 20:42:45 +0000 (22:42 +0200)]
avfilter/af_biquads: add different transform types

3 years agoavfilter/af_arnndn: use RNN_COPY macro to copy
Paul B Mahol [Fri, 21 Aug 2020 20:16:56 +0000 (22:16 +0200)]
avfilter/af_arnndn: use RNN_COPY macro to copy

3 years agoavcodec: add RPZA encoder
Paul B Mahol [Wed, 15 Jul 2020 19:43:59 +0000 (21:43 +0200)]
avcodec: add RPZA encoder

3 years agoavcodec/proresenc: add support for PQ and HLG
Michael Bradshaw [Thu, 20 Aug 2020 02:13:21 +0000 (19:13 -0700)]
avcodec/proresenc: add support for PQ and HLG

Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
3 years agoavformat/movenc: write the colr atom by default
Michael Bradshaw [Mon, 13 Apr 2020 17:11:38 +0000 (11:11 -0600)]
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>
3 years agoavfilter/formats: Remove unused functions
Andreas Rheinhardt [Fri, 21 Aug 2020 13:40:01 +0000 (15:40 +0200)]
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
d1c49bcae9b7fd41df5c6804ac7f6a5c271a7c2e. And the one and only caller of
ff_query_formats_all_layouts() (the asyncts filter) has been removed in
commit a8fe8d6b4a35c95aa94fccde5f001041278d197c.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/audio: Remove unused array, move used-only-once array
Andreas Rheinhardt [Fri, 21 Aug 2020 13:13:02 +0000 (15:13 +0200)]
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 4d4098da009c8340997b8d1abedbf2062e4aa991) 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>
3 years agodnn_backend_native_layer_avgpool: Fix invalid assignment, use av_assert
Andreas Rheinhardt [Fri, 21 Aug 2020 11:47:27 +0000 (13:47 +0200)]
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>
3 years agoavcodec/qdmc: reduce insanely huge tables
Paul B Mahol [Fri, 21 Aug 2020 11:53:23 +0000 (13:53 +0200)]
avcodec/qdmc: reduce insanely huge tables

3 years agoavfilter/vf_overlay: Remove superfluous ;
Andreas Rheinhardt [Fri, 21 Aug 2020 09:46:49 +0000 (11:46 +0200)]
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>
3 years agodoc/APIchanges: Remove version conflict separator
Andreas Rheinhardt [Fri, 21 Aug 2020 10:38:30 +0000 (12:38 +0200)]
doc/APIchanges: Remove version conflict separator

Added in 06f26512046de1a84e045d219e7fa211c37ad0e4.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/fifo: Remove unused functions and headers
Andreas Rheinhardt [Fri, 21 Aug 2020 09:15:21 +0000 (11:15 +0200)]
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 b077d8d9082d057d4c7abd9e0b1a98f9651cfaa8
and channel_layout.h is since fdd9663781e3ebc8ebed0704607abd174095a905.
Both headers have therefore been removed, too.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavu/buffer: forward av_buffer_realloc() error code.
Nicolas George [Sat, 4 Jan 2020 18:52:08 +0000 (19:52 +0100)]
lavu/buffer: forward av_buffer_realloc() error code.

Fix CID 1457235.

3 years agolavu/avstring: deprecate av_d2str().
Nicolas George [Thu, 26 Dec 2019 18:32:23 +0000 (19:32 +0100)]
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.

3 years agoavfilter/libvmaf: mention csv as available log format
Harry Mallon [Thu, 20 Aug 2020 16:39:27 +0000 (17:39 +0100)]
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>
3 years agodnn/native: rename struct ConvolutionalNetwork to NativeModel
Ting Fu [Wed, 19 Aug 2020 13:43:13 +0000 (21:43 +0800)]
dnn/native: rename struct ConvolutionalNetwork to NativeModel

Signed-off-by: Ting Fu <ting.fu@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
3 years agoavfilter/formats: Cosmetics
Andreas Rheinhardt [Fri, 14 Aug 2020 17:21:18 +0000 (19:21 +0200)]
avfilter/formats: Cosmetics

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/formats: Factor checking for mergeability out of ff_merge_*
Andreas Rheinhardt [Fri, 14 Aug 2020 14:47:01 +0000 (16:47 +0200)]
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>
3 years agoavfilter/formats: Avoid code duplication when merging samplerates
Andreas Rheinhardt [Thu, 13 Aug 2020 22:18:09 +0000 (00:18 +0200)]
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>
3 years agoswscale/x86/output: add missing AVX2 support preprocessor wrappers
James Almer [Thu, 20 Aug 2020 18:14:56 +0000 (15:14 -0300)]
swscale/x86/output: add missing AVX2 support preprocessor wrappers

Fixes compilation with old yasm

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavfi: remove request_samples.
Nicolas George [Wed, 12 Aug 2020 17:17:29 +0000 (19:17 +0200)]
lavfi: remove request_samples.

Filters can use min_samples/max_samples if the number is constant
or activate and ff_inlink_consume_samples().

3 years agolavfi: remove needs_fifo.
Nicolas George [Wed, 12 Aug 2020 17:13:37 +0000 (19:13 +0200)]
lavfi: remove needs_fifo.

3 years agolavfi/vaf_spectrumsynth: switch to activate.
Nicolas George [Wed, 12 Aug 2020 17:01:34 +0000 (19:01 +0200)]
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.

3 years agolavfi/vf_overlay_qsv: remove needs_fifo.
Nicolas George [Wed, 12 Aug 2020 15:22:21 +0000 (17:22 +0200)]
lavfi/vf_overlay_qsv: remove needs_fifo.

It is not relevant when using activate and framesync.

3 years agoavcodec/h2645_parse: reset the H2645NAL type value before parsing a NAL header
James Almer [Wed, 12 Aug 2020 18:03:52 +0000 (15:03 -0300)]
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>
3 years agoavcodec/h2645_parse: skip empty NAL units earlier
James Almer [Wed, 12 Aug 2020 17:46:35 +0000 (14:46 -0300)]
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>
3 years agoavcodec/h2645_parse: always return 0 on successful h{264,evc}_parse_nal_header()...
James Almer [Wed, 12 Aug 2020 17:26:50 +0000 (14:26 -0300)]
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>
3 years agoavcodec/decode: move the ff_decode_frame_props() prototype to the proper header
James Almer [Sun, 16 Aug 2020 14:43:48 +0000 (11:43 -0300)]
avcodec/decode: move the ff_decode_frame_props() prototype to the proper header

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/libsrt: close listen fd in listener mode
Nicolas Sugino [Fri, 14 Aug 2020 01:18:26 +0000 (22:18 -0300)]
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>
3 years agoavformat/siff: Reject audio packets without audio stream
Michael Niedermayer [Tue, 11 Aug 2020 12:41:13 +0000 (14:41 +0200)]
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>
3 years agolibavformat/r3d.c: Fix Use-of-uninitialized-value in filename.
Thierry Foucu [Wed, 19 Aug 2020 22:51:02 +0000 (15:51 -0700)]
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>
3 years agolibavcodec/proresdec2: Setup qmat_chroma according to RDD36
Harry Mallon [Wed, 19 Aug 2020 20:32:47 +0000 (21:32 +0100)]
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>
3 years agoffplay: do not set redundant channel count on abuffersink.
Nicolas George [Fri, 14 Aug 2020 09:25:09 +0000 (11:25 +0200)]
ffplay: do not set redundant channel count on abuffersink.

3 years agolavfi/buffersink: add a summary documentation of the API.
Nicolas George [Fri, 14 Aug 2020 09:21:39 +0000 (11:21 +0200)]
lavfi/buffersink: add a summary documentation of the API.

3 years agolavfi/buffersink: clearly document that the Params struct are unused.
Nicolas George [Fri, 14 Aug 2020 08:56:50 +0000 (10:56 +0200)]
lavfi/buffersink: clearly document that the Params struct are unused.

3 years agoavutil/video_enc_params: fix code comment
leozhang [Thu, 13 Aug 2020 03:57:05 +0000 (11:57 +0800)]
avutil/video_enc_params: fix code comment

Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: leozhang <leozhang@qiyi.com>
3 years agolavc/libkvazaar: export encoded frame stats
Jun Zhao [Sun, 26 Jul 2020 02:43:10 +0000 (10:43 +0800)]
lavc/libkvazaar: export encoded frame stats

Export choosen pict_type and qp.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
3 years agoavfilter/formats: Avoid allocations when merging formats and samplerates
Andreas Rheinhardt [Thu, 13 Aug 2020 19:20:22 +0000 (21:20 +0200)]
avfilter/formats: Avoid allocations when merging formats and samplerates

This is the analogue of cfc65520324ae640299bd321ef88ae76dcee6f78 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>
3 years agoavfilter/formats: Make check for buffer overflow redundant
Andreas Rheinhardt [Thu, 13 Aug 2020 16:31:04 +0000 (18:31 +0200)]
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 1cbf7fb4345a3e5b7791d483241bf4759bde4ece (merging commit
5775a1832c4165e6acc1d307004b38701bb463f4). 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>
3 years agoavfilter/af_afir: Fix leak of AVFilterChannelLayout in case of error
Andreas Rheinhardt [Fri, 7 Aug 2020 02:58:56 +0000 (04:58 +0200)]
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>
3 years agoswresample/rematrix: handle 22.2 as a 9 channel layout
Jan Ekström [Thu, 6 Aug 2020 21:35:55 +0000 (00:35 +0300)]
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.

3 years agoavformat/mpegts: only reset timestamps to NOPTS for DVB teletext
Jan Ekström [Wed, 12 Aug 2020 21:27:09 +0000 (00:27 +0300)]
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

3 years agoavformat/mpeg: Check avio_read() return value in get_pts()
Michael Niedermayer [Fri, 14 Aug 2020 23:07:44 +0000 (01:07 +0200)]
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>
3 years agotools/target_dec_fuzzer: Adjust threshold for DST
Michael Niedermayer [Sun, 16 Aug 2020 18:04:08 +0000 (20:04 +0200)]
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>
3 years agoavformat/mlvdec: Only store dimensions after having validated them
Andreas Rheinhardt [Mon, 10 Aug 2020 00:33:19 +0000 (02:33 +0200)]
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>
3 years agoavformat/mlvdec: Don't leak open AVIOContexts on error
Andreas Rheinhardt [Mon, 10 Aug 2020 00:19:35 +0000 (02:19 +0200)]
avformat/mlvdec: Don't leak open AVIOContexts on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/mlvdec: Check for existence of AVIOContext before using it
Andreas Rheinhardt [Sun, 9 Aug 2020 23:32:42 +0000 (01:32 +0200)]
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>
3 years agoavformat/hls: Use av_init_pkt() directly
Andreas Rheinhardt [Fri, 14 Aug 2020 20:59:57 +0000 (22:59 +0200)]
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>
3 years agoavformat/hls: Remove redundant resetting of AVPacket
Andreas Rheinhardt [Fri, 14 Aug 2020 20:36:22 +0000 (22:36 +0200)]
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>
3 years agoavformat/hls: Fix memleak when url is empty
Andreas Rheinhardt [Fri, 14 Aug 2020 20:06:54 +0000 (22:06 +0200)]
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>
3 years agoFATE: fix copy & paste for minterpolate test
Limin Wang [Fri, 14 Aug 2020 00:30:49 +0000 (08:30 +0800)]
FATE: fix copy & paste for minterpolate test

Reported-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agodoc/encoders: Add all options for JPEG2000 encoder
Gautam Ramakrishnan [Mon, 10 Aug 2020 16:44:00 +0000 (22:14 +0530)]
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>
3 years agoavcodec/v4l2_context: return EAGAIN to signal full buffers
Andriy Gelman [Sun, 16 Aug 2020 21:39:13 +0000 (17:39 -0400)]
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
827d6fe73d2f5472c1c2.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
3 years agoavcodec/utils: calculate frame number of HEVC if the framerate > 30FPS
Limin Wang [Sun, 12 Jul 2020 14:19:31 +0000 (22:19 +0800)]
avcodec/utils: calculate frame number of HEVC if the framerate > 30FPS

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agodoc/general: fix ADPCM typos
Paul B Mahol [Sun, 16 Aug 2020 14:23:54 +0000 (16:23 +0200)]
doc/general: fix ADPCM typos

3 years agoavformat/av1dec: don't update temporal_unit_size after it's no longer used
James Almer [Sun, 16 Aug 2020 02:27:44 +0000 (23:27 -0300)]
avformat/av1dec: don't update temporal_unit_size after it's no longer used

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavdevice/xcbgrab: check return values of xcb query functions
Moritz Barsnick [Wed, 5 Aug 2020 12:06:53 +0000 (14:06 +0200)]
avdevice/xcbgrab: check return values of xcb query functions

Fixes #7312, segmentation fault on close of X11 server

xcb_query_pointer_reply() and xcb_get_geometry_reply() can return NULL
if e.g. the X server closes or the connection is lost. This needs to
be checked in order to cleanly exit, because the returned pointers are
dereferenced later.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavcodec/bsf: improve the doxy for av_bsf_flush()
James Almer [Mon, 10 Aug 2020 18:03:46 +0000 (15:03 -0300)]
avcodec/bsf: improve the doxy for av_bsf_flush()

Mention an example scenario where the function should be used.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/qsvenc_h264: add missing atsc_a53.h include
James Almer [Sat, 15 Aug 2020 17:43:11 +0000 (14:43 -0300)]
avcodec/qsvenc_h264: add missing atsc_a53.h include

Regression since 0de01da1d2

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/av1dec: inline obu_read_data() and obu_prefetch() into obu_get_packet()
James Almer [Fri, 14 Aug 2020 03:43:17 +0000 (00:43 -0300)]
avformat/av1dec: inline obu_read_data() and obu_prefetch() into obu_get_packet()

They don't really help making the demuxer more readable.

Reviewed-by: Guangxin Xu <oddstone@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec: move ff_alloc_a53_sei() to atsc_53
James Almer [Sun, 9 Aug 2020 17:01:16 +0000 (14:01 -0300)]
avcodec: move ff_alloc_a53_sei() to atsc_53

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/hevc_sei: use ff_parse_a53_cc() to parse A53 Closed Captions
James Almer [Sun, 9 Aug 2020 20:53:38 +0000 (17:53 -0300)]
avcodec/hevc_sei: use ff_parse_a53_cc() to parse A53 Closed Captions

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/h264_sei: use ff_parse_a53_cc() to parse A53 Closed Captions
James Almer [Fri, 7 Aug 2020 19:04:24 +0000 (16:04 -0300)]
avcodec/h264_sei: use ff_parse_a53_cc() to parse A53 Closed Captions

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/libdav1d: add support for A53 Closed Captions
James Almer [Fri, 7 Aug 2020 19:05:13 +0000 (16:05 -0300)]
avcodec/libdav1d: add support for A53 Closed Captions

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec: split off A53 Closed Caption parsing code into its own file
James Almer [Fri, 7 Aug 2020 19:03:29 +0000 (16:03 -0300)]
avcodec: split off A53 Closed Caption parsing code into its own file

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/libsvtav1: remove unneeded svt_av1_enc_deinit_handle()
Limin Wang [Sat, 1 Aug 2020 05:51:59 +0000 (13:51 +0800)]
avcodec/libsvtav1: remove unneeded svt_av1_enc_deinit_handle()

It's for FF_CODEC_CAP_INIT_CLEANUP flag.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/mpeg12enc: support mpeg2 encoder const level
Limin Wang [Sun, 2 Aug 2020 13:07:04 +0000 (21:07 +0800)]
avcodec/mpeg12enc: support mpeg2 encoder const level

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec: extend CFHD description
Paul B Mahol [Fri, 14 Aug 2020 08:50:07 +0000 (10:50 +0200)]
avcodec: extend CFHD description

3 years agodoc/general: move Cineform HD and Canopus codecs to correct section
Paul B Mahol [Fri, 14 Aug 2020 08:44:48 +0000 (10:44 +0200)]
doc/general: move Cineform HD and Canopus codecs to correct section

3 years agoavformat/av1dec: fix return value on some code paths
James Almer [Fri, 14 Aug 2020 03:09:43 +0000 (00:09 -0300)]
avformat/av1dec: fix return value on some code paths

If avio_read() returns a value of bytes read that's lower than the
expected, return an error instead. And when there are zero bytes in
the prefetch buffer, return 0 in order for the frame merge bsf to
drain all potentially buffered packets.

Missed by mistake when amending and committing 9a7bdb6d71.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/av1dec: add missing preprocessor wrappers to annexb and obu demuxers
James Almer [Thu, 13 Aug 2020 17:06:44 +0000 (14:06 -0300)]
avformat/av1dec: add missing preprocessor wrappers to annexb and obu demuxers

Ensure the modules are compiled only if enabled.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/av1dec: add low-overhead bitstream format
Xu Guangxin [Thu, 13 Aug 2020 06:51:02 +0000 (14:51 +0800)]
avformat/av1dec: add low-overhead bitstream format

It's defined in Section 5.2, used by netflix.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/av1_parse: use macro for MAX_OBU_HEADER_SIZE
Xu Guangxin [Mon, 10 Aug 2020 09:34:30 +0000 (17:34 +0800)]
avcodec/av1_parse: use macro for MAX_OBU_HEADER_SIZE

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agodnn_backend_tf.c: fix build issue for tensorflow backend
Guo, Yejun [Thu, 13 Aug 2020 06:48:11 +0000 (14:48 +0800)]
dnn_backend_tf.c: fix build issue for tensorflow backend

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
3 years agoavfilter/formats: Avoid allocations when merging channel layouts
Andreas Rheinhardt [Wed, 12 Aug 2020 20:31:50 +0000 (22:31 +0200)]
avfilter/formats: Avoid allocations when merging channel layouts

When one merges two AVFilterChannelLayouts structs, there is no need to
allocate a new one. Instead one can reuse one of the two given ones.
If one does this, one also doesn't need to update the references of the
AVFilterChannelLayouts that is reused. Therefore this commit reuses the
structure with the higher refcount.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/formats: Fix heap-buffer overflow when merging channel layouts
Andreas Rheinhardt [Thu, 13 Aug 2020 02:02:26 +0000 (04:02 +0200)]
avfilter/formats: Fix heap-buffer overflow when merging channel layouts

The channel layouts accepted by ff_merge_channel_layouts() are of two
types: Ordinary channel layouts and generic channel layouts. These are
layouts that match all layouts with a certain number of channels.
Therefore parsing these channel layouts is not done in one go; instead
first the intersection of the ordinary layouts of the first input
list of channel layouts with the ordinary layouts of the second list is
determined, then the intersection of the ordinary layouts of the first
one and the generic layouts of the second one etc. In order to mark the
ordinary channel layouts that have already been matched as used they are
zeroed. The inner loop that does this is as follows:

for (j = 0; j < b->nb_channel_layouts; j++) {
    if (a->channel_layouts[i] == b->channel_layouts[j]) {
        ret->channel_layouts[ret_nb++] = a->channel_layouts[i];
        a->channel_layouts[i] = b->channel_layouts[j] = 0;
    }
}

(Here ret->channel_layouts is the array containing the intersection of
the two input arrays.)

Yet the problem with this code is that after a match has been found, the
loop continues the search with the new value a->channel_layouts[i].
The intention of zeroing these elements was to make sure that elements
already paired at this stage are ignored later. And while they are indeed
ignored when pairing ordinary and generic channel layouts later, it has
the exact opposite effect when pairing ordinary channel layouts.

To see this consider the channel layouts A B C D E and E D C B A. In the
first round, A and A will be paired and added to ret->channel_layouts.
In the second round, the input arrays are 0 B C D E and E D C B 0.
At first B and B will be matched and zeroed, but after doing so matching
continues, but this time it will search for 0, which will match with the
last entry of the second array. ret->channel_layouts now contains A B 0.
In the third round, C 0 0 will be added to ret->channel_layouts etc.
This gives a quadratic amount of elements, yet the amount of elements
allocated for said array is only the sum of the sizes of a and b.

This issue can e.g. be reproduced by
ffmpeg -f lavfi -i anullsrc=cl=7.1 \
-af 'aformat=cl=mono|stereo|2.1|3.0|4.0,aformat=cl=4.0|3.0|2.1|stereo|mono' \
-f null -

The fix is easy: break out of the inner loop after having found a match.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agocbs: Mention all codecs in unit type comment
Mark Thompson [Mon, 27 Jul 2020 16:32:16 +0000 (17:32 +0100)]
cbs: Mention all codecs in unit type comment

3 years agoRevert "lavfi/avfiltergraph: add check before free the format"
Andreas Rheinhardt [Fri, 7 Aug 2020 02:28:07 +0000 (04:28 +0200)]
Revert "lavfi/avfiltergraph: add check before free the format"

This reverts commit f156f4ab2317f22bfef33c7eaead0d5d5f162903.

The checks added by said commit are nonsense because they did not help
in case ff_merge_samplerates() or ff_merge_formats() returned NULL
while freeing one of its arguments: Said freeing does not change
the local variables of can_merge_formats().

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/formats: Simplify cleanup for ff_merge_* functions
Andreas Rheinhardt [Fri, 7 Aug 2020 02:10:05 +0000 (04:10 +0200)]
avfilter/formats: Simplify cleanup for ff_merge_* functions

Now that the output's refs-array is only allocated once, it is NULL in
any error case and therefore needn't be freed at all; Instead an
av_assert1() has been added to guarantee it to be NULL.

Furthermore, it is unnecessary to av_freep(&ptr) when ptr == NULL.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/formats: Leave lists' ownership unchanged upon merge failure
Andreas Rheinhardt [Fri, 7 Aug 2020 01:41:18 +0000 (03:41 +0200)]
avfilter/formats: Leave lists' ownership unchanged upon merge failure

ff_merge_formats(), ff_merge_samplerates() and ff_merge_channel_layouts()
share common semantics: If merging succeeds, a non-NULL pointer is
returned and both input lists (of type AVFilterFormats resp.
AVFilterChannelLayouts) are to be treated as if they had been freed;
the owners of the input parameters (if any) become owners of the
returned list. If merging does not succeed, NULL is returned and both
input lists are supposed to be unchanged.

The problem is that the functions did not abide by these semantics:
In case of reallocation failure, it is possible for these functions
to return NULL after having already freed one of the two input list.
This happens because sometimes the refs-array of the destined output
gets reallocated twice to its final size and if the second of these
reallocations fails, the first of the two inputs has already been freed
and its refs updated to point to the destined output which in this case
will be freed immediately so that all of the already updated pointers
are now dangling. This leads to use-after-frees and memory corruptions
lateron (when these owners get cleaned up, the lists they own get
unreferenced). Should the input lists don't have owners at all, the
caller (namely can_merge_formats() in avfiltergraph.c) thinks that both
the input lists are unchanged and need to be freed, leading to a double
free.

The solution to this is simple: Don't reallocate twice; do it just once.
This also saves a reallocation.

This commit fixes the issue behind Coverity issue #1452636. It might
also make Coverity realize that the issue has been fixed.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/formats: Schedule avfilter_make_format64_list() for removal
Andreas Rheinhardt [Fri, 7 Aug 2020 22:37:46 +0000 (00:37 +0200)]
avfilter/formats: Schedule avfilter_make_format64_list() for removal

Despite its name, this function is not part of the public API, as
formats.h, the header containing its declaration, is a private header.
The formats API was once public API, but that changed long ago
(b74a1da49db5ebed51aceae6cacc2329288a92c1, the commit scheduling it to
become private, is from 2012). That avfilter_make_format64_list() was
forgotten is probably a result of the confusion resulting from the
libav-ffmpeg split.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/avf_showcqt: Mark arrays as static const
Andreas Rheinhardt [Fri, 7 Aug 2020 22:24:06 +0000 (00:24 +0200)]
avfilter/avf_showcqt: Mark arrays as static const

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/formats: Remove ff_make_formatu64_list()
Andreas Rheinhardt [Fri, 7 Aug 2020 15:21:58 +0000 (17:21 +0200)]
avfilter/formats: Remove ff_make_formatu64_list()

It is unused since 8cbb055760c725d0fb99fb759caabb5f4e37e340 and it
actually coincides with avfilter_make_format64_list().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavc/snowenc: Expose an option to set the rc_eq expression
Alexander Strasser [Fri, 7 Aug 2020 19:40:40 +0000 (21:40 +0200)]
lavc/snowenc: Expose an option to set the rc_eq expression

Snow uses the ratecontrol module, but does not expose a way to set
the rc_eq expression. The default expression, set in the ratecontrol
module, will always be used.

Make it possible to set rc_eq by adding an AVOption to snowenc.

The option definition is mostly a copy from the mpegvideo common
options definition of rc_eq (libavcodec/mpegvideo.h), with some
minor style adjustments to be closer to the other snowenc option
initializer expressions.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
3 years agolavc/aac_ac3_parser: fix potential overflow when averaging bitrate
Alexander Strasser [Fri, 17 Jul 2020 18:51:43 +0000 (20:51 +0200)]
lavc/aac_ac3_parser: fix potential overflow when averaging bitrate

The new code is analog to how it's done in our mpegaudio parser.

Acked-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
3 years agolavf/url: rewrite ff_make_absolute_url() using ff_url_decompose().
Nicolas George [Wed, 29 Jul 2020 22:02:10 +0000 (00:02 +0200)]
lavf/url: rewrite ff_make_absolute_url() using ff_url_decompose().

Also add and update some tests.

Change the semantic a little, because for filesytem paths
symlinks complicate things.
See the comments in the code for detail.

Fix trac tickets #8813 and 8814.