@Test public void readData5(){ Date traceDateTime = new Date((long) 1414092264446.0); VideoTime videoTime = null; nativeVideoFileOnDevice = makeFile("video.mp4", null); VIDEO_TIME_FILE = makeFile("video_time", new String[] { "1.41409226371E9 1.414092261198E9" }); String result = " Duration: 00:05:53.95, \n creation_time : 2019-01-21 22:24:10" ; String cmd = Util.getFFMPEG() + " -i " + "\"" + nativeVideoFileOnDevice.getAbsolutePath() +"\""; Mockito.when(extRunner.executeCmd(cmd)).thenReturn(result); videoTime = videoTimeReaderImpl.readData(tracePath, traceDateTime); assertEquals(1.54810909605E9, videoTime.getVideoStartTime(), 0); nativeVideoFileOnDevice.delete(); nativeVideoFileOnDevice = null; VIDEO_TIME_FILE.delete(); VIDEO_TIME_FILE = null; }
@Override public VideoTime readData(String directory, Date traceDateTime) { boolean exVideoFound = false; boolean exVideoTimeFileNotFound = false; double videoStartTime = 0.0; boolean nativeVideo = false; String exVideoDisplayFileName = "exvideo.mov"; String filePath = directory + Util.FILE_SEPARATOR + exVideoDisplayFileName; String nativeVideoDisplayfile = "video.mov"; if (filereader.fileExist(filePath) || isExternalVideoSourceFilePresent(nativeVideoFileOnDevice, nativeVideoDisplayfile, false, directory)) { exVideoFound = true; exVideoTimeFileNotFound = false; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.EXVIDEO_TIME_FILE; if (!filereader.fileExist(filePath)) { exVideoTimeFileNotFound = true; exVideoFound = false; } else { videoStartTime += readVideoStartTime(filePath, traceDateTime); } } else { exVideoFound = false; exVideoTimeFileNotFound = false; nativeVideo = true; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.VIDEO_TIME_FILE; videoStartTime = updateVideoStartTimeForMP4(directory, filePath, traceDateTime); } VideoTime vtime = new VideoTime(); vtime.setExVideoFound(exVideoFound); vtime.setExVideoTimeFileNotFound(exVideoTimeFileNotFound); vtime.setNativeVideo(nativeVideo); vtime.setVideoStartTime(videoStartTime); return vtime; }
VideoTimeReaderImpl extends PeripheralBase implements IVideoTimeReader { @Override public VideoTime readData(String directory, Date traceDateTime) { boolean exVideoFound = false; boolean exVideoTimeFileNotFound = false; double videoStartTime = 0.0; boolean nativeVideo = false; String exVideoDisplayFileName = "exvideo.mov"; String filePath = directory + Util.FILE_SEPARATOR + exVideoDisplayFileName; String nativeVideoDisplayfile = "video.mov"; if (filereader.fileExist(filePath) || isExternalVideoSourceFilePresent(nativeVideoFileOnDevice, nativeVideoDisplayfile, false, directory)) { exVideoFound = true; exVideoTimeFileNotFound = false; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.EXVIDEO_TIME_FILE; if (!filereader.fileExist(filePath)) { exVideoTimeFileNotFound = true; exVideoFound = false; } else { videoStartTime += readVideoStartTime(filePath, traceDateTime); } } else { exVideoFound = false; exVideoTimeFileNotFound = false; nativeVideo = true; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.VIDEO_TIME_FILE; videoStartTime = updateVideoStartTimeForMP4(directory, filePath, traceDateTime); } VideoTime vtime = new VideoTime(); vtime.setExVideoFound(exVideoFound); vtime.setExVideoTimeFileNotFound(exVideoTimeFileNotFound); vtime.setNativeVideo(nativeVideo); vtime.setVideoStartTime(videoStartTime); return vtime; } }
VideoTimeReaderImpl extends PeripheralBase implements IVideoTimeReader { @Override public VideoTime readData(String directory, Date traceDateTime) { boolean exVideoFound = false; boolean exVideoTimeFileNotFound = false; double videoStartTime = 0.0; boolean nativeVideo = false; String exVideoDisplayFileName = "exvideo.mov"; String filePath = directory + Util.FILE_SEPARATOR + exVideoDisplayFileName; String nativeVideoDisplayfile = "video.mov"; if (filereader.fileExist(filePath) || isExternalVideoSourceFilePresent(nativeVideoFileOnDevice, nativeVideoDisplayfile, false, directory)) { exVideoFound = true; exVideoTimeFileNotFound = false; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.EXVIDEO_TIME_FILE; if (!filereader.fileExist(filePath)) { exVideoTimeFileNotFound = true; exVideoFound = false; } else { videoStartTime += readVideoStartTime(filePath, traceDateTime); } } else { exVideoFound = false; exVideoTimeFileNotFound = false; nativeVideo = true; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.VIDEO_TIME_FILE; videoStartTime = updateVideoStartTimeForMP4(directory, filePath, traceDateTime); } VideoTime vtime = new VideoTime(); vtime.setExVideoFound(exVideoFound); vtime.setExVideoTimeFileNotFound(exVideoTimeFileNotFound); vtime.setNativeVideo(nativeVideo); vtime.setVideoStartTime(videoStartTime); return vtime; }  }
VideoTimeReaderImpl extends PeripheralBase implements IVideoTimeReader { @Override public VideoTime readData(String directory, Date traceDateTime) { boolean exVideoFound = false; boolean exVideoTimeFileNotFound = false; double videoStartTime = 0.0; boolean nativeVideo = false; String exVideoDisplayFileName = "exvideo.mov"; String filePath = directory + Util.FILE_SEPARATOR + exVideoDisplayFileName; String nativeVideoDisplayfile = "video.mov"; if (filereader.fileExist(filePath) || isExternalVideoSourceFilePresent(nativeVideoFileOnDevice, nativeVideoDisplayfile, false, directory)) { exVideoFound = true; exVideoTimeFileNotFound = false; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.EXVIDEO_TIME_FILE; if (!filereader.fileExist(filePath)) { exVideoTimeFileNotFound = true; exVideoFound = false; } else { videoStartTime += readVideoStartTime(filePath, traceDateTime); } } else { exVideoFound = false; exVideoTimeFileNotFound = false; nativeVideo = true; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.VIDEO_TIME_FILE; videoStartTime = updateVideoStartTimeForMP4(directory, filePath, traceDateTime); } VideoTime vtime = new VideoTime(); vtime.setExVideoFound(exVideoFound); vtime.setExVideoTimeFileNotFound(exVideoTimeFileNotFound); vtime.setNativeVideo(nativeVideo); vtime.setVideoStartTime(videoStartTime); return vtime; }  @Override VideoTime readData(String directory, Date traceDateTime); double updateVideoStartTimeForMP4(String directory, String filepath, Date traceDateTime); double getFfmpegVideoStartTime(String videoPath); void updateVideoTimeFile(double newVideoStartTime, String filePath); }
VideoTimeReaderImpl extends PeripheralBase implements IVideoTimeReader { @Override public VideoTime readData(String directory, Date traceDateTime) { boolean exVideoFound = false; boolean exVideoTimeFileNotFound = false; double videoStartTime = 0.0; boolean nativeVideo = false; String exVideoDisplayFileName = "exvideo.mov"; String filePath = directory + Util.FILE_SEPARATOR + exVideoDisplayFileName; String nativeVideoDisplayfile = "video.mov"; if (filereader.fileExist(filePath) || isExternalVideoSourceFilePresent(nativeVideoFileOnDevice, nativeVideoDisplayfile, false, directory)) { exVideoFound = true; exVideoTimeFileNotFound = false; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.EXVIDEO_TIME_FILE; if (!filereader.fileExist(filePath)) { exVideoTimeFileNotFound = true; exVideoFound = false; } else { videoStartTime += readVideoStartTime(filePath, traceDateTime); } } else { exVideoFound = false; exVideoTimeFileNotFound = false; nativeVideo = true; filePath = directory + Util.FILE_SEPARATOR + TraceDataConst.FileName.VIDEO_TIME_FILE; videoStartTime = updateVideoStartTimeForMP4(directory, filePath, traceDateTime); } VideoTime vtime = new VideoTime(); vtime.setExVideoFound(exVideoFound); vtime.setExVideoTimeFileNotFound(exVideoTimeFileNotFound); vtime.setNativeVideo(nativeVideo); vtime.setVideoStartTime(videoStartTime); return vtime; }  @Override VideoTime readData(String directory, Date traceDateTime); double updateVideoStartTimeForMP4(String directory, String filepath, Date traceDateTime); double getFfmpegVideoStartTime(String videoPath); void updateVideoTimeFile(double newVideoStartTime, String filePath);  }