ffmpeg.git
3 hours agoavformat/mov: update extensions master
Gyan Doshi [Mon, 27 Jan 2020 08:46:50 +0000 (14:16 +0530)]
avformat/mov: update extensions

Added all extensions used by the mov muxer family, except m4v which
is also used for raw MPEG-4 Part 2 bitstreams

10 hours agotest/fate: Add missing exe suffix to h265_levels test.
Carl Eugen Hoyos [Mon, 27 Jan 2020 23:02:01 +0000 (00:02 +0100)]
test/fate: Add missing exe suffix to h265_levels test.

Fixes fate on WSL using mingw.

11 hours agoffmpeg: Do not print "SDP:" on top of sdp files.
Carl Eugen Hoyos [Sun, 26 Jan 2020 20:47:26 +0000 (21:47 +0100)]
ffmpeg: Do not print "SDP:" on top of sdp files.

Fixes ticket #7068.

13 hours agoavformat/matroskaenc: Remove useless AVIOContext
Andreas Rheinhardt [Wed, 1 Jan 2020 00:58:20 +0000 (01:58 +0100)]
avformat/matroskaenc: Remove useless AVIOContext

Write a few numbers directly via AV_WB32 instead of using an AVIOContext
(that is initialized only for this very purpose) to write these numbers
at known offsets into a fixed buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
13 hours agoavformat/matroskaenc: Improve writing Projection
Andreas Rheinhardt [Wed, 1 Jan 2020 00:58:19 +0000 (01:58 +0100)]
avformat/matroskaenc: Improve writing Projection

The Matroska Projection master element has such a small maximum length
that it can always be written with a length field of length one.
So it is unnecessary to first write the element into a dynamic buffer to
get the accurate length in order not to waste bytes on the length field.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
14 hours agoavformat/mux: Don't use av_ prefix for static functions
Andreas Rheinhardt [Tue, 13 Aug 2019 02:47:22 +0000 (04:47 +0200)]
avformat/mux: Don't use av_ prefix for static functions

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
17 hours agoavfilter/vf_colorconstancy: fix memory leak on error
Paul B Mahol [Mon, 27 Jan 2020 15:52:11 +0000 (16:52 +0100)]
avfilter/vf_colorconstancy: fix memory leak on error

Also remove unneeded log message while here.

22 hours agoavfilter/vf_find_rect: Remove assert
Michael Niedermayer [Sun, 26 Jan 2020 19:45:07 +0000 (20:45 +0100)]
avfilter/vf_find_rect: Remove assert

A score of 0 is possible
Fixes: Ticket8500

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 hours agoavfilter/vf_find_rect: Increase worst case score
Michael Niedermayer [Sun, 26 Jan 2020 19:45:06 +0000 (20:45 +0100)]
avfilter/vf_find_rect: Increase worst case score

score could be 1.0 which lead to uninitialized values

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
38 hours agoavcodec/av1_parser: export color information
James Almer [Sun, 26 Jan 2020 17:59:07 +0000 (14:59 -0300)]
avcodec/av1_parser: export color information

Should fix fate-lavf-fate-av1.mkv failures on builds without an AV1 decoder.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
40 hours agoavformat/mux: Don't unnecessarily zero-initialize AVPacketList
Andreas Rheinhardt [Tue, 13 Aug 2019 02:47:15 +0000 (04:47 +0200)]
avformat/mux: Don't unnecessarily zero-initialize AVPacketList

If no error occurs and this AVPacketList is used at all, its packet
substructure will be overwritten and its next pointer explicitly set, so
every field will still be initialized even when using av_malloc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
40 hours agoavformat/mux: Move packet references
Andreas Rheinhardt [Tue, 13 Aug 2019 02:47:14 +0000 (04:47 +0200)]
avformat/mux: Move packet references

In the common case that the input packet was already refcounted,
ff_interleave_add_packet would allocate a new AVPacketList, use
av_packet_ref to create a new reference to the buffer for the
AVPacketList's packet, interleave the packet and finally unreference
the original input packet.
This commit changes this: It uses av_packet_move_ref to transfer
the packet to its destination. In case the input packet is refcounted,
this saves an allocation and a free (of an AVBufferRef); if not, the
packet is made refcounted before moving it. When the input packet has
side data, one saves even more than one allocation+free.

Furthermore, when the packet is in reality an uncoded frame, a hacky
ad-hoc variant of av_packet_move_ref has been employed. Not any more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
40 hours agoavformat/gxfenc: Add deinit function
Andreas Rheinhardt [Sun, 26 Jan 2020 10:27:39 +0000 (11:27 +0100)]
avformat/gxfenc: Add deinit function

