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.
Unified · Split
| @@ -36,6 +36,9 @@ · 35 unmodified lines | ||
| 36 | 36 | #ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder |
| 37 | 37 | # define kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder CFSTR("RequireHardwareAcceleratedVideoDecoder") |
| 38 | 38 | #endif |
| 39 | +#ifndef kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder | |
| 40 | +# define kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder CFSTR("EnableHardwareAcceleratedVideoDecoder") | |
| 41 | +#endif | |
| 39 | 42 | |
| 40 | 43 | #if !HAVE_KCMVIDEOCODECTYPE_HEVC |
| 41 | 44 | enum { kCMVideoCodecType_HEVC = 'hvc1' }; |
| @@ -709,7 +712,9 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec · 667 unmodified lines | ||
| 709 | 712 | &kCFTypeDictionaryValueCallBacks); |
| 710 | 713 | |
| 711 | 714 | CFDictionarySetValue(config_info, |
| 712 | − kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, | |
| 715 | + codec_type == kCMVideoCodecType_HEVC ? | |
| 716 | + kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder : | |
| 717 | + kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, | |
| 713 | 718 | kCFBooleanTrue); |
| 714 | 719 | |
| 715 | 720 | CFMutableDictionaryRef avc_info; |