]> git.sesse.net Git - ffmpeg/log
ffmpeg
6 years agolavf: allow avformat_close_input() with NULL
wm4 [Sun, 16 Jul 2017 10:43:09 +0000 (12:43 +0200)]
lavf: allow avformat_close_input() with NULL

This is consistent with how other destructors behave.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
6 years agodxva: DXVA2_ModeHEVC_VLD_Main10 does not support Main
wm4 [Mon, 10 Jul 2017 13:59:38 +0000 (15:59 +0200)]
dxva: DXVA2_ModeHEVC_VLD_Main10 does not support Main

This mode apparently does not support decoding of HEVC Main (8 bit).
With D3D11 and Intel drivers on Windows 10 I get green corruption, while
using DXVA2_ModeHEVC_VLD_Main works.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
6 years agocaf: add an Opus tag
Anton Khirnov [Sat, 1 Jul 2017 08:49:58 +0000 (10:49 +0200)]
caf: add an Opus tag

CC: libav-stable@libav.org
6 years agohevc: Make sure to update the current frame transfer characteristic
Vittorio Giovara [Thu, 20 Jul 2017 12:43:53 +0000 (14:43 +0200)]
hevc: Make sure to update the current frame transfer characteristic

Otherwise the first decoded frame will still be tagged with the
original transfer instead of the alternative one.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
6 years agormdec: don't ignore the return value of av_get_packet()
Sean McGovern [Wed, 12 Jul 2017 23:45:46 +0000 (19:45 -0400)]
rmdec: don't ignore the return value of av_get_packet()

6 years agobuild: Add feature test macros for glibc 2.19+
Diego Biurrun [Sat, 8 Jul 2017 11:18:39 +0000 (13:18 +0200)]
build: Add feature test macros for glibc 2.19+

glibc introduced _DEFAULT_SOURCE in version 2.19 to replace _BSD_SOURCE and
_SVID_SOURCE, which were deprecated in version 2.20. Add _DEFAULT_SOURCE
where the latter two are used to be forwards-compatible and avoid warnings
about the use of deprecated definitions.

6 years agoflac: Use a local cache for decode_residual()
Luca Barbato [Sat, 29 Apr 2017 02:15:32 +0000 (02:15 +0000)]
flac: Use a local cache for decode_residual()

About an additional 4% speedup.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agoflac: Postpone unlikely condition checks
Luca Barbato [Sat, 29 Apr 2017 02:15:31 +0000 (02:15 +0000)]
flac: Postpone unlikely condition checks

About 2% speedup on gcc-6.3.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agoflac: Convert to the new bitstream reader
Alexandra Hájková [Sat, 29 Apr 2017 02:15:30 +0000 (02:15 +0000)]
flac: Convert to the new bitstream reader

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agobitstream: Avoid undefined behavior in bitstream_skip()
Luca Barbato [Sat, 8 Jul 2017 19:04:44 +0000 (21:04 +0200)]
bitstream: Avoid undefined behavior in bitstream_skip()

Do not use skip_remaining() to fully wipe the cache, as this could do
a 64-bit shift of a 64-bit variable which is undefined behavior in C.
Instead set the related variables to zero directly.

Thanks to Uoti for pointing out the problem.

CC: libav-stable@libav.org
6 years agobink: Split read_dct_coeffs()
Diego Biurrun [Wed, 5 Jul 2017 13:03:56 +0000 (15:03 +0200)]
bink: Split read_dct_coeffs()

This works around type aliasing violations and related warnings.
Also add some missing error checking.

6 years agofate: Add cinepak encoder vsynth tests
Diego Biurrun [Tue, 27 Jun 2017 22:27:19 +0000 (00:27 +0200)]
fate: Add cinepak encoder vsynth tests

6 years agocinepakenc: misc small changes
Diego Biurrun [Tue, 27 Jun 2017 22:27:18 +0000 (00:27 +0200)]
cinepakenc: misc small changes

Avoid anonymously typedeffed structs and enums, drop an unused context member,
fix a small wording mishap, sizeof(type) ---> sizeof(*variable), drop a
needlessly verbose log message, use av_malloc_array() where appropriate.

6 years agocinepakenc: K&R formatting cosmetics
Diego Biurrun [Tue, 27 Jun 2017 22:27:17 +0000 (00:27 +0200)]
cinepakenc: K&R formatting cosmetics

6 years agocinepakenc: Stop using AVPicture
Timothy Gu [Tue, 27 Jun 2017 22:27:15 +0000 (00:27 +0200)]
cinepakenc: Stop using AVPicture

6 years agocinepakenc: Drop broken debug code
Diego Biurrun [Tue, 27 Jun 2017 22:27:14 +0000 (00:27 +0200)]
cinepakenc: Drop broken debug code

6 years agocinepakenc: add option handling for flexibility
addr-see-the-website@aetey.se [Tue, 27 Jun 2017 22:27:13 +0000 (00:27 +0200)]
cinepakenc: add option handling for flexibility

