summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2021-11-13 01:04:21 -0600
committerrcombs <rcombs@rcombs.me>2021-11-28 16:40:43 -0600
commitcaad1146e25fc5c601b949601b0a13d5a2a08c19 (patch)
tree9e8c5cf2ab1ff02bfc8b660ba7554a81fcc41896
parentf0952f87bcfd905f21ce6cefa8e14a127fb00c8a (diff)
lavc/h264dec: support all color formats in videotoolbox hwaccel
-rw-r--r--libavcodec/h264_slice.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 89ea16a57f..4467882775 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -811,6 +811,10 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
*fmt++ = AV_PIX_FMT_YUV420P9;
break;
case 10:
+#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
+ if (h->avctx->colorspace != AVCOL_SPC_RGB)
+ *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
+#endif
if (CHROMA444(h)) {
if (h->avctx->colorspace == AVCOL_SPC_RGB) {
*fmt++ = AV_PIX_FMT_GBRP10;
@@ -850,6 +854,10 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
#if CONFIG_H264_NVDEC_HWACCEL
*fmt++ = AV_PIX_FMT_CUDA;
#endif
+#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
+ if (h->avctx->colorspace != AVCOL_SPC_RGB)
+ *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
+#endif
if (CHROMA444(h)) {
if (h->avctx->colorspace == AVCOL_SPC_RGB)
*fmt++ = AV_PIX_FMT_GBRP;
@@ -873,9 +881,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
#if CONFIG_H264_VAAPI_HWACCEL
*fmt++ = AV_PIX_FMT_VAAPI;
#endif
-#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
- *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
-#endif
if (h->avctx->codec->pix_fmts)
choices = h->avctx->codec->pix_fmts;
else if (h->avctx->color_range == AVCOL_RANGE_JPEG)