public class CameraMetadataNative extends Object implements Parcelable
Modifier and Type | Class and Description |
---|---|
static class |
CameraMetadataNative.Key<T> |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<CameraMetadataNative> |
CREATOR |
static int |
NATIVE_JPEG_FORMAT |
static int |
NUM_TYPES |
static int |
TYPE_BYTE |
static int |
TYPE_DOUBLE |
static int |
TYPE_FLOAT |
static int |
TYPE_INT32 |
static int |
TYPE_INT64 |
static int |
TYPE_RATIONAL |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
CameraMetadataNative() |
CameraMetadataNative(CameraMetadataNative other)
Copy constructor - clone metadata
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
void |
dumpToLog()
Dumps the native metadata contents to logcat.
|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
<T> T |
get(CameraCharacteristics.Key<T> key) |
<T> T |
get(CameraMetadataNative.Key<T> key)
Look-up a metadata field value by its key.
|
<T> T |
get(CaptureRequest.Key<T> key) |
<T> T |
get(CaptureResult.Key<T> key) |
static <K> ArrayList<K> |
getAllVendorKeys(Class<K> keyClass)
Return a list containing keys of the given key class for all defined vendor tags.
|
int |
getEntryCount() |
static int |
getNativeType(int tag)
Get the underlying native type for a tag.
|
static int |
getTag(String key)
Convert a key string into the equivalent native tag.
|
boolean |
isEmpty()
Does this metadata contain at least 1 entry?
|
static CameraMetadataNative |
move(CameraMetadataNative other)
Move the contents from
other into a new camera metadata instance. |
void |
readFromParcel(Parcel in) |
byte[] |
readValues(int tag)
Returns a byte[] of data corresponding to this tag.
|
<T> void |
set(CameraCharacteristics.Key<T> key,
T value) |
<T> void |
set(CameraMetadataNative.Key<T> key,
T value)
Set a camera metadata field to a value.
|
<T> void |
set(CaptureRequest.Key<T> key,
T value) |
<T> void |
set(CaptureResult.Key<T> key,
T value) |
static void |
setupGlobalVendorTagDescriptor()
Set the global client-side vendor tag descriptor to allow use of vendor
tags in camera applications.
|
void |
swap(CameraMetadataNative other)
Perform a 0-copy swap of the internal metadata with another object.
|
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
void |
writeValues(int tag,
byte[] src)
Updates the existing entry for tag with the new bytes pointed by src, erasing
the entry if src was null.
|
public static final int NATIVE_JPEG_FORMAT
public static final Parcelable.Creator<CameraMetadataNative> CREATOR
public static final int TYPE_BYTE
public static final int TYPE_INT32
public static final int TYPE_FLOAT
public static final int TYPE_INT64
public static final int TYPE_DOUBLE
public static final int TYPE_RATIONAL
public static final int NUM_TYPES
public CameraMetadataNative()
public CameraMetadataNative(CameraMetadataNative other)
public static CameraMetadataNative move(CameraMetadataNative other)
other
into a new camera metadata instance.
After this call, other
will become empty.
other
- the previous metadata instance which will get pilferedother
moved into itpublic int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public <T> T get(CameraCharacteristics.Key<T> key)
public <T> T get(CaptureResult.Key<T> key)
public <T> T get(CaptureRequest.Key<T> key)
public <T> T get(CameraMetadataNative.Key<T> key)
key
- a non-null
key instancekey
, or null
if no value was setpublic void readFromParcel(Parcel in)
public static void setupGlobalVendorTagDescriptor() throws ServiceSpecificException
ServiceSpecificException
public <T> void set(CameraMetadataNative.Key<T> key, T value)
CameraCharacteristics
, CaptureResult
, and
CaptureRequest
.key
- The metadata field to write.value
- The value to set the field to, which must be of a matching
type to the key.public <T> void set(CaptureRequest.Key<T> key, T value)
public <T> void set(CaptureResult.Key<T> key, T value)
public <T> void set(CameraCharacteristics.Key<T> key, T value)
public void swap(CameraMetadataNative other)
Perform a 0-copy swap of the internal metadata with another object.
Useful to convert a CameraMetadata into e.g. a CaptureRequest.
other
- Metadata to swap withNullPointerException
- if other was nullpublic int getEntryCount()
public boolean isEmpty()
public static <K> ArrayList<K> getAllVendorKeys(Class<K> keyClass)
public static int getTag(String key)
IllegalArgumentException
- if the key was not recognizedNullPointerException
- if the key was nullpublic static int getNativeType(int tag)
tag
- An integer tag, see e.g. getTag(java.lang.String)
TYPE_BYTE
public void writeValues(int tag, byte[] src)
Updates the existing entry for tag with the new bytes pointed by src, erasing the entry if src was null.
An empty array can be passed in to update the entry to 0 elements.
tag
- An integer tag, see e.g. getTag(java.lang.String)
src
- An array of bytes, or null to erase the entrypublic byte[] readValues(int tag)
Returns a byte[] of data corresponding to this tag. Use a wrapped bytebuffer to unserialize the data properly.
An empty array can be returned to denote an existing entry with 0 elements.
tag
- An integer tag, see e.g. getTag(java.lang.String)
null
if there were 0 entries for this tag, a byte[] otherwise.public void dumpToLog()
Visibility for testing/debugging only. The results will not include any synthesized keys, as they are invisible to the native layer.
protected void finalize() throws Throwable
Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the JavaTM virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.