Java Code Examples for android.hardware.camera2.CaptureRequest#Key
The following examples show how to use
android.hardware.camera2.CaptureRequest#Key .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LegacyMetadataMapper.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private static int[] getTagsForKeys(CaptureRequest.Key<?>[] keys) { int[] tags = new int[keys.length]; for (int i = 0; i < keys.length; ++i) { tags[i] = keys[i].getNativeKey().getTag(); } return tags; }
Example 2
Source File: LegacyRequestMapper.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Return {@code null} if the value is not supported, otherwise return the retrieved key's * value from the request (or the default value if it wasn't set). * * <p>If the fetched value in the request is equivalent to {@code allowedValue}, * then omit the warning (e.g. turning off AF lock on a camera * that always has the AF lock turned off is a silent no-op), but still return {@code null}.</p> * * <p>Logs a warning to logcat if the key is not supported by api1 camera device.</p. */ private static <T> T getIfSupported( CaptureRequest r, CaptureRequest.Key<T> key, T defaultValue, boolean isSupported, T allowedValue) { T val = ParamsUtils.getOrDefault(r, key, defaultValue); if (!isSupported) { if (!Objects.equals(val, allowedValue)) { Log.w(TAG, key.getName() + " is not supported; ignoring requested value " + val); } return null; } return val; }
Example 3
Source File: ParamsUtils.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Return the value set by the key, or the {@code defaultValue} if no value was set. * * @throws NullPointerException if any of the args were {@code null} */ public static <T> T getOrDefault(CaptureRequest r, CaptureRequest.Key<T> key, T defaultValue) { checkNotNull(r, "r must not be null"); checkNotNull(key, "key must not be null"); checkNotNull(defaultValue, "defaultValue must not be null"); T value = r.get(key); if (value == null) { return defaultValue; } else { return value; } }
Example 4
Source File: CameraMetadataNative.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Compare this key against other native keys, request keys, result keys, and * characteristics keys. * * <p>Two keys are considered equal if their name and type reference are equal.</p> * * <p>Note that the equality against non-native keys is one-way. A native key may be equal * to a result key; but that same result key will not be equal to a native key.</p> */ @SuppressWarnings("rawtypes") @Override public final boolean equals(Object o) { if (this == o) { return true; } if (o == null || this.hashCode() != o.hashCode()) { return false; } Key<?> lhs; if (o instanceof CaptureResult.Key) { lhs = ((CaptureResult.Key)o).getNativeKey(); } else if (o instanceof CaptureRequest.Key) { lhs = ((CaptureRequest.Key)o).getNativeKey(); } else if (o instanceof CameraCharacteristics.Key) { lhs = ((CameraCharacteristics.Key)o).getNativeKey(); } else if ((o instanceof Key)) { lhs = (Key<?>)o; } else { return false; } return mName.equals(lhs.mName) && mTypeReference.equals(lhs.mTypeReference); }
Example 5
Source File: RequestTemplate.java From Camera2 with Apache License 2.0 | 5 votes |
/** * Attaches the given value to all derived RequestBuilders. Note that the * value is polled when each new RequestBuilder is created. */ public <T> RequestTemplate setParam(CaptureRequest.Key<T> key, Supplier<T> value) { mParameters.add(new Parameter<T>(key, value)); return this; }
Example 6
Source File: CameraMetadataNative.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * @hide */ public <T> T get(CaptureRequest.Key<T> key) { return get(key.getNativeKey()); }
Example 7
Source File: CameraMetadataNative.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
public <T> void set(CaptureRequest.Key<T> key, T value) { set(key.getNativeKey(), value); }
Example 8
Source File: CameraMetadataNative.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private <T> T getBase(CaptureRequest.Key<T> key) { return getBase(key.getNativeKey()); }
Example 9
Source File: CameraMetadataNative.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private <T> void setBase(CaptureRequest.Key<T> key, T value) { setBase(key.getNativeKey(), value); }
Example 10
Source File: CaptureRequestBuilderProxy.java From Camera2 with Apache License 2.0 | 4 votes |
/** * See {@link CaptureRequest.Builder#get}. */ public <T> T get(CaptureRequest.Key<T> key) throws IllegalArgumentException { return mBuilder.get(key); }
Example 11
Source File: CaptureRequestBuilderProxy.java From Camera2 with Apache License 2.0 | 4 votes |
/** * See {@link CaptureRequest.Builder#set}. */ public <T> void set(CaptureRequest.Key<T> key, T value) { mBuilder.set(key, value); }
Example 12
Source File: CaptureRequestProxy.java From Camera2 with Apache License 2.0 | 4 votes |
@Nullable public <T> T get(@Nonnull CaptureRequest.Key<T> key) { return mRequest.get(key); }
Example 13
Source File: CaptureRequestProxy.java From Camera2 with Apache License 2.0 | 4 votes |
@Nonnull public List<CaptureRequest.Key<?>> getKeys() { return mRequest.getKeys(); }
Example 14
Source File: RequestTemplate.java From Camera2 with Apache License 2.0 | 4 votes |
private Parameter(CaptureRequest.Key<T> key, Supplier<T> value) { this.key = key; this.value = value; }
Example 15
Source File: RequestTemplate.java From Camera2 with Apache License 2.0 | 4 votes |
public <T> RequestTemplate setParam(CaptureRequest.Key<T> key, T value) { return setParam(key, Suppliers.ofInstance(value)); }
Example 16
Source File: RequestBuilder.java From Camera2 with Apache License 2.0 | 2 votes |
/** * Sets the given key-value pair. * * @see {@link CaptureRequest.Builder#set}. */ public <T> void setParam(CaptureRequest.Key<T> key, T value) { mBuilder.set(key, value); }