]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agohwcontext_vulkan: update debugging layer name
Lynne [Sun, 10 May 2020 20:13:55 +0000 (21:13 +0100)]
hwcontext_vulkan: update debugging layer name

4 years agohwcontext_vulkan: remove unused internal REQUIRED extension flag
Lynne [Sun, 10 May 2020 14:17:27 +0000 (15:17 +0100)]
hwcontext_vulkan: remove unused internal REQUIRED extension flag

This is a leftover from an old version which used the 1.0 Vulkan API
with the maintenance extensions being required.

4 years agohwcontext_vulkan: expose enabled device and instance extensions
Lynne [Sun, 10 May 2020 10:47:50 +0000 (11:47 +0100)]
hwcontext_vulkan: expose enabled device and instance extensions

This solves a huge oversight - it lets users reliably use their own
AVVulkanDeviceContext. Otherwise, the extensions supplied and enabled
are not discoverable by anything outside of hwcontext_vulkan.
Also clarifies that any user-supplied VkInstance must be at least 1.1.

4 years agohwcontext_vulkan: let users enable device and instance extensions using options
Lynne [Sun, 10 May 2020 10:26:40 +0000 (11:26 +0100)]
hwcontext_vulkan: let users enable device and instance extensions using options

Also documents all options supported by the hwdevice.
This lets users enable all extensions they need without writing their own
instance initialization code.

4 years agoavformat/hlsenc: Simplify setting base_output_dirname
Andreas Rheinhardt [Fri, 8 May 2020 19:40:29 +0000 (21:40 +0200)]
avformat/hlsenc: Simplify setting base_output_dirname

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Simplify setting basename with av_asprintf()
Andreas Rheinhardt [Wed, 8 Apr 2020 21:41:17 +0000 (23:41 +0200)]
avformat/hlsenc: Simplify setting basename with av_asprintf()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Simplify setting subtitle basename with av_asprintf
Andreas Rheinhardt [Wed, 8 Apr 2020 20:57:50 +0000 (22:57 +0200)]
avformat/hlsenc: Simplify setting subtitle basename with av_asprintf

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Don't cast const away
Andreas Rheinhardt [Sat, 9 May 2020 04:54:56 +0000 (06:54 +0200)]
avformat/hlsenc: Don't cast const away

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Remove redundant initializations
Andreas Rheinhardt [Sat, 9 May 2020 13:59:43 +0000 (15:59 +0200)]
avformat/hlsenc: Remove redundant initializations

For every variantstream vs, vs->packets_written is set to one, only to be
set to zero a few lines below. Given that the relevant structure has
been zeroed during the allocation, this commit removes both assignments.
A redundant initialization for vs->init_range_length has been removed as
well a few lines below. Given that the relevant structure has been
zeroed during the allocation, this commit removes both assignments. A
redundant initialization for vs->init_range_length has been removed as
well.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Don't reset AVIOContext pointer manually a second time
Andreas Rheinhardt [Sat, 9 May 2020 13:34:09 +0000 (15:34 +0200)]
avformat/hlsenc: Don't reset AVIOContext pointer manually a second time

ff_format_io_close() already does it for us.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/vf_signalstats: reindent after last commit
Limin Wang [Mon, 30 Dec 2019 11:09:58 +0000 (19:09 +0800)]
avfilter/vf_signalstats: reindent after last commit

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_signalstats: make the alloc array used for any bit depth
Limin Wang [Mon, 30 Dec 2019 11:09:57 +0000 (19:09 +0800)]
avfilter/vf_signalstats: make the alloc array used for any bit depth

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_signalstats: add SignalstatsContext.maxsize variable
Limin Wang [Mon, 30 Dec 2019 11:09:56 +0000 (19:09 +0800)]
avfilter/vf_signalstats: add SignalstatsContext.maxsize variable

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavfilter/vf_signalstats: rename config_props -> config_output
Limin Wang [Mon, 30 Dec 2019 11:09:55 +0000 (19:09 +0800)]
avfilter/vf_signalstats: rename config_props -> config_output

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agofate: add signalstats 8bit and 10bit test
Limin Wang [Mon, 30 Dec 2019 11:09:54 +0000 (19:09 +0800)]
fate: add signalstats 8bit and 10bit test

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/http: Fix for invalid use of av_strtok
Limin Wang [Sat, 18 Apr 2020 04:19:31 +0000 (12:19 +0800)]
avformat/http: Fix for invalid use of av_strtok

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/ftp: Fix for invalid use of av_strtok
Limin Wang [Sat, 18 Apr 2020 04:19:30 +0000 (12:19 +0800)]
avformat/ftp: Fix for invalid use of av_strtok