Fixes memleaks when the trailer is never written (e.g. if the call to
gxf_write_map_packet() at the end of gxf_write_header() fails).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
40 hours agoavformat/mxfenc: Add deinit function
Andreas Rheinhardt [Sun, 26 Jan 2020 10:27:38 +0000 (11:27 +0100)]
avformat/mxfenc: Add deinit function

Fixes memleaks when allocating the private data of the timecode_track
fails or when the trailer is never written.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
40 hours agoavformat/mxfenc: Don't free priv_data of AVStream
Andreas Rheinhardt [Sun, 26 Jan 2020 10:27:37 +0000 (11:27 +0100)]
avformat/mxfenc: Don't free priv_data of AVStream

It will be freed when the AVStream is freed later anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
40 hours agoavformat/audiointerleave: Check before dereferencing
Andreas Rheinhardt [Sun, 26 Jan 2020 10:27:36 +0000 (11:27 +0100)]
avformat/audiointerleave: Check before dereferencing

In order to use ff_audio_rechunk_interleave() (a special interleavement
function for situations where the ordinary "interleave by dts" is not
appropriate), the AVStreams must have private data and this private data
must begin with an AudioInterleaveContext which contains a fifo that may
need to be freed and when ff_audio_interleave_close() was called, it just
assumed that everything has been properly set up, i.e. that every streams
priv_data exists. This implies that this function can not be called from
the deinit function of a muxer, because such functions might be called
if the private data has not been successfully allocated. In order to
change this, add a check for whether the private data exists before
trying to free the fifo in it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
40 hours agoavformat/dvenc: Don't zero unnecessarily
Andreas Rheinhardt [Sun, 26 Jan 2020 07:13:11 +0000 (08:13 +0100)]
avformat/dvenc: Don't zero unnecessarily

The muxing context has already been zeroed when it was allocated, hence
it is unnecessary to do it again.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
40 hours agoavformat/dvenc: Replace write_trailer by deinit function
Andreas Rheinhardt [Sun, 26 Jan 2020 06:40:50 +0000 (07:40 +0100)]
avformat/dvenc: Replace write_trailer by deinit function

The old write_trailer only freed memory, so it is better to make a
dedicated deinit function out of it. Given that this function will also
be called when writing the header fails, one can also remove code that
frees already allocated fifos when allocating another one fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
41 hours agoavformat/yuv4mpegdec: increase header limit
Gyan Doshi [Sun, 26 Jan 2020 15:22:48 +0000 (20:52 +0530)]
avformat/yuv4mpegdec: increase header limit

Allows demuxing UHD 30000/1001 fps yuvj420p files

41 hours agoavformat/yuv4mpegdec: better error logging
Gyan Doshi [Sun, 26 Jan 2020 15:20:30 +0000 (20:50 +0530)]
avformat/yuv4mpegdec: better error logging

41 hours agofate/lavf-container: add an AV1 in Matroska muxing test
James Almer [Sun, 26 Jan 2020 15:40:34 +0000 (12:40 -0300)]
fate/lavf-container: add an AV1 in Matroska muxing test

Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/av1: Avoid allocation + copying when filtering OBUs
Andreas Rheinhardt [Fri, 24 Jan 2020 22:48:33 +0000 (23:48 +0100)]
avformat/av1: Avoid allocation + copying when filtering OBUs

Certain types of OBUs are stripped away before muxing into Matroska and
ISOBMFF; there are two functions to do this: One that outputs by
directly writing in an AVIOContext and one that returns a freshly
allocated buffer with the units not stripped away copied into it.

The latter option is bad for performance, especially when the input
does already not contain any of the units intended to be stripped away
(this covers typical remuxing scenarios). Therefore this commit changes
this by avoiding allocating and copying when possible; it is possible if
the OBUs to be retained are consecutively in the input buffer (without
an OBU to be discarded between them). In this case, the caller receives
the offset as well as the length of the part of the buffer that contains
the units to be kept. This also avoids copying when e.g. the only unit
to be discarded is a temporal delimiter at the front.

