diff options
author | John Stebbins <[email protected]> | 2019-06-10 08:43:45 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-07-11 13:22:57 -0700 |
commit | eaf442681a48608d3ed4d7df9bf48ec6d8fb9e7e (patch) | |
tree | fb8fef2416c4385e27eed4a9cf4c53ed64d1ce0c /libhb/encx265.c | |
parent | 5b49a09794566c65ef76abd4ffa7598c62d1fe89 (diff) |
encx265: set level
It seems the encoder level has been supported in x265 since May 2014,
just a few months after initial support for x265 was added to
HandBrake :\
Diffstat (limited to 'libhb/encx265.c')
-rw-r--r-- | libhb/encx265.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libhb/encx265.c b/libhb/encx265.c index 30bde6565..6e196eafd 100644 --- a/libhb/encx265.c +++ b/libhb/encx265.c @@ -81,6 +81,29 @@ static int param_parse(hb_work_private_t *pv, x265_param *param, return ret; } +int apply_h265_level(hb_work_private_t *pv, x265_param *param, + const char *h265_level) +{ + if (h265_level == NULL || + !strcasecmp(h265_level, hb_h265_level_names[0])) + { + return 0; + } + // Verify that level is valid + int i; + for (i = 1; hb_h265_level_values[i]; i++) + { + if (!strcmp(hb_h265_level_names[i], h265_level)) + { + return param_parse(pv, param, "level-idc", h265_level); + } + } + + // error (invalid or unsupported level), abort + hb_error("apply_h265_level: invalid level %s", h265_level); + return X265_PARAM_BAD_VALUE; +} + /*********************************************************************** * hb_work_encx265_init *********************************************************************** @@ -273,6 +296,10 @@ int encx265Init(hb_work_object_t *w, hb_job_t *job) { goto fail; } + if (apply_h265_level(pv, param, job->encoder_level) < 0) + { + goto fail; + } /* we should now know whether B-frames are enabled */ job->areBframes = (param->bframes > 0) + (param->bframes > 0 && |