public class RequestThreadManager extends Object
Camera
.
The main components of this class are:
- A message queue of requests to the Camera
.
- A thread that consumes requests to the Camera
and executes them.
- A GLThreadManager
that draws to the configured output Surface
s.
- An CameraDeviceState
state machine that manages the callbacks for various operations.
Modifier and Type | Class and Description |
---|---|
static class |
RequestThreadManager.FpsCounter
Counter class used to calculate and log the current FPS of frame production.
|
Constructor and Description |
---|
RequestThreadManager(int cameraId,
Camera camera,
CameraCharacteristics characteristics,
CameraDeviceState deviceState)
Create a new RequestThreadManager.
|
Modifier and Type | Method and Description |
---|---|
long |
cancelRepeating(int requestId)
Cancel a repeating request.
|
void |
configure(Collection<Pair<Surface,Size>> outputs)
Configure with the current list of output Surfaces.
|
long |
flush()
Flush any pending requests.
|
void |
quit()
Quit the request thread, and clean up everything.
|
void |
start()
Start the request thread.
|
SubmitInfo |
submitCaptureRequests(CaptureRequest[] requests,
boolean repeating)
Submit the given burst of requests to be captured.
|
public RequestThreadManager(int cameraId, Camera camera, CameraCharacteristics characteristics, CameraDeviceState deviceState)
cameraId
- the id of the camera to use.camera
- an open camera object. The RequestThreadManager takes ownership of this camera
object, and is responsible for closing it.characteristics
- the static camera characteristics corresponding to this camera devicedeviceState
- a CameraDeviceState
state machine.public void start()
public long flush()
public void quit()
public SubmitInfo submitCaptureRequests(CaptureRequest[] requests, boolean repeating)
If the burst is repeating, replace the current repeating burst.
requests
- the burst of requests to add to the queue.repeating
- true if the burst is repeating.public long cancelRepeating(int requestId)
requestId
- the id of the repeating request to cancel.INVALID_FRAME
if none exists.public void configure(Collection<Pair<Surface,Size>> outputs)
This operation blocks until the configuration is complete.
Using a null
or empty outputs
list is the equivalent of unconfiguring.
outputs
- a Collection
of outputs to configure.