ffmpeg.git
22 months agoavcodec/j2kenc: Fix out of array access in encode_cblk()
Michael Niedermayer [Thu, 30 Nov 2017 22:42:04 +0000 (23:42 +0100)]
avcodec/j2kenc: Fix out of array access in encode_cblk()

Fixes: 4427/clusterfuzz-testcase-minimized-5106919271301120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavcodec/hevcdsp_template: Fix undefined shift in put_hevc_epel_bi_w_h()
Michael Niedermayer [Thu, 30 Nov 2017 20:27:37 +0000 (21:27 +0100)]
avcodec/hevcdsp_template: Fix undefined shift in put_hevc_epel_bi_w_h()

Fixes: runtime error: left shift of negative value -127
Fixes: 4397/clusterfuzz-testcase-minimized-4779061080489984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoexamples/vaapi_encode: Fix leak on hwframe init failure
Mark Thompson [Fri, 1 Dec 2017 21:06:42 +0000 (21:06 +0000)]
examples/vaapi_encode: Fix leak on hwframe init failure

Fixes CID #1424882.

22 months agomediacodecdec: fix build by including hwaccel.h
Jan Ekström [Fri, 1 Dec 2017 20:21:54 +0000 (22:21 +0200)]
mediacodecdec: fix build by including hwaccel.h

Enables the decoder to utilize the type AVCodecHWConfigInternal.

22 months agocheckasm/utvideo : be more explicit to the WIDTH_PADDED define
Martin Vignali [Tue, 21 Nov 2017 21:01:42 +0000 (22:01 +0100)]
checkasm/utvideo : be more explicit to the WIDTH_PADDED define

22 months agoavfilter: add fillborders filter
Paul B Mahol [Sat, 18 Nov 2017 17:18:39 +0000 (18:18 +0100)]
avfilter: add fillborders filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
22 months agoavcodec/vorbis: Fix another 1 << 31 > int32_t::max() with 1u.
Dale Curtis [Thu, 30 Nov 2017 20:20:36 +0000 (12:20 -0800)]
avcodec/vorbis: Fix another 1 << 31 > int32_t::max() with 1u.

Didn't notice this one when 9648cc6d was landed.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavfilter/vf_tile: add init_padding option
Paul B Mahol [Fri, 17 Nov 2017 20:33:37 +0000 (21:33 +0100)]
avfilter/vf_tile: add init_padding option

Signed-off-by: Paul B Mahol <onemda@gmail.com>
22 months agoavcodec/h264_slice: use H264_SEI_FpaType enum constants
James Almer [Fri, 1 Dec 2017 04:17:44 +0000 (01:17 -0300)]
avcodec/h264_slice: use H264_SEI_FpaType enum constants

Cosmetic change.

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavcodec/h264_sei: remove redundant prefix to H264SEIFramePacking fields
James Almer [Fri, 1 Dec 2017 04:09:43 +0000 (01:09 -0300)]
avcodec/h264_sei: remove redundant prefix to H264SEIFramePacking fields

Cosmetic change.

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoconfigure: Fix dependencies of aac_at decoder.
Jacob Trimble [Thu, 30 Nov 2017 22:58:59 +0000 (14:58 -0800)]
configure: Fix dependencies of aac_at decoder.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
22 months agolavf/mov: fix huge alloc in mov_read_ctts
John Stebbins [Sun, 26 Nov 2017 15:32:30 +0000 (07:32 -0800)]
lavf/mov: fix huge alloc in mov_read_ctts

An invalid file may cause huge alloc.  Delay expansion of ctts entries
until the number of samples is known in mov_build_index.

Fixes: 23

Found-by: zhao dongzhuo, AD-lab of Venustech
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agolavfi/libvmaf: Rename local variable "main" as "master".
Carl Eugen Hoyos [Thu, 30 Nov 2017 13:13:15 +0000 (14:13 +0100)]
lavfi/libvmaf: Rename local variable "main" as "master".

Fixes the following warning:
libavfilter/vf_libvmaf.c:179:14: warning: 'main' is usually a function

Missed in 5d3e9357