Now it is possible to adjust compression speed vs R/D when needed
and also skip vintage player compatibility at will.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agocinepakenc: fixes and improvements
addr-see-the-website@aetey.se [Tue, 27 Jun 2017 22:27:12 +0000 (00:27 +0200)]
cinepakenc: fixes and improvements

version 2013-02-08 Rl
- fixes/optimization in multistrip encoding and codebook size choice,
  quality/bitrate is now better than that of the binary proprietary encoder

version 2013-02-12 Rl
- separated codebook training sets, avoided the transfer of wasted bytes,
  which yields both better quality and smaller files
- now using the correct colorspace (TODO: move conversion to libswscale)

version 2013-02-14 Rl "Valentine's Day" version:
- made strip division more robust
- minimized bruteforcing the number of strips,
  (costs some R/D but speeds up compession a lot), the heuristic
  assumption is that score as a function of the number of strips has
  one wide minimum which moves slowly, of course not fully true
- simplified codebook generation,
  the old code was meant for other optimizations than we actually do
- optimized the codebook generation / error estimation for MODE_MC

version 2013-04-28 Rl
- bugfixed codebook optimization logic

version 2014-01-20 Rl
- made the encoder compatible with vintage decoders
  and added some yet unused code for possible future
  incremental codebook updates
- fixed a small memory leak

version 2014-01-21 Rl
- believe it or not, now we get even smaller files, with better quality
  (which means I missed an optimization earlier :)

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agoAdd Cinepak encoder
Tomas Härdin [Tue, 27 Jun 2017 22:27:11 +0000 (00:27 +0200)]
Add Cinepak encoder

With permission of Tomas Härdin applied by Rl aetey.se

Signed-off-by: Diego Biurrun <diego@biurrun.de>
6 years agoos_support: Use HAVE_UWP instead of manually checking WINAPI_FAMILY
Martin Storsjö [Wed, 5 Jul 2017 09:36:03 +0000 (12:36 +0300)]
os_support: Use HAVE_UWP instead of manually checking WINAPI_FAMILY

Signed-off-by: Martin Storsjö <martin@martin.st>
6 years agod3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY
Martin Storsjö [Tue, 4 Jul 2017 17:03:00 +0000 (20:03 +0300)]
d3d11va: Check WINAPI_FAMILY instead of HAVE_LOADLIBRARY

