Most visited

Recently visited

Added in API level 24

OutputConfiguration

public final class OutputConfiguration
extends Object implements Parcelable

java.lang.Object
   ↳ android.hardware.camera2.params.OutputConfiguration


A class for describing camera output, which contains a Surface and its specific configuration for creating capture session.

See also:

Summary

Constants

int SURFACE_GROUP_ID_NONE

Invalid surface group ID.

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<OutputConfiguration> CREATOR

Public constructors

OutputConfiguration(Surface surface)

Create a new OutputConfiguration instance with a Surface.

OutputConfiguration(int surfaceGroupId, Surface surface)

Create a new OutputConfiguration instance with a Surface, with a surface group ID.

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

boolean equals(Object obj)

Check if this OutputConfiguration is equal to another OutputConfiguration.

Surface getSurface()

Get the Surface associated with this OutputConfiguration.

int getSurfaceGroupId()

Get the surface group ID associated with this OutputConfiguration.

int hashCode()

Returns a hash code value for the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

SURFACE_GROUP_ID_NONE

Added in API level 24
int SURFACE_GROUP_ID_NONE

Invalid surface group ID.

An OutputConfiguration with this value indicates that the included surface doesn't belong to any surface group.

Constant Value: -1 (0xffffffff)

Fields

CREATOR

Added in API level 24
Creator<OutputConfiguration> CREATOR

Public constructors

OutputConfiguration

Added in API level 24
OutputConfiguration (Surface surface)

Create a new OutputConfiguration instance with a Surface.

Parameters
surface Surface: A Surface for camera to output to.

This constructor creates a default configuration, with a surface group ID of .SURFACE_GROUP_ID_NONE.

OutputConfiguration

Added in API level 24
OutputConfiguration (int surfaceGroupId, 
                Surface surface)

Create a new OutputConfiguration instance with a Surface, with a surface group ID.

A surface group ID is used to identify which surface group this output surface belongs to. A surface group is a group of output surfaces that are not intended to receive camera output buffer streams simultaneously. The CameraDevice may be able to share the buffers used by all the surfaces from the same surface group, therefore may reduce the overall memory footprint. The application should only set the same set ID for the streams that are not simultaneously streaming. A negative ID indicates that this surface doesn't belong to any surface group. The default value is .SURFACE_GROUP_ID_NONE.

For example, a video chat application that has an adaptive output resolution feature would need two (or more) output resolutions, to switch resolutions without any output glitches. However, at any given time, only one output is active to minimize outgoing network bandwidth and encoding overhead. To save memory, the application should set the video outputs to have the same non-negative group ID, so that the camera device can share the same memory region for the alternating outputs.

It is not an error to include output streams with the same group ID in the same capture request, but the resulting memory consumption may be higher than if the two streams were not in the same surface group to begin with, especially if the outputs have substantially different dimensions.

Parameters
surfaceGroupId int: A group ID for this output, used for sharing memory between multiple outputs.
surface Surface: A Surface for camera to output to.

Public methods

describeContents

Added in API level 24
int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

equals

Added in API level 24
boolean equals (Object obj)

Check if this OutputConfiguration is equal to another OutputConfiguration.

Two output configurations are only equal if and only if the underlying surfaces, surface properties (width, height, format, dataspace) when the output configurations are created, and all other configuration parameters are equal.

Parameters
obj Object: the reference object with which to compare.
Returns
boolean true if the objects were equal, false otherwise

getSurface

Added in API level 24
Surface getSurface ()

Get the Surface associated with this OutputConfiguration.

Returns
Surface the Surface associated with this OutputConfiguration.

getSurfaceGroupId

Added in API level 24
int getSurfaceGroupId ()

Get the surface group ID associated with this OutputConfiguration.

Returns
int the surface group ID associated with this OutputConfiguration. The default value is .SURFACE_GROUP_ID_NONE.

hashCode

Added in API level 24
int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Returns
int a hash code value for this object.

writeToParcel

Added in API level 24
void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.
flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.

Hooray!