22 months agoconfigure: select vp9_superframe_split_bsf when enabling vp9_decoder
James Almer [Thu, 30 Nov 2017 04:51:16 +0000 (01:51 -0300)]
configure: select vp9_superframe_split_bsf when enabling vp9_decoder

This is required since a5679933c1b8b6bef5c5c3eb7c70d06c695066cf

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/avc: support writting more than one sps/pps in ff_isom_write_avcc
James Almer [Sat, 25 Nov 2017 01:36:22 +0000 (22:36 -0300)]
avformat/avc: support writting more than one sps/pps in ff_isom_write_avcc

Addresses ticket #6864

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/avc: free buffer in ff_isom_write_avcc on failure
James Almer [Fri, 24 Nov 2017 23:26:08 +0000 (20:26 -0300)]
avformat/avc: free buffer in ff_isom_write_avcc on failure

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/avc: reindent after the last commit
James Almer [Fri, 24 Nov 2017 22:47:47 +0000 (19:47 -0300)]
avformat/avc: reindent after the last commit

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/avc: refactor ff_isom_write_avcc
James Almer [Fri, 24 Nov 2017 22:45:54 +0000 (19:45 -0300)]
avformat/avc: refactor ff_isom_write_avcc

This lets us remove one indentation level.

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/avc: return an error in ff_isom_write_avcc if the buffer lenght is too small
James Almer [Fri, 24 Nov 2017 22:42:50 +0000 (19:42 -0300)]
avformat/avc: return an error in ff_isom_write_avcc if the buffer lenght is too small

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/dashenc: Option to generate hls playlist as well
Karthick J [Thu, 30 Nov 2017 02:55:51 +0000 (10:55 +0800)]
avformat/dashenc: Option to generate hls playlist as well

This is to take full advantage of Common Media Application Format(CMAF).
Now server can generate one content and serve both HLS and DASH players.

Reviewed-by: Steven Liu <lq@onvideo.cn>
22 months agoavformat/hlsenc: Refactored 'get_int_from_double' function to allow reuse
Karthick J [Thu, 30 Nov 2017 02:54:54 +0000 (10:54 +0800)]
avformat/hlsenc: Refactored 'get_int_from_double' function to allow reuse

22 months agoavcodec/dnxhddec: Do not overwrite colorspace if the container has set it.
Steven Robertson [Wed, 29 Nov 2017 00:49:46 +0000 (16:49 -0800)]
avcodec/dnxhddec: Do not overwrite colorspace if the container has set it.

The existing logic overrides container metadata even in cases where the
container metadata must be trusted (e.g. HDR). The original spec had no
provision for specifying color volume, so many files rely on the
assumption of Rec. 709.

An update to the spec included a 'clv' field for explicitly signaling
that the container should be trusted in an existing bitfield in the
frame header, but the default of 0 from old encoders forces Rec. 709,
which would break any HDR stream. Because there is no place in DNxHR for
specifying a transfer function, DNxHR HDR files must include
container-level color information.

This patch maintains the existing behavior of choosing the 709 over the
601 matrix when container-level information is missing, and allows
container-level information to win if present.

Signed-off-by: Steven Robertson <steven@strobe.cc>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoMerge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'
James Almer [Thu, 30 Nov 2017 00:06:49 +0000 (21:06 -0300)]
Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'

* commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa':
  stereo3d: Support view type for frame sequence type

Merged-by: James Almer <jamrial@gmail.com>
22 months agoMerge commit '45d7be7f930cf707ead07416e10e2d0e061e99ce'
James Almer [Thu, 30 Nov 2017 00:06:23 +0000 (21:06 -0300)]
Merge commit '45d7be7f930cf707ead07416e10e2d0e061e99ce'

* commit '45d7be7f930cf707ead07416e10e2d0e061e99ce':
  prores: Always assume limited range

This commit is a noop, see 755207dc53d6d18a4a9e07ffb0d3a10f75836f79

Merged-by: James Almer <jamrial@gmail.com>
22 months agoMerge commit 'b843b343d8a3210ae37a2342b1904a5bd1e5fc6e'
James Almer [Thu, 30 Nov 2017 00:04:33 +0000 (21:04 -0300)]
Merge commit 'b843b343d8a3210ae37a2342b1904a5bd1e5fc6e'