If using the winstore compat library, a fallback LoadLibrary
function does exist, that only calls LoadPackagedLibrary though
(which doesn't work for dynamically loading d3d11 DLLs).

Therefore explicitly check the targeted API family instead.

Make this check a reusable HAVE_* component which other parts
of the libraries can check when necessary as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agolavf: Remove codec_tag from dashenc and smoothstreamingenc
Martin Storsjö [Fri, 30 Jun 2017 09:49:49 +0000 (12:49 +0300)]
lavf: Remove codec_tag from dashenc and smoothstreamingenc

Currently, the tags enforced and set on the segmenter muxer level
mismatch what the mp4/ismv muxer uses (since 713efb2c0d013).

Skip the codec_tag altogether here, to let the user (try to) set
whichever codec/tag is preferred; the individual chained muxer will
reject invalid codecs anyway.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agohevc: Add support for alternative transfer characterics SEI
Vittorio Giovara [Fri, 9 Jun 2017 21:27:22 +0000 (17:27 -0400)]
hevc: Add support for alternative transfer characterics SEI

The use of this SEI is for backward compatibility in HLG HDR systems:
older devices that cannot interpret the "arib-std-b67" transfer will
get the compatible transfer (usually bt709 or bt2020) from the VUI,
while newer devices that can interpret HDR will read the SEI and use
its value instead.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
7 years agodvbsubdec: Free subrect memory on allocation error
Vittorio Giovara [Tue, 13 Jun 2017 15:35:16 +0000 (11:35 -0400)]
dvbsubdec: Free subrect memory on allocation error

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
7 years agodvbsubdec: Fixed segfault when decoding subtitles
Lorenz Brun [Fri, 21 Oct 2016 20:51:37 +0000 (22:51 +0200)]
dvbsubdec: Fixed segfault when decoding subtitles

This fixes a segfault (originally found in Movian, but traced to libav)
when decoding subtitles because only an array of rects is allocated,
but not the actual structs it contains. The issue was probably
introduced in commit 2383323 where the loop to allocate the rects in
the array was thrown away.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
7 years agohwframe: Allow hwaccel frame allocators to align surface sizes
Anton Khirnov [Thu, 22 Jun 2017 18:05:12 +0000 (20:05 +0200)]
hwframe: Allow hwaccel frame allocators to align surface sizes

Hardware accelerated decoding generally uses AVHWFramesContext for pool
allocation of hardware surfaces. These are setup to allocate surfaces
aligned to hardware and hwaccel API requirements. Due to the
architecture, av_hwframe_get_buffer() will return AVFrames with
the dimensions set to the aligned sizes.

This causes some decoders (like hevc) return these aligned size as
final frame size, instead of cropping them to the video's actual
dimensions. To make sure this doesn't happen, crop the frame to the
size the decoder expects when ff_get_buffer() is called.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agodxva: verbose-log decoder GUID list
wm4 [Thu, 22 Jun 2017 12:52:59 +0000 (14:52 +0200)]
dxva: verbose-log decoder GUID list

Helpful for debugging.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agohwcontext_d3d11va: add option to enable debug mode
wm4 [Thu, 22 Jun 2017 12:52:57 +0000 (14:52 +0200)]
hwcontext_d3d11va: add option to enable debug mode

Basically copied from VLC (LGPL):

http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_output/win32/direct3d11.c;h=e9fcb83dcabfe778f26e63d19f218caf06a7c3ae;hb=HEAD#l1482
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/d3d11va.c;h=85e7d25caebc059a9770da2ef4bb8fe90816d76d;hb=HEAD#l599

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agodxva: support DXGI_FORMAT_420_OPAQUE decoding
wm4 [Thu, 22 Jun 2017 12:52:56 +0000 (14:52 +0200)]
dxva: support DXGI_FORMAT_420_OPAQUE decoding

Some devices (some phones, apparently) will support only this opaque
format. Of course this won't work with CLI, because copying data
directly is not supported.

Automatic frame allocation (setting AVCodecContext.hw_device_ctx) does
not support this mode, even if it's the only supported mode. But since
opaque surfaces are generally less useful, that's probably ok.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agohwcontext_d3d11va: allocate staging texture lazily
wm4 [Thu, 22 Jun 2017 12:52:55 +0000 (14:52 +0200)]
hwcontext_d3d11va: allocate staging texture lazily

Makes dealing with formats that can not be used for staging textures
easier (DXGI_FORMAT_420_OPAQUE). It also saves memory if the staging
texture is never needed, so this is a good thing.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agohwcontext_d3d11va: fix crash on frames_init failure
wm4 [Thu, 22 Jun 2017 12:52:54 +0000 (14:52 +0200)]
hwcontext_d3d11va: fix crash on frames_init failure

It appears in this case, frames_ininit is called twice (once by
av_hwframe_ctx_init(), and again by unreffing the frames ctx ref).

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agodxva: fix some warnings
wm4 [Thu, 22 Jun 2017 12:52:53 +0000 (14:52 +0200)]
dxva: fix some warnings

Some existed since forever, some are new.

The cast in get_surface() is silly, but unless we change the av_log
function signature, or all callers of ff_dxva2_get_surface_index(), it's
needed to remove the const warning.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agodxva: add declarative profile checks
wm4 [Thu, 22 Jun 2017 12:52:52 +0000 (14:52 +0200)]
dxva: add declarative profile checks

Make supported codec profiles part of each dxva_modes entry. Every DXVA2
mode is representative for a codec with a subset of supported profiles,
so reflecting that in dxva_modes seems appropriate.

In practice, this will more strictly check MPEG2 profiles, will stop
relying on the surface format checks for selecting the correct HEVC
profile, and remove the verbose messages for mismatching H264/HEVC
profiles. Instead of the latter, it will now print the more nebulous "No
decoder device for codec found" verbose message.

This also respects AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH. Move the
Main10 HEVC entry before the normal one to make this work better.

Originally inspired by VLC's code.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agoconfigure: Reset X86ASM_DEP(FLAGS) when probing for the assembler program
Diego Biurrun [Sat, 24 Jun 2017 15:51:02 +0000 (17:51 +0200)]
configure: Reset X86ASM_DEP(FLAGS) when probing for the assembler program

These variables might be set from a previous probe run, but one or the
other program that is probed for may not grok the flags, resulting in
errors during assembling when the values of those variables are passed
to the assembler.

7 years agonvenc: Minimize the surface allocation
Ben Chang [Sat, 24 Jun 2017 12:17:14 +0000 (12:17 +0000)]
nvenc: Minimize the surface allocation

The previous default sets the allocated surfaces to 32 unless it is
user-overridden or the lookahead parameter is set.

Change the surfaces calculation for default, B-frames and lookahead scenario.

7 years agonvenc: Use a fifo to manage the free surface pool
Ben Chang [Sat, 24 Jun 2017 12:14:22 +0000 (12:14 +0000)]
nvenc: Use a fifo to manage the free surface pool

Previously, if a session allocates x surfaces, only x-1 surfaces are
used (due to combination of output delay and lock toggle logic).

7 years agonvenc: Add an explicit auto alias
Ben Chang [Sat, 24 Jun 2017 12:10:10 +0000 (12:10 +0000)]
nvenc: Add an explicit auto alias

7 years agobuild: Add an option for passing linker flags to the shared library build
Janne Grunau [Tue, 20 Jun 2017 17:25:43 +0000 (19:25 +0200)]
build: Add an option for passing linker flags to the shared library build

Also employ this mechanism to pass $libdir to the runtime library search
path if rpath is enabled. This fixes underlinking of some test binaries
on some systems.

7 years agoconfigure: Automatically add -isysroot for darwin if --sysroot is specified
Martin Storsjö [Wed, 21 Jun 2017 13:54:22 +0000 (16:54 +0300)]
configure: Automatically add -isysroot for darwin if --sysroot is specified

Check the existing flags in the cc/cflags/cppflags/ldflags for
occurrances of -isysroot; if none is found but --sysroot was specified,
set -isysroot to the same value as --sysroot.

This simplifies configuring cross-builds for iOS, if the global
environment variable SDKROOT isn't set.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoaf_bs2b: Add missing casts to complex pointer assignments
Diego Biurrun [Mon, 12 Jun 2017 20:12:17 +0000 (22:12 +0200)]
af_bs2b: Add missing casts to complex pointer assignments

Fixes several warnings of the type:
libavfilter/af_bs2b.c:171:22: warning: assignment from incompatible pointer type

7 years agotls_gnutls: Readd support for nonblocking operation
Martin Storsjö [Mon, 19 Jun 2017 12:49:25 +0000 (15:49 +0300)]
tls_gnutls: Readd support for nonblocking operation

The rtmp protocol uses nonblocking reads, to poll for incoming
messages from the server while publishing a stream.

Prior to 94599a6de3822b13c94096d764868128f388ba28 and
d13b124eaf452b267480074b2e6946538ed03a6e, the tls protocol
handled the nonblocking flag, mostly as a side effect from not
using custom IO callbacks for reading from the socket. When custom
IO callbacks were taken into use in
d15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02, the handling of a nonblocking
socket wasn't necessary for the default blocking mode any longer.

The code was simplified, since it was overlooked that other code
within libavformat actually used the tls protocol in nonblocking mode.

This fixes publishing over rtmps, with the gnutls backend.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agotls_openssl: Readd support for nonblocking operation
Martin Storsjö [Mon, 19 Jun 2017 12:45:08 +0000 (15:45 +0300)]
tls_openssl: Readd support for nonblocking operation

The rtmp protocol uses nonblocking reads, to poll for incoming
messages from the server while publishing a stream.

Prior to 94599a6de3822b13c94096d764868128f388ba28 and
d13b124eaf452b267480074b2e6946538ed03a6e, the tls protocol
handled the nonblocking flag, mostly as a side effect from not
using custom IO callbacks for reading from the socket. When custom
IO callbacks were taken into use in
d15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02, the handling of a nonblocking
socket wasn't necessary for the default blocking mode any longer.

The code was simplified, since it was overlooked that other code
within libavformat actually used the tls protocol in nonblocking mode.

This fixes publishing over rtmps, with the openssl backend.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agomovenc: allow alternative hvc1 h.265 codec tag
John Stebbins [Thu, 15 Jun 2017 18:47:16 +0000 (11:47 -0700)]
movenc: allow alternative hvc1 h.265 codec tag

If AVCodecParameters.codec_tag is 'hvc1' use it instead of 'hev1' for
h.265 streams. QuickTime (and other Apple software) requires 'hvc1'.

7 years agomovenc: write correct format hvcc when tag is hvc1
John Stebbins [Thu, 15 Jun 2017 18:41:15 +0000 (11:41 -0700)]
movenc: write correct format hvcc when tag is hvc1

7 years agomovenc: move tags definitions to where they are used
John Stebbins [Mon, 19 Jun 2017 14:53:45 +0000 (07:53 -0700)]
movenc: move tags definitions to where they are used

7 years agomovenc: simplify codec_tag lookup
John Stebbins [Mon, 19 Jun 2017 14:46:48 +0000 (07:46 -0700)]
movenc: simplify codec_tag lookup

mux.c init_muxer() already sets codec_tag correctly in the cases
simplified here.

This also adds the capability to support alternative tags for the
same codec_id.

7 years agomovenc: use correct tag list for AVOutputFormat.codec_tag
John Stebbins [Thu, 15 Jun 2017 18:20:48 +0000 (11:20 -0700)]
movenc: use correct tag list for AVOutputFormat.codec_tag

ff_mp4_obj_type contains the wrong type of tags for
AVOutputFormat.codec_tag. AVOutputFormat.codec_tag is used to
validate AVCodecParameters.codec_tag so needs to be the same
type of tag.

Creates new tag lists for mp4 and ismv.  New tag lists support
same list of codecs found in ff_mp4_obj_type. psp uses the same
tag list as mp4 since these both use mp4_get_codec_tag to look up tags.

7 years agoaarch64: vp9: Fix assembling with Xcode 6.2 and older
Memphiz [Sun, 18 Jun 2017 10:30:16 +0000 (12:30 +0200)]
aarch64: vp9: Fix assembling with Xcode 6.2 and older

Properly use the b.eq/b.ge forms instead of the nonstandard forms
(which both gas and newer clang accept though), and expand the
register list that used a range (which the Xcode 6.2 clang, based
on clang 3.5 svn, didn't support).

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agodoc: Drop the legacy symlink to README
Luca Barbato [Tue, 13 Jun 2017 23:40:40 +0000 (01:40 +0200)]
doc: Drop the legacy symlink to README

Windows does not like symlinks and README.md is pretty common nowadays.

7 years agod3d11va: Link directly to dxgi.dll and d3d11.dll functions if LoadLibrary is unavailable
Martin Storsjö [Fri, 9 Jun 2017 09:05:00 +0000 (12:05 +0300)]
d3d11va: Link directly to dxgi.dll and d3d11.dll functions if LoadLibrary is unavailable

When targeting the UWP API subset, the LoadLibrary function is not
available (and the fallback, LoadPackagedLibrary, can't be used to
load system DLLs). In these cases, link directly to the functions
in the DLLs instead of trying to load them dynamically at runtime.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoavconv_hw: Free device on initialisation failure
Mark Thompson [Fri, 16 Jun 2017 22:18:55 +0000 (23:18 +0100)]
avconv_hw: Free device on initialisation failure

7 years agovf_hwmap: Properly free a locally derived device
Mark Thompson [Fri, 16 Jun 2017 22:11:51 +0000 (23:11 +0100)]
vf_hwmap: Properly free a locally derived device

7 years agovf_hwmap: Add missing error code
Mark Thompson [Fri, 16 Jun 2017 22:08:47 +0000 (23:08 +0100)]
vf_hwmap: Add missing error code

7 years agoconfigure: Fix handling of _select dependencies
Diego Biurrun [Wed, 24 May 2017 15:59:59 +0000 (17:59 +0200)]
configure: Fix handling of _select dependencies

The handling of _select dependencies had two issues:

1) extralibs from _select dependencies of a component were not added to
   the list of extralibs for that component.
2) extralibs from dependencies were only added to the extralibs of a
   component if the component was enabled. This led to incorrect results
   if that component was enabled by another component later in the dependency
   resolution process. Instead, always generate the full list of component
   extralibs for use later in the dependency resolution process.

