ffmpeg.git
16 months agoh265_metadata: Add option to set the level of the stream
Mark Thompson [Mon, 6 May 2019 21:02:21 +0000 (22:02 +0100)]
h265_metadata: Add option to set the level of the stream

To match the same option in h264_metadata.

16 months agolavc/h265_profile_level: Do not allow high tier at level < 4
Mark Thompson [Mon, 6 May 2019 21:02:20 +0000 (22:02 +0100)]
lavc/h265_profile_level: Do not allow high tier at level < 4

16 months agolavc/h265_profile_level: Fix DPB size calculation
Mark Thompson [Mon, 6 May 2019 21:02:19 +0000 (22:02 +0100)]
lavc/h265_profile_level: Fix DPB size calculation

The maxDpbPicBuf value which is used in the DPB size calculation depends
on the profile (it's usually 6, but 7 for screen-extended profiles).

16 months agoavcodec/cngdec: set .caps_internal
Paul B Mahol [Sun, 7 Jul 2019 09:33:19 +0000 (11:33 +0200)]
avcodec/cngdec: set .caps_internal

16 months agovf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables
Calvin Walton [Fri, 21 Jun 2019 13:08:03 +0000 (09:08 -0400)]
vf_drawtext: Add pkt_pos, pkt_duration, pkt_size as variables

Changes to vf_drawtext.c written by
Calvin Walton <calvin.walton@kepstin.ca>

Changes to filters.texi written by
greg Luce <electron.rotoscope@gmail.com>
with lots of help from Moritz Barsnick and Gyan

Fixes #7947.

16 months agoavcodec/alsdec: Add FF_CODEC_CAP_INIT_CLEANUP
Michael Niedermayer [Thu, 20 Jun 2019 22:47:19 +0000 (00:47 +0200)]
avcodec/alsdec: Add FF_CODEC_CAP_INIT_CLEANUP

Fixes: multiple memleaks
Fixes: 15293/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5642409288925184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavcodec/alsdec: Fix integer overflow with buffer number
Michael Niedermayer [Thu, 20 Jun 2019 22:47:17 +0000 (00:47 +0200)]
avcodec/alsdec: Fix integer overflow with buffer number

Fixes: signed integer overflow: 65313 * 65313 cannot be represented in type 'int'
Fixes: 15290/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5738074249625600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavcodec/alsdec: Fixes signed integer overflow in LSB addition
Michael Niedermayer [Thu, 20 Jun 2019 22:47:16 +0000 (00:47 +0200)]
avcodec/alsdec: Fixes signed integer overflow in LSB addition

Fixes: signed integer overflow: 8 * 536870912 cannot be represented in type 'int'
Fixes: 15281/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5744458785619968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavcodec/alsdec: Check opt_order / sb_length in ra_block handling
Michael Niedermayer [Thu, 20 Jun 2019 22:47:15 +0000 (00:47 +0200)]
avcodec/alsdec: Check opt_order / sb_length in ra_block handling

Fixes: out of array access
Fixes: 15277/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5184853437317120
Fixes: 15280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5741062137577472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavcodec/alsdec: Fix integer overflow with shifting samples
Michael Niedermayer [Wed, 19 Jun 2019 21:27:21 +0000 (23:27 +0200)]
avcodec/alsdec: Fix integer overflow with shifting samples

Fixes: signed integer overflow: -346039050 * 8 cannot be represented in type 'int'
Fixes: 15283/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5692700268953600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavcodec/alsdec: Fix undefined behavior in decode_rice()
Michael Niedermayer [Wed, 19 Jun 2019 21:17:31 +0000 (23:17 +0200)]
avcodec/alsdec: Fix undefined behavior in decode_rice()

Fixes: left shift of 72 by 26 places cannot be represented in type 'int'
Fixes: 15279/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5700665621348352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavcodec/alsdec: Fixes invalid shifts in read_var_block_data() and INTERLEAVE_OUTPUT()
Michael Niedermayer [Wed, 19 Jun 2019 19:53:43 +0000 (21:53 +0200)]
avcodec/alsdec: Fixes invalid shifts in read_var_block_data() and INTERLEAVE_OUTPUT()

Fixes: left shift of negative value -6
Fixes: 15275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5742361767837696
Fixes: signed integer overflow: 41582592 * 256 cannot be represented in type 'int'
Fixes: 15296/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5739558227935232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agomatroskadec: Fix overflow introduced in a569a7b3
Andreas Rheinhardt [Sat, 6 Jul 2019 16:59:22 +0000 (18:59 +0200)]
matroskadec: Fix overflow introduced in a569a7b3

This commit fixes an overflow introduced in a569a7b3 that affected EBML
elements that the Matroska demuxer doesn't want to parse like CRC-32
elements. The return value of avio_skip (the new position on success or
an AVERROR on failure) has been assigned to an integer which meant that
new positions in the range of 2GB to 4GB-1 etc. were considered errors.

Fixes ticket #8001.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
16 months agoavfilter/af_afftfilt: remove invalid scaling
Paul B Mahol [Sat, 6 Jul 2019 10:01:38 +0000 (12:01 +0200)]
avfilter/af_afftfilt: remove invalid scaling

16 months agodoc/filters: Document missing options for scale in/out color matrix
Jun Zhao [Fri, 5 Jul 2019 04:26:43 +0000 (12:26 +0800)]
doc/filters: Document missing options for scale in/out color matrix

Document missing options for scale in/out color matrix

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
16 months agolavfi/scale: Add sub-options for in_color_matrix/out_color_matrix
Jun Zhao [Fri, 5 Jul 2019 04:00:12 +0000 (12:00 +0800)]
lavfi/scale: Add sub-options for in_color_matrix/out_color_matrix

Add sub-options for in_color_matrix/out_color_matrix

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
16 months agoavcodec/hevc_ps: fix range of num_tile_{columns,rows}_minus1
James Almer [Sun, 30 Jun 2019 20:32:44 +0000 (17:32 -0300)]
avcodec/hevc_ps: fix range of num_tile_{columns,rows}_minus1

From 7.4.3.3.1:

num_tile_columns_minus1 shall be in the range of 0 to PicWidthInCtbsY - 1, inclusive.
num_tile_rows_minus1 shall be in the range of 0 to PicHeightInCtbsY - 1, inclusive.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
16 months agoavformat/rpl: Calculate the duration of the video track
Cameron Cawley [Sat, 29 Jun 2019 23:00:44 +0000 (00:00 +0100)]
avformat/rpl: Calculate the duration of the video track

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavformat/rpl: Allow a file to have audio, but not video
Cameron Cawley [Fri, 14 Jun 2019 19:51:34 +0000 (20:51 +0100)]
avformat/rpl: Allow a file to have audio, but not video

Signed-off-by: Cameron Cawley <ccawley2011@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavformat/rpl: Fix detection of 8-bit linear formats
Cameron Cawley [Fri, 14 Jun 2019 19:51:33 +0000 (20:51 +0100)]
avformat/rpl: Fix detection of 8-bit linear formats

Was previously broken by commit 8cf5f94.
Fixes ticket #7859

Signed-off-by: Cameron Cawley <ccawley2011@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16 months agoavfilter/vf_lut: fix regression with >8bit planar filtering
Paul B Mahol [Fri, 5 Jul 2019 10:51:29 +0000 (12:51 +0200)]
avfilter/vf_lut: fix regression with >8bit planar filtering

16 months agoavformat/dashdec: fix code style in dash_read_packet
Steven Liu [Fri, 5 Jul 2019 03:52:49 +0000 (11:52 +0800)]
avformat/dashdec: fix code style in dash_read_packet

16 months agodoc/muxers: fix docs format for DASH muxer
Jun Zhao [Fri, 28 Jun 2019 13:09:25 +0000 (21:09 +0800)]
doc/muxers: fix docs format for DASH muxer

fix docs format for DASH muxer

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
16 months agoavformat/dashdec: refine and fix code style of dash_read_header
Steven Liu [Thu, 4 Jul 2019 08:11:47 +0000 (16:11 +0800)]
avformat/dashdec: refine and fix code style of dash_read_header

move the temp variable to the top of the expression paragraph
rename the pls to rep(representation)

16 months agoavformat/dashdec: simplified code in open_demux_for_component
Steven Liu [Thu, 4 Jul 2019 07:08:41 +0000 (15:08 +0800)]
avformat/dashdec: simplified code in open_demux_for_component

change from pls->ctx->streams[i]->codecpar to ist->codecpar

Signed-off-by: Steven Liu <lq@onvideo.cn>
16 months agolibavfilter/vf_colorspace.c: fix demarcation point of gamma linearize function
Yonglin Luo [Wed, 3 Jul 2019 02:05:36 +0000 (10:05 +0800)]
libavfilter/vf_colorspace.c: fix demarcation point of gamma linearize function

The linearize function (usually refered to EOTF) is the inverse of
delinearize function (usually referred to OETF). Demarcation point of
EOTF should be beta*delta, but the actual value used now in the source
code is beta.

For ITU Rec.709, they are 0.081 (0.018*4.5) and 0.018 respectively
(beta = 0.018 and delta = 4.5), and they correspond to pixel value 5
and 21 for an 8-bit image. Linearized result of pixel within that range
(5-21) will be different, but this commit will make linearize function
of the filter more accurate in the mathematical sense.

Signed-off-by: Yonglin Luo <vincenluo@tencent.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
16 months agoavfilter/vf_lut2: use time_base from framesync
Paul B Mahol [Wed, 3 Jul 2019 12:52:44 +0000 (14:52 +0200)]
avfilter/vf_lut2: use time_base from framesync

Fixes non-monotonous timestamps.

16 months agoavfilter/vf_midequalizer: use time_base from framesync
Paul B Mahol [Wed, 3 Jul 2019 12:49:16 +0000 (14:49 +0200)]
avfilter/vf_midequalizer: use time_base from framesync

Fixes non-monotonous timestamps.

16 months agoavfilter/vf_blend: use time_base from framesync
Paul B Mahol [Wed, 3 Jul 2019 12:42:54 +0000 (14:42 +0200)]
avfilter/vf_blend: use time_base from framesync

Fixes non-monotonous timestamps.

16 months agoavfilter/vf_maskedclamp: use time_base from framesync
Paul B Mahol [Wed, 3 Jul 2019 12:38:05 +0000 (14:38 +0200)]
avfilter/vf_maskedclamp: use time_base from framesync

Fixes non-monotonous timestamps.

16 months agoavfilter/vf_maskedmerge: use time_base from framesync
Paul B Mahol [Wed, 3 Jul 2019 12:35:18 +0000 (14:35 +0200)]
avfilter/vf_maskedmerge: use time_base from framesync

Fixes non-monotonous timestamps.

16 months agoifv: populate creation_time
Peter Ross [Mon, 1 Jul 2019 12:00:24 +0000 (22:00 +1000)]
ifv: populate creation_time

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Peter Ross <pross@xvid.org>
16 months agoavfilter/af_deesser: remove extra ;
Paul B Mahol [Wed, 3 Jul 2019 06:53:35 +0000 (08:53 +0200)]
avfilter/af_deesser: remove extra ;

16 months agolavf/dump: More disposition flag dump
Jun Zhao [Wed, 19 Jun 2019 13:13:42 +0000 (21:13 +0800)]
lavf/dump: More disposition flag dump

More disposition flag dump

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
16 months agoffmpeg_opt: Respect default disposition when select audio/video
Jun Zhao [Thu, 20 Jun 2019 04:30:37 +0000 (12:30 +0800)]
ffmpeg_opt: Respect default disposition when select audio/video

Respect default disposition when select audio/video

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
16 months agolavf/utils: Respect default disposition when select the AVStream
Jun Zhao [Thu, 20 Jun 2019 04:26:27 +0000 (12:26 +0800)]
lavf/utils: Respect default disposition when select the AVStream

Respect default disposition when select the AVStream

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
17 months agoavfilter: add deesser audio filter
Paul B Mahol [Sun, 30 Jun 2019 14:35:07 +0000 (16:35 +0200)]
avfilter: add deesser audio filter

17 months agoavfilter/af_silenceremove: use input timestamp for timestamp recalculation
Paul B Mahol [Tue, 2 Jul 2019 16:06:28 +0000 (18:06 +0200)]
avfilter/af_silenceremove: use input timestamp for timestamp recalculation

17 months agodoc/filters: update how to generate native model for sr filter
Guo, Yejun [Thu, 13 Jun 2019 05:30:44 +0000 (13:30 +0800)]
doc/filters: update how to generate native model for sr filter

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
17 months agotools/python: add script to convert TensorFlow model (.pb) to native model (.model)
Guo, Yejun [Thu, 13 Jun 2019 05:30:38 +0000 (13:30 +0800)]
tools/python: add script to convert TensorFlow model (.pb) to native model (.model)

For example, given TensorFlow model file espcn.pb,
to generate native model file espcn.model, just run:
python convert.py espcn.pb

In current implementation, the native model file is generated for
specific dnn network with hard-code python scripts maintained out of ffmpeg.
For example, srcnn network used by vf_sr is generated with
https://github.com/HighVoltageRocknRoll/sr/blob/master/generate_header_and_model.py#L85

In this patch, the script is designed as a general solution which
converts general TensorFlow model .pb file into .model file. The script
now has some tricky to be compatible with current implemention, will
be refined step by step.

The script is also added into ffmpeg source tree. It is expected there
will be many more patches and community needs the ownership of it.

Another technical direction is to do the conversion in c/c++ code within
ffmpeg source tree. While .pb file is organized with protocol buffers,
it is not easy to do such work with tiny c/c++ code, see more discussion
at http://ffmpeg.org/pipermail/ffmpeg-devel/2019-May/244496.html. So,
choose the python script.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
17 months agolibavformat/subfile: Improve AVSEEK_SIZE/SEEK_END seeking
Andreas Rheinhardt [Thu, 20 Jun 2019 04:33:41 +0000 (06:33 +0200)]
libavformat/subfile: Improve AVSEEK_SIZE/SEEK_END seeking

The subfile protocol treats an end of 0 as meaning "until EOF"; this got
implemented by simply setting the end to INT64_MAX. But seeking relative
to EOF or AVSEEK_SIZE seeking hasn't been adapted; the result is that
e.g. the duration of transport streams isn't correctly determined when
this option is used. This is fixed in this patch.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
17 months agolavc/mjpegdec: make code aligned
Zhong Li [Thu, 27 Jun 2019 08:58:24 +0000 (16:58 +0800)]
lavc/mjpegdec: make code aligned

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Zhong Li <zhong.li@intel.com>
17 months agolavc/mjpegdec: replace number with marker name
Zhong Li [Thu, 27 Jun 2019 08:58:23 +0000 (16:58 +0800)]
lavc/mjpegdec: replace number with marker name

Make it easier to read.

Signed-off-by: Zhong Li <zhong.li@intel.com>
17 months agolavc/qsvenc: fix the incorrent map from bits to bytes
Zhong Li [Fri, 28 Jun 2019 05:18:43 +0000 (13:18 +0800)]
lavc/qsvenc: fix the incorrent map from bits to bytes

Reported-by:Maggie Sun <maggie.sun@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
17 months agoavformat/dashdec: Fix reading values from SegmentTimeline inside Period
sfan5 [Mon, 1 Jul 2019 03:06:06 +0000 (11:06 +0800)]
avformat/dashdec: Fix reading values from SegmentTimeline inside Period

This was missed in commit e752da546463e693865d92a837fc0e8d2b28db2e.

17 months agoavformat/hlsenc: changing all filename length to MAX_URL_SIZE
Bela Bodecs [Mon, 1 Jul 2019 02:24:21 +0000 (10:24 +0800)]
avformat/hlsenc: changing all filename length to MAX_URL_SIZE

Throughout hlsenc code, all filename related buffer lengths are set
hardcoded as 1024. This PATCH change it to general value as MAX_URL_SIZE
in internal.h

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
17 months agoavcodec/hevc_ps: Change num_tile_rows/columns checks to sps->ctb_height/weight
Michael Niedermayer [Tue, 25 Jun 2019 08:29:57 +0000 (10:29 +0200)]
avcodec/hevc_ps: Change num_tile_rows/columns checks to sps->ctb_height/weight

Suggested-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/hevc_ps: Fix integer overflow with num_tile_rows and num_tile_columns
Michael Niedermayer [Thu, 13 Jun 2019 13:05:54 +0000 (15:05 +0200)]
avcodec/hevc_ps: Fix integer overflow with num_tile_rows and num_tile_columns

Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 14880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5130977304641536

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/apedec: Add k < 24 check to the only k++ case which lacks such a check
Michael Niedermayer [Sun, 16 Jun 2019 09:26:57 +0000 (11:26 +0200)]
avcodec/apedec: Add k < 24 check to the only k++ case which lacks such a check

Fixes: 15255/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5718831688843264
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavformat/aviobuf: Delay buffer downsizing until asserts are met
Michael Niedermayer [Sun, 9 Jun 2019 20:04:16 +0000 (22:04 +0200)]
avformat/aviobuf: Delay buffer downsizing until asserts are met

Fixes: Assertion failure
Fixes: 15151/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5757079496687616
Fixes: 15205/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5767573242642432
May fix: Ticket7094

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/fitsdec: Check data_min/max
Michael Niedermayer [Wed, 12 Jun 2019 22:24:53 +0000 (00:24 +0200)]
avcodec/fitsdec: Check data_min/max

Fixes: division by 0
Fixes: 15206/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5657260212092928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/m101: Fix off be 2 error
Michael Niedermayer [Mon, 17 Jun 2019 19:13:17 +0000 (21:13 +0200)]
avcodec/m101: Fix off be 2 error

Fixes: out of array read
Fixes: 15263/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_M101_fuzzer-5728999453491200

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/qdm2: Move fft_order check up
Michael Niedermayer [Mon, 17 Jun 2019 18:58:47 +0000 (20:58 +0200)]
avcodec/qdm2: Move fft_order check up

This avoids undefined computations with unchecked values

Fixes: shift exponent -21 is negative
Fixes: 15262/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5651261753393152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/libvorbisdec: Check extradata size
Michael Niedermayer [Mon, 17 Jun 2019 19:26:45 +0000 (21:26 +0200)]
avcodec/libvorbisdec: Check extradata size

Fixes: out of array read
Fixes: 15261/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVORBIS_fuzzer-5764908467093504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavformat/vqf: Check header_size
Michael Niedermayer [Tue, 18 Jun 2019 21:17:23 +0000 (23:17 +0200)]
avformat/vqf: Check header_size

Fixes: 15271/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5735262606327808
Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/atrac9dec: Check q_unit_cnt in parse_band_ext()
Michael Niedermayer [Sun, 16 Jun 2019 19:01:50 +0000 (21:01 +0200)]
avcodec/atrac9dec: Check q_unit_cnt in parse_band_ext()

Fixes: global-buffer-overflow
Fixes: 15247/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5671602181636096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/atrac9dec: Check that the reused block has succeeded initilization
Michael Niedermayer [Sun, 16 Jun 2019 18:56:20 +0000 (20:56 +0200)]
avcodec/atrac9dec: Check that the reused block has succeeded initilization

Fixes: global-buffer-overflow
Fixes: 15247/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5671602181636096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavutil: add FF_DECODE_ERROR_DECODE_SLICES for AVFrame.decode_error_flags
Amir Pauker [Fri, 28 Jun 2019 09:21:18 +0000 (02:21 -0700)]
avutil: add FF_DECODE_ERROR_DECODE_SLICES for AVFrame.decode_error_flags

Signed-off-by: Amir Pauker <amir@livelyvideo.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/cfhd: add back alpha processing removed in 9cefb9e7ec
Paul B Mahol [Fri, 28 Jun 2019 17:39:55 +0000 (19:39 +0200)]
avcodec/cfhd: add back alpha processing removed in 9cefb9e7ec

Fixes #7886.

17 months agoavformat/hlsenc: temp_file usage for master playlist and vtt playlist
Bela Bodecs [Fri, 28 Jun 2019 05:54:27 +0000 (13:54 +0800)]
avformat/hlsenc: temp_file usage for master playlist and vtt playlist

currently master playlist and subtitle playlist creation does not use
temporary files even when temp_file flag is set. Most of the use cases
it is not a problem because master playlist creation happens once on the
beginning of the whole process. But if master playlist is periodically
re-created because of master_pl_refresh_rate is set, non-atomic playlist
creation may cause problems in case of live streaming. This patch
correct this behavior by adding this functionality.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
17 months agolibavformat/mux: Fix mixed delarations and code
Andreas Rheinhardt [Thu, 27 Jun 2019 17:47:23 +0000 (19:47 +0200)]
libavformat/mux: Fix mixed delarations and code

This commit fixes mixed declarations and code introduced in 1889e316.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
17 months agoavformat/sccdec: display last caption even when there is no empty last line
Paul B Mahol [Thu, 27 Jun 2019 18:20:16 +0000 (20:20 +0200)]
avformat/sccdec: display last caption even when there is no empty last line

17 months agohlsenc: Add option to set custom HTTP headers
Derek Buitenhuis [Fri, 21 Jun 2019 13:26:20 +0000 (14:26 +0100)]
hlsenc: Add option to set custom HTTP headers

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
17 months agoavcodec/utils: Check bits_per_coded_sample
Michael Niedermayer [Tue, 18 Jun 2019 21:55:56 +0000 (23:55 +0200)]
avcodec/utils: Check bits_per_coded_sample

This avoids the need for each decoder separately having to handle this case

Fixes: shift exponent -100663046 is negative
Fixes: out of array access
Fixes: 15270/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5727829913763840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/videodsp_template: Fix overflow of addition
Michael Niedermayer [Fri, 14 Jun 2019 22:47:06 +0000 (00:47 +0200)]
avcodec/videodsp_template: Fix overflow of addition

Fixes: addition of unsigned offset to 0x7f56fc26a9b6 overflowed to 0x7f56fc26a8be*
Fixes: clusterfuzz-testcase-minimized-mediasource_MP4_AVC1_pipeline_integration_fuzzer-4917949056679936

Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/alsdec: Fix invalid shift in multiply()
Michael Niedermayer [Thu, 20 Jun 2019 17:09:11 +0000 (19:09 +0200)]
avcodec/alsdec: Fix invalid shift in multiply()

Fixes: shift exponent -24 is negative
Fixes: 15292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5768533318828032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/4xm: Fix vlc memleak
Michael Niedermayer [Thu, 20 Jun 2019 21:58:47 +0000 (23:58 +0200)]
avcodec/4xm: Fix vlc memleak

Fixes: memleak
Fixes: 15297/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5746203548975104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/ffwavesynth: Check ts_end - ts_start for overflow
Michael Niedermayer [Sun, 16 Jun 2019 14:12:42 +0000 (16:12 +0200)]
avcodec/ffwavesynth: Check ts_end - ts_start for overflow

Fixes: signed integer overflow: 2314885530818453536 - -8926099139098304480 cannot be represented in type 'long'
Fixes: 15259/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5764366093254656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/vc1dsp: Avoid undefined shifts in vc1_v_s_overlap_c / vc1_h_s_overlap_c
Michael Niedermayer [Sun, 16 Jun 2019 14:17:12 +0000 (16:17 +0200)]
avcodec/vc1dsp: Avoid undefined shifts in vc1_v_s_overlap_c / vc1_h_s_overlap_c

Fixes: left shift of negative value -13
Fixes: 15260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5702076048343040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/tta: Fix undefined shift
Michael Niedermayer [Sun, 16 Jun 2019 13:55:55 +0000 (15:55 +0200)]
avcodec/tta: Fix undefined shift

Fixes: left shift of negative value -4483
Fixes: 15256/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TTA_fuzzer-5738691617619968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/qdmc: Fix integer overflows in PRNG
Michael Niedermayer [Sun, 16 Jun 2019 13:53:27 +0000 (15:53 +0200)]
avcodec/qdmc: Fix integer overflows in PRNG

Fixes: signed integer overflow: 214013 * 2531011 cannot be represented in type 'int'
Fixes: 15254/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDMC_fuzzer-5698137026461696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/rv10: Avoid calculating undefined value that is unused
Michael Niedermayer [Sun, 16 Jun 2019 10:52:30 +0000 (12:52 +0200)]
avcodec/rv10: Avoid calculating undefined value that is unused

Fixes: shift exponent 64 is too large for 32-bit type 'int'
Fixes: 15253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV10_fuzzer-5671114300194816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/bintext: Check font height
Michael Niedermayer [Sun, 16 Jun 2019 14:01:45 +0000 (16:01 +0200)]
avcodec/bintext: Check font height

Fixes: division by zero
Fixes: 15257/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINTEXT_fuzzer-5757352881422336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/binkdsp: Fix integer overflows in idct
Michael Niedermayer [Tue, 18 Jun 2019 12:28:17 +0000 (14:28 +0200)]
avcodec/binkdsp: Fix integer overflows in idct

Fixes: signed integer overflow: 3784 * 682038 cannot be represented in type 'int'
Fixes: 15265/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5088311799971840
Fixes: 15268/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5666502344179712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/bink: Fix integer overflow in unquantize_dct_coeffs()
Michael Niedermayer [Tue, 18 Jun 2019 12:28:17 +0000 (14:28 +0200)]
avcodec/bink: Fix integer overflow in unquantize_dct_coeffs()

Fixes: signed integer overflow: -3447 * 2883584 cannot be represented in type 'int'
Fixes: 15265/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5088311799971840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agolibavformat/mux: Fix audio_preload
Andreas Rheinhardt [Mon, 24 Jun 2019 21:16:18 +0000 (23:16 +0200)]
libavformat/mux: Fix audio_preload

Commit 31f9032b added the audio_preload feature; its goal is to
interleave audio earlier than the rest. Unfortunately, it has never ever
worked, because the check for whether a packet should be interleaved
before or after another packet was completely wrong: When audio_preload
vanishes, interleave_compare_dts returns 1 if the new packet should be
interleaved earlier than the packet it is compared with and that is what
the rest of the code expects. But the codepath used when audio_preload is
set does the opposite.

Also fixes potential undefined behaviour (namely signed integer
overflow).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavformat/oggparseogm: sync avctx w/ codecpar
Chris Cunningham [Thu, 7 Feb 2019 01:13:03 +0000 (17:13 -0800)]
avformat/oggparseogm: sync avctx w/ codecpar

Codec information may change while reading ogg packets. Update the
stream's internal avctx to match.

17 months agoChangelog: add derain filter into Changelog
Xuewei Meng [Tue, 25 Jun 2019 15:04:23 +0000 (23:04 +0800)]
Changelog: add derain filter into Changelog

17 months agoavcodec/motionpixels: Check for vlc error in mp_get_vlc()
Michael Niedermayer [Sat, 15 Jun 2019 19:08:31 +0000 (21:08 +0200)]
avcodec/motionpixels: Check for vlc error in mp_get_vlc()

Fixes: 15246/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOTIONPIXELS_fuzzer-5168534407086080
Fixes: runtime error: index -1 out of bounds for type 'HuffCode [16]'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/loco: Limit lossy parameter so it is sane and does not overflow
Michael Niedermayer [Sat, 15 Jun 2019 19:47:16 +0000 (21:47 +0200)]
avcodec/loco: Limit lossy parameter so it is sane and does not overflow

Fixes: 15248/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LOCO_fuzzer-5087440458481664
Fixes: signed integer overflow: 3 + 2147483647 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavformat/mov: Set fragment.found_tfhd only after TFHD has been parsed
Michael Niedermayer [Fri, 14 Jun 2019 22:12:36 +0000 (00:12 +0200)]
avformat/mov: Set fragment.found_tfhd only after TFHD has been parsed

Fixes: Assertion failure
Fixes: crbug971646.mp4

Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavformat/img2dec: Fix probe_buffer leak in ff_img_read_header()
Michael Niedermayer [Wed, 12 Jun 2019 19:20:04 +0000 (21:20 +0200)]
avformat/img2dec: Fix probe_buffer leak in ff_img_read_header()

Fixes: memleak
Fixes: 15171/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5683881644130304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/xpmdec: Do not use context dimensions as temporary variables
Michael Niedermayer [Wed, 12 Jun 2019 18:13:34 +0000 (20:13 +0200)]
avcodec/xpmdec: Do not use context dimensions as temporary variables

Fixes: Integer overflow
Fixes: 15134/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XPM_fuzzer-5722635939348480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavformat/vividas: check length in read_vblock()
Michael Niedermayer [Wed, 12 Jun 2019 12:49:11 +0000 (14:49 +0200)]
avformat/vividas: check length in read_vblock()

Fixes: out of array access
Fixes: 15166/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5731062396747776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/fitsdec: Fix division by 0 in size check
Michael Niedermayer [Thu, 13 Jun 2019 14:08:03 +0000 (16:08 +0200)]
avcodec/fitsdec: Fix division by 0 in size check

Fixes: division by zero
Fixes: 15210/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5746033243455488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/aacpsdsp_template: Fix integer overflow in ps_hybrid_analysis_c()
Michael Niedermayer [Thu, 13 Jun 2019 13:00:14 +0000 (15:00 +0200)]
avcodec/aacpsdsp_template: Fix integer overflow in ps_hybrid_analysis_c()

Fixes: signed integer overflow: -1539565182 + -798086761 cannot be represented in type 'int'
Fixes: 14807/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-564925382682214

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/truemotion2: Fix integer overflow in last loop in tm2_update_block()
Michael Niedermayer [Thu, 13 Jun 2019 17:45:50 +0000 (19:45 +0200)]
avcodec/truemotion2: Fix integer overflow in last loop in tm2_update_block()

Fixes: signed integer overflow: -1727985666 - 538976288 cannot be represented in type 'int'
Fixes: 15031/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5100228035739648

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavcodec/pngdec: Check input space
Michael Niedermayer [Tue, 14 May 2019 18:23:48 +0000 (20:23 +0200)]
avcodec/pngdec: Check input space

Fixes: Timeout (33sec -> 78ms)
Fixes: 14668/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LSCR_fuzzer-5767073352908800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
17 months agoavformat/dashenc: split extension for MP4 into .mp4 or .m4s
Alfred E. Heggestad [Mon, 24 Jun 2019 10:50:34 +0000 (12:50 +0200)]
avformat/dashenc: split extension for MP4 into .mp4 or .m4s

17 months agolavf/qsv_scale: add scaling modes support
Zhong Li [Tue, 18 Jun 2019 07:52:29 +0000 (15:52 +0800)]
lavf/qsv_scale: add scaling modes support

low_power mode will use a fixed HW engine (SFC), thus can offload EU usage.
high quality mode will take EU usage (AVS sampler).

Performance and EU usage (Render usage) comparsion on Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz:

High quality mode : ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal_2000frames.h264 \
-vf scale_qsv=w=1280:h=736:mode=hq -f null -
fps=389
RENDER usage: 28.10 (provided by MSDK metrics_monitor)

Low Power mode: ffmpeg -hwaccel qsv -c:v h264_qsv -i ~/bbb_sunflower_1080p_30fps_normal_2000frames.h264 \
-vf scale_qsv=w=1280:h=736:mode=low_power -f null -
fps=343
RENDER usage: 0.00

Low power mode (SFC) may be disabled if not supported by
MSDK/Driver/HW, and replaced by AVS mode interanlly.

Signed-off-by: Zhong Li <zhong.li@intel.com>
17 months agomovsub_bsf: Fix mov2textsub regression
Andreas Rheinhardt [Sun, 23 Jun 2019 04:46:12 +0000 (06:46 +0200)]
movsub_bsf: Fix mov2textsub regression

The mov flavour of timed text uses the first two bytes of the packet as
a length field. And up until 11bef2fe said length field has been read
correctly in the mov2textsub bsf. But since then the next two bytes are
read as if they were the length field. This is fixed in this commit.

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
17 months agolavf/flvenc: add automatic bitstream filtering
Jun Zhao [Sat, 22 Jun 2019 08:50:31 +0000 (16:50 +0800)]
lavf/flvenc: add automatic bitstream filtering

add automatic bitstream filtering when mux AAC

Reported-by: Yabo Wei weiyabogeijing@gmail.com
Reviewed-by: Steven Liu<lq@onvideo.cn>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
17 months agoavformat/matroskadec: Improve error/EOF checks III
Andreas Rheinhardt [Sun, 23 Jun 2019 23:42:31 +0000 (01:42 +0200)]
avformat/matroskadec: Improve error/EOF checks III

Up until now, when an element was skipped, it was relied upon
ffio_limit to make sure that there is enough data available to skip.
ffio_limit itself relies upon the availability of the file's size. As
this needn't be available, the check has been refined: First one byte
less than intended is skipped, then another byte is read, followed by a
check of the error flags.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
17 months agoavformat/matroskadec: Improve read error/EOF checks II
Andreas Rheinhardt [Sun, 23 Jun 2019 23:42:30 +0000 (01:42 +0200)]
avformat/matroskadec: Improve read error/EOF checks II

This commit fixes a number of bugs:

1. There was no check that no read error/EOF occured during
ebml_read_uint, ebml_read_sint and ebml_read_float.
2. ebml_read_ascii and ebml_read_binary did sometimes not forward
error codes; instead they simply returned AVERROR(EIO).
3. In particular, AVERROR_EOF hasn't been used and no dedicated error
message for it existed. This has been changed.

In order to reduce code duplication, the new error code NEEDS_CHECKING
has been introduced which makes ebml_parse check the AVIOContext's
status for errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
17 months agoavformat/matroskadec: Improve read error/EOF checks I
Andreas Rheinhardt [Tue, 25 Jun 2019 01:08:56 +0000 (03:08 +0200)]
avformat/matroskadec: Improve read error/EOF checks I

ebml_read_num had a number of flaws:

1. The check for read errors/EOF was totally wrong. E.g. an EBML number
beginning with the invalid 0x00 would be considered a read error,
although it is just invalid data.
2. The check for read errors/EOF was done just once, after reading the
first byte of the EBML number. But errors/EOF can happen inbetween, of
course, and this wasn't checked.
3. There was no way to distinguish when EOF should be an error (because
the data has to be there) for which an error message should be emitted
and when it is not necessarily an error (namely during parsing of EBML
IDs). Such a possibility has been added and used.

All this was fixed; furthermore, the error messages for invalid EBML
numbers were improved and useless initializations were removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
17 months agoavformat/matroskadec: Properly check return values
Andreas Rheinhardt [Thu, 16 May 2019 22:29:54 +0000 (00:29 +0200)]
avformat/matroskadec: Properly check return values

Up until now, webm_dash_manifest_cues used the return values of
ebml_read_num and ebml_read_length without checking for errors,
i.e. return values < 0. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
17 months agoavformat/matroskadec: Don't zero unnecessarily
Andreas Rheinhardt [Thu, 16 May 2019 22:29:48 +0000 (00:29 +0200)]
avformat/matroskadec: Don't zero unnecessarily

It is only necessary to zero the initial allocated memory used to store
the size of laced frames if the block used Xiph lacing. Otherwise no
unintialized data was ever used, so use av_malloc instead of av_mallocz.

Also use the correct type for the allocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
17 months agoconfigure: print_in_columns: Replace pr with awk
Alexander Strasser [Sat, 27 Apr 2019 21:15:08 +0000 (23:15 +0200)]
configure: print_in_columns: Replace pr with awk

Get rid of pr dependency and write the columns strictly
alphabetical without page size considerations (POSIX
specifies 66 lines as default).

Setting the page size via pr's -l option was considered,
but as there is issue #5680 which wants to avoid pr
mainly because it's not in busybox, we chose to replace
pr instead.

Before pr would attempt to write pages, thus if a page
boundary was reached, the output looked confusing as one
couldn't see there was a new page and the alphabetical
order was disrupted when scanning down one of the columns.

This change is based on a shell implementation submitted
before by Yejun.

Possible differences to the current version using pr:
1. pr implementations should truncate items to not overflow columns;
   depending on how it's done not truncating shall be better IMHO.
2. pr implementations might balance columns differently;
   we use minimum number of lines and might end up not
   using all columns or might have lesser entries in the
   last column(s)
3. we use spaces only for padding the columns; at least the GNU pr
   version on my system also by default stuffs in tabs in addition
   to a single space in between columns. I don't see that this
   behaviour is demanded by POSIX, though I might be very well
   overlooking things. Anyway for our use case I can't see a need
   for having the additional tabs, or why it would be better compared
   to padding with spaces only.

Fixes output for sizes with width < column width, too.

Fixes remaining part of ticket #5680

Contributor: Guo, Yejun <yejun.guo@intel.com>

17 months agoavformat/hlsenc: better error log message for var_stream_map content
Bela Bodecs [Sat, 22 Jun 2019 13:55:54 +0000 (15:55 +0200)]
avformat/hlsenc: better error log message for var_stream_map content

When multiple variant streams are specified by var_stream_map option,
%v is expected either in the filename or in the last sub-directory name,
but only in one of them. When both of them contains %v string, current
error message only states half of the truth.
And even %v may appears several times inside the last sub-directory name
or in filename pattern.
This patch clarifies this in the log message and in the doc also.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
17 months agoavformat/matroskadec: Treat SimpleBlock as EBML_BIN
Andreas Rheinhardt [Thu, 16 May 2019 22:30:00 +0000 (00:30 +0200)]
avformat/matroskadec: Treat SimpleBlock as EBML_BIN

Up until now, the SimpleBlock was treated specially: It basically had
its own EBML category and it was also included in the BlockGroup EBML
syntax (although a SimpleBlock must not exist in a BlockGroup according
to the Matroska specifications). The latter fact also meant that
a MatroskaBlock's buffer was always unreferenced twice.
This has been changed: The type of a SimpleBlock is now an EBML_BIN.
The only way in which SimpleBlocks are still different is that they
share their associated structure with another unit (namely BlockGroup).
This is also used to unref the block: It is always unreferenced via the
BlockGroup syntax.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>