
    if (*pix_fmt == AV_PIX_FMT_NONE) {
        if (!ctx || !ctx->internal || !ctx->internal->hw_type) {
            av_log(NULL, AV_LOG_ERROR, "Invalid context or hardware type\n");
            return AVERROR(EINVAL);
        }
        av_log(ctx, AV_LOG_ERROR,
               "The hardware pixel format '%s' is not supported by the device type '%s'\n",
               av_get_pix_fmt_name(ctx->format), ctx->internal->hw_type->name);