Also remove a leftover unused variable.

7 years agobuild: Adjust dependencies for faan(i)dct components
Diego Biurrun [Mon, 12 Jun 2017 19:33:35 +0000 (21:33 +0200)]
build: Adjust dependencies for faan(i)dct components

7 years agoconfigure: Factorize qsv dependencies
Diego Biurrun [Tue, 6 Jun 2017 15:41:11 +0000 (17:41 +0200)]
configure: Factorize qsv dependencies

7 years agoconfigure: Add missing arch dependencies for arch extensions
Diego Biurrun [Tue, 6 Jun 2017 17:06:10 +0000 (19:06 +0200)]
configure: Add missing arch dependencies for arch extensions

7 years agoconfigure: Add x86 dependency for mmx_internal
Diego Biurrun [Tue, 6 Jun 2017 16:56:24 +0000 (18:56 +0200)]
configure: Add x86 dependency for mmx_internal

This ensures that mmx_internal is only ever enabled on x86.

7 years agobuild: Add missing idctdsp dependency for clearvideo
Diego Biurrun [Wed, 7 Jun 2017 10:48:00 +0000 (12:48 +0200)]
build: Add missing idctdsp dependency for clearvideo

7 years agobuild: Add missing mpeg4audio dependency for RTP muxer
Diego Biurrun [Sun, 11 Jun 2017 21:50:24 +0000 (23:50 +0200)]
build: Add missing mpeg4audio dependency for RTP muxer

