VideoDecodingWrapper


@UnstableApi
@RequiresApi(value = 21)
public final class VideoDecodingWrapper implements AutoCloseable


A wrapper for decoding a video using MediaCodec.

Summary

Public constructors

VideoDecodingWrapper(
    Context context,
    String filePath,
    int comparisonInterval,
    int maxImagesAllowed
)

Creates a new instance.

Public methods

void
@Nullable Image

Returns the next decoded comparison frame, or null if the stream has ended.

Public constructors

VideoDecodingWrapper

public VideoDecodingWrapper(
    Context context,
    String filePath,
    int comparisonInterval,
    int maxImagesAllowed
)

Creates a new instance.

Parameters
Context context

The Context.

String filePath

The path to the video file.

int comparisonInterval

The number of frames between the frames selected for comparison.

int maxImagesAllowed

The max number of images allowed in ImageReader.

Throws
java.io.IOException

When failed to open the video file.

Public methods

close

public void close()

runUntilComparisonFrameOrEnded

public @Nullable Image runUntilComparisonFrameOrEnded()

Returns the next decoded comparison frame, or null if the stream has ended. The caller takes ownership of any returned image and is responsible for closing it before calling this method again.