aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2018-04-19 15:34:01 -0700
committerAman Gupta <aman@tmm1.net>2018-05-18 19:07:06 -0700
commitef9478d2646342b900d156ea64d3a3c9035529ac (patch)
tree4bec0bd43188235dad0419b74cebc1d51532252d /libavcodec
parent13d83899df3c5c6b96f807a6b54801c7f24b83d4 (diff)
downloadffmpeg-ef9478d2646342b900d156ea64d3a3c9035529ac.tar.gz
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 bcff983dc340e76518935111146c0e1daf4cb37b)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/videotoolbox.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 6dd800daf8..8671608a35 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -36,6 +36,9 @@
#ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder
# define kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder CFSTR("RequireHardwareAcceleratedVideoDecoder")
#endif
+#ifndef kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder
+# define kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder CFSTR("EnableHardwareAcceleratedVideoDecoder")
+#endif
#if !HAVE_KCMVIDEOCODECTYPE_HEVC
enum { kCMVideoCodecType_HEVC = 'hvc1' };
@@ -709,7 +712,9 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec
&kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(config_info,
- kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder,
+ codec_type == kCMVideoCodecType_HEVC ?
+ kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder :
+ kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder,
kCFBooleanTrue);
CFMutableDictionaryRef avc_info;