By the av_strtok() description:
 * On the first call to av_strtok(), s should point to the string to
 * parse, and the value of saveptr is ignored. In subsequent calls, s
 * should be NULL, and saveptr should be unchanged since the previous
 * call.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/wavenc: simplify, use av_rescale_q() instead
Limin Wang [Tue, 28 Apr 2020 03:49:17 +0000 (11:49 +0800)]
avformat/wavenc: simplify, use av_rescale_q() instead

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/vividas: simplify, use av_rescale_q() instead
Limin Wang [Tue, 28 Apr 2020 03:49:16 +0000 (11:49 +0800)]
avformat/vividas: simplify, use av_rescale_q() instead

note it'll cause a small difference in accuracy for the pts, please see the testing result below:
 $ wget http://samples.ffmpeg.org/archive/all/unknown+unknown+unknown+unknown+5029_paramount_en_1250.viv
 $ ./ffmpeg -t 0.04 -i ./unknown+unknown+unknown+unknown+5029_paramount_en_1250.viv -f null -
 old:
 pts: 522
 pts: 1044
 pts: 1567
 pts: 3918
 pts: 8097
 pts: 12277
 pts: 16457
 ...

 new:
 pts: 522
 pts: 1045
 pts: 1567
 pts: 3918
 pts: 8098
 pts: 12278
 pts: 16457
 ...

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agohwcontext_vulkan: optionally enable the VK_KHR_surface extension if available
Lynne [Sun, 10 May 2020 10:21:52 +0000 (11:21 +0100)]
hwcontext_vulkan: optionally enable the VK_KHR_surface extension if available

This allows any phys_device derived to be used as a display rendering device.

4 years agoavcodec/dstdec: Check sample rate
Michael Niedermayer [Thu, 13 Feb 2020 19:56:56 +0000 (20:56 +0100)]
avcodec/dstdec: Check sample rate

Fixes: out of array access
Fixes: 20659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5735812071424000
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>
4 years agoavcodec/decode: remove unused AVCodecInternal compat_decode field
James Almer [Mon, 9 Mar 2020 02:18:16 +0000 (23:18 -0300)]
avcodec/decode: remove unused AVCodecInternal compat_decode field

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set
Andriy Gelman [Sat, 9 May 2020 23:34:06 +0000 (19:34 -0400)]
avcodec/v4l2_context: Finish draining if V4L2_BUF_FLAG_LAST is set

V4L2 api can indicate that flushing of the capture buffers is completed
by setting the V4L2_BUF_FLAG_LAST flag.
Use guards because the flag was only defined in Linux v4.2.

Reference:
linux/Documentation/media/uapi/v4l/dev-decoder.rst

    "The client must continue to handle both queues independently,
     similarly to normal decode operation. This includes:
     ...
     - queuing and dequeuing CAPTURE buffers, until a buffer marked with
       the V4L2_BUF_FLAG_LAST flag is dequeued"

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec/v4l2_context: Drop empty packet while draining
Andriy Gelman [Sat, 9 May 2020 23:34:41 +0000 (19:34 -0400)]
avcodec/v4l2_context: Drop empty packet while draining

v4l2_m2m devices may send an empty packet/frame while draining
to indicate that all capture buffers have been flushed.

Currently, the empty packet/frame is not handled correctly:
When encoding, the empty packet is forwarded to the muxer, usually
creating warnings.
When decoding, a reference to the memory is created anyway. Since in
the past this memory contained a decoded frame, it results in an extra
frame being decoded.

This commit discards the empty packet/frame.

References:
linux/Documentation/media/uapi/v4l/dev-decoder.rst:

    "The last buffer may be empty (with :c:type:`v4l2_buffer` bytesused = 0)
     and in that case it must be ignored by the client, as it does not
     contain a decoded frame."

linux/Documentation/media/uapi/media/v4l/vidioc-encoder-cmd.rst:

    "...This buffer may be empty, indicated by the
     driver setting the ``bytesused`` field to 0."

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavcodec/aacdec_template: Pass AVCodecContext seperatly to set_default_channel_config()
Michael Niedermayer [Wed, 15 Apr 2020 18:47:07 +0000 (20:47 +0200)]
avcodec/aacdec_template: Pass AVCodecContext seperatly to set_default_channel_config()

Regression since 4d9b9c5e4637ac15205467f16fcac92a28e18f18
Fixes: Null pointer dereference
Fixes: 21642/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5670101358739456
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/thp: Require a video stream
Michael Niedermayer [Wed, 15 Apr 2020 18:27:27 +0000 (20:27 +0200)]
avformat/thp: Require a video stream

The demuxer code assumes the existence of a video stream

