mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Merge branch '5422-SmallerSizeFilter' of https://github.com/wschaeferB/autopsy into 5423-DiscoveryThumbnailViewer
This commit is contained in:
commit
55449875af
@ -336,17 +336,18 @@ class FileSearch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the video thumbnails for a specified AbstractFile.
|
* Get the video thumbnails for a file which exists in a
|
||||||
|
* VideoThumbnailsWrapper and update the VideoThumbnailsWrapper to include
|
||||||
|
* them.
|
||||||
*
|
*
|
||||||
* @param file Video file to generate thumbnails for.
|
* @param thumbnailWrapper the object which contains the file to generate
|
||||||
|
* thumbnails for.
|
||||||
*
|
*
|
||||||
* @return An object containing the list of video thumbnails, an array of
|
|
||||||
* their timestamps, and the AbstractFile they were generated for.
|
|
||||||
*/
|
*/
|
||||||
@NbBundle.Messages({"# {0} - file name",
|
@NbBundle.Messages({"# {0} - file name",
|
||||||
"FileSearch.genVideoThumb.progress.text=extracting temporary file {0}"})
|
"FileSearch.genVideoThumb.progress.text=extracting temporary file {0}"})
|
||||||
static VideoThumbnailsWrapper getVideoThumbnails(ResultFile resultFile) {
|
static void getVideoThumbnails(VideoThumbnailsWrapper thumbnailWrapper) {
|
||||||
AbstractFile file = resultFile.getFirstInstance();
|
AbstractFile file = thumbnailWrapper.getResultFile().getFirstInstance();
|
||||||
//Currently this method always creates the thumbnails
|
//Currently this method always creates the thumbnails
|
||||||
java.io.File tempFile;
|
java.io.File tempFile;
|
||||||
try {
|
try {
|
||||||
@ -358,7 +359,8 @@ class FileSearch {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0};
|
0};
|
||||||
return new VideoThumbnailsWrapper(createDefaultThumbnailList(), framePositions, resultFile);
|
thumbnailWrapper.setThumbnails(createDefaultThumbnailList(), framePositions);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (tempFile.exists() == false || tempFile.length() < file.getSize()) {
|
if (tempFile.exists() == false || tempFile.length() < file.getSize()) {
|
||||||
ProgressHandle progress = ProgressHandle.createHandle(Bundle.FileSearch_genVideoThumb_progress_text(file.getName()));
|
ProgressHandle progress = ProgressHandle.createHandle(Bundle.FileSearch_genVideoThumb_progress_text(file.getName()));
|
||||||
@ -371,7 +373,8 @@ class FileSearch {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0};
|
0};
|
||||||
return new VideoThumbnailsWrapper(createDefaultThumbnailList(), framePositions, resultFile);
|
thumbnailWrapper.setThumbnails(createDefaultThumbnailList(), framePositions);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
ContentUtils.writeToFile(file, tempFile, progress, null, true);
|
ContentUtils.writeToFile(file, tempFile, progress, null, true);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@ -391,7 +394,8 @@ class FileSearch {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0};
|
0};
|
||||||
return new VideoThumbnailsWrapper(createDefaultThumbnailList(), framePositions, resultFile);
|
thumbnailWrapper.setThumbnails(createDefaultThumbnailList(), framePositions);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
double fps = videoFile.get(5); // gets frame per second
|
double fps = videoFile.get(5); // gets frame per second
|
||||||
double totalFrames = videoFile.get(7); // gets total frames
|
double totalFrames = videoFile.get(7); // gets total frames
|
||||||
@ -402,7 +406,8 @@ class FileSearch {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0};
|
0};
|
||||||
return new VideoThumbnailsWrapper(createDefaultThumbnailList(), framePositions, resultFile);
|
thumbnailWrapper.setThumbnails(createDefaultThumbnailList(), framePositions);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (Thread.interrupted()) {
|
if (Thread.interrupted()) {
|
||||||
int[] framePositions = new int[]{
|
int[] framePositions = new int[]{
|
||||||
@ -410,7 +415,8 @@ class FileSearch {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0};
|
0};
|
||||||
return new VideoThumbnailsWrapper(createDefaultThumbnailList(), framePositions, resultFile);
|
thumbnailWrapper.setThumbnails(createDefaultThumbnailList(), framePositions);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double duration = 1000 * (totalFrames / fps); //total milliseconds
|
double duration = 1000 * (totalFrames / fps); //total milliseconds
|
||||||
@ -465,11 +471,12 @@ class FileSearch {
|
|||||||
|
|
||||||
bufferedImage.getRaster().setDataElements(0, 0, matrixColumns, matrixRows, data);
|
bufferedImage.getRaster().setDataElements(0, 0, matrixColumns, matrixRows, data);
|
||||||
if (Thread.interrupted()) {
|
if (Thread.interrupted()) {
|
||||||
return new VideoThumbnailsWrapper(videoThumbnails, framePositions, resultFile);
|
thumbnailWrapper.setThumbnails(videoThumbnails, framePositions);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
videoThumbnails.add(ScalrWrapper.resizeFast(bufferedImage, ImageUtils.ICON_SIZE_LARGE));
|
videoThumbnails.add(ScalrWrapper.resizeFast(bufferedImage, ImageUtils.ICON_SIZE_LARGE));
|
||||||
}
|
}
|
||||||
return new VideoThumbnailsWrapper(videoThumbnails, framePositions, resultFile);
|
thumbnailWrapper.setThumbnails(videoThumbnails, framePositions);
|
||||||
} finally {
|
} finally {
|
||||||
videoFile.release(); // close the file}
|
videoFile.release(); // close the file}
|
||||||
}
|
}
|
||||||
|
@ -519,26 +519,19 @@ public class ResultsPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
private class VideoThumbnailWorker extends SwingWorker<Void, Void> {
|
private class VideoThumbnailWorker extends SwingWorker<Void, Void> {
|
||||||
|
|
||||||
private final ResultFile file;
|
private final VideoThumbnailsWrapper thumbnailWrapper;
|
||||||
private VideoThumbnailsWrapper thumbnailWrapper;
|
|
||||||
|
|
||||||
VideoThumbnailWorker(ResultFile file) {
|
VideoThumbnailWorker(ResultFile file) {
|
||||||
this.file = file;
|
thumbnailWrapper = new VideoThumbnailsWrapper(new ArrayList<Image>(), new int[4], file);
|
||||||
|
videoThumbnailViewer.addRow(thumbnailWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground() throws Exception {
|
protected Void doInBackground() throws Exception {
|
||||||
thumbnailWrapper = FileSearch.getVideoThumbnails(file);
|
FileSearch.getVideoThumbnails(thumbnailWrapper);
|
||||||
|
videoThumbnailViewer.repaint();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void done() {
|
|
||||||
if (!isCancelled()) {
|
|
||||||
videoThumbnailViewer.addRow(thumbnailWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ImageThumbnailWorker extends SwingWorker<Void, Void> {
|
private class ImageThumbnailWorker extends SwingWorker<Void, Void> {
|
||||||
|
@ -28,9 +28,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
final class VideoThumbnailsWrapper {
|
final class VideoThumbnailsWrapper {
|
||||||
|
|
||||||
private final List<Image> thumbnails;
|
private List<Image> thumbnails;
|
||||||
private final ResultFile resultFile;
|
private final ResultFile resultFile;
|
||||||
private final int[] timeStamps;
|
private int[] timeStamps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new VideoThumbnailsWrapper.
|
* Construct a new VideoThumbnailsWrapper.
|
||||||
@ -79,4 +79,9 @@ final class VideoThumbnailsWrapper {
|
|||||||
return Collections.unmodifiableList(thumbnails);
|
return Collections.unmodifiableList(thumbnails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setThumbnails(List<Image> videoThumbnails, int[] framePositions) {
|
||||||
|
this.thumbnails = videoThumbnails;
|
||||||
|
this.timeStamps = framePositions;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user