Added restriction for Encoding Presets with the yuv420 setting (width and height have to be even numbers)

This commit is contained in:
CrushedPixel
2015-07-16 21:56:29 +02:00
parent da82e3e1f2
commit 9ba99d1794
3 changed files with 20 additions and 0 deletions

View File

@@ -393,6 +393,7 @@ public class GuiRenderSettings extends GuiScreen {
} else {
commandInput.textboxKeyTyped(typedChar, keyCode);
ffmpegArguments.textboxKeyTyped(typedChar, keyCode);
validateInputs();
}
super.keyTyped(typedChar, keyCode);
}
@@ -605,6 +606,22 @@ public class GuiRenderSettings extends GuiScreen {
private void validateInputs() {
boolean valid = true;
boolean isPreset = false;
EncodingPreset curPreset = encodingPresetDropdown.getElement(encodingPresetDropdown.getSelectionIndex());
if(ffmpegArguments.getText().trim().equals(curPreset.getCommandLineArgs())) {
isPreset = true;
}
if(isPreset) {
if(curPreset.isYuv420()) {
if(getWidthSetting() % 2 != 0 || getHeightSetting() % 2 != 0) {
valid = false;
renderButton.hoverText = I18n.format("replaymod.gui.rendersettings.customresolution.warning.yuv420");
}
}
}
switch (rendererDropdown.getElement(rendererDropdown.getSelectionIndex())) {
case CUBIC:
if (getWidthSetting() * 3 / 4 != getHeightSetting()

View File

@@ -38,6 +38,8 @@ public enum EncodingPreset implements GuiEntryListEntry {
return commandLineArgs.contains("%BITRATE%");
}
public boolean isYuv420() { return commandLineArgs.contains("-pix_fmt yuv420p"); }
@Override
public String getDisplayString() {
return getI18nName();

View File

@@ -314,6 +314,7 @@ replaymod.gui.rendersettings.renderer.equirectangular.description=Renders the vi
replaymod.gui.rendersettings.customresolution=Video Resolution
replaymod.gui.rendersettings.customresolution.warning.cubic=Cubic Rendering requires an aspect ratio of 4:3
replaymod.gui.rendersettings.customresolution.warning.equirectangular=Equirectangular Rendering requires an aspect ratio of 2:1
replaymod.gui.rendersettings.customresolution.warning.yuv420=For this preset, the width and height values need to be even numbers
replaymod.gui.rendersettings.resolution=Video Resolution
replaymod.gui.rendersettings.interpolation=Path Interpolation
replaymod.gui.rendersettings.forcechunks=Force Render Chunks