diff options
author | Damiano Galassi <[email protected]> | 2020-10-08 12:07:35 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2020-10-21 09:13:47 +0200 |
commit | 48dccd171739141b8c7deb8f9bcfaf948964cbef (patch) | |
tree | 3b0e601adbe4d2f2170cc2c414489c94c0a13426 /libhb | |
parent | 96317ec508b9ee084e99861e3ad72303e757f183 (diff) |
preset: support the 'PictureUseMaximumSize' key in hb_preset_apply_title()
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/preset.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libhb/preset.c b/libhb/preset.c index e771ded86..e20b76556 100644 --- a/libhb/preset.c +++ b/libhb/preset.c @@ -1868,7 +1868,7 @@ int hb_preset_apply_title(hb_handle_t *h, int title_index, // Calculate default job geometry settings hb_geometry_t srcGeo, resultGeo; hb_geometry_settings_t geo; - int keep_aspect; + int keep_aspect, allow_upscaling, use_maximum_size; srcGeo = title->geometry; if (!hb_value_get_bool(hb_dict_get(preset, "PictureAutoCrop"))) @@ -1937,11 +1937,17 @@ int hb_preset_apply_title(hb_handle_t *h, int title_index, geo.geometry = title->geometry; int width = hb_value_get_int(hb_dict_get(preset, "PictureForceWidth")); int height = hb_value_get_int(hb_dict_get(preset, "PictureForceHeight")); + allow_upscaling = hb_value_get_bool(hb_dict_get(preset, "PictureAllowUpscaling")); + use_maximum_size = hb_value_get_bool(hb_dict_get(preset, "PictureUseMaximumSize")); if (width > 0) { geo.geometry.width = width; geo.keep |= HB_KEEP_WIDTH; } + else if (allow_upscaling && use_maximum_size) + { + geo.geometry.width = geo.maxWidth; + } else { geo.geometry.width -= geo.crop[2] + geo.crop[3]; @@ -1951,6 +1957,10 @@ int hb_preset_apply_title(hb_handle_t *h, int title_index, geo.geometry.height = height; geo.keep |= HB_KEEP_HEIGHT; } + else if (allow_upscaling && use_maximum_size) + { + geo.geometry.height = geo.maxHeight; + } else { geo.geometry.height -= geo.crop[0] + geo.crop[1]; |