For a 22.7mb/s file with average framesize 113 kB this improved the time
for the calls to ff_av1_filter_obus_buf() when writing Matroska from
313319 decicycles to 2368 decicycles; for another file with 1.5mb/s
(average framesize 7.3 kB) it improved from 34539 decicycles to 1922
decicyles. For these files the only units that needed to be stripped
away were temporal unit delimiters at the front.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/av1: Fix nits in the documentation of ff_av1_filter_obus_buf()
Andreas Rheinhardt [Fri, 24 Jan 2020 22:48:31 +0000 (23:48 +0100)]
avformat/av1: Fix nits in the documentation of ff_av1_filter_obus_buf()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/av1, avc, hevc: Remove av_freep()
Andreas Rheinhardt [Fri, 24 Jan 2020 22:48:28 +0000 (23:48 +0100)]
avformat/av1, avc, hevc: Remove av_freep()

ff_av1_filter_obus_buf() and ff_avc_parse_nal_units_buf() both have a
pointer-to-pointer parameter which they use to pass a newly allocated
buffer to the caller. And both functions freed what this pointer points to
before overwriting it. But no caller of these functions used this feature,
but some had to initialize the pointer just because of this. So remove
it and update the documentation of ff_av1_filter_obus_buf() wrt this fact.

ff_hevc_annexb2mp4_buf in contrast did not free the pointer. This has been
documented, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/av1: Improve filtering AV1 OBUs
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:32 +0000 (17:08 +0100)]
avformat/av1: Improve filtering AV1 OBUs

Both ISOBMFF as well as Matroska require certain OBUs to be stripped
before muxing them. There are two functions for this purpose; one writes
directly into an AVIOContext, the other returns a freshly allocated
buffer with the undesired units stripped away.

The latter one actually relies on the former by means of a dynamic
buffer. This has several drawbacks: The underlying buffer might have to
be reallocated multiple times; the buffer will eventually be
overallocated; the data will not be directly copied into the final
buffer, but rather first in the write buffer (in chunks of 1024 byte)
and then written in these chunks. Moreover, the API for dynamic buffers
is defective wrt error checking and as a consequence, the earlier code
would indicate a length of -AV_INPUT_BUFFER_PADDING_SIZE on allocation
failure, but it would not return an error; there would also be no error
in case the arbitrary limit of INT_MAX/2 that is currently imposed on
dynamic buffers is hit.

This commit changes this: The buffer is now parsed twice, once to get
the precise length which will then be allocated; and once to actually
write the data.

For a 22.7mb/s file with average framesize 113 kB this improved the time
for the calls to ff_av1_filter_obus_buf() when writing Matroska from
753662 decicycles to 313319 decicycles (based upon 50 runs a 2048 frames
each); for another 1.5mb/s file (with average framesize of 7.3 kB) it
improved from 79270 decicycles to 34539 decicycles (based upon 50 runs a
4096 frames).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/movenc: Check for reformatting errors when writing hint tracks
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:31 +0000 (17:08 +0100)]
avformat/movenc: Check for reformatting errors when writing hint tracks

If this is not done, the avio_write() calls will cause segfaults
immediately afterwards on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/av1, hevc: Make *_buf-functions return 0 on success
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:30 +0000 (17:08 +0100)]
avformat/av1, hevc: Make *_buf-functions return 0 on success

The output size is already returned via a pointer argument, so there is
no need to return it via the ordinary return value as well. The
rationale behind this is to not poison the return value on success.
It also unifies the behaviour of the *_buf-functions for AVC, AV1 and
HEVC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/hevc: Fix potential leak in case of ff_hevc_annexb2mp4_buf failure
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:29 +0000 (17:08 +0100)]
avformat/hevc: Fix potential leak in case of ff_hevc_annexb2mp4_buf failure

ff_hevc_annexb2mp4_buf() could indicate an error, yet leave cleaning
after itself to the caller, so that a caller could not simply return the
error, but had to free the buffer first.

(Given that all current callers have set filter_ps = 0, this error can
currently not be triggered.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/matroskaenc: Cosmetics
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:28 +0000 (17:08 +0100)]
avformat/matroskaenc: Cosmetics

Add {, } in situations like
if ()
    ...
else if ()
    /* Comment */
    ...
else ...

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavformat/matroskaenc: Check for reformatting errors
Andreas Rheinhardt [Thu, 23 Jan 2020 16:08:27 +0000 (17:08 +0100)]
avformat/matroskaenc: Check for reformatting errors

This is needed especially for AV1: If a reformatting error happens (e.g.
if the length field of an OBU contained in the current packet indicates
that said OBU extends beyond the current packet), the data pointer is
still NULL, yet the size is unchanged, so that writing the data leads
to a segmentation fault.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
41 hours agoavfilter/scale: don't fail for circular expressions
Gyan Doshi [Sun, 26 Jan 2020 15:36:53 +0000 (21:06 +0530)]
avfilter/scale: don't fail for circular expressions

