mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Revert Gst initialization on Windows since it didn't have any impact on crashes.
This commit is contained in:
parent
219bb5b2e0
commit
92a3667a14
@ -74,7 +74,6 @@ import org.freedesktop.gstreamer.Format;
|
|||||||
import org.freedesktop.gstreamer.GstException;
|
import org.freedesktop.gstreamer.GstException;
|
||||||
import org.freedesktop.gstreamer.event.SeekFlags;
|
import org.freedesktop.gstreamer.event.SeekFlags;
|
||||||
import org.freedesktop.gstreamer.event.SeekType;
|
import org.freedesktop.gstreamer.event.SeekType;
|
||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a video player that is part of the Media View layered pane. It uses
|
* This is a video player that is part of the Media View layered pane. It uses
|
||||||
@ -222,14 +221,6 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
//True for fairness. In other words,
|
//True for fairness. In other words,
|
||||||
//acquire() calls are processed in order of invocation.
|
//acquire() calls are processed in order of invocation.
|
||||||
sliderLock = new Semaphore(1, true);
|
sliderLock = new Semaphore(1, true);
|
||||||
|
|
||||||
/**
|
|
||||||
* See JIRA-5888 for details. Initializing gstreamer here is more stable
|
|
||||||
* on Windows.
|
|
||||||
*/
|
|
||||||
if (PlatformUtil.isWindowsOS()) {
|
|
||||||
Gst.init();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void customizeComponents() {
|
private void customizeComponents() {
|
||||||
@ -264,7 +255,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
//Manage the video while the user is performing actions on the track.
|
//Manage the video while the user is performing actions on the track.
|
||||||
progressSlider.addMouseListener(new MouseListener() {
|
progressSlider.addMouseListener(new MouseListener() {
|
||||||
private State previousState = State.NULL;
|
private State previousState = State.NULL;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
previousState = gstPlayBin.getState();
|
previousState = gstPlayBin.getState();
|
||||||
@ -273,11 +264,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(MouseEvent e) {
|
public void mouseReleased(MouseEvent e) {
|
||||||
if(previousState.equals(State.PLAYING)) {
|
if (previousState.equals(State.PLAYING)) {
|
||||||
gstPlayBin.play();
|
gstPlayBin.play();
|
||||||
}
|
}
|
||||||
previousState = State.NULL;
|
previousState = State.NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
}
|
}
|
||||||
@ -289,7 +281,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
//Manage the audio level when the user is adjusting the volume slider
|
//Manage the audio level when the user is adjusting the volume slider
|
||||||
audioSlider.addChangeListener((ChangeEvent event) -> {
|
audioSlider.addChangeListener((ChangeEvent event) -> {
|
||||||
@ -389,6 +381,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
gstPlayBin.getBus().disconnect(endOfStreamListener);
|
gstPlayBin.getBus().disconnect(endOfStreamListener);
|
||||||
gstPlayBin.getBus().disconnect(stateChangeListener);
|
gstPlayBin.getBus().disconnect(stateChangeListener);
|
||||||
gstPlayBin.getBus().disconnect(errorListener);
|
gstPlayBin.getBus().disconnect(errorListener);
|
||||||
|
gstPlayBin.getBus().dispose();
|
||||||
gstPlayBin.dispose();
|
gstPlayBin.dispose();
|
||||||
fxAppSink.clear();
|
fxAppSink.clear();
|
||||||
gstPlayBin = null;
|
gstPlayBin = null;
|
||||||
@ -548,10 +541,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
|
|
||||||
// Initialize Gstreamer. It is safe to call this for every file.
|
// Initialize Gstreamer. It is safe to call this for every file.
|
||||||
// It was moved here from the constructor because having it happen
|
// It was moved here from the constructor because having it happen
|
||||||
// earlier resulted in conflicts on Linux. See JIRA-5888.
|
// earlier resulted in crashes on Linux. See JIRA-5888.
|
||||||
if (!PlatformUtil.isWindowsOS()) {
|
Gst.init();
|
||||||
Gst.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Video is ready for playback. Create new components
|
//Video is ready for playback. Create new components
|
||||||
gstPlayBin = new PlayBin("VideoPlayer", tempFile.toURI());
|
gstPlayBin = new PlayBin("VideoPlayer", tempFile.toURI());
|
||||||
@ -599,23 +590,27 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (!progressSlider.getValueIsAdjusting()) {
|
if (!progressSlider.getValueIsAdjusting()) {
|
||||||
sliderLock.acquireUninterruptibly();
|
try {
|
||||||
long position = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS);
|
sliderLock.acquireUninterruptibly();
|
||||||
long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS);
|
long position = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS);
|
||||||
/**
|
long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS);
|
||||||
* Duration may not be known until there is video data in the
|
/**
|
||||||
* pipeline. We start this updater when data-flow has just been
|
* Duration may not be known until there is video data in
|
||||||
* initiated so buffering may still be in progress.
|
* the pipeline. We start this updater when data-flow has
|
||||||
*/
|
* just been initiated so buffering may still be in
|
||||||
if (duration >= 0 && position >= 0) {
|
* progress.
|
||||||
double relativePosition = (double) position / duration;
|
*/
|
||||||
progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE));
|
if (duration >= 0 && position >= 0) {
|
||||||
}
|
double relativePosition = (double) position / duration;
|
||||||
|
progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
updateTimeLabel(position, duration);
|
updateTimeLabel(position, duration);
|
||||||
});
|
});
|
||||||
sliderLock.release();
|
} finally {
|
||||||
|
sliderLock.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -635,13 +630,13 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
* thumb at the given width and height. It also paints the track blue as
|
* thumb at the given width and height. It also paints the track blue as
|
||||||
* the thumb progresses.
|
* the thumb progresses.
|
||||||
*
|
*
|
||||||
* @param slider JSlider component
|
* @param slider JSlider component
|
||||||
* @param thumbDimension
|
* @param thumbDimension
|
||||||
*/
|
*/
|
||||||
public CircularJSliderUI(JSlider slider, Dimension thumbDimension) {
|
public CircularJSliderUI(JSlider slider, Dimension thumbDimension) {
|
||||||
super(slider);
|
super(slider);
|
||||||
this.thumbDimension = thumbDimension;
|
this.thumbDimension = thumbDimension;
|
||||||
|
|
||||||
//Configure track and thumb colors.
|
//Configure track and thumb colors.
|
||||||
Color lightBlue = new Color(0, 130, 255);
|
Color lightBlue = new Color(0, 130, 255);
|
||||||
thumbColor = lightBlue;
|
thumbColor = lightBlue;
|
||||||
@ -655,8 +650,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the View to be an oval rather than the underlying
|
* Modifies the View to be an oval rather than the underlying rectangle
|
||||||
* rectangle Controller.
|
* Controller.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paintThumb(Graphics graphic) {
|
public void paintThumb(Graphics graphic) {
|
||||||
@ -705,12 +700,13 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
@Override
|
@Override
|
||||||
protected TrackListener createTrackListener(JSlider slider) {
|
protected TrackListener createTrackListener(JSlider slider) {
|
||||||
/**
|
/**
|
||||||
* This track listener will force the thumb to be snapped to the mouse
|
* This track listener will force the thumb to be snapped to the
|
||||||
* location. This makes grabbing and dragging the JSlider much easier.
|
* mouse location. This makes grabbing and dragging the JSlider much
|
||||||
* Using the default track listener, the user would have to click
|
* easier. Using the default track listener, the user would have to
|
||||||
* exactly on the slider thumb to drag it. Now the thumb positions
|
* click exactly on the slider thumb to drag it. Now the thumb
|
||||||
* itself under the mouse so that it can always be dragged.
|
* positions itself under the mouse so that it can always be
|
||||||
*/
|
* dragged.
|
||||||
|
*/
|
||||||
return new TrackListener() {
|
return new TrackListener() {
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
@ -1007,14 +1003,14 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie
|
|||||||
//Don't allow skipping within 2 seconds of video ending. Skipping right to
|
//Don't allow skipping within 2 seconds of video ending. Skipping right to
|
||||||
//the end causes undefined behavior for some gstreamer plugins.
|
//the end causes undefined behavior for some gstreamer plugins.
|
||||||
long twoSecondsInNano = TimeUnit.NANOSECONDS.convert(2, TimeUnit.SECONDS);
|
long twoSecondsInNano = TimeUnit.NANOSECONDS.convert(2, TimeUnit.SECONDS);
|
||||||
if((duration - currentTime) <= twoSecondsInNano) {
|
if ((duration - currentTime) <= twoSecondsInNano) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long newTime;
|
long newTime;
|
||||||
if (currentTime + fastForwardDelta >= duration) {
|
if (currentTime + fastForwardDelta >= duration) {
|
||||||
//If there are less than 30 seconds left, only fast forward to the midpoint.
|
//If there are less than 30 seconds left, only fast forward to the midpoint.
|
||||||
newTime = currentTime + (duration - currentTime)/2;
|
newTime = currentTime + (duration - currentTime) / 2;
|
||||||
} else {
|
} else {
|
||||||
newTime = currentTime + fastForwardDelta;
|
newTime = currentTime + fastForwardDelta;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user