Commit Graph

7 Commits

Author SHA1 Message Date
wm4
9747219958 avcodec/h264, videotoolbox: do not return invalid frames on failure
If videotoolbox_common_end_frame failed, then the AVFrame was returned
to the API user with the dummy buffer (in AVFrame.buf[0]) still set, and
the decode call indicating success.

These "half-set" AVFrames with dummy buffer are a videotoolbox specific
hack, because the decoder requires an allocated AVFrame for its internal
logic. Videotoolbox on the other hand allocates its frame itself
internally, and outputs it only on end_frame. At this point, the dummy
buffer is replaced with the real frame (unless decoding fails).
2015-11-20 11:30:18 +01:00
wm4
16aac9a359 avcodec/videotoolbox: fix decoding of some h264 bitstreams
This affects Annex B streams (such as demuxed from .ts and others). It
also handles the format change in reinit-large_420_8-to-small_420_8.h264
correctly.

Instead of passing through the extradata, create it on the fly it from
the currently active SPS and PPS. Since reconstructing the PPS and SPS
NALs would be very complicated and verbose, we use the NALs as they
originally appeared in the bitstream.

The code for writing the extradata is somewhat derived from
libavformat/avc.c, but it's small and different enough that sharing it
is not really worth it.
2015-10-02 19:09:16 +02:00
Stefano Pigozzi
78cc19f15e videotoolbox: require hardware acceleration
VideoToolbox also implements a software decoder for h264, and will fallback to
using it if the file cannot be decoded on the GPU. In these cases though,
we want the hwaccel to fail so that we can use the libavcodec software decoder
instead of the Apple one.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2015-09-29 23:55:11 +02:00
Ganesh Ajjanagadde
b3066be0e4 avcodec/videotoolbox: fix -Wunused-but-set-variable
pix_fmt was declared presumably to shorten the argument passed to the function.
However, it is currently not being used for such a purpose.
This patch simply removes it instead.
This fixes -Wunused-but-set-variable reported at e.g:
http://fate.ffmpeg.org/log.cgi?time=20150919194249&log=compile&slot=x86_64-darwin-gcc-4.9.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-29 04:50:03 +02:00
Michael Niedermayer
8bdd0dbd60 avcodec/videotoolbox: Add missing AV_ prefix to CODEC_ID in comment
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-03 14:47:11 +02:00
Michael Niedermayer
6b0fa73b4d avcodec/videotoolbox: Fix bistream typo
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-03 14:46:24 +02:00
Sebastien Zwickert
11d923d414 avcodec: add new Videotoolbox hwaccel. 2015-08-03 10:12:10 +02:00