Due to conditional expressions, it is possible for them to be resolved
successfully. A warning is still printed.

43 hours agoavfilter/vf_tonemap_opencl: fix long filter description
Paul B Mahol [Sun, 26 Jan 2020 13:50:24 +0000 (14:50 +0100)]
avfilter/vf_tonemap_opencl: fix long filter description

45 hours agodoc/outdevs: Mention "sdl2" alias for "sdl".
Carl Eugen Hoyos [Sun, 26 Jan 2020 12:15:07 +0000 (13:15 +0100)]
doc/outdevs: Mention "sdl2" alias for "sdl".

Fixes ticket #8498.

47 hours agoavformat: add demuxer for argonaut games' ASF format
Zane van Iperen [Sun, 26 Jan 2020 03:36:54 +0000 (03:36 +0000)]
avformat: add demuxer for argonaut games' ASF format

Adds support for the custom ASF container used by some Argonaut Games'
games, such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Can also handle the sample files in:
https://samples.ffmpeg.org/game-formats/brender/part2.zip

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
47 hours agoavcodec: add decoder for argonaut games' adpcm codec
Zane van Iperen [Sun, 26 Jan 2020 03:36:50 +0000 (03:36 +0000)]
avcodec: add decoder for argonaut games' adpcm codec

Adds support for the ADPCM variant used by some Argonaut Games' games,
such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2 days agoavformat/udp: increase the default buffer size of a receiving socket to 384K
Marton Balint [Tue, 14 Jan 2020 18:18:01 +0000 (19:18 +0100)]
avformat/udp: increase the default buffer size of a receiving socket to 384K

It is a common mistake that people only increase fifo_size when they experience
drops, unfortunately this does not help for higher bitrate (> 100 Mbps) streams
when the reader thread simply might not receive the packets in time (especially
under high CPU load) if the default 64 KB of kernel buffer size is used.

New default is determined so that common linux systems can set this buffer size
without tuning kernel parameters.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 days agoavformat/udp: properly use return value of pthread_cond_timedwait
Marton Balint [Tue, 14 Jan 2020 17:53:45 +0000 (18:53 +0100)]
avformat/udp: properly use return value of pthread_cond_timedwait

Signed-off-by: Marton Balint <cus@passwd.hu>
2 days agoavformat/udp: add newline after warning
Marton Balint [Tue, 14 Jan 2020 17:51:02 +0000 (18:51 +0100)]
avformat/udp: add newline after warning

Signed-off-by: Marton Balint <cus@passwd.hu>
2 days agoavutil/thread: fix strict_pthread_cond_timedwait
Marton Balint [Wed, 22 Jan 2020 20:03:13 +0000 (21:03 +0100)]
avutil/thread: fix strict_pthread_cond_timedwait

Timeout error was assumed to be fatal which it is not.

Signed-off-by: Marton Balint <cus@passwd.hu>
2 days agoavfilter/vf_v360: do not remap alpha plane if that will be overwritten later
Paul B Mahol [Sat, 25 Jan 2020 19:00:53 +0000 (20:00 +0100)]
avfilter/vf_v360: do not remap alpha plane if that will be overwritten later

2 days agoavformat/movenc: allow ISMV timescale to be user-set
Gyan Doshi [Fri, 4 Jan 2019 05:15:47 +0000 (10:45 +0530)]
avformat/movenc: allow ISMV timescale to be user-set

As per the PIFF standard, the timescale of 10000000
is recommended but not mandatory, so don't override
the user-set value.

A warning is shown for non-recommended values.

2 days agoavfilter/vf_v360: mark another hemisphere not visible for flat input format
Paul B Mahol [Sat, 25 Jan 2020 12:26:51 +0000 (13:26 +0100)]
avfilter/vf_v360: mark another hemisphere not visible for flat input format

2 days agoavfilter/vf_v360: add mask option, unset pixels are marked as transparent
Paul B Mahol [Sat, 25 Jan 2020 12:24:33 +0000 (13:24 +0100)]
avfilter/vf_v360: add mask option, unset pixels are marked as transparent

2 days agoavfilter/vf_deshake_opencl: silence warning about usage of uninitialized value
Paul B Mahol [Sat, 25 Jan 2020 10:42:32 +0000 (11:42 +0100)]
avfilter/vf_deshake_opencl: silence warning about usage of uninitialized value

