18 months agoavformat/url: check url root node when rel include double dot and trim double dot
Steven Liu [Wed, 29 Apr 2020 04:50:57 +0000 (12:50 +0800)]
avformat/url: check url root node when rel include double dot and trim double dot

fix ticket: 8625
and add testcase into url for double dot corner case

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
18 months agoavformat/hlsenc: resend full url of the init fragment mp4
Steven Liu [Mon, 4 May 2020 04:00:41 +0000 (12:00 +0800)]
avformat/hlsenc: resend full url of the init fragment mp4

fix ticket: 8651
because the init fragment mp4 file name is without base url name,
so just modify it use the full url which splice after init function.

Tested-by: matclayton
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
18 months agolibavformat/hlsenc: Allow usage of 'periodic-rekey' with multi-variant streams
Yaroslav Pogrebnyak [Thu, 30 Apr 2020 13:10:53 +0000 (21:10 +0800)]
libavformat/hlsenc: Allow usage of 'periodic-rekey' with multi-variant streams

This patch adds possibility to use 'periodic-rekey' option with
multi-variant streams to hlsenc muxer. All streams variants
use parameters from the same key_info_file.

There are 2 sets of encryption options that kind of overlaps and add
complexity, so I tried to do the thing without changing too much code.

There is a little duplication of the key_file, key_uri, iv_string, etc
in the VariantStream since we copy it from hls to each variant stream,
but generally all the code remains the same to minimise appearing
of unexpected bugs. Refactoring could be done as a separate patch then as needed.

Signed-off-by: Yaroslav Pogrebnyak <yyyaroslav@gmail.com>
18 months agoavformat/hlsenc: compute segment duration use current pts minus last segment end pts
Steven Liu [Wed, 29 Apr 2020 12:39:22 +0000 (20:39 +0800)]
avformat/hlsenc: compute segment duration use current pts minus last segment end pts

segment duration is using vs duration which compute by frame per second,
that can not fix problem of VFR video stream, so compute the duration
when split the segment, set the segment target duration use
current packet pts minus the prev segment end pts..

Reported-by: Zhao Jun <barryjzhao@tencent.com>
Reviewed-by: Zhao Jun <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
18 months agotests/fate/hlsenc: rename fate macro define from FATE_AFILTER to FATE_HLSENC
Steven Liu [Wed, 15 Apr 2020 06:58:15 +0000 (14:58 +0800)]
tests/fate/hlsenc: rename fate macro define from FATE_AFILTER to FATE_HLSENC

and add fate-hlsenc for test all of the testcase
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
18 months agolavc/bsf: add an Opus metadata bitstream filter
Lynne [Sun, 3 May 2020 20:17:33 +0000 (21:17 +0100)]
lavc/bsf: add an Opus metadata bitstream filter

The only adjustable field is the gain. Some ripping/transcoding programs
have started to use it.

18 months agoavcodec/wavpack: Check rate_x and sample rate for overflow
Michael Niedermayer [Sat, 2 May 2020 19:20:45 +0000 (21:20 +0200)]
avcodec/wavpack: Check rate_x and sample rate for overflow

Fixes: shift exponent 32 is too large for 32-bit type 'int'
Fixes: 21647/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5686168323883008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: David Bryant <david@wavpack.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agoavformat: add demuxer for Pro Pinball Series' Soundbanks
Zane van Iperen [Mon, 4 May 2020 14:25:56 +0000 (14:25 +0000)]
avformat: add demuxer for Pro Pinball Series' Soundbanks

Adds support for the soundbank files used by the Pro Pinball series of games.


Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agolibswscale: add output support for AV_PIX_FMT_GBRAPF32
Mark Reid [Sun, 3 May 2020 23:10:04 +0000 (16:10 -0700)]
libswscale: add output support for AV_PIX_FMT_GBRAPF32

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agolibswscale: add input support AV_PIX_FMT_GBRAPF32
Mark Reid [Sun, 3 May 2020 23:10:03 +0000 (16:10 -0700)]
libswscale: add input support AV_PIX_FMT_GBRAPF32

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agoavformat/nutenc: Write size into right dynamic buffer
Andreas Rheinhardt [Mon, 4 May 2020 16:49:22 +0000 (18:49 +0200)]
avformat/nutenc: Write size into right dynamic buffer

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/aviobuf, nutenc: Move ff_puv_v, ff_get_v_length to nutenc.c
Andreas Rheinhardt [Thu, 9 Apr 2020 15:41:50 +0000 (17:41 +0200)]
avformat/aviobuf, nutenc: Move ff_puv_v, ff_get_v_length to nutenc.c

and make it static again.

These functions have been moved from nutenc to aviobuf and internal.h
in f8280ff4c00eeaa245085fa9691035203abd168c in order to use them in a
forthcoming patch in utils.c. Said patch never happened, so this commit
moves them back and makes them static, effectively reverting said
commit as well as f8280ff4c00eeaa245085fa9691035203abd168c (which added
the ff-prefix to these functions).

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/nutenc: Add goto fail in nut_write_headers()
Andreas Rheinhardt [Mon, 4 May 2020 11:06:41 +0000 (13:06 +0200)]
avformat/nutenc: Add goto fail in nut_write_headers()

It allows to combine several ffio_free_dyn_buf().

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/nutenc: Reuse dynamic buffers when possible
Andreas Rheinhardt [Mon, 4 May 2020 10:46:45 +0000 (12:46 +0200)]
avformat/nutenc: Reuse dynamic buffers when possible

NUT uses variable-length integers in order to for length fields.
Therefore the NUT muxer often writes data into a dynamic buffer in order
to get the length of it, then writes the length field using the fewest
amount of bytes needed. To do this, a new dynamic buffer was opened,
used and freed for each element which involves lots of allocations. This
commit changes this: The dynamic buffers are now resetted and reused.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agolibavformat/nutenc: Remove redundant function parameter
Andreas Rheinhardt [Mon, 4 May 2020 09:13:58 +0000 (11:13 +0200)]
libavformat/nutenc: Remove redundant function parameter

