@@ -798,6 +798,10 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
const enum AVPixelFormat *choices = pix_fmts;
int i;
+#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
+ *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
+#endif
+
switch (h->ps.sps->bit_depth_luma) {
case 9:
if (CHROMA444(h)) {
@@ -872,9 +876,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
#endif
#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;