Skip to content

Commit

Permalink
Unsupported media no longer stops other previews
Browse files Browse the repository at this point in the history
  • Loading branch information
berry120 committed Dec 26, 2023
1 parent 22cbd84 commit 3ba0e8d
Showing 1 changed file with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,33 @@ public VidPreviewDisplay() {
}

public synchronized Image getPreviewImg(URI uri) {
if(uri == null || playBin == null) {
if (uri == null || playBin == null) {
return VideoListPanel.BLANK;
}

LOGGER.log(Level.INFO,"PROCESSING URI " + uri);
LOGGER.log(Level.INFO, "PROCESSING URI " + uri);
playBin.setURI(uri);
playBin.getState();
playBin.pause();
playBin.getState();
playBin.getState();
Sample s = playBin.emit(Sample.class, "convert-sample", Caps.fromString("video/x-raw,format=BGRA"));
Structure capsStruct = s.getCaps().getStructure(0);
int width = capsStruct.getInteger("width");
int height = capsStruct.getInteger("height");
Buffer activeBuffer = s.getBuffer();
PixelBuffer<ByteBuffer> pixelBuffer = new PixelBuffer<>(width, height,
activeBuffer.map(false), PixelFormat.getByteBgraPreInstance());
WritableImage img = new WritableImage(pixelBuffer);
playBin.stop();
playBin.getState();
return img;
if (s == null) {
playBin.stop();
playBin.getState();
return VideoListPanel.BLANK;
} else {
Structure capsStruct = s.getCaps().getStructure(0);
int width = capsStruct.getInteger("width");
int height = capsStruct.getInteger("height");
Buffer activeBuffer = s.getBuffer();
PixelBuffer<ByteBuffer> pixelBuffer = new PixelBuffer<>(width, height,
activeBuffer.map(false), PixelFormat.getByteBgraPreInstance());
WritableImage img = new WritableImage(pixelBuffer);
playBin.stop();
playBin.getState();
return img;
}
}

}

0 comments on commit 3ba0e8d

Please sign in to comment.