calculate_checksum in put_packet() is always 1.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavcodec/avpacket: add missing entry for prft to av_packet_side_data_name()
James Almer [Mon, 4 May 2020 15:17:01 +0000 (12:17 -0300)]
avcodec/avpacket: add missing entry for prft to av_packet_side_data_name()

Signed-off-by: James Almer <jamrial@gmail.com>
18 months agolavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode
Linjie Fu [Tue, 17 Mar 2020 14:53:58 +0000 (22:53 +0800)]
lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode

With the description in frame size with refs semantics (SPEC 7.2.5),
it is a requirement of bitstream conformance that for at least one
reference frame has the valid dimensions.

Modify the check to make sure the decoder works well in SINGLE_REFERENCE
mode that not all reference frames have valid dimensions.

Check and error out if invalid reference frame is used in inter_recon.

One of the failure case is a 480x272 inter frame (SINGLE_REFERENCE mode)
with following reference pool:

0.  960x544    LAST    valid
1. 1920x1088 GOLDEN  invalid, but not used in single reference mode
2. 1920x1088 ALTREF  invalid, but not used in single reference mode
3~7  ...     Unused

Identical logic in libvpx:

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
18 months agoavcodec/v4l2_m2m_enc: Support changing qmin/qmax
Andriy Gelman [Sun, 19 Jan 2020 06:06:12 +0000 (01:06 -0500)]
avcodec/v4l2_m2m_enc: Support changing qmin/qmax

Hard coded parameters for qmin and qmax are currently used to initialize
v4l2_m2m device. This commit uses values from avctx->{qmin,qmax} if they
are set.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
18 months agoavcodec/utils: simplify, remove duplicate code
Limin Wang [Thu, 30 Apr 2020 10:29:48 +0000 (18:29 +0800)]
avcodec/utils: simplify, remove duplicate code

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavformat/mxfdec: reindent code
Limin Wang [Mon, 4 May 2020 12:51:24 +0000 (20:51 +0800)]
avformat/mxfdec: reindent code

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavcodec/v4l2_m2m_enc: reindent code
Limin Wang [Wed, 29 Apr 2020 23:23:41 +0000 (07:23 +0800)]
avcodec/v4l2_m2m_enc: reindent code

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavcodec/prores_metadata_bsf: Use AVCOL_TRC_NB - 1 for the valid max range
Limin Wang [Sun, 3 May 2020 20:58:26 +0000 (04:58 +0800)]
avcodec/prores_metadata_bsf: Use AVCOL_TRC_NB - 1 for the valid max range

Report by Marton after commit.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agolavc/vaapi_encode: add FF_CODEC_CAP_INIT_CLEANUP caps for encoders
Linjie Fu [Tue, 31 Mar 2020 15:34:00 +0000 (23:34 +0800)]
lavc/vaapi_encode: add FF_CODEC_CAP_INIT_CLEANUP caps for encoders

