Skip to content
com.iristick.smartglass.support.camera2.params

Class OutputConfiguration

  • java.lang.Object
    • com.iristick.smartglass.support.camera2.params.OutputConfiguration
All Implemented Interfaces:
Parcelable

Deprecated. 
Not maintained anymore. Please use the com.iristick.smartglass.core.camera package instead.

@Deprecated
public abstract class OutputConfiguration
extends Object
implements Parcelable
A class for describing camera output, which contains a Surface and its specific configuration for creating capture session.
Since:
Android API level 24
See Also:
CameraDevice.createCaptureSessionByOutputConfigurations(java.util.List<com.iristick.smartglass.support.camera2.params.OutputConfiguration>, com.iristick.smartglass.support.camera2.CameraCaptureSession.StateCallback, android.os.Handler)

Nested Class Summary

Nested classes/interfaces inherited from interface android.os.Parcelable

Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>

Field Summary

Modifier and Type Field and Description
static Parcelable.Creator<com.iristick.smartglass.support.camera2.internal.impl.params.OutputConfigurationImpl> CREATOR
Deprecated. 
 
static int SURFACE_GROUP_ID_NONE
Deprecated. 
Invalid surface group ID.

Fields inherited from interface android.os.Parcelable

CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE

Constructor Summary

Constructor and Description
OutputConfiguration()
Deprecated. 
 

Method Summary

Modifier and Type Method and Description
abstract void addSurface(Surface surface)
Deprecated. 
Add a surface to this OutputConfiguration.
static OutputConfiguration create(int surfaceGroupId, Surface surface)
Deprecated. 
Create a new OutputConfiguration instance with a Surface, with a surface group ID.
static <T> OutputConfiguration create(Size surfaceSize, Class<T> klass)
Deprecated. 
Create a new OutputConfiguration instance, with desired Surface size and Surface source class.
static OutputConfiguration create(Surface surface)
Deprecated. 
Create a new OutputConfiguration instance with a Surface.
abstract int describeContents()
Deprecated. 
 
abstract void enableSurfaceSharing()
Deprecated. 
Enable multiple surfaces sharing the same OutputConfiguration
abstract boolean equals(Object obj)
Deprecated. 
Check if this OutputConfiguration is equal to another OutputConfiguration.
abstract Surface getSurface()
Deprecated. 
Get the Surface associated with this OutputConfiguration.
abstract int getSurfaceGroupId()
Deprecated. 
Get the surface group ID associated with this OutputConfiguration.
abstract List<Surface> getSurfaces()
Deprecated. 
Get the immutable list of surfaces associated with this OutputConfiguration.
abstract int hashCode()
Deprecated. 
abstract void writeToParcel(Parcel dest, int flags)
Deprecated. 
 

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, toString, wait, wait, wait

Field Detail

SURFACE_GROUP_ID_NONE

public static final int SURFACE_GROUP_ID_NONE
Deprecated. 
Invalid surface group ID.

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

CREATOR

public static final Parcelable.Creator<com.iristick.smartglass.support.camera2.internal.impl.params.OutputConfigurationImpl> CREATOR
Deprecated. 

Constructor Detail

OutputConfiguration

public OutputConfiguration()
Deprecated. 

Method Detail

create

public static OutputConfiguration create(Surface surface)
Deprecated. 
Create a new OutputConfiguration instance with a Surface.

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

Parameters:
surface - A Surface for camera to output to.
Returns:
A new OutputConfiguration instance.

create

public static OutputConfiguration create(int surfaceGroupId,
                                         Surface surface)
Deprecated. 
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 -1.

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 - A group ID for this output, used for sharing memory between multiple outputs.
surface - A Surface for camera to output to.
Returns:
A new OutputConfiguration instance.

create

public static <T> OutputConfiguration create(Size surfaceSize,
                                             Class<T> klass)
Deprecated. 
Create a new OutputConfiguration instance, with desired Surface size and Surface source class.

This constructor takes an argument for desired Surface size and the Surface source class without providing the actual output Surface. This is used to setup an output configuration with a deferred Surface. The application can use this output configuration to create a session.

However, the actual output Surface must be set via addSurface(android.view.Surface) and the deferred Surface configuration must be finalized via CameraCaptureSession.finalizeOutputConfigurations(java.util.List<com.iristick.smartglass.support.camera2.params.OutputConfiguration>) before submitting a request with this Surface target. The deferred Surface can only be obtained either from SurfaceView by calling SurfaceHolder.getSurface(), or from SurfaceTexture via Surface(android.graphics.SurfaceTexture)).

Type Parameters:
T - Class type
Parameters:
surfaceSize - Size for the deferred surface.
klass - a non-null Class object reference that indicates the source of this surface. Only SurfaceHolder.class and SurfaceTexture.class are supported.
Returns:
A new OutputConfiguration instance.
Throws:
IllegalArgumentException - if the Surface source class is not supported, or Surface size is zero.
Since:
Android API level 26

enableSurfaceSharing

public abstract void enableSurfaceSharing()
Deprecated. 
Enable multiple surfaces sharing the same OutputConfiguration

