aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/videotoolbox.c
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2017-09-25 16:44:47 -0700
committerAman Gupta <aman@tmm1.net>2017-11-13 14:31:45 -0800
commit6515e2834a51e651aa9855d071291eeb8256dbb6 (patch)
treec1108ad1f5ef172ac4cfbf41605fc487474e9c64 /libavcodec/videotoolbox.c
parentd869928ca6e61358adb916369cafd61366f6b064 (diff)
downloadffmpeg-6515e2834a51e651aa9855d071291eeb8256dbb6.tar.gz
avcodec/videotoolbox: print descriptive errors on decode failures
Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavcodec/videotoolbox.c')
-rw-r--r--libavcodec/videotoolbox.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 67b7429274..4fe89a27e9 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -572,9 +572,22 @@ static OSStatus videotoolbox_session_decode_frame(AVCodecContext *avctx)
return status;
}
+static const char *videotoolbox_error_string(OSStatus status)
+{
+ switch (status) {
+ case kVTVideoDecoderBadDataErr:
+ return "bad data";
+ case kVTVideoDecoderMalfunctionErr:
+ return "decoder malfunction";
+ case kVTInvalidSessionErr:
+ return "invalid session";
+ }
+ return "unknown";
+}
+
static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
{
- int status;
+ OSStatus status;
AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
VTContext *vtctx = avctx->internal->hwaccel_priv_data;
@@ -582,9 +595,8 @@ static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
return AVERROR_INVALIDDATA;
status = videotoolbox_session_decode_frame(avctx);
-
- if (status) {
- av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status);
+ if (status != noErr) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%s, %d)\n", videotoolbox_error_string(status), (int)status);
return AVERROR_UNKNOWN;
}