formatting

This commit is contained in:
Trilok Shahi 2014-03-14 15:51:45 -04:00
parent 0807f3be3e
commit c313f4ec1d

View File

@ -61,7 +61,7 @@ public class ImageUtils {
private static List<String> SUPP_MIME_TYPES = new ArrayList<>(Arrays.asList(ImageIO.getReaderMIMETypes())); // final
private static List<String> SUPP_VIDEO_EXTENSIONS = Arrays.asList("mov", "m4v", "flv", "mp4", "3gp", "avi", "mpg", "mpeg","asf", "divx","rm","moov","wmv","vob","dat","m1v","m2v","m4v","mkv","mpe","yop","vqa","xmv","mve","wtv","webm","vivo","vc1","seq","thp","san","mjpg","smk","vmd","sol","cpk","sdp","sbg","rtsp","rpl","rl2","r3d","mlp","mjpeg","hevc","h265","265","h264","h263","h261","drc","avs","pva","pmp","ogg","nut","nuv","nsv","mxf","mtv","mvi","mxg","lxf","lvf","ivf","mve","cin","hnm","gxf","fli","flc","flx","ffm","wve","uv2","dxa","dv","cdxl","cdg","bfi","jv","bik","vid","vb","son","avs","paf","mm","flm","tmv","4xm");
private static List<String> SUPP_VIDEO_MIME_TYPES = Arrays.asList("video/avi","video/msvideo", "video/x-msvideo", "video/mp4", "video/x-ms-wmv", "mpeg","asf");
private static boolean temp_add =false;
/**
* Get the default Icon, which is the icon for a file.
* @return
@ -93,8 +93,7 @@ public class ImageUtils {
return true;
}
}
}
catch (TskCoreException ex) {
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Error while getting file signature from blackboard.", ex);
}
@ -241,26 +240,33 @@ public class ImageUtils {
fileName = jFile.toString(); //store filepath as String
VideoCapture videoFile = new VideoCapture(); // will contain the video
if(!videoFile.open(fileName))return DEFAULT_ICON;
if (!videoFile.open(fileName)) {
return DEFAULT_ICON;
}
double fps = videoFile.get(5); // gets frame per second
double totalFrames = videoFile.get(7); // gets total frames
if (fps==0||totalFrames==0 ) return DEFAULT_ICON;
if (fps == 0 || totalFrames == 0) {
return DEFAULT_ICON;
}
double milliseconds = 1000 * (totalFrames / fps); //total milliseconds
if (milliseconds <= 0) return DEFAULT_ICON;
if (milliseconds <= 0) {
return DEFAULT_ICON;
}
Mat mat = new Mat();
double timestamp = (milliseconds < 500) ? milliseconds : 500; //default time to check for is 500ms, unless the files is extremely small
if(!videoFile.set(0,timestamp))return DEFAULT_ICON;
if(! videoFile.read(mat)) return DEFAULT_ICON; //if the image for some reason is bad, return default icon
if (!videoFile.set(0, timestamp)) {
return DEFAULT_ICON;
}
if (!videoFile.read(mat)) {
return DEFAULT_ICON; //if the image for some reason is bad, return default icon
}
byte[] data = new byte[mat.rows() * mat.cols() * (int) (mat.elemSize())];
mat.get(0, 0, data);
if (mat.channels() == 3)
{
for (int k = 0; k < data.length; k += 3)
{
if (mat.channels() == 3) {
for (int k = 0; k < data.length; k += 3) {
byte temp = data[k];
data[k] = data[k + 2];
data[k + 2] = temp;
@ -273,8 +279,11 @@ public class ImageUtils {
videoFile.release(); // close the file
//if (image==null) return DEFAULT_ICON;
B_image = ScalrWrapper.resizeFast(B_image, iconSize);
if (B_image==null) return DEFAULT_ICON;
else return B_image;
if (B_image == null) {
return DEFAULT_ICON;
} else {
return B_image;
}
}
private static Image generateAndSaveIcon(Content content, int iconSize) {
@ -284,11 +293,12 @@ public class ImageUtils {
if (icon == null) {
return DEFAULT_ICON;
}
}
catch (Exception ex) {
} catch (Exception ex) {
logger.log(Level.WARNING, "Could not write cache thumbnail: " + content, ex);
}
if (icon==null) return DEFAULT_ICON;
if (icon == null) {
return DEFAULT_ICON;
}
return icon;
}