Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
GstLoader.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2020 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 package org.sleuthkit.autopsy.contentviewers.utils;
21 
22 import java.util.logging.Level;
23 import org.freedesktop.gstreamer.Gst;
25 
29 public final class GstLoader {
30 
31  private static final Logger logger = Logger.getLogger(GstLoader.class.getName());
32  private static GstStatus status;
33 
41  public synchronized static GstStatus tryLoad() {
42  // Null is our 'unknown' status. Prior to the first call, the status
43  // is unknown.
44  if (status != null) {
45  return status;
46  }
47 
48  try {
49  // Setting the following property causes the GST
50  // Java bindings to call dispose() on the GST
51  // service thread instead of running it in the GST
52  // Native Object Reaper thread.
53  System.setProperty("glib.reapOnEDT", "true");
54  Gst.init();
55  status = GstStatus.SUCCESS;
56  } catch (Throwable ex) {
57  status = GstStatus.FAILURE;
58  logger.log(Level.WARNING, "Failed to load gsteamer bindings", ex);
59  }
60 
61  return status;
62  }
63 
67  public enum GstStatus {
68  SUCCESS, FAILURE
69  }
70 
71  private GstLoader() {
72 
73  }
74 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.