summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAndrey Turkin <andrey.turkin@gmail.com>2016-05-25 18:06:02 +0300
committerTimo Rothenpieler <timo@rothenpieler.org>2016-05-31 15:48:43 +0200
commit40df468ab1745c0acf0d9973037ea5841d643a96 (patch)
tree83eb5bd110610e1fbb0c22b82f2390ca5d34b58a /libavcodec
parentb0172873a89d66976e7ca12e2cd8842afd9a27f5 (diff)
avcodec/nvenc: convert tier to AVOptions
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/nvenc.c11
-rw-r--r--libavcodec/nvenc.h2
-rw-r--r--libavcodec/nvenc_hevc.c4
3 files changed, 5 insertions, 12 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index a078043110..d74960563d 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -708,16 +708,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
hevc->level = ctx->level;
- if (ctx->tier) {
- if (!strcmp(ctx->tier, "main")) {
- hevc->tier = NV_ENC_TIER_HEVC_MAIN;
- } else if (!strcmp(ctx->tier, "high")) {
- hevc->tier = NV_ENC_TIER_HEVC_HIGH;
- } else {
- av_log(avctx, AV_LOG_FATAL, "Tier \"%s\" is unknown! Supported tiers: main, high\n", ctx->tier);
- return AVERROR(EINVAL);
- }
- }
+ hevc->tier = ctx->tier;
return 0;
}
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index fdb8853bb9..8007311da1 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -169,7 +169,7 @@ typedef struct NvencContext
int preset;
int profile;
int level;
- char *tier;
+ int tier;
int cbr;
int twopass;
int gpu;
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 2278bb7e6b..2bd6521c42 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -62,7 +62,9 @@ static const AVOption options[] = {
{ "6.0", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_HEVC_6 }, 0, 0, VE, "level" },
{ "6.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_HEVC_61 }, 0, 0, VE, "level" },
{ "6.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_HEVC_62 }, 0, 0, VE, "level" },
- { "tier", "Set the encoding tier (main or high)", OFFSET(tier), AV_OPT_TYPE_STRING, { .str = "main" }, 0, 0, VE },
+ { "tier", "Set the encoding tier", OFFSET(tier), AV_OPT_TYPE_INT, { .i64 = NV_ENC_TIER_HEVC_MAIN }, NV_ENC_TIER_HEVC_MAIN, NV_ENC_TIER_HEVC_HIGH, VE, "tier"},
+ { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TIER_HEVC_MAIN }, 0, 0, VE, "tier" },
+ { "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TIER_HEVC_HIGH }, 0, 0, VE, "tier" },
{ "cbr", "Use cbr encoding mode", OFFSET(cbr), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "2pass", "Use 2pass encoding mode", OFFSET(twopass), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
{ "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", OFFSET(gpu), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },