summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-07-14 12:13:53 +0200
committerAnton Khirnov <anton@khirnov.net>2016-07-22 19:08:13 +0200
commitf65285aba0df7d46298abe0c945dfee05cbc6028 (patch)
tree2d40ae0556033ea9595e75ea7c15a17bac4c6137
parentd59641abfd25a1007bdf4723d952887b1e3619c6 (diff)
lavc: set sw_pix_fmt for hwaccel encoding
-rw-r--r--libavcodec/utils.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index bc1beee462..4184b95e63 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1113,6 +1113,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
ret = AVERROR(EINVAL);
goto free_and_end;
}
+ if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&
+ avctx->sw_pix_fmt != frames_ctx->sw_format) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Mismatching AVCodecContext.sw_pix_fmt (%s) "
+ "and AVHWFramesContext.sw_format (%s)\n",
+ av_get_pix_fmt_name(avctx->sw_pix_fmt),
+ av_get_pix_fmt_name(frames_ctx->sw_format));
+ ret = AVERROR(EINVAL);
+ goto free_and_end;
+ }
+ avctx->sw_pix_fmt = frames_ctx->sw_format;
}
}