3 days agoavcodec/cbs_av1_syntax_template: Remove unused variable
Andreas Rheinhardt [Mon, 18 Nov 2019 07:47:59 +0000 (08:47 +0100)]
avcodec/cbs_av1_syntax_template: Remove unused variable

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 days agoavcodec/libaomenc: add an option to set the encoder "usage"
James Almer [Thu, 23 Jan 2020 00:02:17 +0000 (21:02 -0300)]
avcodec/libaomenc: add an option to set the encoder "usage"

This allows the user enable the realtime encoding speed mode

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
3 days agoavfilter/vf_v360: fix fov calculation from dfov for fisheye input/output
Paul B Mahol [Fri, 24 Jan 2020 22:10:38 +0000 (23:10 +0100)]
avfilter/vf_v360: fix fov calculation from dfov for fisheye input/output

3 days agocheckasm: Check HAVE_GETSTDHANDLE here as well
Martin Storsjö [Thu, 23 Jan 2020 22:02:35 +0000 (00:02 +0200)]
checkasm: Check HAVE_GETSTDHANDLE here as well

This was missed in 63418e374fcf26.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 days agoavdevice/xcbgrab: check if frame size fits in INT_MAX
Marton Balint [Tue, 31 Dec 2019 00:24:32 +0000 (01:24 +0100)]
avdevice/xcbgrab: check if frame size fits in INT_MAX

Also fixes a possible overflow and sets stream bitrate.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 days agoavdevice/xcbgrab: move some initialization code from pixfmt_from_pixmap_format to...
Marton Balint [Mon, 30 Dec 2019 23:43:49 +0000 (00:43 +0100)]
avdevice/xcbgrab: move some initialization code from pixfmt_from_pixmap_format to create_stream

Signed-off-by: Marton Balint <cus@passwd.hu>
4 days agoavformat/libsrt: add missing SRT_VERSION_VALUE check
Marton Balint [Tue, 21 Jan 2020 22:01:31 +0000 (23:01 +0100)]
avformat/libsrt: add missing SRT_VERSION_VALUE check

This was missed in d7e2a2bb35e394287b3e3dc27744830bf0b7ca99.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 days agolibavutil: x86: Include stdlib.h before using _byteswap_ulong
Martin Storsjö [Tue, 21 Jan 2020 19:54:22 +0000 (21:54 +0200)]
libavutil: x86: Include stdlib.h before using _byteswap_ulong

When clang works in MSVC mode, it does have the _byteswap_ulong
builtin, but one has to include stdlib.h before using it.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 days agoconfigure: Check for GetStdHandle in addition to SetConsoleTextAttribute
Martin Storsjö [Tue, 21 Jan 2020 12:47:57 +0000 (14:47 +0200)]
configure: Check for GetStdHandle in addition to SetConsoleTextAttribute

SetConsoleTextAttribute used to be unavailable for Windows Store apps,
but is available to them now. But GetStdHandle still is unavailable,
thus make sure to check for both functions before using code that
requires both.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 days agoavcodec/ra144enc: Fix invalid left shift of negative number
Andreas Rheinhardt [Wed, 22 Jan 2020 14:52:10 +0000 (15:52 +0100)]
avcodec/ra144enc: Fix invalid left shift of negative number

by replacing it with a multiplication. Said multiplication can't
overflow an int32_t because lpc_coefs is limited to 16 bit precision.

Fixes the FACE-test acodec-ra144 as well as part of #8217.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 days agoavfilter/vf_v360: support input flips for tetrahedron format
Paul B Mahol [Thu, 23 Jan 2020 10:16:13 +0000 (11:16 +0100)]
avfilter/vf_v360: support input flips for tetrahedron format

4 days agoavfilter/vf_v360: fix small artifacts with tetrahedron inputs
Paul B Mahol [Thu, 23 Jan 2020 09:31:22 +0000 (10:31 +0100)]
avfilter/vf_v360: fix small artifacts with tetrahedron inputs

5 days agoavformat/utils: log corrupt packets
Gyan Doshi [Wed, 18 Sep 2019 05:07:16 +0000 (10:37 +0530)]
avformat/utils: log corrupt packets

5 days agoavfilter/vf_v360: add tetrahedron format
Paul B Mahol [Wed, 22 Jan 2020 21:21:32 +0000 (22:21 +0100)]
avfilter/vf_v360: add tetrahedron format

5 days agotools/target_dec_fuzzer: Use codec_tags list
Michael Niedermayer [Sun, 29 Dec 2019 21:09:35 +0000 (22:09 +0100)]
tools/target_dec_fuzzer: Use codec_tags list