Fixes: assertion failure
Fixes: 21512/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5699660783288320
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mpeg: Decrease score by 1 for files with very little valid data
Michael Niedermayer [Mon, 13 Apr 2020 22:03:30 +0000 (00:03 +0200)]
avformat/mpeg: Decrease score by 1 for files with very little valid data

Fixes: 8233/PPY6574574605_cut.mp3
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/pngdec: Check length in fdAT
Michael Niedermayer [Tue, 7 Apr 2020 17:29:44 +0000 (19:29 +0200)]
avcodec/pngdec: Check length in fdAT

Fixes: 21089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5135981419429888
Fixes: out of array read
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agotools/target_dec_fuzzer: Adjust threshold for PNG and APNG
Michael Niedermayer [Tue, 7 Apr 2020 17:42:55 +0000 (19:42 +0200)]
tools/target_dec_fuzzer: Adjust threshold for PNG and APNG

Fixes: Timeout (84sec -> 2sec)
Fixes: 21127/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5098412367413248
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/g2meet: Check tile_width in epic_jb_decode_tile()
Michael Niedermayer [Sun, 5 Apr 2020 20:58:29 +0000 (22:58 +0200)]
avcodec/g2meet: Check tile_width in epic_jb_decode_tile()

Fixes: out of array access
Fixes: 21469/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5199357982015488
Alternatively the arrays can be made bigger or the index can be clipped.
In case a real file with such huge tiles exist we ask the user to upload it.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/hapdec: Check tex_size more strictly and before using it
Michael Niedermayer [Sat, 28 Mar 2020 19:36:00 +0000 (20:36 +0100)]
avcodec/hapdec: Check tex_size more strictly and before using it

Fixes: OOM
Fixes: 20774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5678608951803904
Fixes: 20956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5713643025203200
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoconfigure: add missing bsf dependencies to muxers
James Almer [Sat, 9 May 2020 21:52:46 +0000 (18:52 -0300)]
configure: add missing bsf dependencies to muxers

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoconfigure: fix pcm_rechunk_bsf dependency for MXF and GXF muxers
James Almer [Sat, 9 May 2020 21:44:24 +0000 (18:44 -0300)]
configure: fix pcm_rechunk_bsf dependency for MXF and GXF muxers

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavdevice/v4l2enc: Allow writing non-rawvideos to v4l2.
David Manouchehri [Sat, 4 Nov 2017 20:32:41 +0000 (16:32 -0400)]
avdevice/v4l2enc: Allow writing non-rawvideos to v4l2.

Signed-off-by: David Manouchehri <david.manouchehri@riseup.net>
4 years agoavformat/oggenc: Avoid allocating and copying when writing page data
Andreas Rheinhardt [Sat, 2 May 2020 23:06:37 +0000 (01:06 +0200)]
avformat/oggenc: Avoid allocating and copying when writing page data

When the Ogg muxer writes a page, it has to do three things: It needs to
write a page header, then it has to actually copy the page data and then
it has to calculate and write a CRC checksum of both header as well as
data at a certain position in the page header.

