1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00
Commit Graph

90886 Commits

Author SHA1 Message Date
Aman Gupta
df2c811b7c avcodec/mediacodecdec: restructure mediacodec_receive_frame
The new logic follows a recommendation by @rcombs to use
dequeueInputBuffer with a timeout of 0 as a way to detect
whether the codec wants more data. The dequeued buffer index is
kept in MediaCodecDecContext until it can be used next.

A similar technique is also used by the Google's official media
player Exoplayer: see MediaCodecRenderer.feedInputBuffer().

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
(cherry picked from commit f6681feda6)
2018-05-18 19:16:34 -07:00
Aman Gupta
6f55a36be9 avcodec/mediacodec_wrapper: add helper to fetch SDK_INT
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit fe0a6bcbda)
2018-05-18 19:16:34 -07:00
Aman Gupta
33042d632d avcodec/mediacodecdec: refactor pts handling
Also fixes a bug where EOS buffer was sent with incorrect
pts when not using surface generation.

Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit d8e92a89ed)
2018-05-18 19:16:34 -07:00
Aman Gupta
3054e53ddc avcodec/mediacodecdec: use AV_TIME_BASE_Q
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit 7a4639b1eb)
2018-05-18 19:16:34 -07:00
Aman Gupta
84bf631018 avcodec/mediacodecdec: clarify delay_flush specific code
As of 2a0eb8685, ff_mediacodec_dec_is_flushing() only returns
true in delay_flush mode. Make this more obvious by adding
delay_flush to the if statement.

Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit 6a7a84b2d1)
2018-05-18 19:16:34 -07:00
Aman Gupta
2884575d97 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>
(cherry picked from commit 8f146b526f)
2018-05-18 19:16:34 -07:00
Aman Gupta
76716518a8 avcodec/hevc: remove videotoolbox hack
No longer required since 63d875772d. The equivalent hack
for h264 was removed in that commit, but this one was missed.

Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit a19bac8fc8)
2018-05-18 19:16:34 -07:00
Aman Gupta
e8caf67f56 avcodec/videotoolbox: split h264/hevc callbacks
Previously the shared callbacks were trying to interpret
avctx->priv_data as H264Context*

Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit 07d175d0b0)
2018-05-18 19:07:06 -07:00
Aman Gupta
e40922c16c avcodec/videotoolbox: cleanups
No functional changes.

Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit dd77cca1c4)
2018-05-18 19:07:06 -07:00
Aman Gupta
ef9478d264 avcodec/videotoolbox: fix kVTCouldNotFindVideoDecoderErr trying to decode HEVC on iOS
Older iOS devices don't have a hardware HEVC decoder, but the
software decoder offered by VideoToolbox is well-optimized and
performs much better than the ffmpeg decoder.

Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit bcff983dc3)
2018-05-18 19:07:06 -07:00
Aman Gupta
13d83899df avcodec/videotoolbox: improve logging of decoder errors
Signed-off-by: Aman Gupta <aman@tmm1.net>
(cherry picked from commit 84e03db9a3)
2018-05-18 19:07:06 -07:00
Marton Balint
61fed89ad4 avcodec/xwddec: fix palette alpha
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 50d6b7bd83)
2018-05-16 22:50:18 +02:00
Marton Balint
7931e01540 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>
(cherry picked from commit 2dbe936bf7)
2018-05-15 23:09:51 +02:00
Niklas Haas
93cee87b13 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`.

(cherry picked from commit 32234e03a7)
2018-05-13 19:18:48 +03:00
Philip Langdale
2a44f706aa avcodec/nvdec_hevc: fix scaling lists
The main issue here was the use of [i] instead of [i * 3] for the 32x32
matrix. As part of fixing this, I changed the code to match that used
in vdpau_hevc, which I spent a lot of time verifying.

I also changed to calculating NumPocTotalCurr using the existing helper,
which is what vdpau does.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
(cherry picked from commit 1261003700)
2018-05-10 18:44:02 +02:00
Timo Rothenpieler
61b673b1f1 avcodec/hevcdec: make ff_hevc_frame_nb_refs take a const pointer
(cherry picked from commit 46c1ee1917)
2018-05-10 18:44:00 +02:00
Jan Ekström
8fde71acd9 lavf/bluray: translate a read of 0 to EOF
Yet another case of forgotten 0 =! EOF translation. The libbluray
documentation specifically mentions that a read of 0 is EOF.

Reported by Fyr on IRC.

(cherry picked from commit b995ec078f)
2018-05-10 17:59:55 +03:00
Rodger Combs
b32f865969 lavf/dashenc: don't call flush_init_segment before avformat_write_header
Fixes crash when muxing MKV-in-DASH
2018-05-04 13:38:18 +05:30
Marton Balint
d89eea3455 avdevice/decklink_dec: unref packets on avpacket_queue_put error
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 649087fa83)
2018-05-01 21:22:33 +02:00
Marton Balint
0a22e31fbb avcodec/hnm4video: fix palette alpha
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 4c501bafc0)
2018-05-01 21:22:19 +02:00
Marton Balint
70a01aa490 avcodec/anm: fix palette alpha
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit e894d958fc)
2018-05-01 21:22:03 +02:00
Marton Balint
da6c519f6e avformat/qtpalette: parse color table according to the QuickTime file format specs
The specs says that the the first color component in the color array is
not alpha, but simply 0.

Fixes 0 alpha of fate-suite/cvid/catfight-cvid-pal8-partial.mov

Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit c60a824ee8)
2018-05-01 21:21:49 +02:00
Matt Oliver
29328d96b9 ffplay: Fix realloc_texture when input texture is NULL.
SDL_QueryTexture and SDL_DestroyTexture require that the input texture
pointer be non-null. Debug builds of SDL will correctly check for this
and break program execution. This patch fixes this by checking the
status of the texture pointer.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
(cherry picked from commit 6be690685a)
2018-05-01 21:21:02 +02:00
Mark Thompson
44cb647477 hwcontext_vaapi: Fix compilation with libva versions < 1.4.0
The BufferHandle API was added in libva 1.4.0 / VAAPI 0.36.0.

(cherry picked from commit 92a0a6bea9)
2018-04-27 23:42:07 +01:00
Ruiling Song
a768c0a3e1 lavf/qsv: clone the frame which may be managed by framework
For filters based on framesync, the input frame was managed
by framesync, so we should not directly keep and destroy it,
instead we make a clone of it here, or else double-free will occur.
But for other filters not based on framesync, we still need to
free the input frame inside filter_frame.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
(cherry picked from commit d865783b6c)
2018-04-23 22:56:18 +01:00
Ruiling Song
58569162c2 lavf: make overlay_qsv work based on framesync
The existing version which was cherry-picked from Libav does not work
with FFmpeg framework, because ff_request_frame() was totally
different between Libav (recursive) and FFmpeg (non-recursive).
The existing overlay_qsv implementation depends on the recursive version
of ff_request_frame to trigger immediate call to request_frame() on input pad.
But this has been removed in FFmpeg since "lavfi: make request_frame() non-recursive."
Now that we have handy framesync support in FFmpeg, so I make it work
based on framesync. Some other fixing which is also needed to make
overlay_qsv work are put in a separate patch.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
(cherry picked from commit f3341a0452)
2018-04-23 22:56:06 +01:00
Gyan Doshi
6b2fee19a7 avformat/segafilm - revert keyframe detection
Keyframe detection was inverted in cfe1a9d311 in order to fix keyframe
flags set for the sample attached to trac #7091. However, that sample is
errantly muxed.

As noted at
https://web.archive.org/web/20020803104640/http://www.pcisys.net:80/~melanson/codecs/film-format.txt,
the original keyframe detection logic is correct, and this patch
restores it.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 9f9f56e679)
2018-04-22 16:34:39 -03:00
Aman Gupta
8cd79c2e73 avformat/utils: refactor upstream_stream_timings
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7b8daa771c)
2018-04-20 12:25:32 -07:00
Aman Gupta
0502602d37 avformat/utils: ignore outlier durations on subtitle/data streams as well
Similar to 4c9c4fe8b2, but for durations. This fixes #7151, where
the report duration and bitrate on a mpegts stream is wildly off
due to the dvb_teletext stream's timings.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fd6e89586c)
2018-04-20 12:25:26 -07:00
Michael Niedermayer
ace829cb45 Changelog: replace <next> by 4.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:55:05 +02:00
Stephan Holljes
b9b3ef4f5a lavf/http.c: Free allocated client URLContext in case of error.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7b6b8c9265)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
b2b7cb0f60 avdevice/android_camera: Fix AVClass.version
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 13b77af2f0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
5cc6370a15 avcodec: Fix AVClass .version
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c0bce367e4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
8b019be79b avcodec/sheervideodata: Fix libavutil include
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3dfe3436ac)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
e36830c695 avcodec/sbc: Fix non static function prefix
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9f1b99e7d0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
bc2ceeb3ac avcodec/opusenc_psy: Fix warning: ISO C90 forbids mixed declarations and code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f8b17fe332)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
66bdf8f145 avcodec/dsicinvideo: Fail if there is only a small fraction of the data available that comprises a full frame
Fixes: Timeout
Fixes: 6306/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSICINVIDEO_fuzzer-5079253549842432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5549488bbf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
bfe61bbd00 avcodec/dsicinvideo: Propagate errors from cin_decode_rle()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 942217b153)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
5888679ae3 avcodec/dfa: Check dimension against maximum
The headers from where the dimensions are read in actual files
are limited to 16bit per component.

Fixes: Timeout
Fixes: 6305/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DFA_fuzzer-4824270749302784

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9d5a4fcfbb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
ecb375684d avcodec/cinepak: Skip empty frames
Speeds up decoding from 3 to 0.1 seconds for 6302/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5626371985375232
Fixes: Timeout

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9033920bec)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
df56bc18ef avcodec/cinepak: move some checks prior to frame allocation
Speeds up decoding from 8 to 3 seconds for 6302/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5626371985375232
Fixes: Timeout

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2324ef1ff3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Rahul Chaudhry
ef99025603 swresample/arm: remove unintentional relocation.
Branch to global symbol results in reference to PLT, and when compiling
for THUMB-2 - in a R_ARM_THM_JUMP19 relocation. Some linkers don't
support this relocation (ld.gold), while others can end up truncating
the relocation to fit (ld.bfd).

Convert this branch through PLT into a direct branch that the assembler
can resolve locally.

See https://github.com/android-ndk/ndk/issues/337 for background.

The current workaround is to disable neon during gstreamer build,
which is not optimal and can be reverted after this patch:
41556c4157

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b22db4f465)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Michael Niedermayer
860293a9a2 doc/APIchanges: Fix typos in hashes
Thanks-to: Moritz Barsnick <barsnick@gmx.net> for finding the correct ones

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ec8a5262b0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:53:41 +02:00
Matthieu Bouron
9b71114247 avcodec/mediacodecdec_common: make stride and slice-height non-mandatory fields
Fixes decoding on the Samsung Chromebook Pro which do not set the codec
output format stride and slice-height fields.

(cherry picked from commit 67d0911f27)
2018-04-19 14:25:23 +02:00
Hendrik Leppkes
0b6de235b9 avformat/tls_schannel: fix handling of EOF after avio changes
(cherry picked from commit 5c6365af45)
2018-04-19 13:27:49 +02:00
Hendrik Leppkes
a73b464118 configure: fix clang-cl check in the MSVC section
Without properly grouping the checks, the second test would execute for
MSVC cl.exe, which results in configure getting stuck since cl.exe -? is
an interactive paginated help screen, waiting for input.
2018-04-19 09:58:48 +02:00
James Almer
d9e9e97e5f avdevice/iec61883: free the private context at the end
Fixes part of ticket #7146.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 5079e96bcc)
2018-04-18 23:04:04 -03:00
James Almer
d52676da38 avdevice/iec61883: return reference counted packets
Fixes part of ticket #7146, dealing with leaks of packet data since
commit 87c8812270.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit b8629654c6)
2018-04-18 23:04:01 -03:00
Timo Teräs
ca85c3cd7d avformat/movenc: support writing iTunes cover image
Fixes https://trac.ffmpeg.org/ticket/2798

This makes movenc handle AV_DISPOSITION_ATTACHED_PIC and write
the associated pictures in iTunes cover atom. This corresponds
to how 'mov' demuxer parses and exposes the cover images when
reading.

Most of the existing track handling loops properly ignore
these 'virtual streams' as MOVTrack->entry is never incremented
for them. However, additional tests are added as needed to ignore
them.

Tested to produce valid output with:
  ffmpeg -i movie.mp4 -i thumb.jpg -disposition✌️1 attached_pic \
         -map 0 -map 1 -c copy movie-with-cover.mp4

The cover image is also copied correctly with:
  ffmpeg -i movie-with-cover.mp4 -map 0 -c copy out.mp4

AtomicParseley says that the attached_pic stream is properly
not visible in the main tracks of the file.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
(cherry picked from commit 9af71b326f)
2018-04-17 20:13:37 +01:00
Timo Teräs
de253343c1 ffprobe: report unavailable SAR correctly in stream info
av_guess_sample_aspect_ratio() will return undefined or missing
value as {0,1}. This fixes show_stream() to check numerator to
display 'N/A' when appropriate. show_frame() does this already
correctly.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
(cherry picked from commit c663dce031)
2018-04-17 20:13:25 +01:00