Skip to content

Commit 2a589de

Browse files
committed
create an abstract base class for Capture and Movie
Signed-off-by: Umair Khan <[email protected]>
1 parent 51d648a commit 2a589de

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/in/omerjerk/processing/video/android/Capture.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@
2020
import android.util.Log;
2121
import processing.core.PConstants;
2222
import processing.core.PApplet;
23-
import processing.core.PImage;
2423
import processing.opengl.PGL;
2524
import processing.opengl.PGraphicsOpenGL;
2625
import processing.opengl.Texture;
2726

2827
@SuppressWarnings("deprecation")
29-
public class Capture extends PImage implements PConstants,
30-
CameraHandlerCallback, SurfaceTexture.OnFrameAvailableListener {
28+
public class Capture extends VideoBase implements CameraHandlerCallback,
29+
SurfaceTexture.OnFrameAvailableListener {
3130

3231
private static final boolean DEBUG = true;
3332

@@ -126,12 +125,12 @@ public void start() {
126125
public boolean available() {
127126
return isAvailable;
128127
}
129-
128+
130129
@Override
131130
public void loadPixels() {
132131
super.loadPixels();
133132
//It's ultra slow right now
134-
133+
135134
if (pixelBuffer == null) {
136135
pixelBuffer = IntBuffer.allocate(width * height);
137136
}
@@ -141,8 +140,6 @@ public void loadPixels() {
141140
GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pixelBuffer);
142141
pixelBuffer.position(0);
143142
pixelBuffer.get(Capture.this.pixels);
144-
145-
// getImage(true);
146143
}
147144

148145
public void pause() {

src/in/omerjerk/processing/video/android/Movie.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package in.omerjerk.processing.video.android;
22

33
import processing.core.PApplet;
4-
import processing.core.PConstants;
5-
import processing.core.PImage;
64

7-
public class Movie extends PImage implements PConstants {
5+
public class Movie extends VideoBase {
86

97
public Movie(PApplet parent) {
108
this(parent, -1, -1);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package in.omerjerk.processing.video.android;
2+
3+
import processing.core.PConstants;
4+
import processing.core.PImage;
5+
6+
public abstract class VideoBase extends PImage implements PConstants{
7+
8+
}

0 commit comments

Comments
 (0)