use of org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser in project fmv by f-agu.
the class FFSoftProvider method createParser.
// ***********************************************************************
/**
* @param file
* @return
*/
Parser createParser(File file) {
return new Parser() {
private static final String CONFIGURATION_START_PATTERN = "configuration:";
private Version version = null;
private Date builtDate = null;
// configuration
private Set<String> configuration = null;
// lib versions
private Map<String, Version> libVersions = new HashMap<>();
private SoftFound softFound;
@Override
public void readLine(final String lineIn) {
if (StringUtils.isBlank(lineIn) || softFound != null) {
return;
}
String line = lineIn.trim();
// version
Matcher matcher = FF_FIRSTLINE_PATTERN.matcher(line);
if (matcher.matches()) {
String parsedTool = matcher.group(1).trim();
if (parsedTool.equalsIgnoreCase(getName())) {
version = getVersion(matcher.group(2).trim());
return;
}
softFound = SoftFound.foundError(file, "Wrong tool, need " + getName() + " and found " + parsedTool + ": " + line);
}
// configuration
if (line.startsWith(CONFIGURATION_START_PATTERN)) {
configuration = getConfiguration(StringUtils.substringAfter(line, CONFIGURATION_START_PATTERN).trim());
return;
}
// built
matcher = BUILD_PATTERN.matcher(line);
if (matcher.matches()) {
builtDate = getBuiltDate(matcher);
return;
}
// lib versions
matcher = LIBVERSION_PATTERN.matcher(line);
if (matcher.matches()) {
addLibVersions(libVersions, matcher);
}
}
@Override
public SoftFound closeAndParse(String cmdLineStr, int exitValue) throws IOException {
if (softFound != null) {
return softFound;
}
Integer builtVersion = null;
if (version != null && version.size() == 1) {
final int minBuildVersion = 100;
int major = version.getFieldValue(VersionUnit.VF_0_MAJOR, 0);
// N-70767-gd24af70
if (major > minBuildVersion) {
builtVersion = major;
version = null;
}
}
FFInfo ffInfo = new FFInfo(file, version, getName(), builtDate, builtVersion, configuration, libVersions);
return FFSoftPolicy.toSoftFound(ffInfo);
}
};
}
use of org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser in project fmv by f-agu.
the class FFInfoTestCase method testFFMPEGFull_v2_6_1.
/**
* @throws Exception
*/
@Test
public void testFFMPEGFull_v2_6_1() throws Exception {
Parser parser = newParserFFMpeg();
parser.readLine("ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers");
parser.readLine("built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)");
parser.readLine("configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab");
parser.readLine("libavutil 54. 20.100 / 54. 20.100");
parser.readLine("libavcodec 56. 26.100 / 56. 26.100");
parser.readLine("libavformat 56. 25.101 / 56. 25.101");
parser.readLine("libavdevice 56. 4.100 / 56. 4.100");
parser.readLine("libavfilter 5. 11.102 / 5. 11.102");
parser.readLine("libavresample 2. 1. 0 / 2. 1. 0");
parser.readLine("libswscale 3. 1.101 / 3. 1.101");
parser.readLine("libswresample 1. 1.100 / 1. 1.100");
assertFull(parser, new Version(2, 6, 1), date(2014, 12, 30), null);
}
use of org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser in project fmv by f-agu.
the class FFInfoTestCase method testFFMPEGFull_N65107.
/**
* @throws Exception
*/
@Test
public void testFFMPEGFull_N65107() throws Exception {
Parser parser = newParserFFMpeg();
parser.readLine("ffmpeg version N-65107-ga507623 Copyright (c) 2000-2014 the FFmpeg developers");
parser.readLine("built on Jul 29 2014 22:10:17 with gcc 4.8.3 (GCC)");
parser.readLine("configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib");
parser.readLine("libavutil 52. 93.100 / 52. 93.100");
parser.readLine("libavcodec 55. 71.100 / 55. 71.100");
parser.readLine("libavformat 55. 49.100 / 55. 49.100");
parser.readLine("libavdevice 55. 13.102 / 55. 13.102");
parser.readLine("libavfilter 4. 11.102 / 4. 11.102");
parser.readLine("libswscale 2. 6.100 / 2. 6.100");
parser.readLine("libswresample 0. 19.100 / 0. 19.100");
parser.readLine("libpostproc 52. 3.100 / 52. 3.100");
Calendar calendar = Calendar.getInstance();
calendar.set(2014, Calendar.JULY, 29, 22, 10, 17);
assertFull(parser, null, calendar.getTime(), 65107);
}
use of org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser in project fmv by f-agu.
the class FFInfoTestCase method testFFProbeFull_N70767.
/**
* @throws Exception
*/
@Test
public void testFFProbeFull_N70767() throws Exception {
Parser parser = newParserProbe();
parser.readLine("ffprobe version N-70767-gd24af70 Copyright (c) 2000-2015 the FFmpeg developers");
parser.readLine("built with gcc 4.9.2 (GCC)");
parser.readLine("configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib");
parser.readLine("libavutil 54. 20.100 / 54. 20.100");
parser.readLine("libavcodec 56. 28.100 / 56. 28.100");
parser.readLine("libavformat 56. 25.101 / 56. 25.101");
parser.readLine("libavdevice 56. 4.100 / 56. 4.100");
parser.readLine("libavfilter 5. 12.100 / 5. 12.100");
parser.readLine("libswscale 3. 1.101 / 3. 1.101");
parser.readLine("libswresample 1. 1.100 / 1. 1.100");
parser.readLine("libpostproc 53. 3.100 / 53. 3.100");
assertFull(parser, null, date(2015, 1, 2), 70767);
}
use of org.fagu.fmv.soft.find.ExecSoftFoundFactory.Parser in project fmv by f-agu.
the class FFInfoTestCase method testFFProbeFull_v2_6_1.
/**
* @throws Exception
*/
@Test
public void testFFProbeFull_v2_6_1() throws Exception {
Parser parser = newParserProbe();
parser.readLine("ffprobe version 2.6.1 Copyright (c) 2007-2015 the FFmpeg developers");
parser.readLine("built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)");
parser.readLine("configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab");
parser.readLine("libavutil 54. 20.100 / 54. 20.100");
parser.readLine("libavcodec 56. 26.100 / 56. 26.100");
parser.readLine("libavformat 56. 25.101 / 56. 25.101");
parser.readLine("libavdevice 56. 4.100 / 56. 4.100");
parser.readLine("libavfilter 5. 11.102 / 5. 11.102");
parser.readLine("libavresample 2. 1. 0 / 2. 1. 0");
parser.readLine("libswscale 3. 1.101 / 3. 1.101");
parser.readLine("libswresample 1. 1.100 / 1. 1.100");
parser.readLine("libpostproc 53. 3.100 / 53. 3.100");
assertFull(parser, new Version(2, 6, 1), date(2014, 12, 30), null);
}
Aggregations