7 years agohwcontext: Mark local table static const
Mark Thompson [Tue, 13 Jun 2017 21:27:31 +0000 (22:27 +0100)]
hwcontext: Mark local table static const

7 years agolibfdk-aacdec: Correct buffer_size parameter
Michael Niedermayer [Thu, 25 May 2017 01:21:50 +0000 (03:21 +0200)]
libfdk-aacdec: Correct buffer_size parameter

The timeDataSize argument to aacDecoder_DecodeFrame() seems undocumented
and until 2016 04 (203e3f28fbebec7011342017fafc2a0bda0ce530) unused.
After that commit libfdk-aacdec interprets it as size in sample units
and memsets that on error.

FFmpeg as well as others (like GStreamer) did interpret it as size in
bytes.

Fixes: 1442/clusterfuzz-testcase-minimized-4540199973421056 (This requires recent libfdk to reproduce)
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agommal: Add missing .item_name to AVClass declaration
Diego Biurrun [Mon, 12 Jun 2017 09:01:14 +0000 (11:01 +0200)]
mmal: Add missing .item_name to AVClass declaration

7 years agoconfigure: Simplify AltiVec/VSX check with a helper function
Diego Biurrun [Fri, 26 May 2017 17:04:51 +0000 (19:04 +0200)]
configure: Simplify AltiVec/VSX check with a helper function