* commit 'b843b343d8a3210ae37a2342b1904a5bd1e5fc6e':
  qsvenc: cavlc option is only available for h264

Merged-by: James Almer <jamrial@gmail.com>
22 months agoexamples/hw_decode: Use hw-config information to find pixfmt
Mark Thompson [Tue, 28 Nov 2017 13:58:31 +0000 (13:58 +0000)]
examples/hw_decode: Use hw-config information to find pixfmt

This removes all remaining device-type specificity.

22 months agolavc/samidec: properly raise errors from sami_paragraph_to_ass()
Clément Bœsch [Wed, 29 Nov 2017 21:23:36 +0000 (22:23 +0100)]
lavc/samidec: properly raise errors from sami_paragraph_to_ass()

22 months agoavcodec/samidec: check av_strdup() return value
Pan Bian [Mon, 27 Nov 2017 06:56:32 +0000 (14:56 +0800)]
avcodec/samidec: check av_strdup() return value

In function sami_paragraph_to_ass(), the return value of av_strdup() is
not checked. To avoid potential NULL dereference, the return value
should be checked against NULL.

Signed-off-by: Pan Bian <bianpan2016@163.com>
22 months agoavcodec/amfenc: move config.h include where it's needed
James Almer [Wed, 29 Nov 2017 17:24:08 +0000 (14:24 -0300)]
avcodec/amfenc: move config.h include where it's needed

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agovp9_parser: don't split superframes into separate packets
wm4 [Wed, 29 Nov 2017 16:07:26 +0000 (17:07 +0100)]
vp9_parser: don't split superframes into separate packets

We did this for the sake of the decoder. With the vp9 change, it's not
necessary anymore.

22 months agovp9: use superframe split BSF
wm4 [Fri, 17 Nov 2017 13:15:22 +0000 (14:15 +0100)]
vp9: use superframe split BSF

webm usually has invisible superframes merged with normal frames.
(vpxenc muxes them in this form, which is evidence enough that this is
the standard webm packet format. It's rather unclear whether ffmpeg is
even allowed to remux them with split packets.)

The vp9 decoder needs them to be in separate packets for multithreading
to work. Add the BSF to the decoder, so the conversion happens
automatically.

This contains the important part of fa1749dd34c55fb9, which
was apparently skipped in commit d417e95af76. This restores Libav API
compatibility.

22 months agoavformat/hlsplaylist: add missing header includes
James Almer [Wed, 29 Nov 2017 16:09:23 +0000 (13:09 -0300)]
avformat/hlsplaylist: add missing header includes

Fixes checkheaders.

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/hlsplaylist: fix header include guard
James Almer [Wed, 29 Nov 2017 16:02:37 +0000 (13:02 -0300)]
avformat/hlsplaylist: fix header include guard

Fixes fate-source

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/hlsenc: Modularized playlist creation to allow reuse
Karthick J [Wed, 29 Nov 2017 11:44:15 +0000 (19:44 +0800)]
avformat/hlsenc: Modularized playlist creation to allow reuse

22 months agoavcodec/nvenc: set correct error code
Pan Bian [Mon, 27 Nov 2017 01:52:50 +0000 (09:52 +0800)]
avcodec/nvenc: set correct error code

In function process_output_surface(), the return value is 0 on the path
that av_mallocz() returns a NULL pointer. 0 indicates success, which
deviates from the fact. Return "AVERROR(ENOMEM)" instead of "0".

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
22 months agolibavformat/hlsenc: Persistent HTTP connections supported as an option
Jeyapal, Karthick [Wed, 29 Nov 2017 06:33:07 +0000 (14:33 +0800)]
libavformat/hlsenc: Persistent HTTP connections supported as an option

22 months agolibavformat/http: Handled multiple_requests option during write
Jeyapal, Karthick [Wed, 29 Nov 2017 06:32:16 +0000 (14:32 +0800)]
libavformat/http: Handled multiple_requests option during write

22 months agolibavformat/avio: Utility function to return URLContext
Jeyapal, Karthick [Wed, 29 Nov 2017 06:31:34 +0000 (14:31 +0800)]
libavformat/avio: Utility function to return URLContext

