* 1080p/720p/etc values are defined now by height as well as width

This commit is contained in:
Reinhard Pointner 2013-03-24 13:37:10 +00:00
parent 9065429152
commit ca999c82a9
1 changed files with 4 additions and 4 deletions

View File

@ -257,22 +257,22 @@ public class MediaBindingBean {
@Define("vf")
public String getVideoFormat() {
int width = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Width"));
int height = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Height"));
int ns = 0;
int[] ws = new int[] { 1920, 1280, 720, 360, 240, 120 };
int[] hs = new int[] { 1080, 720, 480, 360, 240, 120 };
for (int i = 0; i < hs.length - 1; i++) {
if (height > hs[i + 1]) {
for (int i = 0; i < ws.length - 1; i++) {
if (width > ws[i + 1] && 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
}