use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.
the class WebRender method getOutputOptions.
@Override
public boolean getOutputOptions(List<String> cmdList, DLNAResource resource, Player player, OutputParams params) {
if (player instanceof FFMpegVideo) {
if (resource.getFormat().isVideo()) {
DLNAMediaInfo media = resource.getMedia();
boolean flash = media != null && "video/flash".equals(media.getMimeType());
if (flash) {
ffFlashCmds(cmdList, media);
} else {
String mimeType = getVideoMimeType();
switch(mimeType) {
case RemoteUtil.MIME_OGG:
ffOggCmd(cmdList);
break;
case RemoteUtil.MIME_MP4:
ffMp4Cmd(cmdList);
break;
case RemoteUtil.MIME_WEBM:
if (isChromeTrick()) {
ffChromeCmd(cmdList);
} else {
// nothing here yet
}
break;
}
}
if (isLowBitrate()) {
cmdList.addAll(((FFMpegVideo) player).getVideoBitrateOptions(resource, media, params));
}
} else {
// nothing here yet
}
return true;
// } else if (player instanceof MEncoderVideo) {
// // nothing here yet
}
return false;
}
use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.
the class Issue1278 method dlnaMediaInfoDoubleParseWithDot.
@Test
public void dlnaMediaInfoDoubleParseWithDot() {
DLNAMediaInfo info = new DLNAMediaInfo();
info.setFrameRate("23.976");
String validFps = info.getValidFps(true);
assertNotNull("validFps", validFps);
assertEquals("proper ratio", "24000/1001", validFps);
validFps = info.getValidFps(false);
assertNotNull("validFps", validFps);
assertEquals("proper ratio", "23.976", validFps);
}
use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.
the class Issue1278 method testNullFrameRate.
@Test
public void testNullFrameRate() {
DLNAMediaInfo info = new DLNAMediaInfo();
assertNull("valid fps", info.getValidFps(true));
}
use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.
the class Issue1278 method dlnaMediaInfoDoubleParseWithComma.
@Test
public void dlnaMediaInfoDoubleParseWithComma() {
DLNAMediaInfo info = new DLNAMediaInfo();
info.setFrameRate("23,976");
String validFps = info.getValidFps(true);
assertNotNull("validFps", validFps);
assertEquals("proper ratio", "24000/1001", validFps);
validFps = info.getValidFps(false);
assertNotNull("validFps", validFps);
assertEquals("proper ratio", "23.976", validFps);
}
use of net.pms.dlna.DLNAMediaInfo in project UniversalMediaServer by UniversalMediaServer.
the class modAwareHashMap method parseMediaInfo.
/**
* Parse media info from ffmpeg headers during playback
*/
public void parseMediaInfo(String filename, final DLNAResource dlna, final ProcessWrapperImpl pw) {
if (dlna.getMedia() == null) {
dlna.setMedia(new DLNAMediaInfo());
} else if (dlna.getMedia().isFFmpegparsed()) {
return;
}
final ArrayList<String> lines = new ArrayList<>();
final String input = filename.length() > 200 ? filename.substring(0, 199) : filename;
OutputTextLogger ffParser = new OutputTextLogger(null) {
@Override
public boolean filter(String line) {
if (endOfHeader.reset(line).find()) {
dlna.getMedia().parseFFmpegInfo(lines, input);
LOGGER.trace("[{}] parsed media from headers: {}", ID, dlna.getMedia());
dlna.getParent().updateChild(dlna);
// done, stop filtering
return false;
}
lines.add(line);
// keep filtering
return true;
}
};
ffParser.setFiltered(true);
pw.setStderrConsumer(ffParser);
}
Aggregations