19 package org.sleuthkit.autopsy.contentviewers;
21 import java.awt.Dimension;
22 import java.util.Arrays;
23 import java.util.List;
25 import java.util.SortedSet;
26 import java.util.TreeSet;
27 import java.util.logging.Level;
28 import javax.swing.JPanel;
38 abstract class MediaViewVideoPanel
extends JPanel implements FrameCapture, MediaFileViewer.MediaViewPanel {
40 private static final Set<String> AUDIO_EXTENSIONS =
new TreeSet<>(Arrays.asList(
".mp3",
".wav",
".wma"));
42 private static final Logger logger = Logger.getLogger(MediaViewVideoPanel.class.getName());
45 private static final String[] ARCH64 =
new String[]{
"amd64",
"x86_64"};
48 private static final String[] ARCH32 =
new String[]{
"x86"};
57 public static MediaViewVideoPanel createVideoPanel() {
59 logger.log(Level.INFO,
"64 bit JVM detected. Creating JavaFX Video Player.");
62 logger.log(Level.INFO,
"32 bit JVM detected. Creating GStreamer Video Player.");
72 private static boolean is64BitJVM() {
73 String arch = System.getProperty(
"os.arch");
74 return Arrays.asList(ARCH64).contains(arch);
82 private static MediaViewVideoPanel getGstImpl() {
83 return new GstVideoPanel();
91 private static MediaViewVideoPanel getFXImpl() {
92 return new FXVideoPanel();
100 public abstract boolean isInited();
105 abstract void reset();
113 abstract void setupVideo(
final AbstractFile file,
final Dimension dims);
120 abstract public String[] getExtensions();
126 abstract public List<String> getMimeTypes();
129 public List<String> getExtensionsList() {
130 return Arrays.asList(getExtensions());
134 public boolean isSupported(AbstractFile file) {
135 String extension = file.getNameExtension();
152 if (AUDIO_EXTENSIONS.contains(
"." + extension) || getExtensionsList().contains(
"." + extension)) {
153 SortedSet<String> mimeTypes =
new TreeSet<>(getMimeTypes());
155 String mimeType =
new FileTypeDetector().getMIMEType(file);
156 return mimeTypes.contains(mimeType);
157 }
catch (FileTypeDetector.FileTypeDetectorInitException ex) {
158 logger.log(Level.WARNING,
"Failed to look up mimetype for " + file.getName() +
" using FileTypeDetector. Fallingback on AbstractFile.isMimeType", ex);
159 if (!mimeTypes.isEmpty() && file.isMimeType(mimeTypes) == AbstractFile.MimeMatchEnum.TRUE) {
164 return getExtensionsList().contains(
"." + extension);