diff options
author | jstebbins <[email protected]> | 2015-05-28 20:29:01 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-05-28 20:29:01 +0000 |
commit | 04dbdddcb1a1d2a8231cee75ac51feae9727833d (patch) | |
tree | 94e6e9002566807730265ff969e62ee68cda0a83 | |
parent | f0109cb4cecd63949e65f7cafda9f47d81916759 (diff) |
libhb: fix issues with video options
Fixes: https://forum.handbrake.fr/viewtopic.php?f=10&t=32535&sid=321e6d1092fd09c8d380e13e86d1a9ee
- Sanitize empty video encoder settings strings to NULL.
- In the CLI, use encoder defaults if user changes the preset's video
encoder.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7237 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/common.c | 20 | ||||
-rw-r--r-- | libhb/encx265.c | 1 | ||||
-rw-r--r-- | test/test.c | 20 |
3 files changed, 41 insertions, 0 deletions
diff --git a/libhb/common.c b/libhb/common.c index 1c8ac0925..5f22fd1b0 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -3304,6 +3304,10 @@ void hb_job_set_encoder_preset(hb_job_t *job, const char *preset) { if (job != NULL) { + if (preset == NULL || preset[0] == 0) + { + preset = NULL; + } hb_update_str(&job->encoder_preset, preset); } } @@ -3312,6 +3316,10 @@ void hb_job_set_encoder_tune(hb_job_t *job, const char *tune) { if (job != NULL) { + if (tune == NULL || tune[0] == 0) + { + tune = NULL; + } hb_update_str(&job->encoder_tune, tune); } } @@ -3320,6 +3328,10 @@ void hb_job_set_encoder_options(hb_job_t *job, const char *options) { if (job != NULL) { + if (options == NULL || options[0] == 0) + { + options = NULL; + } hb_update_str(&job->encoder_options, options); } } @@ -3328,6 +3340,10 @@ void hb_job_set_encoder_profile(hb_job_t *job, const char *profile) { if (job != NULL) { + if (profile == NULL || profile[0] == 0) + { + profile = NULL; + } hb_update_str(&job->encoder_profile, profile); } } @@ -3336,6 +3352,10 @@ void hb_job_set_encoder_level(hb_job_t *job, const char *level) { if (job != NULL) { + if (level == NULL || level[0] == 0) + { + level = NULL; + } hb_update_str(&job->encoder_level, level); } } diff --git a/libhb/encx265.c b/libhb/encx265.c index ba55ab703..e3160c589 100644 --- a/libhb/encx265.c +++ b/libhb/encx265.c @@ -105,6 +105,7 @@ int encx265Init(hb_work_object_t *w, hb_job_t *job) if (x265_param_default_preset(param, job->encoder_preset, job->encoder_tune) < 0) { + hb_error("encx265: x265_param_default_preset failed. Preset (%s) Tune (%s)", job->encoder_preset, job->encoder_tune); goto fail; } diff --git a/test/test.c b/test/test.c index 22816c73c..408181f02 100644 --- a/test/test.c +++ b/test/test.c @@ -3231,6 +3231,26 @@ static hb_dict_t * PreparePreset(const char *preset_name) if (vcodec != NULL) { + const char *s; + int old, new; + + s = hb_value_get_string(hb_dict_get(preset, "VideoEncoder")); + old = hb_video_encoder_get_from_name(s); + new = hb_video_encoder_get_from_name(vcodec); + if (old != new) + { + // If the user explicitly changes a video encoder, remove the + // preset VideoPreset, VideoTune, VideoProfile, VideoLevel, and + // VideoOptionExtra. + // + // Use defaults for the encoder since these settings may not be + // compatible across encoders. + hb_dict_remove(preset, "VideoPreset"); + hb_dict_remove(preset, "VideoTune"); + hb_dict_remove(preset, "VideoProfile"); + hb_dict_remove(preset, "VideoLevel"); + hb_dict_remove(preset, "VideoOptionExtra"); + } hb_dict_set(preset, "VideoEncoder", hb_value_string(vcodec)); } if (encoder_preset != NULL) |