Skip to content

Commit

Permalink
support video formats with alpha channels, such as prores 4444
Browse files Browse the repository at this point in the history
  • Loading branch information
hx2A committed May 19, 2021
1 parent 321de06 commit 2499235
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/processing/video/Movie.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class Movie extends PImage implements PConstants {
* @param filename String
*/
public Movie(PApplet parent, String filename) {
super(0, 0, RGB);
super(0, 0, ARGB);
initGStreamer(parent, filename);
}

Expand Down Expand Up @@ -377,7 +377,7 @@ public void stop() {
*/
public synchronized void read() {
if (firstFrame) {
super.init(sourceWidth, sourceHeight, RGB, 1);
super.init(sourceWidth, sourceHeight, ARGB, 1);
firstFrame = false;
}

Expand Down Expand Up @@ -613,10 +613,13 @@ protected void initSink() {

useBufferSink = Video.useGLBufferSink && parent.g.isGL();
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
if (useBufferSink) rgbSink.setCaps(Caps.fromString("video/x-raw, format=RGBx"));
else rgbSink.setCaps(Caps.fromString("video/x-raw, format=BGRx"));
if (useBufferSink) {
rgbSink.setCaps(Caps.fromString("video/x-raw, format=RGBA"));
} else {
rgbSink.setCaps(Caps.fromString("video/x-raw, format=BGRA"));
}
} else {
rgbSink.setCaps(Caps.fromString("video/x-raw, format=xRGB"));
rgbSink.setCaps(Caps.fromString("video/x-raw, format=ARGB"));
}
}

Expand Down

0 comments on commit 2499235

Please sign in to comment.