7 years agoppc: Drop support for Apple GCC
Diego Biurrun [Mon, 12 Jun 2017 09:48:57 +0000 (11:48 +0200)]
ppc: Drop support for Apple GCC

Apple GCC has not been a thing anymore on PowerPC since many years.

7 years agoConvert all AVClass struct declarations to designated initializers.
Diego Biurrun [Sat, 10 Jun 2017 14:45:06 +0000 (16:45 +0200)]
Convert all AVClass struct declarations to designated initializers.

7 years agonvenc: Add default value for AVCodecContext::refs
Srinath K R [Thu, 8 Jun 2017 09:13:54 +0000 (14:43 +0530)]
nvenc: Add default value for AVCodecContext::refs

AVCodecContext::refs is used to control the DPB size to be used by the
encoder. The default value for AVCodecContext::refs as set in
libavcodec/options_table.h is 1.

This patch sets AVCodecContext::refs to 0 for h264_nvenc and hevc_nvenc in
order to let the driver take the decision of the correct DPB size to use in
all cases.

Signed-off-by: Srinath K R <skr@nvidia.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agodxva: add support for new dxva2 and d3d11 hwaccel APIs
wm4 [Wed, 7 Jun 2017 15:11:17 +0000 (17:11 +0200)]
dxva: add support for new dxva2 and d3d11 hwaccel APIs

This also adds support to avconv (which is trivial due to the new
hwaccel API being generic enough).

The new decoder setup code in dxva2.c is significantly based on work by
Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agodxva: move d3d11 locking/unlocking to functions
wm4 [Tue, 6 Jun 2017 16:51:10 +0000 (18:51 +0200)]
dxva: move d3d11 locking/unlocking to functions

I want to make it non-mandatory to set a mutex in the D3D11 device
context, and replacing it with user callbacks seems like the best
solution. This is preparation for it. Also makes the code slightly more
readable.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agodxva: preparations for new hwaccel API
wm4 [Tue, 6 Jun 2017 16:51:09 +0000 (18:51 +0200)]
dxva: preparations for new hwaccel API

The actual hwaccel code will need to access an internal context instead
of avctx->hwaccel_context, so add a new DXVA_CONTEXT() macro, that will
dispatch between the "old" external and the new internal context.

Also, the new API requires a new D3D11 pixfmt, so all places which check
for the pixfmt need to be adjusted. Introduce a ff_dxva2_is_d3d11()
function, which does the check.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agolavc: set avctx->hwaccel before init
wm4 [Tue, 6 Jun 2017 16:51:08 +0000 (18:51 +0200)]
lavc: set avctx->hwaccel before init

So a hwaccel can access avctx->hwaccel in init for whatever reason. This
is for the new d3d hwaccel API. We could create separate entrypoints for
each of the 3 hwaccel types (dxva2, d3d11va, new d3d11va), but this
seems nicer.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agolavu: add new D3D11 pixfmt and hwcontext
wm4 [Tue, 6 Jun 2017 16:51:07 +0000 (18:51 +0200)]
lavu: add new D3D11 pixfmt and hwcontext

To be used with the new d3d11 hwaccel decode API.

With the new hwaccel API, we don't want surfaces to depend on the
decoder (other than the required dimension and format). The old D3D11VA
pixfmt uses ID3D11VideoDecoderOutputView pointers, which include the
decoder configuration, and thus is incompatible with the new hwaccel
API. This patch introduces AV_PIX_FMT_D3D11, which uses ID3D11Texture2D
and an index. It's simpler and compatible with the new hwaccel API.

The introduced hwcontext supports only the new pixfmt.

Frame upload code untested.

Significantly based on work by Steve Lhomme <robux4@gmail.com>, but with
heavy changes/rewrites.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agoconfigure: Bail out if both GnuTLS and OpenSSL are enabled
Diego Biurrun [Fri, 26 May 2017 11:05:12 +0000 (13:05 +0200)]
configure: Bail out if both GnuTLS and OpenSSL are enabled

Both libraries provide similar functionality and cannot be used together.
When both are enabled one is used and the other ignored arbitrarily. Error
out instead and have the user choose which library to use.

7 years agoconfigure: Move x86 assembler sanity check into assembler probe function
Diego Biurrun [Mon, 22 May 2017 12:48:15 +0000 (14:48 +0200)]
configure: Move x86 assembler sanity check into assembler probe function

This allows for more graceful fallback from NASM to Yasm if the available
NASM version is too old.

7 years agobuild: Add missing zlib dependencies for several protocols
Diego Biurrun [Tue, 14 Mar 2017 15:44:24 +0000 (16:44 +0100)]
build: Add missing zlib dependencies for several protocols

7 years agocmdutils: Mark conditionally used variable as av_unused
Diego Biurrun [Mon, 22 May 2017 14:27:51 +0000 (16:27 +0200)]
cmdutils: Mark conditionally used variable as av_unused

