\r
@Test\r
public void test999995() throws Exception {\r
- // (InformOption_HTML(\r
- long progress[] = { 0, 0 };\r
- System.setProperty("user.dir", "c:/apps/MediaInfo");\r
- System.setProperty("jna.library.path", "c:/apps/MediaInfo");\r
- System.setProperty("java.library.path", "c:/apps/MediaInfo");\r
+// System.setProperty("user.dir", "c:/apps/MediaInfo");\r
+// System.setProperty("jna.library.path", "c:/apps/MediaInfo");\r
+// System.setProperty("java.library.path", "c:/apps/MediaInfo");\r
MediaArea ma = new MediaArea(Paths.get("d:/output.mov"));\r
- BasicDBObject informJSON = ma.informJSON();\r
+ ma.process();\r
+ BasicDBObject informJSON = ma.getInform();\r
\r
System.out.println(informJSON.toPrettyString(""));\r
\r
// ma.process();\r
// System.out.println(ma.getFrameCount());\r
+\r
+// long progress[] = { 0, 0 };\r
//\r
// ExternalCommandExecutor executor = new ExternalCommandExecutor();\r
// executor.execute("profile1", "c:\\_workspace\\data\\video\\1.mxf", "c:\\_video\\test1.mp4", e -> {\r
private long frameCount;\r
private double frameRate;\r
private String format = "";\r
+ private BasicDBObject inform = null;\r
\r
public MediaArea(Path filePath) {\r
this.filePath = filePath;\r
return format;\r
}\r
\r
- public String inform() {\r
- String result = null;\r
- // auto closable\r
- try (MediaInfo mi = new MediaInfo(filePath.toAbsolutePath().toString())) {\r
- result = mi.inform();\r
- } catch (Exception ex) {\r
- throw new RuntimeException(ex);\r
- }\r
- return result;\r
- }\r
-\r
- public BasicDBObject informJSON() {\r
- BasicDBObject result = null;\r
- // auto closable\r
- try (MediaInfo mi = new MediaInfo(filePath.toAbsolutePath().toString())) {\r
- Map<String, MediaMetadata> data = InformParser.parse(mi.inform());\r
-\r
- result = new BasicDBObject();\r
- for (MediaMetadata md : data.values()) {\r
- result.append(md.getType(),\r
- new BasicDBObject(Collections.<String, Object>unmodifiableMap(md.getMetaData())));\r
- }\r
-\r
- } catch (Exception ex) {\r
- throw new RuntimeException(ex);\r
- }\r
- return result;\r
- }\r
+// public String inform() {\r
+// String result = null;\r
+// // auto closable\r
+// try (MediaInfo mi = new MediaInfo(filePath.toAbsolutePath().toString())) {\r
+// result = mi.inform();\r
+// } catch (Exception ex) {\r
+// throw new RuntimeException(ex);\r
+// }\r
+// return result;\r
+// }\r
\r
public void process() throws Exception {\r
// auto closable\r
format = mi.get(StreamKind.Video, 0, "Format").toUpperCase();\r
frameRate = Double.parseDouble(mi.get(StreamKind.Video, 0, "FrameRate"));\r
frameCount = Integer.parseInt(mi.get(StreamKind.Video, 0, "FrameCount"));\r
+\r
+ inform = new BasicDBObject();\r
+\r
+ getInform().put("fileName", filePath.getFileName().toString());\r
+ getInform().put("width", width);\r
+ getInform().put("height", height);\r
+ getInform().put("displayAspect", displayAspect);\r
+ getInform().put("formatProfile", formatProfile);\r
+ getInform().put("format", format);\r
+ getInform().put("frameRate", frameRate);\r
+ getInform().put("frameCount", frameCount);\r
+\r
+ Map<String, MediaMetadata> data = InformParser.parse(mi.inform());\r
+ for (MediaMetadata md : data.values()) {\r
+ getInform().append(md.getType(),\r
+ new BasicDBObject(Collections.<String, Object>unmodifiableMap(md.getMetaData())));\r
+ }\r
} catch (Exception ex) {\r
throw new Exception(ex);\r
}\r
}\r
+\r
+ public BasicDBObject getInform() {\r
+ return inform;\r
+ }\r
}\r