@Test public void readData4() throws IOException { makeFile("video.dv", null); makeFile("video.qt", null); makeFile("video.mev", null); makeFile("video.m4", null); makeFile("video_time", new String[] { "1.41409226371E9 1.414092261198E9" }); boolean r = videoTimeReaderImpl.isExternalVideoSourceFilePresent("video.mp4", "video.mov", true, tracePath); assertTrue("should not have found \"video.mov\" or \"video.mp4\"", !r); makeFile("video.mov", null); r = videoTimeReaderImpl.isExternalVideoSourceFilePresent("video.mp4", "video.mov", true, tracePath); assertTrue("should have found \"video.mov\"", r); }
boolean isExternalVideoSourceFilePresent(String nativeVideoFileOnDevice, String nativeVideoDisplayfile,boolean isPcap, String traceDirectory){ int index =0; String[] matches; if(isPcap){ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); }else{ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); } if(matches!= null){ List<String> matchesList = new ArrayList<>(); for (int str = 0; str < matches.length; str++) { if (!matches[str].startsWith("._")) { matchesList.add(matches[str]); } } matches = matchesList.toArray(new String[matchesList.size()]); while(index < matches.length){ if(matches.length == 1){ return (!(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index]))); }else { if((matches.length == 2) && ((index + 1)!=2) && (nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])) && (nativeVideoFileOnDevice.equals(matches[index+1]) || nativeVideoDisplayfile.equals(matches[index+1])) ){ return false; } else{ if(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])){ return true; } } } index+=1; } } return false; }
VideoTimeReaderImpl extends PeripheralBase implements IVideoTimeReader { boolean isExternalVideoSourceFilePresent(String nativeVideoFileOnDevice, String nativeVideoDisplayfile,boolean isPcap, String traceDirectory){ int index =0; String[] matches; if(isPcap){ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); }else{ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); } if(matches!= null){ List<String> matchesList = new ArrayList<>(); for (int str = 0; str < matches.length; str++) { if (!matches[str].startsWith("._")) { matchesList.add(matches[str]); } } matches = matchesList.toArray(new String[matchesList.size()]); while(index < matches.length){ if(matches.length == 1){ return (!(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index]))); }else { if((matches.length == 2) && ((index + 1)!=2) && (nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])) && (nativeVideoFileOnDevice.equals(matches[index+1]) || nativeVideoDisplayfile.equals(matches[index+1])) ){ return false; } else{ if(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])){ return true; } } } index+=1; } } return false; } }
VideoTimeReaderImpl extends PeripheralBase implements IVideoTimeReader { boolean isExternalVideoSourceFilePresent(String nativeVideoFileOnDevice, String nativeVideoDisplayfile,boolean isPcap, String traceDirectory){ int index =0; String[] matches; if(isPcap){ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); }else{ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); } if(matches!= null){ List<String> matchesList = new ArrayList<>(); for (int str = 0; str < matches.length; str++) { if (!matches[str].startsWith("._")) { matchesList.add(matches[str]); } } matches = matchesList.toArray(new String[matchesList.size()]); while(index < matches.length){ if(matches.length == 1){ return (!(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index]))); }else { if((matches.length == 2) && ((index + 1)!=2) && (nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])) && (nativeVideoFileOnDevice.equals(matches[index+1]) || nativeVideoDisplayfile.equals(matches[index+1])) ){ return false; } else{ if(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])){ return true; } } } index+=1; } } return false; }  }
VideoTimeReaderImpl extends PeripheralBase implements IVideoTimeReader { boolean isExternalVideoSourceFilePresent(String nativeVideoFileOnDevice, String nativeVideoDisplayfile,boolean isPcap, String traceDirectory){ int index =0; String[] matches; if(isPcap){ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); }else{ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); } if(matches!= null){ List<String> matchesList = new ArrayList<>(); for (int str = 0; str < matches.length; str++) { if (!matches[str].startsWith("._")) { matchesList.add(matches[str]); } } matches = matchesList.toArray(new String[matchesList.size()]); while(index < matches.length){ if(matches.length == 1){ return (!(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index]))); }else { if((matches.length == 2) && ((index + 1)!=2) && (nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])) && (nativeVideoFileOnDevice.equals(matches[index+1]) || nativeVideoDisplayfile.equals(matches[index+1])) ){ return false; } else{ if(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])){ return true; } } } index+=1; } } return false; }  @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 { boolean isExternalVideoSourceFilePresent(String nativeVideoFileOnDevice, String nativeVideoDisplayfile,boolean isPcap, String traceDirectory){ int index =0; String[] matches; if(isPcap){ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); }else{ matches = filereader.list(traceDirectory, new FilenameFilter() { public boolean accept(File dir, String name) { return isVideoFile(name); } }); } if(matches!= null){ List<String> matchesList = new ArrayList<>(); for (int str = 0; str < matches.length; str++) { if (!matches[str].startsWith("._")) { matchesList.add(matches[str]); } } matches = matchesList.toArray(new String[matchesList.size()]); while(index < matches.length){ if(matches.length == 1){ return (!(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index]))); }else { if((matches.length == 2) && ((index + 1)!=2) && (nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])) && (nativeVideoFileOnDevice.equals(matches[index+1]) || nativeVideoDisplayfile.equals(matches[index+1])) ){ return false; } else{ if(nativeVideoFileOnDevice.equals(matches[index]) || nativeVideoDisplayfile.equals(matches[index])){ return true; } } } index+=1; } } return false; }  @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);  }