22 months agoDon't manipulate duration when it's AV_NOPTS_VALUE.
Dale Curtis [Tue, 28 Nov 2017 22:26:55 +0000 (14:26 -0800)]
Don't manipulate duration when it's AV_NOPTS_VALUE.

This leads to signed integer overflow.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/oggparseopus: Free opus extradata before reallocating.
Dale Curtis [Tue, 28 Nov 2017 21:44:49 +0000 (13:44 -0800)]
avformat/oggparseopus: Free opus extradata before reallocating.

Otherwise ff_alloc_extradata() just leaks any existing allocated
memory.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agolibvpxenc,vp9: add corpus-complexity option
James Zern [Tue, 21 Nov 2017 01:32:23 +0000 (17:32 -0800)]
libvpxenc,vp9: add corpus-complexity option

Corpus VBR mode is a variant of standard VBR where the complexity
distribution midpoint is passed in rather than calculated for a specific
clip or chunk.

The valid range is [0, 10000]. 0 (default) uses standard VBR.

Signed-off-by: James Zern <jzern@google.com>
22 months agoffmpeg_opt: Constify hwaccel pointer.
Carl Eugen Hoyos [Mon, 27 Nov 2017 22:54:33 +0000 (23:54 +0100)]
ffmpeg_opt: Constify hwaccel pointer.

Fixes a warning:
fftools/ffmpeg_opt.c:804:29: warning: assignment discards ‘const’ qualifier from pointer target type

22 months agoAdd HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK
Mikhail Mironov [Mon, 27 Nov 2017 02:36:06 +0000 (21:36 -0500)]
Add HW H.264 and HEVC encoding for AMD GPUs based on AMF SDK

Requires AMF headers for at least version 1.4.4.1.

Signed-off-by: Mikhail Mironov <mikhail.mironov@amd.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
22 months agoexamples: Add a VA-API encode example.
Jun Zhao [Mon, 6 Nov 2017 06:45:27 +0000 (14:45 +0800)]
examples: Add a VA-API encode example.

Supports only raw NV12 input.

Example use:
./vaapi_encode 1920 1080 test.yuv test.h264

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Liu, Kaixuan <kaixuan.liu@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
22 months agoChangelog: add VAAPI VP8 decoder
Mark Thompson [Tue, 28 Nov 2017 21:37:38 +0000 (21:37 +0000)]
Changelog: add VAAPI VP8 decoder

22 months agoavformat/mov: return correct value in mov_read_cmov
Pan Bian [Mon, 27 Nov 2017 03:13:05 +0000 (11:13 +0800)]
avformat/mov: return correct value in mov_read_cmov

On some failure paths, the error code is not correctly set.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavformat/mov: set correct error code in mov_read_custom
Pan Bian [Mon, 27 Nov 2017 03:12:56 +0000 (11:12 +0800)]
avformat/mov: set correct error code in mov_read_custom

In function mov_read_custom(), it returns 0 on the path that av_malloc()
returns a NULL pointer. 0 indicates success. An error code should be
assigned to ret.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavformat/mxfenc: pass MXFPackage around instead of type
Mark Reid [Mon, 27 Nov 2017 05:42:16 +0000 (21:42 -0800)]
avformat/mxfenc: pass MXFPackage around instead of type

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavcodec: set correct return value in ff_mpeg_ref_picture
Pan Bian [Mon, 27 Nov 2017 12:41:10 +0000 (20:41 +0800)]
avcodec: set correct return value in ff_mpeg_ref_picture

In function ff_mpeg_ref_picture(), it returns 0 on the error path that
the return value of av_buffer_ref() is NULL. 0 indicates success, which
seems to deviate from the fact. Set ret to AVERROR(ENOMEM) to propagate
the error status to the callers.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoFree extradata before reallocating.
Dale Curtis [Tue, 21 Nov 2017 23:10:08 +0000 (15:10 -0800)]
Free extradata before reallocating.

Otherwise ff_alloc_extradata() just leaks any existing allocated
memory.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavfilter/drawbox: rename variable for maximum thickness
Gyan Doshi [Mon, 20 Nov 2017 10:06:39 +0000 (15:36 +0530)]
avfilter/drawbox: rename variable for maximum thickness

The present value name for maximum thickness is 'max' which results in a
parse error of any thickness expression containing 'max(val1,val2)'.

