HeifCodecSession

Decodes the coded samples of one item or one track.

The contract: call cancellationCheck at a coarse step, such as once a row of coding blocks, and let what it throws pass through. Never catch Throwable, because cancellation is not an Exception. Throw ImageDecodeException for malformed data and UnsupportedImageException for a feature the codec lacks.

Functions

Link copied to clipboard
abstract fun decode(sample: ByteArray, cancellationCheck: () -> Unit?): HeifPlanes?

The picture that sample shows, or null when it shows none, as a sample a codec skips can. The core decodes an item, and the first frame of a track, through this method.

Link copied to clipboard
open fun decodeInOutputOrder(sample: ByteArray, cancellationCheck: () -> Unit?): List<HeifPlanes>

Decodes sample, the next sample of a track in decoding order, and returns the pictures the codec outputs after it, in output order: none, one or several. A codec whose output order differs from its decoding order, as HEVC's does with B pictures, holds a picture back until every picture before it in output order is decoded, and flush gives the ones it still holds at the end. The core plays a track through this method and flush, and pairs the pictures in turn with the samples in order of composition time.

Link copied to clipboard
open fun flush(): List<HeifPlanes>

Ends the track: the pictures the codec still holds back for output, in output order. The default holds none.