VideoDecodingWrapper
@UnstableApi
class VideoDecodingWrapper : AutoCloseable
A wrapper for decoding a video using MediaCodec.
This test utility class prefers using a software decoder. Depending on video resolution and device, some hardware decoders fail to write frames in YUV_420_888 to ImageReader for use in CPU test utility functions.
Summary
Public constructors |
|---|
VideoDecodingWrapper(Creates a new instance. |
Public functions |
|
|---|---|
Unit |
close() |
Image? |
Returns the next decoded comparison frame, or |
Public constructors
VideoDecodingWrapper
VideoDecodingWrapper(
context: Context!,
filePath: String!,
comparisonInterval: Int,
maxImagesAllowed: Int
)
Creates a new instance.
| Parameters | |
|---|---|
context: Context! |
The |
filePath: String! |
The path to the video file. |
comparisonInterval: Int |
The number of frames between the frames selected for comparison. |
maxImagesAllowed: Int |
The max number of images allowed in |
| Throws | |
|---|---|
java.io.IOException |
When failed to open the video file. |
Public functions
runUntilComparisonFrameOrEnded
fun runUntilComparisonFrameOrEnded(): Image?
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.