To do this, the muxer used a dynamic buffer for both writing as well as
calculating the checksum via an AVIOContext's feature to automatically
calculate checksums on the data it writes. This entails an allocation of
an AVIOContext, of the opaque specific to dynamic buffers and of the
buffer itself (which may be reallocated multiple times) as well as
memcopying the data (first into the AVIOContext's small write buffer,
then into the dynamic buffer's big buffer).

This commit changes this: The page header is no longer written into a
dynamic buffer any more; instead the (small) page header is written into
a small buffer on the stack. The CRC is then calculated directly via
av_crc() on both the page header as well as the page data. Then both the
page header and the page data are written.

Finally, ogg_write_page() can now no longer fail, so it has been
modified to return nothing; this also fixed a bug in the only caller of
this function: It didn't check the return value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/mpegvideo: return more specific error codes for init_duplicate_context()
Limin Wang [Thu, 7 May 2020 23:00:17 +0000 (07:00 +0800)]
avcodec/mpegvideo: return more specific error codes for init_duplicate_context()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/mpegvideo: return more specific error codes for ff_mpv_common_init()
Limin Wang [Thu, 7 May 2020 22:57:58 +0000 (06:57 +0800)]
avcodec/mpegvideo: return more specific error codes for ff_mpv_common_init()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/mpeg12enc: return more specific error codes for encode_init()
Limin Wang [Thu, 7 May 2020 10:55:11 +0000 (18:55 +0800)]
avcodec/mpeg12enc: return more specific error codes for encode_init()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/mpegvideo_enc: return more specific error codes for ff_mpv_encode_init()
Limin Wang [Thu, 7 May 2020 10:52:19 +0000 (18:52 +0800)]
avcodec/mpegvideo_enc: return more specific error codes for ff_mpv_encode_init()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agodoc/encoders: remove unsubstantiated ffaacenc > fdk-aac claim
Lou Logan [Thu, 30 Apr 2020 18:44:04 +0000 (10:44 -0800)]
doc/encoders: remove unsubstantiated ffaacenc > fdk-aac claim

After this claim was made in e34e361 kamedo2 did an in-depth ABX
test comparing these encoders:

https://hydrogenaud.io/index.php?topic=111085.0

Result: FFmpeg AAC wasn't as good as libfdk_aac on average.

I know some things have changed since then such as, "use the fast
coder as the default" (fcb681ac) for example, so maybe the situation
is different now.

However, I am unaware of any recent comparison. So without any
substantiation we shouldn't make such a blantant claim.

Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
4 years agoavcodec/(null|opus_metadata)_bsf: Use ff_bsf_get_packet_ref() directly
Andreas Rheinhardt [Fri, 8 May 2020 10:33:09 +0000 (12:33 +0200)]
avcodec/(null|opus_metadata)_bsf: Use ff_bsf_get_packet_ref() directly

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/bsf: Restrict ff_bsf_get_packet_ref() return values to <= 0
Andreas Rheinhardt [Fri, 8 May 2020 18:37:24 +0000 (20:37 +0200)]
avcodec/bsf: Restrict ff_bsf_get_packet_ref() return values to <= 0

Up until now the documentation of ff_bsf_get_packet_ref() allowed return
values >= 0 in case of success, whereas av_bsf_receive_packet() only
allows 0 on success. Given that for some bitstream filters the return
value of ff_bsf_get_packet_ref() is forwarded to the caller of
av_bsf_receive_packet() without any filtering, there would be a problem
if ff_bsf_get_packet_ref() actually returned values > 0. But it
currently doesn't and there is no reason why it should ever do so.
Therefore this commit aligns the return values of these functions by
restricting ff_bsf_get_packet_ref() to always returns 0 on success.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Cosmetics
Andreas Rheinhardt [Fri, 28 Feb 2020 06:59:34 +0000 (07:59 +0100)]
avformat/hlsenc: Cosmetics

Mainly includes reindentation and returning directly (i.e. without
a goto fail when possible).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Factor check out of loop
Andreas Rheinhardt [Sun, 15 Dec 2019 18:39:16 +0000 (19:39 +0100)]
avformat/hlsenc: Factor check out of loop

The check will be true at most once anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Localize initialization of subtitle streams
Andreas Rheinhardt [Sun, 15 Dec 2019 21:12:53 +0000 (22:12 +0100)]
avformat/hlsenc: Localize initialization of subtitle streams

Before this commit, the checks were unnecessarily scattered.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Unconditionally free some strings
Andreas Rheinhardt [Sun, 15 Dec 2019 17:48:28 +0000 (18:48 +0100)]
avformat/hlsenc: Unconditionally free some strings

hls_init() would at first allocate the vtt_basename string, then
allocate the vtt_m3u8_name string followed by several operations that
may fail and then open the subtitles' output context. Yet upon freeing,
these strings were only freed when the subtitles' output context
existed, ensuring that they leak if something goes wrong between their
allocation and the opening of the subtitles' output context. So drop the
check for whether this output context exists.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Check some unchecked allocations
Andreas Rheinhardt [Sun, 15 Dec 2019 10:24:32 +0000 (11:24 +0100)]
avformat/hlsenc: Check some unchecked allocations

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Add deinit function
Andreas Rheinhardt [Sun, 15 Dec 2019 10:00:02 +0000 (11:00 +0100)]
avformat/hlsenc: Add deinit function

This fixes memleaks in instances such as:
a) When an allocation fails at one of the two places in hls_init() where
the error is returned immediately without goto fail first.
b) When an error happens when writing the header.
c) When an allocation fails at one of the three places in
hls_write_trailer() where the error is returned immediately without goto
fail first.
d) When one decides not to write the trailer at all (e.g. because of
errors when writing packets).
Furthermore, it removes code duplication and allows to return
immediately, without goto fail first.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/mpegvideo_enc: reindent code
Limin Wang [Thu, 7 May 2020 10:41:17 +0000 (18:41 +0800)]
avcodec/mpegvideo_enc: reindent code

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/hlsenc: Avoid setting unused variables
Andreas Rheinhardt [Sun, 15 Dec 2019 06:42:01 +0000 (07:42 +0100)]
avformat/hlsenc: Avoid setting unused variables

Several variables which are only used when the HLS_SINGLE_FILE flag is
unset have been set even when this flag is set. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Allow multiple Tags elements
Andreas Rheinhardt [Thu, 30 Apr 2020 22:49:49 +0000 (00:49 +0200)]
avformat/matroskadec: Allow multiple Tags elements

