X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fvideotoolbox.c;h=8671608a35ec7b752bb25b379185ccbc4789a808;hb=bcff983dc340e76518935111146c0e1daf4cb37b;hp=57b6698e1b949ae0ef1cb3556170280b707d9353;hpb=b14761d1f8372dfe558193b8b754b9f1a858077d;p=ffmpeg diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 57b6698e1b9..8671608a35e 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; @@ -833,6 +838,9 @@ static int videotoolbox_start(AVCodecContext *avctx) case kVTVideoDecoderUnsupportedDataFormatErr: av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox does not support this format.\n"); return AVERROR(ENOSYS); + case kVTCouldNotFindVideoDecoderErr: + av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder for this format not found.\n"); + return AVERROR(ENOSYS); case kVTVideoDecoderMalfunctionErr: av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox malfunction.\n"); return AVERROR(EINVAL); @@ -842,7 +850,7 @@ static int videotoolbox_start(AVCodecContext *avctx) case 0: return 0; default: - av_log(avctx, AV_LOG_VERBOSE, "Unknown VideoToolbox session creation error %u\n", (unsigned)status); + av_log(avctx, AV_LOG_VERBOSE, "Unknown VideoToolbox session creation error %d\n", (int)status); return AVERROR_UNKNOWN; } }