This should make it much quicker for the fuzzer to test
real relevant codec_tags

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 days agoavcodec/hapdec: Add codec_tags list
Michael Niedermayer [Sun, 29 Dec 2019 20:24:01 +0000 (21:24 +0100)]
avcodec/hapdec: Add codec_tags list

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 days agoavcodec/avcodec: Add codec_tags array to AVCodec
Michael Niedermayer [Sun, 29 Dec 2019 20:22:05 +0000 (21:22 +0100)]
avcodec/avcodec: Add codec_tags array to AVCodec

This allows the fuzzer to target meaningfull codec tags instead
of hunting the 4gb space, which it seems to have problems with.

Suggested-by: James
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 days agoswscale/input: Fix several invalid shifts related to rgb2yuv constants
Michael Niedermayer [Tue, 21 Jan 2020 21:52:19 +0000 (22:52 +0100)]
swscale/input: Fix several invalid shifts related to rgb2yuv constants

Fixes: Invalid shifts
Fixes: #8140
Fixes: #8146

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 days agoavfilter/vf_stack: add fill option for xstack
Paul B Mahol [Wed, 22 Jan 2020 18:11:38 +0000 (19:11 +0100)]
avfilter/vf_stack: add fill option for xstack

5 days agoavutil/log: Move log_level_offset_offset code from av_log() to v_log()
Michael Niedermayer [Tue, 21 Jan 2020 14:32:24 +0000 (15:32 +0100)]
avutil/log: Move log_level_offset_offset code from av_log() to v_log()

Suggested-by: Anton
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 days agoswscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()
Michael Niedermayer [Tue, 21 Jan 2020 21:52:19 +0000 (22:52 +0100)]
swscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()

Fixes: Invalid shifts
Fixes: #8320

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 days agoswscale/swscale: Fix several invalid shifts related to vChrDrop
Michael Niedermayer [Tue, 21 Jan 2020 21:52:19 +0000 (22:52 +0100)]
swscale/swscale: Fix several invalid shifts related to vChrDrop

Fixes: Invalid shifts
Fixes: #8166
Fixes: filter-crop_scale_vflip FATE-test

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 days agoavfilter/vf_v360: improve fisheye input format
Paul B Mahol [Wed, 22 Jan 2020 11:23:58 +0000 (12:23 +0100)]
avfilter/vf_v360: improve fisheye input format

5 days agoavcodec/exr: fix some small cosmetics nits
Paul B Mahol [Wed, 22 Jan 2020 09:42:57 +0000 (10:42 +0100)]
avcodec/exr: fix some small cosmetics nits

5 days agoavcodec/exr.c: make channel name comparisons case insensitive
Gonzalo Garramuño [Mon, 20 Jan 2020 17:25:50 +0000 (14:25 -0300)]
avcodec/exr.c: make channel name comparisons case insensitive

Allow matching channel names in lowercase, like Diffuse.r in addition to Diffuse.R

6 days agoavutil/thread: Add pthread_cond_timedwait function
Matt Oliver [Wed, 7 Dec 2016 05:55:35 +0000 (16:55 +1100)]
avutil/thread: Add pthread_cond_timedwait function

v2: fix calculating milisecond times and use SleepConditionVariableSRW.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
6 days agotools/target_dec_fuzzer: Also Fuzz with CPU optimizations disabled
Michael Niedermayer [Sun, 29 Dec 2019 16:13:21 +0000 (17:13 +0100)]
tools/target_dec_fuzzer: Also Fuzz with CPU optimizations disabled

This should improve coverage of *_c()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agotools/target_dec_fuzzer: Fuzz private options of AC3/E-AC3
Michael Niedermayer [Sun, 29 Dec 2019 16:09:44 +0000 (17:09 +0100)]
tools/target_dec_fuzzer: Fuzz private options of AC3/E-AC3

This should improve AC-3 coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agotools/target_dec_fuzzer: Fuzz idct_algo value
Michael Niedermayer [Sat, 28 Dec 2019 22:20:37 +0000 (23:20 +0100)]
tools/target_dec_fuzzer: Fuzz idct_algo value

This should improve coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agoavfilter/vf_v360: add support for fisheye input format
Paul B Mahol [Tue, 21 Jan 2020 17:42:46 +0000 (18:42 +0100)]
avfilter/vf_v360: add support for fisheye input format

6 days agoavcodec/j2kenc: Fix undefined shifts of negative numbers
Andreas Rheinhardt [Tue, 21 Jan 2020 00:23:47 +0000 (01:23 +0100)]
avcodec/j2kenc: Fix undefined shifts of negative numbers