ff_vaapi_encode_close() is not enough to free the resources like cbs
if initialization failure happens after codec->configure (except for

We need to call avctx->codec->close() to deallocate, otherwise memory
leak happens.

Add FF_CODEC_CAP_INIT_CLEANUP for vaapi encoders and deallocate the
resources at free_and_end inside avcodec_open2().

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
18 months agoavformat/matroskadec: Free right buffer on error
Andreas Rheinhardt [Sun, 3 May 2020 06:35:25 +0000 (08:35 +0200)]
avformat/matroskadec: Free right buffer on error

Since commit 979b5b89594c7628bd846c63198cb64ef9d81d16, reverting the
Matroska ContentCompression is no longer done inside
matroska_parse_frame() (the function that creates AVPackets out of the
parsed data (unless we are dealing with certain codecs that need special
handling)), but instead in matroska_parse_block(). As a consequence,
the data that matroska_parse_frame() receives is no longer always owned
by an AVBuffer; it is owned by an AVBuffer iff no ContentCompression needed
to be reversed; otherwise the data is independently allocated and needs
to be freed on error.

Whether the data is owned by an AVBuffer or not is indicated by a variable
buf of type AVBufferRef *: If it is NULL, the data is independently
allocated, if not it is owned by the underlying AVBuffer (and is used to
avoid copying the data when creating the AVPackets).

Because the allocation of the buffer holding the uncompressed data happens
outside of matroska_parse_frame() (if a ContentCompression needs to be
reversed), the data is passed as uint8_t ** in order to not leave any
dangling pointers behind in matroska_parse_block() should the data need to
be freed: In case of errors, said uint8_t ** would be av_freep()'ed in
case buf indicated the data to be independently allocated.

Yet there is a problem with this: Some codecs (namely WavPack and
ProRes) need special handling: Their packets are only stored in
Matroska in a stripped form to save space and the demuxer reconstructs
full packets. This involved allocating a new, enlarged buffer. And if
an error happens when trying to wrap this new buffer into an AVBuffer,
this buffer needs to be freed; yet instead the given uint8_t ** (holding
the uncompressed, yet still stripped form of the data) would be freed
(av_freep()'ed) which certainly leads to a memleak of the new buffer;
even worse, in case the track does not use ContentCompression the given
uint8_t ** must not be freed as the actual data is owned by an AVBuffer
and the data given to matroska_parse_frame() is not the start of the
actual allocated buffer at all.

Both of these issues are fixed by always freeing the current data in
case it is independently allocated. Furthermore, while it would be
possible to track whether the pointer from matroska_parse_block() needs
to be reset or not, there is no gain in doing so, as the pointer is not
used at all afterwards and the sematics are clear: If the data passed
to matroska_parse_frame() is independently allocated, then ownership
of the data passes to matroska_parse_frame(). So don't pass the data
via uint8_t **.

Fixes Coverity ID 1462661 (the issue as described by Coverity is btw
a false positive: It thinks that this error can be triggered by ProRes
with a size of zero after reconstructing the original packets, but the
reconstructed packets can't have a size of zero).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agodoc/muxers: remove hls_fmp4_init_resend parameter
Steven Liu [Mon, 4 May 2020 05:39:44 +0000 (13:39 +0800)]
doc/muxers: remove hls_fmp4_init_resend parameter

the parameter should boolean

18 months agoavcodec/cbs_h265: add missing support for reserved_payload_extension_data SEI bits
James Almer [Fri, 24 Apr 2020 20:41:47 +0000 (17:41 -0300)]
avcodec/cbs_h265: add missing support for reserved_payload_extension_data SEI bits

Fixes ticket #8622

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
18 months agoavcodec/cbs_h265: move the payload_extension_present check into its own function
James Almer [Mon, 20 Apr 2020 20:33:55 +0000 (17:33 -0300)]
avcodec/cbs_h265: move the payload_extension_present check into its own function

Will be reused in the following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
18 months agoavcodec/cbs_h265: rename H265RawPSExtensionData to H265RawExtensionData
James Almer [Mon, 20 Apr 2020 18:33:18 +0000 (15:33 -0300)]
avcodec/cbs_h265: rename H265RawPSExtensionData to H265RawExtensionData

So that NAL types other than Parameter Set ones may use it.

Signed-off-by: James Almer <jamrial@gmail.com>
18 months agoRevert "avcodec/proresenc_anatoliy: support for more color matrix for proresenc"
Limin Wang [Sun, 3 May 2020 21:22:51 +0000 (05:22 +0800)]
Revert "avcodec/proresenc_anatoliy: support for more color matrix for proresenc"

This reverts commit e0eed1fd523ec5d0cc390a08c468dbc57316378a.

18 months agoavcodec/librav1e: Require a bitrate to be set when using 2-pass mode
Derek Buitenhuis [Sat, 2 May 2020 13:10:48 +0000 (14:10 +0100)]
avcodec/librav1e: Require a bitrate to be set when using 2-pass mode

Not requiring this leads to unexpected result, since Rav1e's current
two pass API has no way to fail in such a case.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
18 months agoffmpeg: Don't require a known device to pass a frames context to an encoder
Mark Thompson [Tue, 28 Apr 2020 22:56:42 +0000 (23:56 +0100)]
ffmpeg: Don't require a known device to pass a frames context to an encoder

The previous code here did not handle passing a frames context when
ffmpeg itself did not know about the device it came from (for example,
because it was created by device derivation inside a filter graph), which
would break encoders requiring that input.  Fix that by checking for HW
frames and device context methods independently, and prefer to use a
frames context method if possible.  At the same time, revert the encoding
additions to the device matching function because the additional
complexity was not relevant to decoding.

Also fixes #8637, which is the same case but with the device creation
hidden in the ad-hoc libmfx setup code.

18 months agoavcodec/h265_metadata: filter parameter sets in packet side data
James Almer [Wed, 22 Apr 2020 15:09:47 +0000 (12:09 -0300)]
avcodec/h265_metadata: filter parameter sets in packet side data

Signed-off-by: James Almer <jamrial@gmail.com>
18 months agoavcodec/h264_metadata: filter parameter sets in packet side data
James Almer [Wed, 22 Apr 2020 15:09:46 +0000 (12:09 -0300)]
avcodec/h264_metadata: filter parameter sets in packet side data

Signed-off-by: James Almer <jamrial@gmail.com>
18 months agoavcodec/av1_metadata: filter parameter sets in packet side data
James Almer [Wed, 22 Apr 2020 15:09:45 +0000 (12:09 -0300)]
avcodec/av1_metadata: filter parameter sets in packet side data

Extradata included in packet side data is meant to replace the codec context
extradata. So when muxing for example to MP4 without this change and if
extradata is present in a packet side data, the result will be that the
parameter sets present in keyframes will be filtered, but the parameter sets
ultimately included in the av1C box will not.

This is especially important for AV1 as both currently supported encoders don't
export the Sequence Header in the codec context extradata, but as packet side
data instead.

Signed-off-by: James Almer <jamrial@gmail.com>
18 months agoavformat/matroskaenc: Check mimetypes earlier
Andreas Rheinhardt [Sun, 3 Nov 2019 12:25:08 +0000 (13:25 +0100)]
avformat/matroskaenc: Check mimetypes earlier

This avoids errors lateron after the file header has already been
partially written.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskaenc: Fix memleak upon encountering bogus chapter
Andreas Rheinhardt [Mon, 27 Apr 2020 03:42:09 +0000 (05:42 +0200)]
avformat/matroskaenc: Fix memleak upon encountering bogus chapter

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskaenc: Make sure UIDs of delayed chapters are != 0
Andreas Rheinhardt [Mon, 27 Apr 2020 01:12:24 +0000 (03:12 +0200)]
avformat/matroskaenc: Make sure UIDs of delayed chapters are != 0

This has previously only been checked if the chapters were initially
available, but not if they were only written in the trailer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/vorbiscomment: Switch to AVIOContext from bytestream API
Andreas Rheinhardt [Tue, 28 Apr 2020 02:54:05 +0000 (04:54 +0200)]
avformat/vorbiscomment: Switch to AVIOContext from bytestream API

Up until now ff_vorbiscomment_write() used the bytestream API to write
VorbisComments. Therefore the caller had to provide a sufficiently large
buffer to write the output.

Yet two of the three callers (namely the FLAC and the Matroska muxer)
actually want the output to be written via an AVIOContext; therefore
they allocated buffers of the right size just for this purpose (i.e.
they get freed immediately afterwards). Only the Ogg muxer actually
wants a buffer. But given that it is easy to wrap a buffer into an
AVIOContext this commit changes ff_vorbiscomment_write() to use an
AVIOContext for its output.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/vorbiscomment: Replace AVDictionary ** by const AVDictionary *
Andreas Rheinhardt [Tue, 28 Apr 2020 01:03:36 +0000 (03:03 +0200)]
avformat/vorbiscomment: Replace AVDictionary ** by const AVDictionary *

ff_vorbiscomment_write() used an AVDictionary ** parameter for a
dictionary whose contents ought to be written; yet this can be replaced
by AVDictionary * since commit 042ca05f0fdc5f4d56a3e9b94bc9cd67bca9a4bc;
and this in turn can be replaced by const AVDictionary * to indicate
that the dictionary isn't modified; the latter also applies to

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskaenc: Replace impossible condition with assert
Andreas Rheinhardt [Tue, 28 Apr 2020 00:24:16 +0000 (02:24 +0200)]
avformat/matroskaenc: Replace impossible condition with assert

If a FLAC track uses an unconventional channel layout, the Matroska
muxer adds a WAVEFORMATEXTENSIBLE_CHANNEL_MASK VorbisComment to the
CodecPrivate to preserve this information. And given that FLAC uses
24bit length fields, the muxer checks if the length is more than this
and errors out if it is.

Yet this can never happen, because we create the AVDictionary that is
the source for the VorbisComment. It only contains exactly one entry
that can't grow infinitely large (in fact, the length of the
VorbisComment is <= 4 + 33 + 1 + 18 + strlen(LIBAVFORMAT_IDENT)).
So we can simply assert the size to be < (1 << 24) - 4.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskaenc: Write SeekHead when livestreaming
Andreas Rheinhardt [Sun, 26 Apr 2020 08:39:27 +0000 (10:39 +0200)]
avformat/matroskaenc: Write SeekHead when livestreaming

Commit 6fd300ac6c2c3871736ce0e6df95603255004dc6 added support for WebM
Chunk livestreaming; in this case, both the header as well as each
Cluster is written to a file of its own, so that even if the AVIOContext
seems seekable, the muxer has to behave as if it were not. Yet one of
the added checks makes no sense: It ensures that no SeekHead is written
preliminarily (and hence no SeekHead is written at all) if the option
for livestreaming is set, although one should write the SeekHead in this
case when writing the Header. E.g. the WebM-DASH specification [1]
never forbids writing a SeekHead and in some instances (that don't apply
here) even requires it (if Cues are written after the Clusters).

[1]: https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskaenc: Only write Cluster if it has in fact been opened
Andreas Rheinhardt [Sat, 2 May 2020 00:18:44 +0000 (02:18 +0200)]
avformat/matroskaenc: Only write Cluster if it has in fact been opened

Since commit 4aa0665f393847c35387a1c673e62346d0acfc95, the dynamic
buffer destined for the contents of the current Cluster is no longer
constantly allocated, reallocated and then freed after writing the
content; instead it is reset and reused when closing a Cluster.

Yet the code in mkv_write_trailer() still checked for whether a Cluster
is open by checking whether the pointer to the dynamic buffer is NULL or
not (instead of checking whether the position of the current Cluster is
-1 or not). If a Cluster was not open, an empty Cluster would be output.

One usually does not run into this issue, because unless there are
errors, there are only three possibilities to not have an opened Cluster
at the end of writing a packet:
The first is if one sent an audio packet to the muxer. It might trigger
closing and outputting the old Cluster, but because the muxer caches
audio packets internally, it would not be output immediately and
therefore no new Cluster would be opened.
The second is an audio packet that does not contain data (such packets
are sometimes sent for side-data only, e.g. by the FLAC encoder). The
only difference to the first scenario is that such packets are not
The third is if one explicitly flushes the muxer by sending a NULL
packet via av_write_frame().

If one also allows for errors, then there is also another possibility:
Caching the audio packet may fail in the first scenario.

If one calls av_write_trailer() after the first scenario, the cached
audio packet will be output when writing the trailer, for which
a Cluster is opened and everything is fine; because flushing the muxer
does currently not output the cached audio packet (if one is cached),
the issue also does not exist if an audio packet has been cached before
flushing. The issue only exists in one of the other scenarios.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavcodec/proresenc_anatoliy: support for more color matrix for proresenc
Limin Wang [Tue, 5 Nov 2019 02:31:51 +0000 (10:31 +0800)]
avcodec/proresenc_anatoliy: support for more color matrix for proresenc

Please tested with below command:
./ffmpeg -i ../fate-suite/mpeg2/t.mpg  -c:v prores_aw -color_primaries bt2020 -colorspace bt2020_ncl -color_trc smpte2084 -an output.mov

mediainfo outout.mov
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant

./ffmpeg -i ../fate-suite/mpeg2/t.mpg  -c:v prores_aw -color_primaries bt2020 -colorspace bt2020_ncl -color_trc arib-std-b67 -an output.mov
mediainfo outout.mov
Color primaries                          : BT.2020
Transfer characteristics                 : HLG
Matrix coefficients                      : BT.2020 non-constant

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavcodec/prores_metadata_bsf: add arib-std-b67 format support
Limin Wang [Mon, 4 Nov 2019 11:10:01 +0000 (19:10 +0800)]
avcodec/prores_metadata_bsf: add arib-std-b67 format support

It's based on the following specs:
RDD 45:2017 - SMPTE Registered Disclosure Doc - Interoperable Master Format - Application ProRes

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavcodec/prores_metadata_bsf: add smpte2084 format support
Limin Wang [Mon, 4 Nov 2019 11:10:00 +0000 (19:10 +0800)]
avcodec/prores_metadata_bsf: add smpte2084 format support

It's based on the following specs:
RDD 36:2015 - SMPTE Registered Disclosure Doc - Apple ProRes Bitstream Syntax and Decoding Process

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavcodec/nvenc_hevc: add spatial-aq and temporal-aq option to consistent with nvenc_h264
Limin Wang [Wed, 15 Apr 2020 02:09:01 +0000 (10:09 +0800)]
avcodec/nvenc_hevc: add spatial-aq and temporal-aq option to consistent with nvenc_h264

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavcodec/nvenc_h264: add spatial_aq and temporal_aq option to consistent with nvenc_hevc
Limin Wang [Wed, 15 Apr 2020 02:09:00 +0000 (10:09 +0800)]
avcodec/nvenc_h264: add spatial_aq and temporal_aq option to consistent with nvenc_hevc

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavformat/libsrt: change open_timeout to int64_t to avoid integer overflow
Limin Wang [Tue, 31 Mar 2020 14:08:08 +0000 (22:08 +0800)]
avformat/libsrt: change open_timeout to int64_t to avoid integer overflow

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavformat/libsrt: clarify option description for timeout and latency unit of measurement
Limin Wang [Tue, 31 Mar 2020 14:08:07 +0000 (22:08 +0800)]
avformat/libsrt: clarify option description for timeout and latency unit of measurement

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agodoc/protocols: clarify timeout and latency unit of measurement for SRT
Limin Wang [Tue, 31 Mar 2020 14:08:06 +0000 (22:08 +0800)]
doc/protocols: clarify timeout and latency unit of measurement for SRT

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agofftools/ffmpeg: use a bsf list instead of individual bsfs
Marton Balint [Fri, 17 Apr 2020 21:55:55 +0000 (23:55 +0200)]
fftools/ffmpeg: use a bsf list instead of individual bsfs

Signed-off-by: Marton Balint <cus@passwd.hu>
18 months agoavcodec/bsf: support shorthand options for av_bsf_list_parse_str
Marton Balint [Fri, 17 Apr 2020 22:58:18 +0000 (00:58 +0200)]
avcodec/bsf: support shorthand options for av_bsf_list_parse_str

Signed-off-by: Marton Balint <cus@passwd.hu>
18 months agoavcodec/decode: use a single list bsf for codec decode bsfs
Marton Balint [Sat, 25 Apr 2020 21:48:21 +0000 (23:48 +0200)]
avcodec/decode: use a single list bsf for codec decode bsfs

Signed-off-by: Marton Balint <cus@passwd.hu>
18 months agofftools/ffprobe: show closed caption info in the stream dump
vectronic [Wed, 29 Apr 2020 16:14:33 +0000 (17:14 +0100)]
fftools/ffprobe: show closed caption info in the stream dump

Signed-off-by: vectronic <hello.vectronic@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
18 months agoavcodec/vp9dsp_template: Fix integer overflows in idct32_1d()
Michael Niedermayer [Tue, 11 Feb 2020 21:58:08 +0000 (22:58 +0100)]
avcodec/vp9dsp_template: Fix integer overflows in idct32_1d()

Fixes: signed integer overflow: -193177 * 11585 cannot be represented in type 'int'
Fixes: 20557/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5704852816789504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agoavcodec/alacdsp: Fix invalid shift in append_extra_bits()
Michael Niedermayer [Sun, 26 Apr 2020 17:29:39 +0000 (19:29 +0200)]
avcodec/alacdsp: Fix invalid shift in append_extra_bits()

Fixes: left shift of negative value -1
Fixes: 21390/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-6242539519868928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agolibavcodec/wmalosslessdec: prevent sum of positive numbers from becoming negative
Michael Niedermayer [Sun, 9 Feb 2020 17:09:24 +0000 (18:09 +0100)]
libavcodec/wmalosslessdec: prevent sum of positive numbers from becoming negative

Fixes: left shift of negative value -8321365
Fixes: 20506/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-4798062906310656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agoavcodec/dstdec: Fix integer overflow in read_table()
Michael Niedermayer [Sat, 8 Feb 2020 23:23:14 +0000 (00:23 +0100)]
avcodec/dstdec: Fix integer overflow in read_table()

Fixes: signed integer overflow: -16 * 134217879 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5639509530378240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agodoc/mailing-list-faq: Mention current problem with GMX
Michael Niedermayer [Sat, 2 May 2020 09:50:18 +0000 (11:50 +0200)]
doc/mailing-list-faq: Mention current problem with GMX

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agolavc/opus: Reset alloc_trim when doing decoder bit-allocation.
Carl Eugen Hoyos [Sat, 2 May 2020 08:09:01 +0000 (10:09 +0200)]
lavc/opus: Reset alloc_trim when doing decoder bit-allocation.

Fixes ticket #8649.
Reported-by: irc user Xogium
18 months agos->target_i and global are in dB but s->target_tp and true_peak are
Sebastian Dröge [Sat, 2 May 2020 03:52:00 +0000 (20:52 -0700)]
s->target_i and global are in dB but s->target_tp and true_peak are
linear. Instead of mixing these in the calculations, convert the former
first to have all following calculations in the same unit.

Signed-off-by: Kyle Swanson <k@ylo.ph>
18 months agoavcodec/nvenc: refactor dts calculation logic
Timo Rothenpieler [Fri, 1 May 2020 21:42:56 +0000 (23:42 +0200)]
avcodec/nvenc: refactor dts calculation logic

The old approach used some highly complex delta computation math and
I do not remember what the initial reasoning behind that was, but given
that we can just offset the dts by the amount of bframes, it seems wholy

This leaves open an issue with VFR content, for which some more complex
logic might be needed.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
18 months agoac3enc: fix AC3 downmix metadata issue
Piotr Oleszczyk [Thu, 30 Apr 2020 16:17:36 +0000 (18:17 +0200)]
ac3enc: fix AC3 downmix metadata issue

Due to a typo, it was impossible to write 0.595 / -4.5 dB
of ltrt_cmixlev, ltrt_surmixlev, loro_cmixlev, loro_surmixlev.
Without any error 0.841 / -1.5 dB was written to file.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agoavformat/oggdec: Reallocate buffer before writing into it
Michael Niedermayer [Fri, 1 May 2020 12:34:18 +0000 (14:34 +0200)]
avformat/oggdec: Reallocate buffer before writing into it

Fixes: out of array write
Fixes: Regression since f619e1ec66b89215582eff4404b681b760540b4f

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agoavformat/oggdec: Factor buffer reallocation out
Michael Niedermayer [Fri, 1 May 2020 12:33:46 +0000 (14:33 +0200)]
avformat/oggdec: Factor buffer reallocation out

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
18 months agoavcodec/librav1e: Use the framerate when available for ratecontrol
Derek Buitenhuis [Thu, 30 Apr 2020 19:06:43 +0000 (20:06 +0100)]
avcodec/librav1e: Use the framerate when available for ratecontrol

Rav1e currently uses the time base given to it only for ratecontrol... where
the inverse is taken and used as a framerate. So, do what we do in other wrappers
and use the framerate if we can.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
18 months agoavcodec/nvenc: offset dts to account for b-frame reordering
Timo Rothenpieler [Fri, 1 May 2020 18:51:26 +0000 (20:51 +0200)]
avcodec/nvenc: offset dts to account for b-frame reordering

Fixes ticket #7303

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
18 months agoavformat/hlsenc: add support for microseconds since epoch based sequence number
Marton Balint [Sat, 18 Apr 2020 20:15:39 +0000 (22:15 +0200)]
avformat/hlsenc: add support for microseconds since epoch based sequence number

Sequence numbers of segments should be unique, if an encoder is using shorter
than 1 second segments and it is restarted, then future segments will be using
already used sequence numbers if initial sequence number is based on the number
of seconds since epoch and not microseconds.

Signed-off-by: Marton Balint <cus@passwd.hu>
18 months agoavutil/opt: only skip evaluation for rational options
Marton Balint [Sat, 18 Apr 2020 19:37:45 +0000 (21:37 +0200)]
avutil/opt: only skip evaluation for rational options

Fixes problems when non-rational options were set using rational expressions,
causing rounding errors and the option range limits not to be enforced

ffmpeg -f lavfi -i "sine=r=96000/2"

This caused an assertion failure with assert level 2.

Signed-off-by: Marton Balint <cus@passwd.hu>
18 months agodoc/utils: add more examples for valid time duration
Limin Wang [Wed, 8 Apr 2020 02:10:44 +0000 (10:10 +0800)]
doc/utils: add more examples for valid time duration

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavformat/concat: priv_data should be freed internally
Limin Wang [Fri, 3 Apr 2020 13:03:06 +0000 (21:03 +0800)]
avformat/concat: priv_data should be freed internally

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavformat/dashenc: remove the arbitrary restrictions for filename
Limin Wang [Wed, 8 Apr 2020 01:34:28 +0000 (09:34 +0800)]
avformat/dashenc: remove the arbitrary restrictions for filename

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavcodec/mpeg12enc: Use FF_PROFILE_MPEG2_xxx macros
Limin Wang [Fri, 3 Apr 2020 13:04:53 +0000 (21:04 +0800)]
avcodec/mpeg12enc: Use FF_PROFILE_MPEG2_xxx macros

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavformat/matroskadec: Cosmetics
Andreas Rheinhardt [Fri, 6 Dec 2019 23:11:01 +0000 (00:11 +0100)]
avformat/matroskadec: Cosmetics

Reindentation as well as marking several variables used for demuxing
RealAudio as const to clearly see that they don't change during

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Support ContentCompression for all codecs
Andreas Rheinhardt [Fri, 6 Dec 2019 08:53:34 +0000 (09:53 +0100)]
avformat/matroskadec: Support ContentCompression for all codecs

The Matroska demuxer has three functions for creating packets out of
the data read: One for certain RealAudio codecs (ATRAC3, cook, sipr,
RealAudio 28.8), one for WebVTT (actually, the WebM flavour of it) and
one for all the others. Only the last function supported Matroska's
ContentCompression (e.g. it reversed zlib compression or added the
removed headers to the packets). But in Matroska, all tracks are allowed
to be compressed. This commit adds support for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Cache whether a track needs to be decoded
Andreas Rheinhardt [Wed, 4 Dec 2019 16:54:45 +0000 (17:54 +0100)]
avformat/matroskadec: Cache whether a track needs to be decoded

There is no need to recheck this for every frame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Improve forward compability
Andreas Rheinhardt [Wed, 25 Mar 2020 05:52:09 +0000 (06:52 +0100)]
avformat/matroskadec: Improve forward compability

Matroska is built around the principle that a reader does not need to
understand everything in a file in order to be able to make use of it;
it just needs to ignore the data it doesn't know about.

Our demuxer typically follows this principle, but there is one important
instance where it does not: A Block belonging to a TrackEntry with no
associated stream is treated as invalid data (i.e. the demuxer will try
to resync to the next level 1 element because it takes this as a sign
that it has lost sync). Given that we do not create streams if we don't
know or don't support the type of the TrackEntry, this impairs this
demuxer's forward compability.

Furthermore, ignoring Blocks belonging to a TrackEntry without
corresponding stream can (in future commits) also be used to ignore
TrackEntries with obviously bogus entries without affecting the other
TrackEntries (by not creating a stream for said TrackEntry).

Finally, given that matroska_find_track_by_num() already emits its own
error message in case there is no TrackEntry with a given TrackNumber,
the error message (with level AV_LOG_INFO) for this can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Don't discard valid packets
Andreas Rheinhardt [Wed, 25 Mar 2020 05:00:53 +0000 (06:00 +0100)]
avformat/matroskadec: Don't discard valid packets

A Block (meaning both a Block in a BlockGroup as well as a SimpleBlock)
must have at least three bytes after the field containing the encoded
TrackNumber. So if there are <= 3 bytes, the Matroska demuxer would
skip this block, believing it to be an empty, but valid Block.

This might discard valid nonempty Blocks, namely if the track uses header
stripping. And certain definitely spec-incompliant Blocks don't raise
errors: Those with two or less bytes left after the encoded TrackNumber
and those with three bytes left, but with flags indicating that the Block
uses lacing as then there has to be further data describing the lacing.

Furthermore, zero-sized packets were still possible because only the
size of the last entry of a lace was checked.

This commit fixes this. All spec-compliant Blocks that contain data
(even if side data only) are now returned to the caller; spec-compliant
Blocks that don't contain anything are not returned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Simplify checks for cook and ATRAC3
Andreas Rheinhardt [Mon, 20 Apr 2020 06:54:23 +0000 (08:54 +0200)]
avformat/matroskadec: Simplify checks for cook and ATRAC3

Some conditions which don't change and which can therefore be checked
in read_header() were instead rechecked upon parsing each block. This
has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Don't output uninitialized data for RealAudio 28.8
Andreas Rheinhardt [Wed, 22 Apr 2020 13:17:41 +0000 (15:17 +0200)]
avformat/matroskadec: Don't output uninitialized data for RealAudio 28.8

The Matroska demuxer splits every sequence of h Matroska Blocks into
h * w / cfs packets of size cfs; here h (sub_packet_h), w (frame_size)
and cfs (coded_framesize) are parameters from the track's CodecPrivate.

It does this by splitting the Block's data in h/2 pieces of size cfs each
and putting them into a buffer at offset m * 2 * w + n * cfs where
m (range 0..(h/2 - 1)) indicates the index of the current piece in the
current Block and n (range 0..(h - 1)) is the index of the current Block
in the current sequence of Blocks. The data in this buffer is then used
for the output packets.

The problem is that there is currently no check to actually guarantee
that no uninitialized data will be output. One instance where this is
trivially so is if h == 1; another is if cfs * h is so small that the
input pieces do not cover everything that is output. In order to
preclude this, rmdec.c checks for h * cfs == 2 * w and h >= 2. The
former requirement certainly makes much sense, as it means that for
every given m the input pieces (corresponding to the h different values
of n) form a nonoverlapping partition of the two adjacent frames of size w
corresponding to m. But precluding h == 1 is not enough, other odd
values can cause problems, too. That is because the assumption behind
the code is that h frames of size w contain data to be output, although
the real number is h/2 * 2. E.g. for h = 3, cfs = 2 and w = 3 the
current code would output four (== h * w / cfs) packets. although only
data for three (== h/2 * h) packets has been read.

(Notice that if h * cfs == 2 * w, h being even is equivalent to
cfs dividing w; the latter condition also seems very reasonable:
It means that the subframes are a partition of the frames.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Fix buffer overflow when demuxing RealAudio 28.8
Andreas Rheinhardt [Tue, 21 Apr 2020 22:15:54 +0000 (00:15 +0200)]
avformat/matroskadec: Fix buffer overflow when demuxing RealAudio 28.8

RealAudio 28.8 (like other RealAudio codecs) uses a special demuxing
mode in which the data of the existing Matroska Blocks is not simply
forwarded as-is. Instead data from several Blocks is recombined
together to output several packets. The parameters governing this
process are parsed from the CodecPrivate: Coded framesize (cfs), frame
size (w) and sub_packet_h (h).

During demuxing, h/2 pieces of data of size cfs each are read from every
Matroska (Simple)Block and put at offset m * 2 * w + n * cfs of a buffer
of size h * w, where m ranges from 0 to h/2 - 1 for each Block while n
is initially zero and incremented after a Block has been parsed until it
is h, at which poin the assembled packets are output and n reset.

The highest offset is given by (h/2 - 1) * 2 * w + (h - 1) * cfs + cfs
while the destination buffer's size is given by h * w. For even h, this
leads to a buffer overflow (and potential segfault) if h * cfs > 2 * w;
for odd h, the condition is h * cfs > 3 * w.

This commit adds a check to rule this out.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Fix demuxing RealAudio 28.8
Andreas Rheinhardt [Mon, 20 Apr 2020 05:47:06 +0000 (07:47 +0200)]
avformat/matroskadec: Fix demuxing RealAudio 28.8

RealAudio 28.8 does not need or use sub_packet_size for its demuxing
and this field is therefore commonly set to zero. But since 18ca491b
the Real Audio specific demuxing is no longer applied if sub_packet_size
is zero because the codepath for cook and ATRAC3 divide by it; this made
these files undecodable.

Furthermore, since 569d18aa (merged in 2c8d876d) sub_packet_size being
zero is used as an indicator for invalid data, so that a file containing
such a track was completely skipped.

This commit fixes this by not checking sub_packet_size for RealAudio
28.8 at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Simplify check for RealAudio
Andreas Rheinhardt [Mon, 2 Dec 2019 10:04:55 +0000 (11:04 +0100)]
avformat/matroskadec: Simplify check for RealAudio

They need a special parsing mode and in order to find out whether this
mode is in use, several checks have to be performed. They can all be
combined into one: If the buffer that is only used to assemble their
packets has been allocated, use the RealAudio parsing mode.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/matroskadec: Reject sipr flavor > 3
Andreas Rheinhardt [Mon, 2 Dec 2019 09:41:12 +0000 (10:41 +0100)]
avformat/matroskadec: Reject sipr flavor > 3

Only flavors 0..3 seem to exist. E.g. rmdec.c treats any flavor > 3
as invalid data. Furthermore, we do not know how big the packets to
create ought to be given that for sipr these values are not read from
the bitstream, but from a table.

Furthermore, flavor is only used for sipr, so only check it for sipr;
rmdec.c does the same. (The old check for flavor being < 0 was
always wrong given that flavor is an int that is read via avio_rb16(),
so it has been removed completely.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
18 months agoavformat/mpegts: fix av_freep for dovi pointer
Limin Wang [Thu, 30 Apr 2020 13:20:28 +0000 (21:20 +0800)]
avformat/mpegts: fix av_freep for dovi pointer

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavformat/mov: fix av_freep for dovi pointer
Limin Wang [Thu, 30 Apr 2020 13:19:11 +0000 (21:19 +0800)]
avformat/mov: fix av_freep for dovi pointer

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agofate/oggopus-demux: fix fate failure
Lynne [Fri, 1 May 2020 00:36:43 +0000 (01:36 +0100)]
fate/oggopus-demux: fix fate failure

Failure was due to the extra comment printed by libavcodec/utils.c since
side data is used to signal the skipped samples.

18 months agoavfilter/af_adelay: Check sscanf() return value
Limin Wang [Sun, 29 Mar 2020 00:08:05 +0000 (08:08 +0800)]
avfilter/af_adelay: Check sscanf() return value

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavfilter/vf_mix: Check sscanf() return value
Limin Wang [Sun, 29 Mar 2020 01:08:13 +0000 (09:08 +0800)]
avfilter/vf_mix: Check sscanf() return value

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agooggdec: add support for proper demuxing of chained Opus files and streams
Lynne [Tue, 28 Apr 2020 11:25:46 +0000 (12:25 +0100)]
oggdec: add support for proper demuxing of chained Opus files and streams

Part of this patch is based on Paul B Mahol's patch from last year.

This also allows for single-stream parameter/codec changes.

18 months agooggdec: use ffio_ensure_seekback() to seek back on incorrect data
Lynne [Tue, 28 Apr 2020 11:55:17 +0000 (12:55 +0100)]
oggdec: use ffio_ensure_seekback() to seek back on incorrect data

This cleans up the code and simplifies it.
It also speeds up parsing since the old pb position was incorrect.

18 months agooggdec: verify page checksum
Lynne [Tue, 28 Apr 2020 11:52:11 +0000 (12:52 +0100)]
oggdec: verify page checksum

This makes decoding far more robust, since OggS, the ogg magic,
can be commonly found randomly in streams, which previously made
the demuxer think there's a new stream or a change in such.

18 months agooggdec: eliminate copies and extra buffers
Lynne [Tue, 28 Apr 2020 11:41:34 +0000 (12:41 +0100)]
oggdec: eliminate copies and extra buffers

This also makes implementing CRC checking far simpler and more robust.

18 months agoavformat/utils: change the duration to int64_t for update_initial_durations
Limin Wang [Tue, 28 Apr 2020 23:49:24 +0000 (07:49 +0800)]
avformat/utils: change the duration to int64_t for update_initial_durations

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
18 months agoavcodec/cbs_h265: fix writing extension_data bits
James Almer [Mon, 20 Apr 2020 18:25:58 +0000 (15:25 -0300)]
avcodec/cbs_h265: fix writing extension_data bits

We only care about the right most bit.

Signed-off-by: James Almer <jamrial@gmail.com>
18 months agoavcodec/v4l2_context: Log warning when all capture buffers are in userspace
Andriy Gelman [Thu, 30 Apr 2020 14:58:37 +0000 (10:58 -0400)]
avcodec/v4l2_context: Log warning when all capture buffers are in userspace

v4l2_m2m uses device memory mapped buffers to store dequeued
frames/packets (reference counted by AVBufferRef). When the reference
count drops to zero, the buffer ownership is returned back to the
device, so that they can re-filled with frames/packets.

There are some cases when all the capture buffers are in userspace
(i.e. due to internal buffering in ffmpeg). On the s5p-mfc this causes
an infinite wait when polling to dequeue the buffers, which can be
prevented by increasing the total number of buffers. This commit adds a
warning when all the capture buffers are dequeued.

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
18 months agoavfoundation: Fix building on iOS
Martin Storsjö [Thu, 30 Apr 2020 10:34:13 +0000 (13:34 +0300)]
avfoundation: Fix building on iOS

Apparently the changes from 3c9185bf3a83395d12a987f626dbdb985eac4320
aren't enough; even with that in place, I got errors like this
when trying to build for iOS:

src/libavdevice/avfoundation.m:135:5: error:
      'AVCaptureDeviceTransportControlsPlaybackMode' is unavailable: not
      available on iOS
    AVCaptureDeviceTransportControlsPlaybackMode observed_mode;

18 months agoavfilter/af_crossfeed: make options runtime configurable
Paul B Mahol [Thu, 30 Apr 2020 10:04:27 +0000 (12:04 +0200)]
avfilter/af_crossfeed: make options runtime configurable

18 months agoavfilter/af_crossfeed: make slope configurable
Paul B Mahol [Thu, 30 Apr 2020 09:58:04 +0000 (11:58 +0200)]
avfilter/af_crossfeed: make slope configurable

18 months agoavfilter/af_crossfeed: fix calculation of alpha parameter
Paul B Mahol [Thu, 30 Apr 2020 09:44:48 +0000 (11:44 +0200)]
avfilter/af_crossfeed: fix calculation of alpha parameter

Use A in calculation.