The Matroska specification allows multiple (level 1) Tags elements per
file, yet our demuxer didn't: While it parsed any amount of Tags
elements it found in front of the Clusters (albeit with warnings because
of duplicate elements), it would treat any Tags element only referenced
via a SeekHead entry as already parsed if any Tags element has already
been parsed; therefore this Tags element would not be parsed at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Improve handling of circular SeekHeads
Andreas Rheinhardt [Thu, 30 Apr 2020 21:16:44 +0000 (23:16 +0200)]
avformat/matroskadec: Improve handling of circular SeekHeads

There can be more than one SeekHead in a Matroska file, but most of the
other level 1 elements can only occur once.* Therefore the Matroska
demuxer only allows one entry per ID in its internal list of level 1
elements known to it; the only exception to this are SeekHeads.

The only exception to this are SeekHeads: When one is encountered
(either directly or in the list of entries read from SeekHeads),
a new entry in the list of known level-1 elements is always added,
even when this entry is actually already known.

This leads to lots of seeks in case of circular SeekHeads: Each time a
SeekHead is parsed, a new entry for a SeekHead will be added to the list
of entries read from SeekHeads. The exception for SeekHeads mentioned
above now implies that this SeekHead will always appear new and unparsed
and parsing will be attempted. This continued until the list of known
level-1 elements is full.

Fixing this is pretty simple: Don't add a new entry for a SeekHead if
its position matches the position of an already known SeekHead.

*: Actually, there can be multiple Tags and several other level 1
elements are "identically recurring" which means they may be resent
multiple times, but each instance must be absolutely identical to the
previous.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskadec: Sanitize SeekHead entries
Andreas Rheinhardt [Fri, 30 Aug 2019 11:20:26 +0000 (13:20 +0200)]
avformat/matroskadec: Sanitize SeekHead entries

A Seek element in a Matroska SeekHead should contain a SeekID and a
SeekPosition element and upon reading, they should be sanitized:

Given that IDs are restricted to 32 bit, longer SeekIDs should be treated
as invalid. Instead currently the lower 32 bits have been used.

For SeekPosition, no checks were performed for the element to be
present and if present, whether it was excessively large (i.e. the
absolute file position described by it exceeding INT64_MAX). The
SeekPosition element had a default value of -1 which means that a check
seems to have been intended; but it was not implemented. This commit adds
a check for overflow to the calculation of the absolute file position of
the referenced level 1 elements.
Using -1 (i.e. UINT64_MAX) as default value for SeekPosition implies that
a Seek element without SeekPosition will run afoul of this check.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoRevert "doc/mailing-list-faq: Mention current problem with GMX"
Michael Niedermayer [Thu, 7 May 2020 10:41:13 +0000 (12:41 +0200)]
Revert "doc/mailing-list-faq: Mention current problem with GMX"

mails to GMX seem working again

This reverts commit cd11fbcfb03994d3ddbc83f0620530d6f6748f68.

4 years agodnn-layer-mathbinary-test: add unit test for minimum
Guo, Yejun [Sun, 26 Apr 2020 07:49:39 +0000 (15:49 +0800)]
dnn-layer-mathbinary-test: add unit test for minimum

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
4 years agodnn/native: add native support for minimum
Guo, Yejun [Sun, 26 Apr 2020 07:46:38 +0000 (15:46 +0800)]
dnn/native: add native support for minimum

it can be tested with model file generated with below python script:
import tensorflow as tf
import numpy as np
import imageio

in_img = imageio.imread('input.jpg')
in_img = in_img.astype(np.float32)/255.0
in_data = in_img[np.newaxis, :]

x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
x1 = tf.minimum(0.7, x)
x2 = tf.maximum(x1, 0.4)
y = tf.identity(x2, name='dnn_out')

sess=tf.Session()
sess.run(tf.global_variables_initializer())

graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'image_process.pb', as_text=False)

print("image_process.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate image_process.model\n")

output = sess.run(y, feed_dict={x: in_data})
imageio.imsave("out.jpg", np.squeeze(output))

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
4 years agoavcodec/zmbv: remove the unnecessary type conversion
Limin Wang [Thu, 12 Sep 2019 09:23:42 +0000 (17:23 +0800)]
avcodec/zmbv: remove the unnecessary type conversion

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/tiff: remove the unnecessary type conversion
Limin Wang [Thu, 12 Sep 2019 09:23:41 +0000 (17:23 +0800)]
avcodec/tiff: remove the unnecessary type conversion

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/pngdec: remove the unnecessary type conversion
Limin Wang [Thu, 12 Sep 2019 09:23:40 +0000 (17:23 +0800)]
avcodec/pngdec: remove the unnecessary type conversion

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/lcldec: remove the unnecessary type conversion
Limin Wang [Thu, 12 Sep 2019 09:23:39 +0000 (17:23 +0800)]
avcodec/lcldec: remove the unnecessary type conversion

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/libx264: return error if unknown picture type encountered
Limin Wang [Sat, 18 Apr 2020 04:52:49 +0000 (12:52 +0800)]
avcodec/libx264: return error if unknown picture type encountered

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/libx264: return immediately if encode_nals return 0
Limin Wang [Sat, 18 Apr 2020 04:52:48 +0000 (12:52 +0800)]
avcodec/libx264: return immediately if encode_nals return 0

