ffmpeg.git
12 months agoconfigure: fix check for mbedtls
Reino Wijnsma [Wed, 23 May 2018 00:11:30 +0000 (02:11 +0200)]
configure: fix check for mbedtls

Add missing libraries needed when linking with a static build of MbedTLS.

Signed-off-by: James Almer <jamrial@gmail.com>
12 months agoavformat/mxf: fix NTSC 59.94 samples per frame layout
Marton Balint [Thu, 24 May 2018 20:03:43 +0000 (22:03 +0200)]
avformat/mxf: fix NTSC 59.94 samples per frame layout

FFmbc uses this.
bmx uses this.
XAVC MXF Mapping and Operating Points prefers this.
Basic rounding rules also yields these numbers.

Signed-off-by: Marton Balint <cus@passwd.hu>
12 months agolavc/cfhd: interlaced frame decoding added
Gagandeep Singh [Tue, 22 May 2018 15:40:21 +0000 (21:10 +0530)]
lavc/cfhd: interlaced frame decoding added

ticket #5522 output of given samples significantly improved

13 months agoavcodec/mlpdec: Only change noise_type if the related fields are valid
Michael Niedermayer [Thu, 17 May 2018 11:58:46 +0000 (13:58 +0200)]
avcodec/mlpdec: Only change noise_type if the related fields are valid

Fixes: inconsistency
Fixes:runtime error: index 8 out of bounds for type 'int32_t [8]'
Fixes: 6686/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5191383498358784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoindeo4: Decode all or nothing of a band header.
Michael Niedermayer [Thu, 17 May 2018 11:40:38 +0000 (13:40 +0200)]
indeo4: Decode all or nothing of a band header.

This avoids inconsistent value combinations.
Alternatively it would be possible to add more checks and careful use of
temporary variables, but my try of this quickly seemed to become
a rather large change.
The disadvantage of this, is that the struct is copied back and forth.

Fixes: index 6 out of bounds for type 'const uint16_t [5][16]'
Fixes: 6557/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-4787296550256640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/ac3dec: Use frame_size if superframe_size is 0
Michael Niedermayer [Thu, 17 May 2018 23:48:38 +0000 (01:48 +0200)]
avcodec/ac3dec: Use frame_size if superframe_size is 0

Fixes: Infinite loop
Fixes: 7669/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_AC3_FIXED_fuzzer-4689042185650176
Fixes: 7670/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_AC3_fuzzer-4706306762997760
Fixes: 7672/clusterfuzz-testcase-ffmpeg_AV_CODEC_ID_EAC3_fuzzer-4702108499574784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agolavc/hevc_ps: Use correct pix_fmt AV_PIX_FMT_GRAY9 for 9-bit 4:0:0 input.
Carl Eugen Hoyos [Fri, 25 May 2018 18:46:11 +0000 (20:46 +0200)]
lavc/hevc_ps: Use correct pix_fmt AV_PIX_FMT_GRAY9 for 9-bit 4:0:0 input.

13 months agolavc/j2kenc: Support AV_PIX_FMT_PAL8.
Carl Eugen Hoyos [Tue, 22 May 2018 00:21:04 +0000 (02:21 +0200)]
lavc/j2kenc: Support AV_PIX_FMT_PAL8.

13 months agolavf/img2dec: Auto-detect xwd images.
Carl Eugen Hoyos [Fri, 25 May 2018 18:06:34 +0000 (20:06 +0200)]
lavf/img2dec: Auto-detect xwd images.

13 months agodoc/codecs: Remove option sc_factor.
Carl Eugen Hoyos [Thu, 24 May 2018 16:21:05 +0000 (18:21 +0200)]
doc/codecs: Remove option sc_factor.

Fixes ticket #7228.
The option was disabled since 4a62f477 and removed in 6e69525e.

13 months agoavformat/hlsenc: support http method for hls fmp4
Steven Liu [Thu, 24 May 2018 03:55:58 +0000 (11:55 +0800)]
avformat/hlsenc: support http method for hls fmp4

fix ticket: 7160

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
13 months agoavformat/dashdec: replace user-agent to user_agent for deprecate warning message
Steven Liu [Thu, 24 May 2018 03:43:35 +0000 (11:43 +0800)]
avformat/dashdec: replace user-agent to user_agent for deprecate warning message

13 months agoavformat/dashdec: Fix for ticket 7149 (Segfault when decoding dash streams)
Colin NG [Thu, 24 May 2018 03:10:17 +0000 (11:10 +0800)]
avformat/dashdec: Fix for ticket 7149 (Segfault when decoding dash streams)

simplify the code to check common init section

13 months agoavformat/dashdec: Fix for ticket 7149 (Segfault when decoding dash streams)
Colin NG [Thu, 24 May 2018 03:09:20 +0000 (11:09 +0800)]
avformat/dashdec: Fix for ticket 7149 (Segfault when decoding dash streams)

Add NULL pointer check for init_section

13 months agohwcontext_vaapi: Fix mapping from DRM
Mark Thompson [Thu, 24 May 2018 00:17:12 +0000 (01:17 +0100)]
hwcontext_vaapi: Fix mapping from DRM