Value renamed to 'fill'. Tested locally and documented.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agostereo3d: Support view type for frame sequence type
Vittorio Giovara [Mon, 25 Sep 2017 13:09:21 +0000 (15:09 +0200)]
stereo3d: Support view type for frame sequence type

Implement detection in h264 and hevc and insertion in framepack filter.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
22 months agoprores: Always assume limited range
Vittorio Giovara [Wed, 27 Sep 2017 21:28:55 +0000 (17:28 -0400)]
prores: Always assume limited range

As defined by the specification.

22 months agovf_zscale: Add more supported input properties
Vittorio Giovara [Tue, 28 Nov 2017 18:56:06 +0000 (13:56 -0500)]
vf_zscale: Add more supported input properties

Bump the minimum version necessary in the configure file.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
22 months agovf_zscale: Relax color properties maximum bounds
Vittorio Giovara [Tue, 28 Nov 2017 18:55:47 +0000 (13:55 -0500)]
vf_zscale: Relax color properties maximum bounds

This simplifies adding new values, which are already validated elsewhere.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
22 months agomov: Support mdcv and clli boxes for mastering display an color light level
Vittorio Giovara [Wed, 4 Oct 2017 18:47:54 +0000 (14:47 -0400)]
mov: Support mdcv and clli boxes for mastering display an color light level

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
22 months agoprores: Always assume limited range
Vittorio Giovara [Wed, 27 Sep 2017 19:52:52 +0000 (15:52 -0400)]
prores: Always assume limited range

As defined by the specification.

22 months agoavcodec/videotoolbox: fix SEGV when hwaccel decoding h264 with ffmpeg.c
Aman Gupta [Tue, 28 Nov 2017 16:49:21 +0000 (08:49 -0800)]
avcodec/videotoolbox: fix SEGV when hwaccel decoding h264 with ffmpeg.c

Signed-off-by: Aman Gupta <aman@tmm1.net>
22 months agoavformat/hlsenc: Fixed initial setting for end_pts
Karthick J [Tue, 28 Nov 2017 12:03:15 +0000 (20:03 +0800)]
avformat/hlsenc: Fixed initial setting for end_pts

This patch fixes Bug #6868
Sometimes end_pts is getting initialized to audio stream's
first pts, while the duration is calculated based on video stream's pts.
In this patch the end_pts is initialized with the correct stream's first pts.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Tested-by: beloko
22 months agoavformat/hls: Obey AVProgram discard flags
Anssi Hannula [Sun, 19 Nov 2017 18:11:49 +0000 (20:11 +0200)]
avformat/hls: Obey AVProgram discard flags

Currently HLS demuxer only obeys AVStream discard flags but not
AVProgram (which bandwidth variants appear as) discard flags.

Fix that.

22 months agoavformat/hls: Factor playlist need check to a common function
Anssi Hannula [Sun, 19 Nov 2017 17:30:02 +0000 (19:30 +0200)]
avformat/hls: Factor playlist need check to a common function

22 months agolavu/hwcontext_opencl.h: fix build on macOS
Rodger Combs [Tue, 28 Nov 2017 05:38:46 +0000 (23:38 -0600)]
lavu/hwcontext_opencl.h: fix build on macOS

22 months agoavformat/matroskaenc: add missing allocation failure checks for stream durations
James Almer [Tue, 28 Nov 2017 04:23:23 +0000 (01:23 -0300)]
avformat/matroskaenc: add missing allocation failure checks for stream durations

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavformat/matroskaenc: move some initialization checks to mkv_init
James Almer [Mon, 27 Nov 2017 17:11:21 +0000 (14:11 -0300)]
avformat/matroskaenc: move some initialization checks to mkv_init

It's the correct place for them.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoffmpeg: Check read_ffserver_streams() return value
Pan Bian [Mon, 27 Nov 2017 01:12:54 +0000 (09:12 +0800)]
ffmpeg: Check read_ffserver_streams() return value

