[FFmpeg-devel] [PATCH] videotoolbox: log errors

wm4 nfxjfg at googlemail.com
Wed May 24 16:47:36 EEST 2017


With the new decode API, you can't handle errors directly in the API
user - you only know that the hwaccel did not initialize at all.

Add some approximate logging.
---
 libavcodec/videotoolbox.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index d36a33efcd..85cd2215c9 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -648,15 +648,21 @@ static int videotoolbox_default_init(AVCodecContext *avctx)
 
     switch (status) {
     case kVTVideoDecoderNotAvailableNowErr:
+        av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox session not available.\n");
+        return AVERROR(ENOSYS);
     case kVTVideoDecoderUnsupportedDataFormatErr:
+        av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox does not support this format.\n");
         return AVERROR(ENOSYS);
     case kVTVideoDecoderMalfunctionErr:
+        av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox malfunction.\n");
         return AVERROR(EINVAL);
     case kVTVideoDecoderBadDataErr :
+        av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox reported invalid data.\n");
         return AVERROR_INVALIDDATA;
     case 0:
         return 0;
     default:
+        av_log(avctx, "Unknown VideoToolbox session creation error %u\n", (unsigned)status);
         return AVERROR_UNKNOWN;
     }
 }
-- 
2.11.0



More information about the ffmpeg-devel mailing list