# ACameraCaptureSession_stateCallbacks

Capture session state callbacks used in [ACameraDevice_createCaptureSession](https://developer.android.com/ndk/reference/group/camera#group___camera_1ga2d2cc252a4c3cb60ca0a85cb9d408191) and [ACameraDevice_createCaptureSessionWithSessionParameters](https://developer.android.com/ndk/reference/group/camera#group___camera_1ga622c05d72ab1fcee2c5d9de91e4f0730).

## Summary

| ### Public attributes ||
|---|---|
| `https://developer.android.com/ndk/reference/struct/a-camera-capture-session-state-callbacks#struct_a_camera_capture_session__state_callbacks_1a18b663984bf05166f64db16b3d953ad4` | `void *` optional application context. |
| `https://developer.android.com/ndk/reference/struct/a-camera-capture-session-state-callbacks#struct_a_camera_capture_session__state_callbacks_1a6f9eb7decdfd701243b59c5747af66f7` | `https://developer.android.com/ndk/reference/group/camera#group___camera_1ga98d5538ab4c3b1603f954e992881fc07` This callback is called when the session starts actively processing capture requests. |
| `https://developer.android.com/ndk/reference/struct/a-camera-capture-session-state-callbacks#struct_a_camera_capture_session__state_callbacks_1a07d611ad3ad26daf04328304a17f356d` | `https://developer.android.com/ndk/reference/group/camera#group___camera_1ga98d5538ab4c3b1603f954e992881fc07` This callback is called when the session is closed and deleted from memory. |
| `https://developer.android.com/ndk/reference/struct/a-camera-capture-session-state-callbacks#struct_a_camera_capture_session__state_callbacks_1a3d3f86c319a3334c4ba3d51a36a869c2` | `https://developer.android.com/ndk/reference/group/camera#group___camera_1ga98d5538ab4c3b1603f954e992881fc07` This callback is called every time the session has no more capture requests to process. |

## Public attributes

### context

Declared in `camera/NdkCameraCaptureSession.h`

```scdoc
void * ACameraCaptureSession_stateCallbacks::context
```
optional application context.

### onActive

Declared in `camera/NdkCameraCaptureSession.h`

```scdoc
ACameraCaptureSession_stateCallback ACameraCaptureSession_stateCallbacks::onActive
```
This callback is called when the session starts actively processing capture requests.

If the session runs out of capture requests to process and calls [onReady](https://developer.android.com/ndk/reference/struct/a-camera-capture-session-state-callbacks#struct_a_camera_capture_session__state_callbacks_1a3d3f86c319a3334c4ba3d51a36a869c2), then this callback will be invoked again once new requests are submitted for capture.

### onClosed

Declared in `camera/NdkCameraCaptureSession.h`

```scdoc
ACameraCaptureSession_stateCallback ACameraCaptureSession_stateCallbacks::onClosed
```
This callback is called when the session is closed and deleted from memory.

A session is closed when [ACameraCaptureSession_close](https://developer.android.com/ndk/reference/group/camera#group___camera_1ga6cb82494e36cb9506fee0ddc737e37dc) is called, a new session is created by the parent camera device, or when the parent camera device is closed (either by the user closing the device, or due to a camera device disconnection or fatal error).

Once this callback is called, all access to this ACameraCaptureSession object will cause a crash.

### onReady

Declared in `camera/NdkCameraCaptureSession.h`

```scdoc
ACameraCaptureSession_stateCallback ACameraCaptureSession_stateCallbacks::onReady
```
This callback is called every time the session has no more capture requests to process.

This callback will be invoked any time the session finishes processing all of its active capture requests, and no repeating request or burst is set up.