The function avformat_alloc_context() will return a NULL pointer on
failure. However, in function read_ffserver_streams(), its return value
is not validated and the subsequent dereference may result in a bad
memory access bug. Check its return value against NULL and avoid
potential NULL dereference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agolibavformat/rtpenc_mpegts: check avformat_new_stream() return value
Pan Bian [Mon, 27 Nov 2017 01:30:53 +0000 (09:30 +0800)]
libavformat/rtpenc_mpegts: check avformat_new_stream() return value

The function avformat_new_stream() returns a NULL pointer on failure.
However, in function rtp_mpegts_write_header(), its return value is not
validated before it is dereferenced. Check the return value against NULL
to avoid potential NULL dereference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavfilter/vf_threshold: use correct linesize
Paul B Mahol [Mon, 27 Nov 2017 17:04:39 +0000 (18:04 +0100)]
avfilter/vf_threshold: use correct linesize

Signed-off-by: Paul B Mahol <onemda@gmail.com>
22 months agoavformat/matroskaenc: actually enforce the stream limit
James Almer [Mon, 27 Nov 2017 16:39:42 +0000 (13:39 -0300)]
avformat/matroskaenc: actually enforce the stream limit

Prevents out of array accesses. Adressess ticket #6873

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavfilter/af_silenceremove: fix possible crash if supplied duration is negative
Paul B Mahol [Mon, 27 Nov 2017 15:32:54 +0000 (16:32 +0100)]
avfilter/af_silenceremove: fix possible crash if supplied duration is negative

Signed-off-by: Paul B Mahol <onemda@gmail.com>
22 months agolavd/alsa: Double maximum alsa buffer size.
Carl Eugen Hoyos [Mon, 27 Nov 2017 13:05:28 +0000 (14:05 +0100)]
lavd/alsa: Double maximum alsa buffer size.

Fixes recording from ATI Wonder 600 USB adapter, regression since e35c674d.

Reported and analyzed by: Marco Paolieri, paolieri at gmail

22 months agoavfilter/af_silenceremove: fix logic error in EOF case
Paul B Mahol [Mon, 27 Nov 2017 12:38:33 +0000 (13:38 +0100)]
avfilter/af_silenceremove: fix logic error in EOF case

Signed-off-by: Paul B Mahol <onemda@gmail.com>
22 months agoavformat/avienc: fix fields-per-frame value for interlaced video streams
Tobias Rapp [Mon, 27 Nov 2017 08:13:05 +0000 (09:13 +0100)]
avformat/avienc: fix fields-per-frame value for interlaced video streams

Writes one set of field framing information for progressive streams and
two sets for interlaced streams. Fixes ticket #6383.

Unfortunately the OpenDML v1.02 document is not very specific on what
value to use for start_line when frame data is not coming from a
capturing device, so this is just using 0/1 depending on the field order
as a best-effort guess.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
22 months agoavcodec/nvdec: More effort to make vp8 compile with gcc < 4.6
Philip Langdale [Mon, 27 Nov 2017 06:18:22 +0000 (22:18 -0800)]
avcodec/nvdec: More effort to make vp8 compile with gcc < 4.6

I'm told my prefix work-around wasn't enough to make it compile,
although I'm not sure why; I did some basic testing and that
approach appeared to work, but I'm not in a position to do a
full compile on CentOS 6 so I can't be sure of anything.

I have had it confirmed that the additional change to not use
named initialisers is enough to make it compile, so let's
throw that into the mix too.

22 months agoavcodec/nvdec: Make vp8 initialisation more 'compatible'
Philip Langdale [Mon, 27 Nov 2017 04:40:32 +0000 (20:40 -0800)]
avcodec/nvdec: Make vp8 initialisation more 'compatible'

Ancient versions of gcc (pre 4.6) can't directly initialise
members of anonymous inner unions/structs by name.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676

Unfortunately, RHEL 6 shipped with one of these ancient
versions and so we're stuck with it until approximately the
heat death of the universe.

Putting explicit braces into the initialisation is possibly a
work-around but the behaviour there was never fully understood
before direct initialisation was made to work.

So, this may or may not work.

22 months agotests/fate-run: Use -bitexact
Michael Niedermayer [Sat, 21 Oct 2017 23:19:59 +0000 (01:19 +0200)]
tests/fate-run: Use -bitexact

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavcodec/mlpdsp: Fix signed integer overflow, 2nd try
Michael Niedermayer [Mon, 20 Nov 2017 17:45:45 +0000 (18:45 +0100)]
avcodec/mlpdsp: Fix signed integer overflow, 2nd try

