Skip to content

Commit

Permalink
Add new buffer format implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
caprica committed Feb 2, 2024
1 parent a994602 commit 9c10b36
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ public BufferFormat(String chroma, int width, int height, int[] pitches, int[] l
this.lines = Arrays.copyOf(lines, lines.length);
}

/**
* Constructs a new BufferFormat instance with the given parameters.
*
* @param chroma a VLC buffer type, must be exactly 4 characters and cannot contain non-ASCII characters
* @param width the width, must be > 0
* @param height the height, must be > 0
* @param channels number of channels
*/
public BufferFormat(String chroma, int width, int height, int channels) {
this(chroma, width, height, new int[] {width * channels}, new int[] {height});
}

/**
* Get the pixel format.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* <p>
* RV32 is a 24-bit BGR format with 8-bit of padding (no alpha) in a single plane.
*/
@Deprecated
public class RV32BufferFormat extends BufferFormat {

/**
Expand All @@ -35,7 +36,6 @@ public class RV32BufferFormat extends BufferFormat {
* @param height height of the buffer
*/
public RV32BufferFormat(int width, int height) {
super("RV32", width, height, new int[] {width * 4}, new int[] {height});
super("RV32", width, height, 4);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This file is part of VLCJ.
*
* VLCJ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VLCJ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2009-2024 Caprica Software Limited.
*/

package uk.co.caprica.vlcj.player.embedded.videosurface.callback.format;

import uk.co.caprica.vlcj.player.embedded.videosurface.callback.BufferFormat;

/**
* Implementation of a buffer format for RV32.
* <p>
* BGRA is used, a 32-bit BGR format with alpha in a single plane.
*/
public class StandardAlphaBufferFormat extends BufferFormat {

/**
* Creates a RV32 buffer format with the given width and height.
*
* @param width width of the buffer
* @param height height of the buffer
*/
public StandardAlphaBufferFormat(int width, int height) {
super("BGRA", width, height, 4);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This file is part of VLCJ.
*
* VLCJ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VLCJ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2009-2024 Caprica Software Limited.
*/

package uk.co.caprica.vlcj.player.embedded.videosurface.callback.format;

import uk.co.caprica.vlcj.player.embedded.videosurface.callback.BufferFormat;

/**
* Implementation of a standard opaque buffer format.
* <p>
* RV24 is used, a 24-bit RGB format in a single plane.
*/
public class StandardOpaqueBufferFormat extends BufferFormat {

/**
* Creates a RV32 buffer format with the given width and height.
*
* @param width width of the buffer
* @param height height of the buffer
*/
public StandardOpaqueBufferFormat(int width, int height) {
super("RV24", width, height, 3);
}
}

0 comments on commit 9c10b36

Please sign in to comment.