x264_encoder_encode can return 0 with nnal 0. As a result, encode_nals will
return 0. In this condition, it's better to return 0 immediately to avoid
the following unneeded pict_type and flags setting.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavcodec/libx265: Fix Uninitialized scalar variable
Limin Wang [Sat, 18 Apr 2020 04:52:47 +0000 (12:52 +0800)]
avcodec/libx265: Fix Uninitialized scalar variable

return error if unknown picture type encountered

Fixes CID 1457234
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat: implement retiming directly in mxfenc and gxfenc
Marton Balint [Mon, 27 Apr 2020 22:39:40 +0000 (00:39 +0200)]
avformat: implement retiming directly in mxfenc and gxfenc

Generic retime functionality is replaced by a few lines of code directly in the
muxers which used it, which seems a lot easier to understand and this way the
retiming is not dependant of the input durations.

Also remove retimeinterleave, since it is not used by anything anymore.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/audiointerleave: only keep the retime functionality of the audio interleaver
Marton Balint [Wed, 25 Mar 2020 22:49:17 +0000 (23:49 +0100)]
avformat/audiointerleave: only keep the retime functionality of the audio interleaver

And rename it to retimeinterleave, use the pcm_rechunk bitstream filter for
rechunking.

By seperating the two functions we hopefully get cleaner code.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/pcm_rechunk_bsf: add bitstream filter to rechunk pcm audio
Marton Balint [Tue, 24 Mar 2020 22:24:22 +0000 (23:24 +0100)]
avcodec/pcm_rechunk_bsf: add bitstream filter to rechunk pcm audio

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/mux: add proper support for full N:M bitstream filtering
Marton Balint [Sat, 18 Apr 2020 12:20:51 +0000 (14:20 +0200)]
avformat/mux: add proper support for full N:M bitstream filtering

Previously only 1:1 bitstream filters were supported, the end of the stream was
not signalled to the bitstream filters and time base changes were ignored.

This change also allows muxers to set up bitstream filters regardless of the
autobsf flag during write_header instead of during check_bitstream and those
bitstream filters will always be executed.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/mux: factorize writing a packet
Marton Balint [Fri, 27 Mar 2020 01:22:53 +0000 (02:22 +0100)]
avformat/mux: factorize writing a packet

In preparation for N:M bsf support.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/mux: factorize interleaved write_packet
Marton Balint [Thu, 26 Mar 2020 23:00:53 +0000 (00:00 +0100)]
avformat/mux: factorize interleaved write_packet

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/mux: move interleaved packet functions upwards
Marton Balint [Mon, 27 Apr 2020 19:07:07 +0000 (21:07 +0200)]
avformat/mux: move interleaved packet functions upwards

Will be needed later to avoid a forward declaration.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/hlsenc: Remove redundant setting of output format
Andreas Rheinhardt [Sat, 29 Feb 2020 01:21:34 +0000 (02:21 +0100)]
avformat/hlsenc: Remove redundant setting of output format

avformat_alloc_output_context2() already sets the oformat member, so
that there is no reason to overwrite it again with the value it already
has.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/profiles: remove duplicate FF_PROFILE_RESERVED entry
Limin Wang [Tue, 5 May 2020 14:43:10 +0000 (22:43 +0800)]
avcodec/profiles: remove duplicate FF_PROFILE_RESERVED entry

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/dashdec: compute the segment size use current pos minus offset plus one
Steven Liu [Wed, 6 May 2020 06:51:22 +0000 (14:51 +0800)]
avformat/dashdec: compute the segment size use current pos minus offset plus one

because the offset should use one byte

Reviewed-by: Zhao Jun <barryjzhao@tencent.com>
Reported-by: Zhao Jun <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
4 years agoavformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packet
Limin Wang [Tue, 21 Apr 2020 15:35:24 +0000 (23:35 +0800)]
avformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packet

The patch will make audio and subtitle packets be marked as AV_PKT_FLAG_KEY.