The outputted bits should match what is used in the lossless check

Fixes: runtime error: signed integer overflow: -538697856 * 256 cannot be represented in type 'int'
Fixes: 4326/clusterfuzz-testcase-minimized-5689449645080576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agolibavformat/mov: Replace duplicate stream_nb check by assert
Michael Niedermayer [Wed, 22 Nov 2017 11:16:57 +0000 (12:16 +0100)]
libavformat/mov: Replace duplicate stream_nb check by assert

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavcodec/h264idct_template: Fix integer overflow in ff_h264_idct8_add
Michael Niedermayer [Mon, 20 Nov 2017 02:08:20 +0000 (03:08 +0100)]
avcodec/h264idct_template: Fix integer overflow in ff_h264_idct8_add

Fixes: signed integer overflow: 452986184 - -2113885312 cannot be represented in type 'int'
Fixes: 4196/clusterfuzz-testcase-minimized-5580648594014208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavcodec/kgv1dec: Check that there is enough input for maximum RLE compression
Michael Niedermayer [Wed, 22 Nov 2017 19:14:54 +0000 (20:14 +0100)]
avcodec/kgv1dec: Check that there is enough input for maximum RLE compression

Fixes: Timeout
Fixes: 4271/clusterfuzz-testcase-4676667768307712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agotests/checkasm/float_dsp: Increase allowed difference for float_dsp.vector_dmul
Michael Niedermayer [Sun, 29 Oct 2017 14:26:50 +0000 (15:26 +0100)]
tests/checkasm/float_dsp: Increase allowed difference for float_dsp.vector_dmul

Tested for 10000 iterations on x86-32

Fixes: Ticket6848

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavcodec/vc1dec: fix preprocessor checks and hw_configs lists for the hwaccels
James Almer [Mon, 27 Nov 2017 01:22:17 +0000 (22:22 -0300)]
avcodec/vc1dec: fix preprocessor checks and hw_configs lists for the hwaccels

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavcodec/mpeg4videodec: fix preprocessor check for the nvdec hwaccel
James Almer [Mon, 27 Nov 2017 01:19:45 +0000 (22:19 -0300)]
avcodec/mpeg4videodec: fix preprocessor check for the nvdec hwaccel

Signed-off-by: James Almer <jamrial@gmail.com>
22 months agoavcodec/nvdec: Implement vp8 hwaccel
Philip Langdale [Sun, 19 Nov 2017 16:42:39 +0000 (08:42 -0800)]
avcodec/nvdec: Implement vp8 hwaccel

22 months agovaapi_decode: Ignore the profile when not useful
Mark Thompson [Sat, 18 Nov 2017 17:52:27 +0000 (17:52 +0000)]
vaapi_decode: Ignore the profile when not useful

Enables VP8 decoding - the decoder places the the bitstream version
in the profile field, which we want to ignore.

22 months agovaapi: Add VP8 decode hwaccel
Mark Thompson [Sat, 18 Nov 2017 17:55:24 +0000 (17:55 +0000)]
vaapi: Add VP8 decode hwaccel

22 months agovp8: Add hwaccel hooks
Mark Thompson [Sat, 18 Nov 2017 17:55:18 +0000 (17:55 +0000)]
vp8: Add hwaccel hooks

Also adds some extra fields to the main context structure that may
be needed by a hwaccel decoder.

The current behaviour of the WebP decoder is maintained by adding an
additional field to the VP8 decoder private context to indicate that
it is actually being used as WebP (no hwaccel is supported for that
case).

22 months agovaapi: Make the decode profile matching more explicit
Mark Thompson [Thu, 9 Nov 2017 01:04:44 +0000 (01:04 +0000)]
vaapi: Make the decode profile matching more explicit

Also fixes a bug where it could attempt to decode with an unsupported
codec if allow-profile-mismatch was set.

22 months agoffmpeg: Use codec hardware config to configure hwaccels
Mark Thompson [Wed, 25 Oct 2017 23:18:47 +0000 (00:18 +0100)]
ffmpeg: Use codec hardware config to configure hwaccels

