]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/videotoolbox.c
avcodec/vc1: Don't pretend ff_vc1_init_common() can fail
[ffmpeg] / libavcodec / videotoolbox.c
index 67e5b54932635e9b7c6c52cdbe745c4b291df8fe..49e726a75fcd9ae679dd613806ccee5acdc5dfa2 100644 (file)
@@ -91,6 +91,11 @@ static int videotoolbox_postproc_frame(void *avctx, AVFrame *frame)
         return AVERROR_EXTERNAL;
     }
 
+    frame->crop_right = 0;
+    frame->crop_left = 0;
+    frame->crop_top = 0;
+    frame->crop_bottom = 0;
+
     frame->data[3] = (uint8_t*)ref->pixbuf;
 
     if (ref->hw_frames_ctx) {
@@ -612,7 +617,7 @@ static void videotoolbox_decoder_callback(void *opaque,
     }
 
     if (!image_buffer) {
-        av_log(NULL, AV_LOG_DEBUG, "vt decoder cb: output image buffer is null\n");
+        av_log(avctx, AV_LOG_DEBUG, "vt decoder cb: output image buffer is null\n");
         return;
     }
 
@@ -898,11 +903,6 @@ static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
     AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
     VTContext *vtctx = avctx->internal->hwaccel_priv_data;
 
-    frame->crop_right = 0;
-    frame->crop_left = 0;
-    frame->crop_top = 0;
-    frame->crop_bottom = 0;
-
     if (vtctx->reconfig_needed == true) {
         vtctx->reconfig_needed = false;
         av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder needs reconfig, restarting..\n");
@@ -1088,7 +1088,13 @@ static int videotoolbox_common_init(AVCodecContext *avctx)
     vtctx->vt_ctx->cv_pix_fmt_type =
         av_map_videotoolbox_format_from_pixfmt2(hw_frames->sw_format, full_range);
     if (!vtctx->vt_ctx->cv_pix_fmt_type) {
-        av_log(avctx, AV_LOG_ERROR, "Unknown sw_format.\n");
+        const AVPixFmtDescriptor *attempted_format =
+            av_pix_fmt_desc_get(hw_frames->sw_format);
+        av_log(avctx, AV_LOG_ERROR,
+               "Failed to map underlying FFmpeg pixel format %s (%s range) to "
+               "a VideoToolbox format!\n",
+               attempted_format ? attempted_format->name : "<unknown>",
+               av_color_range_name(avctx->color_range));
         err = AVERROR(EINVAL);
         goto fail;
     }