avtools/cmdutils.c:1234:28: warning: unused variable ‘pix_fmt’ [-Wunused-variable]

7 years agobuild: Skip generating .version files when reconfiguring
Diego Biurrun [Wed, 15 Mar 2017 16:36:16 +0000 (17:36 +0100)]
build: Skip generating .version files when reconfiguring

The .version files are only relevant during an actual build.

7 years agoavutil/md5: fix misaligned reads
James Almer [Fri, 3 Mar 2017 03:25:54 +0000 (00:25 -0300)]
avutil/md5: fix misaligned reads

This makes ubsan happy and also considerably increases performance on
big endian systems.

Tested on an IBM POWER7 3.55 GHz

Before:

2.24user 0.14system 0:02.39elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
2.26user 0.11system 0:02.38elapsed 99%CPU (0avgtext+0avgdata 2688maxresident)k
2.23user 0.15system 0:02.38elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
2.25user 0.12system 0:02.38elapsed 100%CPU (0avgtext+0avgdata 2624maxresident)k
2.20user 0.15system 0:02.36elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k

After:

1.86user 0.13system 0:02.00elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.89user 0.11system 0:02.01elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.85user 0.14system 0:02.00elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.84user 0.15system 0:01.99elapsed 99%CPU (0avgtext+0avgdata 2624maxresident)k
1.89user 0.13system 0:02.02elapsed 99%CPU (0avgtext+0avgdata 2688maxresident)k

Tested-by: Nicolas George <george@nsup.org>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Sean McGovern <gseanmcg@gmail.com>
7 years agotls: Hide backend implementation details from users
Diego Biurrun [Tue, 23 May 2017 08:15:28 +0000 (10:15 +0200)]
tls: Hide backend implementation details from users

TLS is currently implemented over either OpenSSL or GnuTLS, with more
backends likely to appear in the future. Currently, those backend libraries
are part of the protocol names used during e.g. the configure stage of a
build. Hide those details behind a generically-named declaration for the
TLS protocol to avoid leaking those details into the configuration stage.

7 years agosmacker: Improve error handling
Diego Biurrun [Tue, 30 May 2017 16:12:48 +0000 (18:12 +0200)]
smacker: Improve error handling

Return sensible error values and forward error codes.

7 years agosmacker: Check that the data size is a multiple of a sample vector
Michael Niedermayer [Sun, 15 Nov 2015 13:52:08 +0000 (14:52 +0100)]
smacker: Check that the data size is a multiple of a sample vector

Fixes out of array access
Fixes: ce19e41f0ef1e52a23edc488faecdb58/asan_heap-oob_2504e97_4202_ffa0df1baed14022b9bfd4f8ac23d0cb.smk
Bug-Id: CVE-2015-8365
CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4a9af07a49295e014b059c1ab624c40345af5892)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
7 years agoos_support: Remove the dynamic loading of getaddrinfo from the fallback getaddrinfo
Martin Storsjö [Wed, 31 May 2017 10:08:29 +0000 (13:08 +0300)]
os_support: Remove the dynamic loading of getaddrinfo from the fallback getaddrinfo

If we for some unexplicable reason didn't pick up getaddrinfo
at configure, the default, IPv4-only, fallback should be good enough.

This effectively reverts 6023d84a2b7.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agoconfigure: Default to _WIN32_WINNT=0x0502 (XP) as minimum, for legacy mingw
Martin Storsjö [Wed, 31 May 2017 10:07:04 +0000 (13:07 +0300)]
configure: Default to _WIN32_WINNT=0x0502 (XP) as minimum, for legacy mingw

This makes the getaddrinfo functions visible, which aren't normally
by default on legacy mingw.

We already force __MSVCRT_VERSION__ to an XP version.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agohlsenc: Support recovery from an already present playlist
Luca Barbato [Fri, 19 May 2017 18:32:47 +0000 (20:32 +0200)]
hlsenc: Support recovery from an already present playlist

Parse the playlist to recover the start sequence and previously
generated segments and continue muxing from there.

Mainly useful for near-seamless recovery in live scenarios.

7 years agoavconv: Always initialize the opkt struct on streamcopy
Luca Barbato [Mon, 29 May 2017 11:55:28 +0000 (13:55 +0200)]
avconv: Always initialize the opkt struct on streamcopy

7 years agoconfigure: Fix the msvcrt version check for mingw32
Martin Storsjö [Wed, 31 May 2017 09:53:32 +0000 (12:53 +0300)]
configure: Fix the msvcrt version check for mingw32

This was actually broken when committed in 46e3936fb04; the
test never succeeded, and thus, _aligned_malloc wasn't actually
used on legacy mingw.

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agovaapi: Add ABGR map only if VA_FOURCC_ABGR is defined
Elviss Strazdins [Wed, 24 May 2017 12:33:08 +0000 (14:33 +0200)]
vaapi: Add ABGR map only if VA_FOURCC_ABGR is defined

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
7 years agoconfigure: Do not check for the __builtin_vec_vsx_ld
Luca Barbato [Wed, 10 May 2017 15:18:48 +0000 (17:18 +0200)]
configure: Do not check for the __builtin_vec_vsx_ld