For advanced use cases, a camera application may require more streams than the combination guaranteed by CameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.iristick.smartglass.support.camera2.CameraCaptureSession.StateCallback, android.os.Handler). In this case, more than one compatible surface can be attached to an OutputConfiguration so that they map to one camera stream, and the outputs share memory buffers when possible.

Two surfaces are compatible in the below cases:

  1. Surfaces with the same size, format, dataSpace, and Surface source class. In this case, CameraDevice.createCaptureSessionByOutputConfigurations(java.util.List<com.iristick.smartglass.support.camera2.params.OutputConfiguration>, com.iristick.smartglass.support.camera2.CameraCaptureSession.StateCallback, android.os.Handler) is guaranteed to succeed.
  2. Surfaces with the same size, format, and dataSpace, but different Surface source classes that are generally not compatible. However, on some devices, the underlying camera device is able to use the same buffer layout for both surfaces. The only way to discover if this is the case is to create a capture session with that output configuration. For example, if the camera device uses the same private buffer format between a SurfaceView/SurfaceTexture and a MediaRecorder/MediaCodec, CameraDevice.createCaptureSessionByOutputConfigurations(java.util.List<com.iristick.smartglass.support.camera2.params.OutputConfiguration>, com.iristick.smartglass.support.camera2.CameraCaptureSession.StateCallback, android.os.Handler) will succeed. Otherwise, it fails with CameraCaptureSession.StateCallback.onConfigureFailed(com.iristick.smartglass.support.camera2.CameraCaptureSession).

To enable surface sharing, this function must be called before CameraDevice.createCaptureSessionByOutputConfigurations(java.util.List<com.iristick.smartglass.support.camera2.params.OutputConfiguration>, com.iristick.smartglass.support.camera2.CameraCaptureSession.StateCallback, android.os.Handler). Calling this function after CameraDevice.createCaptureSessionByOutputConfigurations(java.util.List<com.iristick.smartglass.support.camera2.params.OutputConfiguration>, com.iristick.smartglass.support.camera2.CameraCaptureSession.StateCallback, android.os.Handler) has no effect.

Up to 2 surfaces can be shared for an OutputConfiguration. The supported surfaces for sharing must be of type SurfaceTexture, SurfaceView, MediaRecorder, MediaCodec, or implementation defined ImageReader.

Since:
Android API level 26

addSurface

public abstract void addSurface(Surface surface)
Deprecated. 
Add a surface to this OutputConfiguration.

This function can be called before or after CameraDevice.createCaptureSessionByOutputConfigurations(java.util.List<com.iristick.smartglass.support.camera2.params.OutputConfiguration>, com.iristick.smartglass.support.camera2.CameraCaptureSession.StateCallback, android.os.Handler). If it's called after, the application must finalize the capture session with CameraCaptureSession.finalizeOutputConfigurations(java.util.List<com.iristick.smartglass.support.camera2.params.OutputConfiguration>).

If the OutputConfiguration was constructed with a deferred surface by create(Size, Class), the added surface must be obtained from SurfaceView by calling SurfaceHolder.getSurface(), or from SurfaceTexture via Surface(android.graphics.SurfaceTexture)).

If the OutputConfiguration was constructed by other constructors, the added surface must be compatible with the existing surface. See enableSurfaceSharing() for details of compatible surfaces.

If the OutputConfiguration already contains a Surface, enableSurfaceSharing() must be called before calling this function to add a new Surface.

Parameters:
surface - The surface to be added.
Throws:
IllegalArgumentException - if the Surface is invalid, the Surface's dataspace/format doesn't match, or adding the Surface would exceed number of shared surfaces supported.
IllegalStateException - if the Surface was already added to this OutputConfiguration, or if the OutputConfiguration is not shared and it already has a surface associated with it.
Since:
Android API level 26

getSurface

public abstract Surface getSurface()
Deprecated. 
Get the Surface associated with this OutputConfiguration. If more than one surface is associated with this OutputConfiguration, return the first one as specified in the constructor or addSurface(android.view.Surface).
Returns:
The associated Surface.

getSurfaces

public abstract List<Surface> getSurfaces()
Deprecated. 
Get the immutable list of surfaces associated with this OutputConfiguration.
Returns:
the list of surfaces associated with this OutputConfiguration as specified in the constructor and addSurface(android.view.Surface). The list should not be modified.
Since:
Android API level 26

getSurfaceGroupId

public abstract int getSurfaceGroupId()
Deprecated. 
Get the surface group ID associated with this OutputConfiguration.
Returns:
the surface group ID associated with this OutputConfiguration. The default value is -1.

describeContents

public abstract int describeContents()
Deprecated. 
Specified by:
describeContents in interface Parcelable

writeToParcel

public abstract void writeToParcel(Parcel dest,
                                   int flags)
Deprecated. 
Specified by:
writeToParcel in interface Parcelable

equals

public abstract boolean equals(Object obj)
Deprecated. 
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.

Overrides:
equals in class Object
Returns:
true if the objects were equal, false otherwise

hashCode

public abstract int hashCode()
Deprecated. 
Overrides:
hashCode in class Object