This was broken by bed670a1de29b58fcb3fe046562d8bd125b1457f, which added
an assert that always failed.

13 months agoavformat/mov: replace a value error by clipping into valid range in mov_read_stsc()
Michael Niedermayer [Mon, 21 May 2018 01:16:58 +0000 (03:16 +0200)]
avformat/mov: replace a value error by clipping into valid range in mov_read_stsc()

Fixes: #7165

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/bintext: Reduce detection for random .bin files as it more likely is not...
Michael Niedermayer [Sat, 12 May 2018 16:33:26 +0000 (18:33 +0200)]
avformat/bintext: Reduce detection for random .bin files as it more likely is not a multimedia related file

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agolavc/jpeg2000dec: Move a variable declaration closer to its usage.
Carl Eugen Hoyos [Tue, 22 May 2018 10:55:46 +0000 (12:55 +0200)]
lavc/jpeg2000dec: Move a variable declaration closer to its usage.

13 months agolavc/jpeg2000dec: Use a define to clarify the meaning of a constant.
Carl Eugen Hoyos [Tue, 22 May 2018 10:54:32 +0000 (12:54 +0200)]
lavc/jpeg2000dec: Use a define to clarify the meaning of a constant.

13 months agolavc/h264_parse: Remove a superfluous linebreak.
Carl Eugen Hoyos [Tue, 22 May 2018 10:48:53 +0000 (12:48 +0200)]
lavc/h264_parse: Remove a superfluous linebreak.

13 months agolibavformat: add mbedTLS based TLS
Thomas Volkert [Sat, 21 Apr 2018 13:53:31 +0000 (15:53 +0200)]
libavformat: add mbedTLS based TLS

Signed-off-by: James Almer <jamrial@gmail.com>
13 months agoavcodec/libvpxenc: fix setting amount of threads used for encoding
James Almer [Sat, 19 May 2018 18:01:56 +0000 (15:01 -0300)]
avcodec/libvpxenc: fix setting amount of threads used for encoding

The libvpx doxy says that a value of 0 for the g_threads field is
equivalent to a value of 1, whereas for avctx->thread_count it means
the maximum amount of threads possible for the host system.

Use av_cpu_count() to get the correct thread count when auto threads
is requested.

Reviewed-by: James Zern <jzern@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
13 months agohwcontext: Add test for device creation and derivation
Mark Thompson [Tue, 15 May 2018 22:15:03 +0000 (23:15 +0100)]
hwcontext: Add test for device creation and derivation

This uses any devices it can find on the host system - on a system with no
hardware device support or in builds with no support included it will do
nothing and pass.

13 months agoavformat/mpegts: fix memory leak with merge_pmt_versions=1
Aman Gupta [Mon, 21 May 2018 19:13:06 +0000 (12:13 -0700)]
avformat/mpegts: fix memory leak with merge_pmt_versions=1

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agodoc: remove AVStream private fields from APIchanges
Aman Gupta [Mon, 21 May 2018 19:12:46 +0000 (12:12 -0700)]
doc: remove AVStream private fields from APIchanges

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavformat/mpegts: rename variable to clarify meaning
Aman Gupta [Mon, 21 May 2018 19:11:45 +0000 (12:11 -0700)]
avformat/mpegts: rename variable to clarify meaning

Both stream_id and stream_identifier are used in this file,
and have different meanings. The latter comes from the
stream_identifier_descriptor.

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavformat/mov: Only fail for STCO/STSC contradictions if both exist
Michael Niedermayer [Tue, 15 May 2018 15:07:00 +0000 (17:07 +0200)]
avformat/mov: Only fail for STCO/STSC contradictions if both exist

Fixes regression with playback of GF9720Repeal20the20Eighth20with20Helen20Linehan.m4a
See: crbug 822666

Found-by: "Mattias Wadman <mattias.wadman@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/mov: Break out early if chunk_count is 0 in mov_build_index()
Michael Niedermayer [Tue, 15 May 2018 15:06:59 +0000 (17:06 +0200)]
avformat/mov: Break out early if chunk_count is 0 in mov_build_index()

Without this some operations might overflow (undefined behavior)
even though the index adding loop would never execute

No testcase known

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/vc1: FIELDTX is only present in interlaced frame I/BI pictures
Jerome Borsboom [Sun, 20 May 2018 11:45:56 +0000 (13:45 +0200)]
avcodec/vc1: FIELDTX is only present in interlaced frame I/BI pictures

If v->fieldtx_is_raw is not reset to zero, it may spill over from a previous
interlaced frame I/BI picture.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/mp3dec: require 90% of a file to be mp3 if only 1 mp3 frame is found in...
Michael Niedermayer [Sat, 12 May 2018 16:33:29 +0000 (18:33 +0200)]
avformat/mp3dec: require 90% of a file to be mp3 if only 1 mp3 frame is found in sequence

This eliminates several low score detections of non mp3 files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/mp3dec: Require 50% of the file to be mp3 frames in the maxframes>200 probin...
Michael Niedermayer [Sat, 12 May 2018 16:33:28 +0000 (18:33 +0200)]
avformat/mp3dec: Require 50% of the file to be mp3 frames in the maxframes>200 probing test

