Skip to content

Commit

Permalink
Buffer format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
caprica committed Feb 2, 2024
1 parent 9c10b36 commit ef6fd44
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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));
Expand Down

0 comments on commit ef6fd44

Please sign in to comment.