For audio, it'll caused the audio sample to be sync sample.
To verify ref/fate/movenc results:
1. Get the movenc test data
[lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_old && mv *.mp4 audio_old_

After applied the patch:
[lmwang@vpn ffmpeg]$ make fate-movenc SAMPLES=../fate-suite
[lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_key && mv *.mp4 audio_key

2. Get l-smash and build boxdumper
https://github.com/l-smash/l-smash.git

3. dump the box of crc change mp4 and diff -u
[lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box audio_key/non-empty-moov-no-elst.mp4  > audio_key/non-empty-moov-no-elst.log
[lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box audio_old/non-empty-moov-no-elst.mp4  > audio_old/non-empty-moov-no-elst.log
[lmwang@vpn ffmpeg]$ diff -u audio_key/non-empty-moov-no-elst.log audio_old/non-empty-moov-no-elst.log
-                default_sample_flags = 0x02000000
-                    independent
-                    sync sample
+                default_sample_flags = 0x01010000
+                    dependent
+                    non-sync sample

4. have checked the change of crc are caused by default_sample_flags
non-empty-moov.mp4, non-empty-moov-elst.mp4,
non-empty-moov-no-elst.mp4, empty-moov.mp4, delay-moov-content.mp4,
empty-moov-second-frag.mp4, empty-moov-second-frag-discont.mp4,
delay-moov-second-frag-discont.mp4, delay-moov-elst-second-frag.mp4
etc

5 For subtitle, it'll effect for tests/ref/fate/binsub-movtextenc and
tests/ref/fate/sub2video, that's expecting result for the subtitle is
marked as keyframe. Below is the checking result of binsub-movtextenc:

[lmwang@vpn ffmpeg]$ ./ffmpeg -i ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov audio_key/binsub-movtextenc.mp4
[lmwang@vpn ffmpeg]$ ./ffmpeg -i ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov audio_old/binsub-movtextenc.mp4
[lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_key/binsub-movtextenc.mp4  > audio_key/binsub-movtextenc.log
[lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_old/binsub-movtextenc.mp4  > audio_old/binsub-movtextenc.log
[lmwang@vpn ffmpeg]$ diff -u audio_key/binsub-movtextenc.log audio_old/binsub-movtextenc.log
.... // the key difference is the flag for sync sample
-                flags = 0x000701
+                flags = 0x000301
                     data-offset-present
                     sample-duration-present
                     sample-size-present
-                    sample-flags-present
                 sample_count = 6
-                data_offset = 188
+                data_offset = 164
                 sample[0]
                     sample_duration = 1570000
                     sample_size = 21
-                    sample_flags = 0x02000000
-                        independent
-                        sync sample
-                        degradation_priority = 0
                 sample[1]
                     sample_duration = 510000
                     sample_size = 2
-                    sample_flags = 0x01010000
-                        dependent
-                        non-sync sample
-                        degradation_priority = 0
                 sample[2]
                     sample_duration = 1690000
                     sample_size = 9
-                    sample_flags = 0x02000000
-                        independent
-                        sync sample
-                        degradation_priority = 0

Suggested-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Suggested-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoMAINTAINERS: Add myself to libopenh264enc
Linjie Fu [Thu, 30 Apr 2020 01:12:44 +0000 (09:12 +0800)]
MAINTAINERS: Add myself to libopenh264enc

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/utils: move is_intra_only() to header and rename to ff_is_intra_only()
Limin Wang [Tue, 21 Apr 2020 15:35:23 +0000 (23:35 +0800)]
avformat/utils: move is_intra_only() to header and rename to ff_is_intra_only()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/rtmpproto: use av_reallocp_array()
Limin Wang [Sun, 26 Apr 2020 09:49:22 +0000 (17:49 +0800)]
avformat/rtmpproto: use av_reallocp_array()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/smoothstreamingenc: use av_reallocp_array()
Limin Wang [Sun, 26 Apr 2020 09:49:21 +0000 (17:49 +0800)]
avformat/smoothstreamingenc: use av_reallocp_array()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agofftools/ffmpeg: use local variable with same contents directly
Limin Wang [Sun, 26 Apr 2020 09:49:17 +0000 (17:49 +0800)]
fftools/ffmpeg: use local variable with same contents directly

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/matroskaenc: Check allocations implicit in dynamic buffers
Andreas Rheinhardt [Wed, 29 Apr 2020 18:55:26 +0000 (20:55 +0200)]
avformat/matroskaenc: Check allocations implicit in dynamic buffers

Failures of the allocations that happen under the hood when using dynamic
buffers are usually completely unchecked and the Matroska muxer is no
exception to this.

The API has its part in this, because there is no documented way to
actually check for errors: The return value of both avio_get_dyn_buf()
as well as avio_close_dyn_buf() is only documented as "the length of
the byte buffer", so that using this to return errors would be an API
break.

Therefore this commit uses the only reliable way to check for errors
with avio_get_dyn_buf(): The AVIOContext's error flag. (This is one of
the advantages of avio_get_dyn_buf(): By not destroying the AVIOContext
it is possible to inspect this value.) Checking whether the size or the
pointer vanishes is not enough as it does not check for truncated output
(the dynamic buffer API is int based and so has to truncate the buffer
even when enough memory would be available; it's current actual limit is
even way below INT_MAX).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Simplify writing buffer
Andreas Rheinhardt [Wed, 29 Apr 2020 18:33:06 +0000 (20:33 +0200)]
avformat/matroskaenc: Simplify writing buffer

If one already has the contents of a master elements in a buffer of
known size, then writing a EBML master element is no different from
writing an EBML binary element. It is overtly complicated to use
start/end_ebml_master() as these functions first write an unkown-length
size field of the appropriate length, then write the buffer's contents,
followed by a seek to the length field to overwrite it with the real
size (obtained via avio_tell() although it was already known in
advance), followed by another seek to the previous position. Just use
put_ebml_binary() instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Avoid dynamic buffer when writing Colour
Andreas Rheinhardt [Wed, 29 Apr 2020 18:22:40 +0000 (20:22 +0200)]
avformat/matroskaenc: Avoid dynamic buffer when writing Colour

There is a good upper bound for the maximum length of the Colour master
element; it is therefore unnecessary to use a dynamic buffer for it.
A simple buffer on the stack is enough. This commit implements this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Unify writing level 1 elements preliminarily
Andreas Rheinhardt [Wed, 29 Apr 2020 04:31:07 +0000 (06:31 +0200)]
avformat/matroskaenc: Unify writing level 1 elements preliminarily

The Matroska muxer updates several header elements when the output is
seekable; if unseekable, the buffer containing the contents of the element
is immediately freed after writing. Before this commit, there were three
places doing exactly the same: Checking whether the output is seekable
and calling the function that writes and frees or the function that
just writes the EBML master. This has been unified; adding SeekHead
entries for these elements has been unified, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Move adding SeekEntry into end_ebml_master_crc32()
Andreas Rheinhardt [Mon, 27 Apr 2020 02:34:45 +0000 (04:34 +0200)]
avformat/matroskaenc: Move adding SeekEntry into end_ebml_master_crc32()

Up until now, SeekEntries were already added before
start_ebml_master_crc32() was even called and before we were actually
sure that we really write the element the SeekHead references: After
all, we might also error out later; and given that the allocations
implicit in dynamic buffers should be checked, end_ebml_master_crc32()
will eventually have to return errors itself, so that it is the right
place to add SeekHead entries.

The earlier behaviour is of course a remnant of the time in which
start_ebml_master_crc32() really did output something, so that the
position before start_ebml_master_crc32() needed to be recorded.
Erroring out later is also not as dangerous as it seems because in
this case no SeekHead will be written (if it happened when writing
the header, the whole muxing process would abort; if it happened
when writing the trailer (when writing chapters not available initially),
writing the trailer would be aborted and no SeekHead containing the
bogus chapter entry would be written).

This commit does not change the way the SeekEntries are added for those
elements that are output preliminarily; this is so because the SeekHead
is written before those elements are finally output and doing it
otherwise would increase the amount of seeks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Improve checks for invalid stream mappings
Andreas Rheinhardt [Mon, 4 May 2020 22:40:44 +0000 (00:40 +0200)]
avformat/hlsenc: Improve checks for invalid stream mappings

The mapping of streams to the various variant streams to be created by
the HLS muxer is roughly as follows: Space and tab separate variant
stream group maps while the entries in each variant stream group map are
separated by ','.

The parsing process of each variant stream group proceeded as follows:
At first the number of occurences of "a:", "v:" and "s:" in each variant
stream group is calculated so that one can can allocate an array of
streams with this number of entries. Then each entry is checked and the
check for stream numbers was deficient: It did check that there is a
number beginning after the ":", but it did not check that the number
extends until the next "," (or until the end).

This means that an invalid variant stream group like v:0_v:1 will not be
rejected; the problem is that the variant stream in this example is
supposed to have two streams associated with it (because it contains two
"v:"), yet only one stream is actually associated with it (because there
is no ',' to start a second stream specifier). This discrepancy led to
segfaults (null pointer dereferencing) in the rest of the code (when the
nonexistent second stream associated to the variant stream was inspected).

Furthermore, this commit also removes an instance of using atoi() whose
behaviour on a range error is undefined.

Fixes ticket #8652.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agolavf/dashdec: support larger manifests
rcombs [Sat, 2 May 2020 06:33:13 +0000 (01:33 -0500)]
lavf/dashdec: support larger manifests

4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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.

4 years 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>
4 years 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.

https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2020-May/262094.html

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>