This corrects several misdetections of large files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/mp3dec: Require probing data to be 50% mp3 frames for low score probing...
Michael Niedermayer [Sat, 12 May 2018 16:33:27 +0000 (18:33 +0200)]
avformat/mp3dec: Require probing data to be 50% mp3 frames for low score probing to succeed

This massively reduces the detection of random data as low score mp3
It may improve security by making it harder to read non multimedia data

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/vc1: fix calculation of the last line of a slice
Jerome Borsboom [Fri, 18 May 2018 15:06:32 +0000 (17:06 +0200)]
avcodec/vc1: fix calculation of the last line of a slice

Only for the last slice of the first field is the last line of the slice
equal to the height of the field.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/vc1: DIRECTBIT is only present in inter MBs
Jerome Borsboom [Fri, 18 May 2018 15:06:28 +0000 (17:06 +0200)]
avcodec/vc1: DIRECTBIT is only present in inter MBs

DIRECTBIT was decoded before the intra/inter MB branching when decoding
interlace frame B pictures. Resulting in mistakenly also decoding it for intra
MBs where this syntax element is not present.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavdevice/sdl2 : add option to define if the window quit action is available
Martin Vignali [Tue, 8 May 2018 09:55:40 +0000 (11:55 +0200)]
avdevice/sdl2 : add option to define if the window quit action is available

13 months agoavdevice/sdl2output : fix setting window_size
Martin Vignali [Tue, 8 May 2018 09:47:13 +0000 (11:47 +0200)]
avdevice/sdl2output : fix setting window_size

13 months agoavformat/mpegts: add merge_pmt_versions option
Aman Gupta [Tue, 8 May 2018 23:12:12 +0000 (16:12 -0700)]
avformat/mpegts: add merge_pmt_versions option

This new optional flag makes it easier to deal with mpegts
samples where the PMT is updated and elementary streams move
to different PIDs in the middle of playback.

Previously, new AVStreams were created per PID, and it was up
to the user to figure out which streams had migrated to a new PID
(by iterating over the list of AVProgram and making guesses), and
switch seamlessly to the new AVStream during playback.

Transcoding or remuxing these streams with ffmpeg on the CLI was
also quite painful, and the user would need to extract each set
of PIDs into a separate file and then stitch them back together.

With this new option, the mpegts demuxer will automatically detect
PMT changes and feed data from the new PID to the original AVStream
that was created for the orignal PID. For mpegts samples with
stream_identifier_descriptor available, the unique ID is used to
merge PIDs together. If the stream id is not available, the demuxer
attempts to map PIDs based on their position within the PMT.

With this change, I am able to playback and transcode/remux these
two samples which previously caused issues:

    https://tmm1.s3.amazonaws.com/pmt-version-change.ts
    https://kuroko.fushizen.eu/videos/pid_switch_sample.ts

I also have another longer sample in which the PMT changes
repeatedly and ES streams move to different pids three times
during playback:

    https://tmm1.s3.amazonaws.com/multiple-pmt-change.ts

