From ef6fd445ba93a7a2392bae337d65a438f469f012 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Fri, 2 Feb 2024 19:39:08 +0000 Subject: [PATCH] Buffer format changes --- .../CallbackMediaPlayerComponent.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/uk/co/caprica/vlcj/player/component/CallbackMediaPlayerComponent.java b/src/main/java/uk/co/caprica/vlcj/player/component/CallbackMediaPlayerComponent.java index c5e3c3d1b..8d3d38855 100644 --- a/src/main/java/uk/co/caprica/vlcj/player/component/CallbackMediaPlayerComponent.java +++ b/src/main/java/uk/co/caprica/vlcj/player/component/CallbackMediaPlayerComponent.java @@ -34,10 +34,16 @@ import uk.co.caprica.vlcj.player.embedded.videosurface.callback.BufferFormatCallbackAdapter; import uk.co.caprica.vlcj.player.embedded.videosurface.callback.RenderCallback; import uk.co.caprica.vlcj.player.embedded.videosurface.callback.RenderCallbackAdapter; -import uk.co.caprica.vlcj.player.embedded.videosurface.callback.format.RV32BufferFormat; - -import javax.swing.*; -import java.awt.*; +import uk.co.caprica.vlcj.player.embedded.videosurface.callback.format.StandardAlphaBufferFormat; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; @@ -360,7 +366,7 @@ private class DefaultBufferFormatCallback extends BufferFormatCallbackAdapter { @Override public BufferFormat getBufferFormat(int sourceWidth, int sourceHeight) { newVideoBuffer(sourceWidth, sourceHeight); - return new RV32BufferFormat(sourceWidth, sourceHeight); + return new StandardAlphaBufferFormat(sourceWidth, sourceHeight); } } @@ -377,7 +383,7 @@ public BufferFormat getBufferFormat(int sourceWidth, int sourceHeight) { * @param height height of the video */ private void newVideoBuffer(int width, int height) { - image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE); defaultRenderCallback.setImageBuffer(image); if (videoSurfaceComponent != null) { videoSurfaceComponent.setPreferredSize(new Dimension(width, height));