public class GLThreadManager extends Object
Constructor and Description |
---|
GLThreadManager(int cameraId,
int facing,
CameraDeviceState state)
Create a new GL thread and renderer.
|
Modifier and Type | Method and Description |
---|---|
void |
allowNewFrames()
Re-enable drawing new frames after a call to
ignoreNewFrames() . |
SurfaceTexture |
getCurrentSurfaceTexture()
Get the underlying surface to produce frames from.
|
void |
ignoreNewFrames()
Ignore any subsequent calls to
#queueNewFrame(java.util.Collection) . |
void |
queueNewFrame()
Queue a new call to draw into the surfaces specified in the next available preview
request from the
CaptureCollector passed to
setConfigurationAndWait(java.util.Collection, CaptureCollector) ; |
void |
quit()
Quit the thread.
|
void |
setConfigurationAndWait(Collection<Pair<Surface,Size>> surfaces,
CaptureCollector collector)
Configure the GL renderer for the given set of output surfaces, and block until
this configuration has been applied.
|
void |
start()
Start the thread.
|
void |
waitUntilIdle()
Wait until no messages are queued.
|
void |
waitUntilStarted()
Wait until the thread has started.
|
public GLThreadManager(int cameraId, int facing, CameraDeviceState state)
cameraId
- the camera id for this thread.facing
- direction the camera is facing.state
- CameraDeviceState
to use for error handling.public void start()
This must be called before queueing new frames.
public void waitUntilStarted()
public void quit()
No further methods can be called after this.
public void queueNewFrame()
CaptureCollector
passed to
setConfigurationAndWait(java.util.Collection, CaptureCollector)
;public void setConfigurationAndWait(Collection<Pair<Surface,Size>> surfaces, CaptureCollector collector)
surfaces
- a collection of pairs of Surface
s and their
corresponding sizes to configure.collector
- a CaptureCollector
to retrieve requests from.public SurfaceTexture getCurrentSurfaceTexture()
This returns the surface that is drawn into the set of surfaces passed in for each frame.
This method should only be called after a call to
#setConfigurationAndWait(java.util.Collection)
. Calling this before the first call
to #setConfigurationAndWait(java.util.Collection)
, after quit()
, or
concurrently to one of these calls may result in an invalid
SurfaceTexture
being returned.
SurfaceTexture
to draw to.public void ignoreNewFrames()
#queueNewFrame(java.util.Collection)
.public void waitUntilIdle()
public void allowNewFrames()
ignoreNewFrames()
.