+static av_cold int libx265_param_parse_float(AVCodecContext *avctx,
+ const char *key, float value)
+{
+ libx265Context *ctx = avctx->priv_data;
+ char buf[256];
+
+ snprintf(buf, sizeof(buf), "%2.2f", value);
+ if (ctx->api->param_parse(ctx->params, key, buf) == X265_PARAM_BAD_VALUE) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid value %2.2f for param \"%s\".\n", value, key);
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+
+static av_cold int libx265_param_parse_int(AVCodecContext *avctx,
+ const char *key, int value)
+{
+ libx265Context *ctx = avctx->priv_data;
+ char buf[256];
+
+ snprintf(buf, sizeof(buf), "%d", value);
+ if (ctx->api->param_parse(ctx->params, key, buf) == X265_PARAM_BAD_VALUE) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid value %d for param \"%s\".\n", value, key);
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+