From c6037b03d3a7abb2eba039c5e38429115859651b Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 16 Jul 2012 11:43:14 +0000 Subject: [PATCH] * support 360 and 240 as standard height as well for {vf} --- .../filebot/format/MediaBindingBean.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/source/net/sourceforge/filebot/format/MediaBindingBean.java b/source/net/sourceforge/filebot/format/MediaBindingBean.java index 31d076d7..7d4fd7a5 100644 --- a/source/net/sourceforge/filebot/format/MediaBindingBean.java +++ b/source/net/sourceforge/filebot/format/MediaBindingBean.java @@ -188,21 +188,23 @@ public class MediaBindingBean { @Define("vf") public String getVideoFormat() { - // {def h = video.height as int; h > 720 ? 1080 : h > 480 ? 720 : 480}p int height = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Height")); - String vf = ""; - if (height > 720) - vf += 1080; - else if (height > 480) - vf += 720; - else if (height > 360) - vf += 480; - else - return null; // video too small - - // e.g. 720p - return vf + 'p'; // nobody actually wants files to be tagged as interlaced, e.g. 720i + int ns = 0; + int[] hs = new int[] { 1080, 720, 480, 360, 240, 120 }; + for (int i = 0; i < hs.length - 1; i++) { + if (height > hs[i + 1]) { + ns = hs[i]; + break; + } + } + + if (ns > 0) { + // e.g. 720p, nobody actually wants files to be tagged as interlaced, e.g. 720i + return String.format("%dp", ns); + } + + return null; // video too small }