summaryrefslogtreecommitdiff
path: root/libavcodec/nvenc.c
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2020-10-21 17:52:43 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2020-10-21 18:03:45 +0200
commit11a8e93681dfe51c75683ac5a13b72d4bed7ac1f (patch)
tree32161887e95c2ac10ecf2751fd90f5d8a20eaa83 /libavcodec/nvenc.c
parent1868cb731660490beb750389266adb6e68e9123d (diff)
avcodec/nvenc: use alias to provide deprecated profiles
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r--libavcodec/nvenc.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 1aae6c00e5..63fbe17810 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -657,6 +657,28 @@ typedef struct GUIDTuple {
static void nvenc_map_preset(NvencContext *ctx)
{
GUIDTuple presets[] = {
+#ifdef NVENC_HAVE_NEW_PRESETS
+ PRESET(P1),
+ PRESET(P2),
+ PRESET(P3),
+ PRESET(P4),
+ PRESET(P5),
+ PRESET(P6),
+ PRESET(P7),
+ PRESET_ALIAS(SLOW, P7, NVENC_TWO_PASSES),
+ PRESET_ALIAS(MEDIUM, P4, NVENC_ONE_PASS),
+ PRESET_ALIAS(FAST, P1, NVENC_ONE_PASS),
+ // Compat aliases
+ PRESET_ALIAS(DEFAULT, P4, NVENC_DEPRECATED_PRESET),
+ PRESET_ALIAS(HP, P1, NVENC_DEPRECATED_PRESET),
+ PRESET_ALIAS(HQ, P7, NVENC_DEPRECATED_PRESET),
+ PRESET_ALIAS(BD, P5, NVENC_DEPRECATED_PRESET),
+ PRESET_ALIAS(LOW_LATENCY_DEFAULT, P4, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
+ PRESET_ALIAS(LOW_LATENCY_HP, P1, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
+ PRESET_ALIAS(LOW_LATENCY_HQ, P7, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
+ PRESET_ALIAS(LOSSLESS_DEFAULT, P4, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS),
+ PRESET_ALIAS(LOSSLESS_HP, P1, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS),
+#else
PRESET(DEFAULT),
PRESET(HP),
PRESET(HQ),
@@ -669,14 +691,6 @@ static void nvenc_map_preset(NvencContext *ctx)
PRESET(LOW_LATENCY_HQ, NVENC_LOWLATENCY),
PRESET(LOSSLESS_DEFAULT, NVENC_LOSSLESS),
PRESET(LOSSLESS_HP, NVENC_LOSSLESS),
-#ifdef NVENC_HAVE_NEW_PRESETS
- PRESET(P1),
- PRESET(P2),
- PRESET(P3),
- PRESET(P4),
- PRESET(P5),
- PRESET(P6),
- PRESET(P7),
#endif
};
@@ -1238,6 +1252,9 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
nvenc_map_preset(ctx);
+ if (ctx->flags & NVENC_DEPRECATED_PRESET)
+ av_log(avctx, AV_LOG_WARNING, "The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.\n");
+
preset_config.version = NV_ENC_PRESET_CONFIG_VER;
preset_config.presetCfg.version = NV_ENC_CONFIG_VER;