1
1
package in .omerjerk .processing .video .android ;
2
2
3
3
import java .io .IOException ;
4
- import java .nio .IntBuffer ;
5
4
import java .util .ArrayList ;
6
5
import java .util .List ;
7
6
8
7
import android .graphics .SurfaceTexture ;
9
8
import android .hardware .Camera ;
10
9
import android .hardware .Camera .Size ;
11
- import android .opengl .GLES20 ;
12
- import android .opengl .GLSurfaceView ;
13
10
import android .os .Handler ;
14
11
import android .os .Message ;
15
12
import android .util .Log ;
16
13
import processing .core .PApplet ;
17
- import processing .opengl .PGraphicsOpenGL ;
18
14
19
15
@ SuppressWarnings ("deprecation" )
20
16
public class Capture extends VideoBase implements CameraHandlerCallback {
@@ -36,27 +32,7 @@ public Capture(PApplet parent) {
36
32
37
33
public Capture (final PApplet parent , int width , int height ) {
38
34
super (parent );
39
- this .parent = parent ;
40
- if (width == -1 || height == -1 ) {
41
- //TODO: Temp hack. Needs to be handled intelligently.
42
- width = 720 ;
43
- height = 1280 ;
44
- }
45
- init (width , height , ARGB );
46
35
47
- glView = (GLSurfaceView ) parent .getSurfaceView ();
48
- pg = (PGraphicsOpenGL )parent .g ;
49
- // customTexture = new Texture(pg, width, height);
50
- // customTexture.invertedY(true);
51
- glView .queueEvent (new Runnable () {
52
- @ Override
53
- public void run () {
54
- createSurfaceTexture ();
55
- prepareFrameBuffers ();
56
- }
57
- });
58
- // pg.setCache(this, customTexture);
59
- activity = parent .getActivity ();
60
36
activity .runOnUiThread (new Runnable () {
61
37
@ Override
62
38
public void run () {
@@ -83,22 +59,6 @@ public void start() {
83
59
CameraHandler .MSG_START_PREVIEW ));
84
60
}
85
61
86
- @ Override
87
- public void loadPixels () {
88
- super .loadPixels ();
89
- //It's ultra slow right now
90
-
91
- if (pixelBuffer == null ) {
92
- pixelBuffer = IntBuffer .allocate (width * height );
93
- }
94
- pixelBuffer .position (0 );
95
- GLES20 .glBindFramebuffer (GLES20 .GL_FRAMEBUFFER , frameBuffers .get (0 ));
96
- GLES20 .glViewport (0 , 0 , width , height );
97
- GLES20 .glReadPixels (0 , 0 , width , height , GLES20 .GL_RGBA , GLES20 .GL_UNSIGNED_BYTE , pixelBuffer );
98
- pixelBuffer .position (0 );
99
- pixelBuffer .get (Capture .this .pixels );
100
- }
101
-
102
62
@ Override
103
63
public void onPause () {
104
64
log ("pause called" );
0 commit comments