Clang support for Altivec/VSX uses a different approach.

7 years agoavutil/hwcontext_dxva2: Don't improperly free IDirect3DSurface9 objects
Aaron Levinson [Tue, 16 May 2017 21:23:27 +0000 (14:23 -0700)]
avutil/hwcontext_dxva2: Don't improperly free IDirect3DSurface9 objects

Add dxva2_pool_release_dummy() and use it in call to
av_buffer_create() in dxva2_pool_alloc().

Prior to this change, av_buffer_create() was called with NULL for the
third argument, which indicates that av_buffer_default_free() should
be used to free the buffer's data.  Eventually, it gets to
buffer_pool_free() and calls buf->free() on a surface object (which is
av_buffer_default_free()).

This can result in a crash when the debug version of the C-runtime is
used on Windows.  While it doesn't appear to result in a crash when
the release version of the C-runtime is used on Windows, it likely
results in memory corruption, since av_free() is being called on
memory that was allocated using
IDirectXVideoAccelerationService::CreateSurface().

Signed-off-by: Aaron Levinson <alevinsn@aracnet.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
7 years agodecode: fix the code reducing cropping to preserve alignment
Anton Khirnov [Fri, 19 May 2017 09:47:21 +0000 (11:47 +0200)]
decode: fix the code reducing cropping to preserve alignment

Currently it does not work at all.

Bug-Id: 1058

7 years agohevcdec: move the MD5 context out of HEVCSEIPictureHash back into HEVCContext
Anton Khirnov [Fri, 12 May 2017 14:36:41 +0000 (16:36 +0200)]
hevcdec: move the MD5 context out of HEVCSEIPictureHash back into HEVCContext

HEVCSEIPictureHash should store only the information extracted from the
bitstream and exported to the higher layer (the decoder or the parser).
The MD5 context is allocated, used and freed by this higher layer, so it
makes more sense for it to also be stored there.

7 years agoextract_extradata_bsf: make sure all needed parameter set NALUs were found
James Almer [Fri, 14 Apr 2017 13:53:52 +0000 (10:53 -0300)]
extract_extradata_bsf: make sure all needed parameter set NALUs were found

This mimics the behavior of the now unused h264/hevc parser's split()
function and fixes decoding some files when extract_extradata bsf is
enabled.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
7 years agovp9_superframe_bsf: cache input packets directly
Anton Khirnov [Wed, 26 Apr 2017 07:42:32 +0000 (09:42 +0200)]
vp9_superframe_bsf: cache input packets directly

Avoids unnecessary allocs+copies and makes the code slightly simpler.

7 years agovp9_superframe_bsf: convert to the new bitstream reader
Anton Khirnov [Wed, 26 Apr 2017 07:25:05 +0000 (09:25 +0200)]
vp9_superframe_bsf: convert to the new bitstream reader

7 years agohevc: Add names for reserved NAL unit types
Mark Thompson [Sun, 14 May 2017 14:47:36 +0000 (15:47 +0100)]
hevc: Add names for reserved NAL unit types

While not yet used, these NAL units do already have some defined
semantics and are referred to elsewhere.

7 years agoh264_sei: Add namespace prefix to all SEI values
Mark Thompson [Mon, 15 May 2017 21:42:14 +0000 (22:42 +0100)]
h264_sei: Add namespace prefix to all SEI values

This avoids confusion with equivalent H.265 SEI values when both are
being used at the same time.

7 years agoavconv: Flush output BSFs when stream copy reaches EOF
Mark Thompson [Thu, 4 May 2017 22:01:23 +0000 (23:01 +0100)]
avconv: Flush output BSFs when stream copy reaches EOF

Same as f64d1100a54d12c78ce436181bb64229c56da6b3, for stream copy
rather than encode.

7 years agodoc: Document hwupload, hwdownload and hwmap filters
Mark Thompson [Sun, 30 Apr 2017 21:11:54 +0000 (22:11 +0100)]
doc: Document hwupload, hwdownload and hwmap filters

7 years agomovenc-test: Add tests for negative cts offsets
Martin Storsjö [Thu, 7 Apr 2016 13:16:27 +0000 (16:16 +0300)]
movenc-test: Add tests for negative cts offsets

Signed-off-by: Martin Storsjö <martin@martin.st>
7 years agomovenc: Don't write any edit list if the start offset is zero
Martin Storsjö [Thu, 7 Apr 2016 12:47:31 +0000 (15:47 +0300)]
movenc: Don't write any edit list if the start offset is zero

In these cases, the CTTS flag is set, but no edit list is necessary.

Signed-off-by: Martin Storsjö <martin@martin.st>