Also add parentheses to some lines to make the operator precedence
clearer.

This affected the FATE-tests vsynth*-jpeg2000 and vsynth*-jpeg2000-97
(where * ranges over { 1, 2, 3, _lena }) as well as ticket #7983.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agoavformat/libzmq: Replace fail statements with goto
Andriy Gelman [Sat, 11 Jan 2020 04:25:26 +0000 (23:25 -0500)]
avformat/libzmq: Replace fail statements with goto

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agoavformat/libzmq: Check return of zmq_setsockopt
Andriy Gelman [Sat, 11 Jan 2020 04:25:25 +0000 (23:25 -0500)]
avformat/libzmq: Check return of zmq_setsockopt

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 days agolavc/mjpegenc: Fix not writing RST tag after final slice.
Carl Eugen Hoyos [Mon, 20 Jan 2020 22:57:38 +0000 (23:57 +0100)]
lavc/mjpegenc: Fix not writing RST tag after final slice.

Fixes ticket #8412.

6 days agoavfilter/vf_v360: add support for input fov to input sg format
Paul B Mahol [Tue, 21 Jan 2020 10:23:00 +0000 (11:23 +0100)]
avfilter/vf_v360: add support for input fov to input sg format

6 days agodoc/filters: v360: cylindrical supports input
Paul B Mahol [Tue, 21 Jan 2020 08:52:23 +0000 (09:52 +0100)]
doc/filters: v360: cylindrical supports input

7 days agoavcodec/adxdec: Remove unnecessary left-shift
Andreas Rheinhardt [Mon, 20 Jan 2020 19:20:43 +0000 (20:20 +0100)]
avcodec/adxdec: Remove unnecessary left-shift

Replace "(a * (1 << shift) * b + c) >> shift" by "a * b + (c >> shift)".
It is equivalent to the old code because a is in the range of uint16_t,
shift is 12 and b is effectively a signed 4-bit number, so that no
overflow/truncation of high bits happens during the multiplication
(overflow would be undefined anyway).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 days agoavcodec/adxenc: Avoid undefined left shift of negative numbers
Andreas Rheinhardt [Mon, 20 Jan 2020 19:20:42 +0000 (20:20 +0100)]
avcodec/adxenc: Avoid undefined left shift of negative numbers

Replace "((a << shift) + b) >> shift" by "a + (b >> shift)". This avoids
a left shift which also happens to trigger undefined behaviour in case "a"
is negative. This affected the FATE-tests acodec-adpcm-adx and
acodec-adpcm-adx-trellis; it also fixes ticket #8008.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 days agoavcodec/adpcm: Fix undefined left shifts of negative numbers
Andreas Rheinhardt [Mon, 20 Jan 2020 15:56:55 +0000 (16:56 +0100)]
avcodec/adpcm: Fix undefined left shifts of negative numbers

Affected the adpcm-afc, adpcm-ea-1, adpcm-ea-2, adpcm-ea-maxis-xa,
adpcm-thp and ea-cdata FATE-tests. Also fixes ticket #8487.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 days agoavfilter/vf_v360: add support for cylindrical input format
Paul B Mahol [Mon, 20 Jan 2020 22:29:14 +0000 (23:29 +0100)]
avfilter/vf_v360: add support for cylindrical input format

7 days agoavfilter/vf_v360: add support for flat input format
Paul B Mahol [Mon, 20 Jan 2020 13:50:54 +0000 (14:50 +0100)]
avfilter/vf_v360: add support for flat input format

7 days agoavfilter/vf_v360: rewrite fov_from_dfov()
Paul B Mahol [Mon, 20 Jan 2020 12:45:07 +0000 (13:45 +0100)]
avfilter/vf_v360: rewrite fov_from_dfov()

7 days agodoc/fftools-common-opts: small fix to -report documentation.
Nicolas George [Mon, 20 Jan 2020 16:05:53 +0000 (17:05 +0100)]
doc/fftools-common-opts: small fix to -report documentation.

7 days agodoc/filters: clarify resampling and linear mode in loudnorm
Gyan Doshi [Mon, 20 Jan 2020 11:54:11 +0000 (17:24 +0530)]
doc/filters: clarify resampling and linear mode in loudnorm

8 days agoavformat/hlsenc: fix default AES key file url with variant streams
Bela Bodecs [Sun, 19 Jan 2020 22:01:32 +0000 (23:01 +0100)]
avformat/hlsenc: fix default AES key file url with variant streams

