# CaptureRequestWrappers

Artifact: [androidx.camera:camera-common](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/common/CaptureRequestWrapper.kt+class:androidx.camera.common.CaptureRequestWrappers) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
object CaptureRequestWrappers
```

<br />

*** ** * ** ***

Helper utilities for constructing and wrapping `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper` instances.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper` | `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrappers#wrap(android.hardware.camera2.CaptureRequest,kotlin.collections.Map)(captureRequest: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html, metadata: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/camera/common/Metadata.Key<*>, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>)` Wraps a native `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html` and optional custom metadata into a `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper`. |

## Public functions

### wrap

```
fun wrap(
    captureRequest: CaptureRequest,
    metadata: Map<Metadata.Key<*>, Any?> = emptyMap()
): CaptureRequestWrapper
```

Wraps a native `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html` and optional custom metadata into a `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper`.

```kotlin
import androidx.camera.common.CaptureRequestWrapper
import androidx.camera.common.CaptureRequestWrappers
import androidx.camera.common.Metadata

// Wrap a native CaptureRequest into a CaptureRequestWrapper.
val requestWrapper: CaptureRequestWrapper = CaptureRequestWrappers.wrap(captureRequest)

// Query native Camera2 CaptureRequest keys:
val aeMode = requestWrapper[CaptureRequest.CONTROL_AE_MODE]

// Or attach custom library/application metadata to the request:
val customKey = Metadata.Key<String>("com.example.custom_request_tag")
val requestWithMetadata =
    CaptureRequestWrappers.wrap(
        captureRequest,
        metadata = mapOf(customKey to "sample_tag_value"),
    )
val customTagValue = requestWithMetadata[customKey]
```

| Parameters |
|---|---|
| `captureRequest: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html` | the native `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html` to wrap. |
| `metadata: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/camera/common/Metadata.Key<*>, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> = emptyMap()` | optional map of custom `https://developer.android.com/reference/kotlin/androidx/camera/common/Metadata.Key` values to attach to the wrapper. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper` | a `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrapper` wrapping the given `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrappers#wrap(android.hardware.camera2.CaptureRequest,kotlin.collections.Map)` and `https://developer.android.com/reference/kotlin/androidx/camera/common/CaptureRequestWrappers#wrap(android.hardware.camera2.CaptureRequest,kotlin.collections.Map)`. |