FileDocCategorySizeDatePackage
StreamConfiguration.javaAPI DocAndroid 5.1 API5398Thu Mar 12 22:22:10 GMT 2015android.hardware.camera2.params

StreamConfiguration

public final class StreamConfiguration extends Object
Immutable class to store the available stream {@link CameraCharacteristics#SCALER_AVAILABLE_STREAM_CONFIGURATIONS configurations} to set up {@link android.view.Surface Surfaces} for creating a {@link CameraCaptureSession capture session} with {@link CameraDevice#createCaptureSession}.

This is the authoritative list for all input/output formats (and sizes respectively for that format) that are supported by a camera device.

see
CameraCharacteristics#SCALER_AVAILABLE_STREAM_CONFIGURATIONS
hide

Fields Summary
private final int
mFormat
private final int
mWidth
private final int
mHeight
private final boolean
mInput
Constructors Summary
public StreamConfiguration(int format, int width, int height, boolean input)
Create a new {@link StreamConfiguration}.

param
format image format
param
width image width, in pixels (positive)
param
height image height, in pixels (positive)
param
input true if this is an input configuration, false for output configurations
throws
IllegalArgumentException if width/height were not positive or if the format was not user-defined in ImageFormat/PixelFormat (IMPL_DEFINED is ok)
hide

        mFormat = checkArgumentFormatInternal(format);
        mWidth = checkArgumentPositive(width, "width must be positive");
        mHeight = checkArgumentPositive(height, "height must be positive");
        mInput = input;
    
Methods Summary
public booleanequals(java.lang.Object obj)
Check if this {@link StreamConfiguration} is equal to another {@link StreamConfiguration}.

Two vectors are only equal if and only if each of the respective elements is equal.

return
{@code true} if the objects were equal, {@code false} otherwise

        if (obj == null) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        if (obj instanceof StreamConfiguration) {
            final StreamConfiguration other = (StreamConfiguration) obj;
            return mFormat == other.mFormat &&
                    mWidth == other.mWidth &&
                    mHeight == other.mHeight &&
                    mInput == other.mInput;
        }
        return false;
    
public final intgetFormat()
Get the internal image {@code format} in this stream configuration.

return
an integer format
see
ImageFormat
see
PixelFormat

        return mFormat;
    
public intgetHeight()
Return the height of the stream configuration.

return
height > 0

        return mHeight;
    
public android.util.SizegetSize()
Convenience method to return the size of this stream configuration.

return
a Size with positive width and height

        return new Size(mWidth, mHeight);
    
public intgetWidth()
Return the width of the stream configuration.

return
width > 0

        return mWidth;
    
public inthashCode()
{@inheritDoc}

        return HashCodeHelpers.hashCode(mFormat, mWidth, mHeight, mInput ? 1 : 0);
    
public booleanisInput()
Determines if this configuration is usable for input streams.

Input and output stream configurations are not interchangeable; input stream configurations must be used when configuring inputs.

return
{@code true} if input configuration, {@code false} otherwise

        return mInput;
    
public booleanisOutput()
Determines if this configuration is usable for output streams.

Input and output stream configurations are not interchangeable; out stream configurations must be used when configuring outputs.

return
{@code true} if output configuration, {@code false} otherwise
see
CameraDevice#createCaptureSession

        return !mInput;