Currently when hls_enc is active and there are multiple variant stream
outputs, default key file url construction does not work, because it is
based on the FormatContext' url field. But in case of multiple variant
streams, it contains the variant m3u8 output playlist url that contains
the %v placeholder. So the result key file url will hold the %v
placeholder causing run time error message about "could not write the
key file".
This patch correct this behaviour, and use the master playlist url for
constructing the output key file url when master playlist is vailable.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
8 days agoavformat/hlsenc: program_date_time and append_list flags conflict
Bela Bodecs [Sat, 18 Jan 2020 16:41:55 +0000 (17:41 +0100)]
avformat/hlsenc: program_date_time and append_list flags conflict

When program_date_time flag is present, in m3u8 playlist file each
segment has a corresponding EXT-X-PROGRAM-DATE-TIME value. The intial
program-date-time value is the actual current time at init and
each new segment increments this value by its duration. When append_list
flags is also present, existing playlist parsing by hls_append_segment
treats existing segments as new segments regarding the program-date-time
calculation. But it should not do that, because this way all real the
new segments' EXT-X-PROGRAM-DATE-TIME values will be shifted erroneously
by the sum duration of existing segments. Instead it should have
decremented the initial program-date-time value by its duration. This
would ensure that
the first new segment's program-date-time value had the current time as
it is expected.
This patch corrects this behaviour and prevent existing segments to
increment the value of initial_prog_date_time variable but decrements
it.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
8 days agoavformat/udp: modify the not write-only to read-only mode.
Xuchen Su [Tue, 26 Nov 2019 07:02:06 +0000 (15:02 +0800)]
avformat/udp: modify the not write-only to read-only mode.

not write-only include read-write pseudo flag. so make the flag read-only

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
8 days agoavformat/hlsenc: compare without the last directory separator in get_relative_url
Steven Liu [Fri, 10 Jan 2020 14:51:22 +0000 (22:51 +0800)]
avformat/hlsenc: compare without the last directory separator in get_relative_url

fix ticket: 8461
there is no problem before commit 75aea52a1051a22bdebd0b7a8098ac6479a529a0

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
8 days agoavformat/dashenc: use ff_rename instead of avpriv_io_move
Marton Balint [Sun, 5 Jan 2020 15:54:08 +0000 (16:54 +0100)]
avformat/dashenc: use ff_rename instead of avpriv_io_move

ff_rename always logs the error message.

Signed-off-by: Marton Balint <cus@passwd.hu>
8 days agoavformat/avio: fix ff_rename to respect used protocol
Marton Balint [Sun, 5 Jan 2020 15:32:51 +0000 (16:32 +0100)]
avformat/avio: fix ff_rename to respect used protocol

Also simplify it and make it always log the error.

This fixes for example the image2 muxer when used with an URL which also
contains the protocol:

ffmpeg -f lavfi -i testsrc -vframes 10 -atomic_writing 1 file:out%d.png

Signed-off-by: Marton Balint <cus@passwd.hu>
8 days agoavformat/avio: move ff_rename implementation from internal.h to avio.c
Marton Balint [Wed, 8 Jan 2020 22:50:41 +0000 (23:50 +0100)]
avformat/avio: move ff_rename implementation from internal.h to avio.c

Signed-off-by: Marton Balint <cus@passwd.hu>
8 days agoavfilter/vf_v360: replace rest of roundf() with lrintf()
Paul B Mahol [Sun, 19 Jan 2020 17:30:29 +0000 (18:30 +0100)]
avfilter/vf_v360: replace rest of roundf() with lrintf()

8 days agoavfilter/vf_v360: change remaps to int16_t type
Paul B Mahol [Sun, 19 Jan 2020 09:46:07 +0000 (10:46 +0100)]
avfilter/vf_v360: change remaps to int16_t type

8 days agoavfilter/vf_v360: move map variable up
Paul B Mahol [Sat, 18 Jan 2020 18:44:03 +0000 (19:44 +0100)]
avfilter/vf_v360: move map variable up

8 days agoavfilter/vf_v360: make more stuff const
Paul B Mahol [Sat, 18 Jan 2020 17:48:02 +0000 (18:48 +0100)]
avfilter/vf_v360: make more stuff const

9 days agoavfilter/pad: improve error check for w and h
Gyan Doshi [Wed, 15 Jan 2020 15:39:38 +0000 (21:09 +0530)]
avfilter/pad: improve error check for w and h

Target dimensions have to cover entire input.