Skip to content

Commit

Permalink
json: fix sanitization of vquality
Browse files Browse the repository at this point in the history
…for encoders that check for a valid bitrate before quality.
  • Loading branch information
twalker314 committed Apr 3, 2016
1 parent 7a268dc commit 18821cd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libhb/hb_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,18 +993,22 @@ hb_job_t* hb_dict_to_job( hb_handle_t * h, hb_dict_t *dict )
hb_job_set_encoder_level(job, video_level);
hb_job_set_encoder_options(job, video_options);

// If both vbitrate and vquality were specified, vbitrate is used
// If both vbitrate and vquality were specified, vbitrate is used;
// we need to ensure the unused rate contro mode is always set to an
// invalid value, as if both values aere valid, behavior is undefined
// (some encoders first check for a valid vquality, whereas others
// check for a valid vbitrate instead)
if (vbitrate > 0)
{
job->vbitrate = vbitrate;
job->vquality = HB_INVALID_VIDEO_QUALITY;
}
else if (vquality != HB_INVALID_VIDEO_QUALITY)
else if (vquality > HB_INVALID_VIDEO_QUALITY)
{
job->vbitrate = -1;
job->vquality = vquality;
}
// If neither vbitrate or vquality were specified, defaults are used
// defaults are set in job_setup()
// If neither were specified, defaults are used (set in job_setup())

job->select_subtitle_config.dest = subtitle_search_burn ?
RENDERSUB : PASSTHRUSUB;
Expand Down

0 comments on commit 18821cd

Please sign in to comment.