Removes specific support for all hwaccels supported by the generic code
(DXVA2, D3D11VA, NVDEC, VAAPI and VDPAU).

22 months agolavc: Mark all AVHWAccel structures as const
Mark Thompson [Sat, 4 Nov 2017 18:53:26 +0000 (18:53 +0000)]
lavc: Mark all AVHWAccel structures as const

22 months agolavc: Delete all fake hwaccels
Mark Thompson [Wed, 25 Oct 2017 23:18:46 +0000 (00:18 +0100)]
lavc: Delete all fake hwaccels

They are now unused.

22 months agolavc: Remove register mechanism for hwaccels
Mark Thompson [Wed, 25 Oct 2017 23:18:45 +0000 (00:18 +0100)]
lavc: Remove register mechanism for hwaccels

There is no longer any need for a list of them at runtime, because
decoders now carry the pointers to their associated hwaccels internally.
The file containing external declarations is now used to make the list
of hwaccels for configure.

22 months agolavc: Deprecate av_hwaccel_next() and av_register_hwaccel()
Mark Thompson [Wed, 25 Oct 2017 23:18:44 +0000 (00:18 +0100)]
lavc: Deprecate av_hwaccel_next() and av_register_hwaccel()

22 months agolavc: Use hardware config information in ff_get_format()
Mark Thompson [Wed, 25 Oct 2017 23:18:43 +0000 (00:18 +0100)]
lavc: Use hardware config information in ff_get_format()

This removes the dependency that hardware pixel formats previously had on
AVHWAccel instances, meaning only those which actually do something need
exist after this patch.

Also updates avcodec_default_get_format() to be able to choose hardware
formats if either a matching device has been supplied or no additional
external configuration is required, and avcodec_get_hw_frames_parameters()
to use the hardware config rather than searching the old hwaccel list.

The FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS mechanism is deleted because it
no longer does anything (the codec already contains the pointers to the
matching hwaccels).

22 months agolavc: Add hardware config metadata for decoders supporting hardware output
Mark Thompson [Wed, 25 Oct 2017 23:18:40 +0000 (00:18 +0100)]
lavc: Add hardware config metadata for decoders supporting hardware output

This includes a pointer to the associated hwaccel for decoders using
hwaccels - these will be used later to implement the hwaccel setup
without needing a global list.

Also added is a new file listing all hwaccels as external declarations -
this will be used later to generate the hwaccel list at configure time.

22 months agolavc: Add codec metadata to indicate hardware support
Mark Thompson [Wed, 25 Oct 2017 23:18:39 +0000 (00:18 +0100)]
lavc: Add codec metadata to indicate hardware support

22 months agoavformat/aacdec: Fix leak in adts_aac_read_packet()
Michael Niedermayer [Sat, 25 Nov 2017 18:22:51 +0000 (19:22 +0100)]
avformat/aacdec: Fix leak in adts_aac_read_packet()

Fixes: chromium-773637/clusterfuzz-testcase-minimized-6418078673141760

Found-by: ossfuzz/chromium
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agoavcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi*
Michael Niedermayer [Sat, 25 Nov 2017 02:15:16 +0000 (03:15 +0100)]
avcodec/dirac_dwt: Fix integer overflow in COMPOSE_FIDELITYi*

Fixes: runtime error: signed integer overflow: -2143827186 - 7404944 cannot be represented in type 'int'
Fixes: 4354/clusterfuzz-testcase-minimized-4671122764201984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
22 months agovorbisenc: Check the return value of av_frame_clone
Derek Buitenhuis [Fri, 24 Nov 2017 19:24:41 +0000 (19:24 +0000)]
vorbisenc: Check the return value of av_frame_clone

Prevents a segfault when alloc fails.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
22 months agodoc/ffmpeg: Document opencl for -init_hw_device
Mark Thompson [Sun, 26 Nov 2017 15:35:27 +0000 (15:35 +0000)]
doc/ffmpeg: Document opencl for -init_hw_device

22 months agodoc/fftools: Remove documentation for old -opencl_bench option
Mark Thompson [Sun, 26 Nov 2017 10:29:24 +0000 (10:29 +0000)]
doc/fftools: Remove documentation for old -opencl_bench option