Demuxing this sample with the new option shows several new log
messages as the PMT changes are handled:

    [mpegts] detected PMT change (program=1, version=3/6, pcr_pid=0xf98/0xfb7)
    [mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xfb7
    [mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xfb8
    [mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xfb9
    [mpegts] detected PMT change (program=1, version=6/3, pcr_pid=0xfb7/0xf98)
    [mpegts] detected PMT change (program=1, version=3/4, pcr_pid=0xf98/0xf9b)
    [mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xf9b
    [mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xf9c
    [mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xf9d
    [mpegts] detected PMT change (program=1, version=4/5, pcr_pid=0xf9b/0xfa9)
    [mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xfa9
    [mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xfaa
    [mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xfab
    [mpegts] detected PMT change (program=1, version=5/6, pcr_pid=0xfa9/0xfb7)

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavformat/mpegts: keep track of PMT details in AVProgram/AVStream
Aman Gupta [Thu, 17 May 2018 22:31:11 +0000 (15:31 -0700)]
avformat/mpegts: keep track of PMT details in AVProgram/AVStream

With these fields, the user has enough information to
detect PMT changes and switch to new streams when the PMT
is updated with new ES pids.

To do so, the user would monitor the AVProgram they're interested
in for changes to pmt_version. If the version changes, they would
iterate over the program's streams to find new streams added with
the updated version number.

If new versions of streams are found, then the user would first try
to replace existing streams where stream_identifier matched.
If stream_identifier is not available, then the user would compare
pmt_stream_idx instead to replace the stream that was previously
at the same position within the PMT.

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavformat: add fields to AVProgram/AVStream for PMT change tracking
Aman Gupta [Thu, 17 May 2018 22:30:21 +0000 (15:30 -0700)]
avformat: add fields to AVProgram/AVStream for PMT change tracking

These fields will allow the mpegts demuxer to expose details about
the PMT/program which created the AVProgram and its AVStreams.

In mpegts, a PMT which advertises streams has a version number
which can be incremented at any time. When the version changes,
the pids which correspond to each of it's streams can also change.

Since ffmpeg creates a new AVStream per pid by default, an API user
needs the ability to (a) detect when the PMT changed, and (b) tell
which AVStream were added to replace earlier streams.

This has been a long-standing issue with ffmpeg's handling of mpegts
streams with PMT changes, and I found two related patches in the wild
that attempt to solve the same problem:

The first is in MythTV's ffmpeg fork, where they added a
void (*streams_changed)(void*); to AVFormatContext and call it from
their fork of the mpegts demuxer whenever the PMT changes.

The second was proposed by XBMC in
https://ffmpeg.org/pipermail/ffmpeg-devel/2012-December/135036.html,
where they created a new AVMEDIA_TYPE_DATA stream with id=0 and
attempted to send packets to it whenever the PMT changed.

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavfilter/vsrc_testsrc: fix a preprocessor check
James Almer [Fri, 18 May 2018 20:42:57 +0000 (17:42 -0300)]
avfilter/vsrc_testsrc: fix a preprocessor check

Signed-off-by: James Almer <jamrial@gmail.com>
13 months agoavcodec/videotoolbox: fix decoding of some HEVC videos
Aman Gupta [Fri, 4 May 2018 22:41:30 +0000 (15:41 -0700)]
avcodec/videotoolbox: fix decoding of some HEVC videos

In a normal hwaccel, the AVHWFramesContext sets AVFrame.hw_frames_ctx
when it initializes a new AVFrame in av_hwframe_get_buffer().

But the VT hwaccel doesn't know what hw_frames_ctx to assign when
the AVFrame is first created, because it depends on the format of
the pixbuf that the decoder eventually decides to return. Thus
newly created AVFrames always have a NULL hw_frames_ctx, and the
hwaccel would only assign the ctx once a frame was done decoding.
This worked fine with the H264 decoder, but with the HEVC decoder
the frame's data may be moved to another empty AVFrame. Since the
empty AVFrame never had hw_frames_ctx set, a frame with a NULL
ctx could be returned to the API user.

This patch works around the issue by moving the derived
hw_frames_ctx from the AVFrame to a new VTHWFrame which now holds
both the CVPixelBufferRef and the AVBuffer. The hw_frames_ctx
is only copied to the AVFrame right before it is about to be
returned to the user in videotoolbox_postproc_frame() (since
in the case of VT, the hw_frames_ctx is only there for the API
user anyway).

Fixes playback on macOS and iOS of some hevc videos like
https://s3.amazonaws.com/tmm1/videotoolbox/germany-hevc-zdf.ts

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavformat/mpegts: add skip_unknown_pmt option
Aman Gupta [Tue, 8 May 2018 19:49:43 +0000 (12:49 -0700)]
avformat/mpegts: add skip_unknown_pmt option

Some filtered mpegts streams may erroneously include PMTs for
programs that are not advertised in the PAT. This confuses ffmpeg
and most players because multiple audio/video streams are created
and it is unclear which ones actually contain data.

See for example https://tmm1.s3.amazonaws.com/unknown-pmts.ts

In this sample, the PAT advertises exactly one program. But the
pid it points to for the program's PMT contains PMTs for other
programs as well. This is because the broadcaster decided to
re-use the same pid for multiple program PMTs.

The hardware that filtered the original multi-program stream
into a single-program stream did so by rewriting the PAT to
contain only the program that was requested. But since it just
passed through the PMT pid referenced in the PAT, multiple PMTs
are still present for the other programs.

Before:

    Input #0, mpegts, from 'unknown-pmts.ts':
      Duration: 00:00:10.11, start: 80741.189700, bitrate: 9655 kb/s
      Program 4
        Stream #0:2[0x41]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 11063 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
        Stream #0:3[0x44](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
        Stream #0:4[0x45](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s
      No Program
        Stream #0:0[0x31]: Video: mpeg2video ([2][0][0][0] / 0x0002), none(tv), 90k tbr, 90k tbn, 90k tbc
        Stream #0:1[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp
        Stream #0:5[0x51]: Video: mpeg2video ([2][0][0][0] / 0x0002), none, 90k tbr, 90k tbn
        Stream #0:6[0x54](eng): Audio: ac3 (AC-3 / 0x332D4341), 0 channels

With skip_unknown_pmt=1:

    Input #0, mpegts, from 'unknown-pmts.ts':
      Duration: 00:00:10.11, start: 80741.189700, bitrate: 9655 kb/s
      Program 4
        Stream #0:0[0x41]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 11063 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
        Stream #0:1[0x44](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
        Stream #0:2[0x45](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agotests/checkasm/nlmeans: fix invalid read/write on ii buffer
Clément Bœsch [Fri, 18 May 2018 17:12:11 +0000 (19:12 +0200)]
tests/checkasm/nlmeans: fix invalid read/write on ii buffer

13 months agoavfilter/vsrc_testsrc: add pal75bars and pal100bars video filter sources
Tobias Rapp [Tue, 8 May 2018 09:43:50 +0000 (11:43 +0200)]
avfilter/vsrc_testsrc: add pal75bars and pal100bars video filter sources

Generates color bar test patterns based on EBU PAL recommendations.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
13 months agoavfilter/vf_waveform: add slice threading
Paul B Mahol [Tue, 15 May 2018 07:22:33 +0000 (09:22 +0200)]
avfilter/vf_waveform: add slice threading

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 months agoopusenc: use for loops with declarations
Rostislav Pehlivanov [Fri, 18 May 2018 01:38:08 +0000 (02:38 +0100)]
opusenc: use for loops with declarations

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
13 months agodoc/developer: update style guidelines to include for loops with declarations
Rostislav Pehlivanov [Fri, 18 May 2018 01:24:28 +0000 (02:24 +0100)]
doc/developer: update style guidelines to include for loops with declarations

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
13 months agoconfigure: error out on unsupported MSVC versions
Rostislav Pehlivanov [Mon, 14 May 2018 23:53:26 +0000 (00:53 +0100)]
configure: error out on unsupported MSVC versions

The FATE tests for MSVC versions older than 2013 are untested in FATE
and apparently are no longer supported.

This commit makes the configure process error out in case an older version
is used, and suggests to use a supported version of MSVC to compile.

This also changes the documentation to reflect this.

As discussed on IRC:

2018-05-12 19:45:16     jamrial then again, most of those were for old msvc, and i think we're not supporting versions older than 2013 (first one c99 compliant) anymore
2018-05-12 19:45:43     +JEEB   yea, I think 2013 update 2 is needed

22:53 <@atomnuker> nevcairiel: which commit broke/unsupported support for msvc 2013?
23:23 <@atomnuker> okay, it was JEEB
23:25 <+JEEB> which was for 2012 and older
23:25 <+JEEB> and IIRC we no longer test those in FATE so that was my assumption
23:26 <+JEEB> 2013 is when MS got trolled enough to actually update their C part
23:26 <+JEEB> aand actually advertised FFmpeg support
23:26 <+JEEB> (although it was semi-failing until VS2013 update 1 or 2)

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
13 months agoavformat/mpegts: tag video streams with still images
Aman Gupta [Tue, 15 May 2018 18:26:07 +0000 (11:26 -0700)]
avformat/mpegts: tag video streams with still images

Parses the video_stream_descriptor (H.222 2.6.2) to look
for the still_picture_flag. This is exposed to the user
via a new AV_DISPOSITION_STILL_IMAGE.

See for example https://tmm1.s3.amazonaws.com/music-choice.ts,
whose video stream only updates every ~6 seconds.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat: add skip_estimate_duration_from_pts
Aman Gupta [Tue, 15 May 2018 22:56:45 +0000 (15:56 -0700)]
avformat: add skip_estimate_duration_from_pts

For seekable mpegts streams, duration is calculated from
pts by seeking to the end of the file for a pts and subtracting
the initial pts to compute a duration.

This can be expensive in terms of added latency during
probe, especially when streaming over a network. This new
option lets you skip the duration calculation, which is useful
when you don't care about the value and want to save some overhead.

This patch is particularly useful when dealing with live mpegts
streams. Normally such streams are not seekable, so durations
are not calculated. However in my case I am dealing with a seekable
live mpegts stream (networked access to a .ts file which is still
being appended to).

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agolavc/v210dec: Skip Canopus C210 extradata.
Carl Eugen Hoyos [Thu, 10 May 2018 20:45:07 +0000 (22:45 +0200)]
lavc/v210dec: Skip Canopus C210 extradata.

Unbreaks files with unknown extradata, the Canopus decoder accepts both files
with and without this extradata (24 byte "INFO", 16 byte "RDRT", rest "FIEL").

Reported-by: Peter Bubestinger
Tested-by: Piotr Bandurski
13 months agoavcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD97iH0 / COMPOSE_DD137iL0
Michael Niedermayer [Sun, 13 May 2018 22:10:33 +0000 (00:10 +0200)]
avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD97iH0 / COMPOSE_DD137iL0

Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int');
Fixes: 6500/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-4523620274536448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/fic: Check available input space for cursor
Michael Niedermayer [Sat, 5 May 2018 20:00:01 +0000 (22:00 +0200)]
avcodec/fic: Check available input space for cursor

Fixes: out of array read
Fixes: 6546/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FIC_fuzzer-6317064647081984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/fic: Avoid some magic numbers related to cursors
Michael Niedermayer [Sat, 5 May 2018 21:42:36 +0000 (23:42 +0200)]
avcodec/fic: Avoid some magic numbers related to cursors

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/mpeg4video: Detect reference studio streams as studio streams
Michael Niedermayer [Sun, 29 Apr 2018 21:39:41 +0000 (23:39 +0200)]
avcodec/mpeg4video: Detect reference studio streams as studio streams

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/mpeg4videodec: Check bps (VOL header) before VOP for studio profile
Michael Niedermayer [Sun, 29 Apr 2018 18:28:46 +0000 (20:28 +0200)]
avcodec/mpeg4videodec: Check bps (VOL header) before VOP for studio profile

Fixes: runtime error: shift exponent -1 is negative
Fixes: 7486/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-4977380939530240

Fixes: runtime error: index 36 out of bounds for type 'const uint8_t [32]'
Fixes: 7566/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-6536620682510336

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/mpeg4videodec: Do not corrupt bits_per_raw_sample
Michael Niedermayer [Sun, 29 Apr 2018 18:49:21 +0000 (20:49 +0200)]
avcodec/mpeg4videodec: Do not corrupt bits_per_raw_sample

Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/mpeg4videode: Eliminate out of loop VOP startcode reading for studio profile
Michael Niedermayer [Sun, 29 Apr 2018 17:09:05 +0000 (19:09 +0200)]
avcodec/mpeg4videode: Eliminate out of loop VOP startcode reading for studio profile

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/g2meet: ask for sample with overflowing RGB
Michael Niedermayer [Wed, 16 May 2018 20:50:19 +0000 (22:50 +0200)]
avcodec/g2meet: ask for sample with overflowing RGB

Suggested-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/g2meet: Check RGB upper limit
Michael Niedermayer [Fri, 27 Apr 2018 18:16:13 +0000 (20:16 +0200)]
avcodec/g2meet: Check RGB upper limit

Fixes: runtime error: left shift of 1876744317 by 16 places cannot be represented in type 'int'
Fixes: 6799/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5115274731716608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavcodec/xwddec: fix palette alpha
Marton Balint [Sun, 6 May 2018 16:18:19 +0000 (18:18 +0200)]
avcodec/xwddec: fix palette alpha

Signed-off-by: Marton Balint <cus@passwd.hu>
13 months agoavformat/hls: fix seeking around EVENT playlist after media sequence changes
Aman Gupta [Tue, 24 Apr 2018 00:30:21 +0000 (17:30 -0700)]
avformat/hls: fix seeking around EVENT playlist after media sequence changes

The seek functions use first_timestamp, so keep that up to date as
old segments drop off the playlist.

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agolavc/h2645_parse: add h264_nal_unit_name for h264 NAL type.
Jun Zhao [Fri, 11 May 2018 02:28:32 +0000 (10:28 +0800)]
lavc/h2645_parse: add h264_nal_unit_name for h264 NAL type.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
13 months agolavc/h2645_parse: rename the nal_unit_name to hevc_nal_unit_name.
Jun Zhao [Mon, 14 May 2018 06:49:56 +0000 (14:49 +0800)]
lavc/h2645_parse: rename the nal_unit_name to hevc_nal_unit_name.

Rename the nal_unit_name to hevc_nal_unit_name, will add a
h264_nal_unit_name function.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
13 months agolavc/h2645_parse: log more HEVC NAL type.
Jun Zhao [Fri, 11 May 2018 02:02:27 +0000 (10:02 +0800)]
lavc/h2645_parse: log more HEVC NAL type.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
13 months agoavfilter: add aderivative and aintegral filter
Paul B Mahol [Mon, 14 May 2018 08:07:44 +0000 (10:07 +0200)]
avfilter: add aderivative and aintegral filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 months agoavcodec: Disable new iterate API for ossfuzz
Michael Niedermayer [Mon, 14 May 2018 10:43:59 +0000 (12:43 +0200)]
avcodec: Disable new iterate API for ossfuzz

A few days ago ossfuzz stoped testing new FFmpeg as it run out of diskspacee

https://oss-fuzz-build-logs.storage.googleapis.com/index.html

An alternative would be to revert the API.

This changes for example
-rwxr-x--- 1 michael michael 144803654 May 14 12:54 tools/target_dec_ac3_fixed_fuzzer*
to
-rwxr-x--- 1 michael michael  30333852 May 14 12:51 tools/target_dec_ac3_fixed_fuzzer*

Which should massively decrease space requirements

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agodoc/examples: add missing ignore files
Zhao Zhili [Mon, 14 May 2018 12:18:02 +0000 (20:18 +0800)]
doc/examples: add missing ignore files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoexamples/filtering_video: fix memory leak
Zhao Zhili [Mon, 14 May 2018 12:18:01 +0000 (20:18 +0800)]
examples/filtering_video: fix memory leak

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoexamples/filtering_video: add missing headers
Zhao Zhili [Mon, 14 May 2018 12:18:00 +0000 (20:18 +0800)]
examples/filtering_video: add missing headers

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoexamples/filtering_video: drop an always true condition
Zhao Zhili [Mon, 14 May 2018 12:17:59 +0000 (20:17 +0800)]
examples/filtering_video: drop an always true condition

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agolavu/Makefile: Fix alignment and ordering
Mark Thompson [Mon, 14 May 2018 21:58:57 +0000 (22:58 +0100)]
lavu/Makefile: Fix alignment and ordering

13 months agohwcontext: Do not call device_init again when deriving an existing device
Mark Thompson [Mon, 14 May 2018 21:58:56 +0000 (22:58 +0100)]
hwcontext: Do not call device_init again when deriving an existing device

The change in 309d660775e2b47af6723a0477c4d753bc0c54f4 to call device_init
when doing derivation missed this case - we should only call it if we
actually made a new device.

13 months agoavutil/hwcontext_cuda: fix YUV420P cuda_get_buffer
Marton Balint [Mon, 14 May 2018 21:24:43 +0000 (23:24 +0200)]
avutil/hwcontext_cuda: fix YUV420P cuda_get_buffer

Regression since ece068a771ac3f725e854c681ecbef08e792addc.

Signed-off-by: Marton Balint <cus@passwd.hu>
13 months agoavformat/webm_chunk: always use a static buffer for get_chunk_filename
Marton Balint [Sun, 13 May 2018 20:14:22 +0000 (22:14 +0200)]
avformat/webm_chunk: always use a static buffer for get_chunk_filename

My conversation from AVFormatContext->filename to AVFormatContext->url was
wrong in this case because get_chunk_filename uses filename as an output
buffer, and not as an input buffer.

Fixes ticket #7188.

Signed-off-by: Marton Balint <cus@passwd.hu>
13 months agoavformat/mpegts: fix incorrect indentation
Aman Gupta [Tue, 15 May 2018 18:47:30 +0000 (11:47 -0700)]
avformat/mpegts: fix incorrect indentation

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavformat/dashenc: configuring container format options
Vishwanath Dixit [Mon, 7 May 2018 09:58:02 +0000 (15:28 +0530)]
avformat/dashenc: configuring container format options

13 months agoavcodec/h2645_parse: skip NALUs with no content after stripping all the trailing...
James Almer [Mon, 14 May 2018 21:09:32 +0000 (18:09 -0300)]
avcodec/h2645_parse: skip NALUs with no content after stripping all the trailing zeros

The GetBitContext is effectively empty in them.

Signed-off-by: James Almer <jamrial@gmail.com>
13 months agoconfigure: Mention the dash demuxer in the libxml2 help text.
Carl Eugen Hoyos [Mon, 14 May 2018 19:00:26 +0000 (21:00 +0200)]
configure: Mention the dash demuxer in the libxml2 help text.

13 months agoavformat/mpegts: initialize section_buf to fix valgrind test failure
Aman Gupta [Mon, 14 May 2018 17:24:44 +0000 (10:24 -0700)]
avformat/mpegts: initialize section_buf to fix valgrind test failure

http://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-valgrind&time=20180513001958

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavfilter/vf_lut2: add timeline support to tlut2 filter
Paul B Mahol [Mon, 14 May 2018 16:26:16 +0000 (18:26 +0200)]
avfilter/vf_lut2: add timeline support to tlut2 filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 months agoavfilter/vf_blend: add timeline support to tblend filter
Paul B Mahol [Mon, 14 May 2018 15:58:27 +0000 (17:58 +0200)]
avfilter/vf_blend: add timeline support to tblend filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 months agoconfigure: add pkg-config check for libmysofa
Reino Wijnsma [Mon, 7 May 2018 15:59:43 +0000 (17:59 +0200)]
configure: add pkg-config check for libmysofa

This does require libmysofa with today's latest commit (https://github.com/hoene/libmysofa/commit/08f243d1ec35f6f794aedeb4b187d9f9353bdbc1).
They already had a pkg-config file, but the dependencies weren't setup right. Until now.

13 months agoavfilter/vf_srcnn: use function to get number of threads
Paul B Mahol [Mon, 14 May 2018 14:02:00 +0000 (16:02 +0200)]
avfilter/vf_srcnn: use function to get number of threads

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 months agoavfilter/vf_amplify: check if array is availabe before using it
Paul B Mahol [Mon, 14 May 2018 14:00:00 +0000 (16:00 +0200)]
avfilter/vf_amplify: check if array is availabe before using it

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 months agoAdd IRC nicknames
Tomas Härdin [Sat, 7 Apr 2018 10:18:00 +0000 (12:18 +0200)]
Add IRC nicknames

13 months agoavformat/dashenc: Add documentation for http method option
Karthick Jeyapal [Mon, 14 May 2018 04:48:13 +0000 (10:18 +0530)]
avformat/dashenc: Add documentation for http method option

13 months agoavcodec/vp3: Check that there will be sufficient input for the coded fragments in...
Michael Niedermayer [Sat, 5 May 2018 18:08:36 +0000 (20:08 +0200)]
avcodec/vp3: Check that there will be sufficient input for the coded fragments in unpack_superblocks()

Fixes: Timeout
Fixes: 6292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-4871218218926080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoconfigure: fix configure check for lilv-0
Niklas Haas [Sun, 13 May 2018 15:07:48 +0000 (17:07 +0200)]
configure: fix configure check for lilv-0

This should be included as `<lilv/lilv.h>`, same as is done in af_lv2.c.
Forcing the extra lilv-0 breaks platforms where the include dir is
`/usr/include/lilv/lilv.h` rather than
`/usr/include/lilv-0/lilv/lilv.h`.

The new include path works for both, because the `pkg-config --cflags`
includes `-I/usr/include/lilv-0`.

13 months agodoc: fix incorrect reference to xsd_compliant option
Aman Gupta [Sat, 12 May 2018 19:09:18 +0000 (12:09 -0700)]
doc: fix incorrect reference to xsd_compliant option

reported by Mindless` on IRC

13 months agoavformat/mpegts: reindent after last change
Aman Gupta [Wed, 9 May 2018 21:31:30 +0000 (14:31 -0700)]
avformat/mpegts: reindent after last change

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavformat/mpegts: parse sections with multiple tables
Aman Gupta [Wed, 9 May 2018 21:20:48 +0000 (14:20 -0700)]
avformat/mpegts: parse sections with multiple tables

Fixes PMT parsing in some mpegts streams which contain
multiple tables within the PMT pid. Previously, the parser
assumed only one table was present in each packet, and discarded
the rest of the section data after attempting to parse the first
table.

A similar issue was documented in the BeyondTV software[1], which
helped me diagnose the same bug in the ffmpeg mpegts demuxer. I also
tried DVBInspector, libdvbpsi's dvbinfo, and tstools' tsinfo to
help debug. The former two properly read PMTs with multiple tables,
whereas the last has the same bug as ffmpeg.

I've created a minimal sample[2] which contains the combined PMT.
Here's what ffmpeg probe shows before and after this patch:

Before:

    Input #0, mpegts, from 'combined-pmt-tids.ts':
      Duration: 00:00:01.08, start: 4932.966167, bitrate: 741 kb/s
      Program 1
      No Program
        Stream #0:0[0xf9d]: Audio: ac3, 48000 Hz, mono, fltp, 96 kb/s
        Stream #0:1[0xf9b]: Audio: mp3, 0 channels, fltp
        Stream #0:2[0xf9c]: Unknown: none

After:

    Input #0, mpegts, from 'combined-pmt-tids.ts':
      Duration: 00:00:01.11, start: 4932.966167, bitrate: 718 kb/s
      Program 1
        Stream #0:0[0xf9b]: Video: mpeg2video ([2][0][0][0] / 0x0002), none(tv, top first), 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
        Stream #0:1[0xf9c](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
        Stream #0:2[0xf9d](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, mono, fltp, 96 kb/s

With the patch, the PMT is parsed correctly so the streams are
created in the correct order, are associated with "Program 1",
and their codecs are set correctly.

[1] http://forums.snapstream.com/vb/showpost.php?p=343816&postcount=201
[2] https://s3.amazonaws.com/tmm1/combined-pmt-tids.ts

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/hlsenc: set AVFMT_NODIMENSIONS
Aman Gupta [Thu, 10 May 2018 02:22:33 +0000 (19:22 -0700)]
avformat/hlsenc: set AVFMT_NODIMENSIONS

Same as previous commit but for mpegts inside HLS.

Signed-off-by: Aman Gupta <aman@tmm1.net>
13 months agoavformat/mpegtsenc: set AVFMT_NODIMENSIONS
Aman Gupta [Thu, 10 May 2018 02:21:10 +0000 (19:21 -0700)]
avformat/mpegtsenc: set AVFMT_NODIMENSIONS

This allows remuxing streams from one mpegts container to another,
without requiring avformat_find_stream_info() (or using `ffmpeg
-probesize 32` on the cli).

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavfilter/vf_maskedmerge: add slice threading
Paul B Mahol [Sat, 12 May 2018 13:46:28 +0000 (15:46 +0200)]
avfilter/vf_maskedmerge: add slice threading

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 months agoavfilter/vf_deblock: add timeline support
Paul B Mahol [Sat, 12 May 2018 10:34:02 +0000 (12:34 +0200)]
avfilter/vf_deblock: add timeline support

Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 months agoavformat/mxfenc: Set color siting to 0 for D10-MXF
Michael Niedermayer [Fri, 6 Apr 2018 16:09:54 +0000 (18:09 +0200)]
avformat/mxfenc: Set color siting to 0 for D10-MXF

SMPTE 386M (D-10) lists 4 as value to be used
SMPTE 377-1-2009 says
    "The definitions of 00h (coSiting) and 04h (Rec 601) are equivalent. The value of 04h is deprecated. New
     MXF encoders shall use the value of 00h instead."

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agoavformat/mxfenc: Add Sample width/height/x offset/y offset, Display x offset and...
Michael Niedermayer [Sat, 17 Mar 2018 22:06:13 +0000 (23:06 +0100)]
avformat/mxfenc: Add Sample width/height/x offset/y offset, Display x offset and F2 offset

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
13 months agofate: add more tests for hue video filter
Tobias Rapp [Wed, 9 May 2018 09:30:40 +0000 (11:30 +0200)]
fate: add more tests for hue video filter

Adds tests for the hue angle and brightness filter parameters.
Renames the existing saturation parameter test for consistency.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
13 months agofate/cbs: Add an SEI test
Mark Thompson [Mon, 7 May 2018 22:55:20 +0000 (23:55 +0100)]
fate/cbs: Add an SEI test

The artificial sample file sei-1.h264 contains five frames (IDR P B I B)
and the following SEI message types:
* Buffering period
* Picture timing
* Pan-scan rectangle (display as 4:3)
* User data registered, containing A/53 closed captions (captions match
  frame content, including reordering)
* Recovery point (at the I frame)
* Display orientation (identity transformation)
* Mastering display (with arbitrary contents)
* Undefined SEI type 1234 (containing ascending bytes)