HeifWriter


public final class HeifWriter implements AutoCloseable


Writes one or more still images (of the same dimensions) into a heif file.

This class currently supports three input modes: INPUT_MODE_BUFFER, INPUT_MODE_SURFACE, or INPUT_MODE_BITMAP.

The general sequence (in pseudo-code) to write a heif file using this class is as follows:

1) Construct the writer:HeifWriter heifwriter = new HeifWriter(...);

2) If using surface input mode, obtain the input surface:Surface surface = heifwriter.getInputSurface();

3) Call start:heifwriter.start();

4) Depending on the chosen input mode, add one or more images using one of these methods:heifwriter.addYuvBuffer(...); Orheifwriter.addBitmap(...); Or render to the previously obtained surface

5) Call stop:heifwriter.stop(...);

6) Close the writer:heifwriter.close();

Please refer to the documentations on individual methods for the exact usage.

Summary

Nested types

public final class HeifWriter.Builder

Builder class for constructing a HeifWriter object from specified parameters.

Constants

static final int

The input mode where the client adds bitmaps.

static final int

The input mode where the client adds input buffers with YUV data.

static final int

The input mode where the client renders the images to an input Surface created by the writer.

Inherited methods

From java.lang.AutoCloseable
abstract void

Constants

INPUT_MODE_BITMAP

Added in 1.0.0
public static final int INPUT_MODE_BITMAP = 2

The input mode where the client adds bitmaps.

See also
addBitmap

INPUT_MODE_BUFFER

Added in 1.0.0
public static final int INPUT_MODE_BUFFER = 0

The input mode where the client adds input buffers with YUV data.

See also
addYuvBuffer

INPUT_MODE_SURFACE

Added in 1.0.0
public static final int INPUT_MODE_SURFACE = 1

The input mode where the client renders the images to an input Surface created by the writer. The input surface operates in single buffer mode. As a result, for use case where camera directly outputs to the input surface, this mode will not work because camera framework requires multiple buffers to operate in a pipeline fashion.

See also
getInputSurface