VideoDecodingWrapper
@UnstableApi
public final class VideoDecodingWrapper implements 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 methods |
|
|---|---|
void |
close() |
@Nullable Image |
Returns the next decoded comparison frame, or |
Public constructors
VideoDecodingWrapper
public VideoDecodingWrapper(
Context context,
String filePath,
int comparisonInterval,
int maxImagesAllowed
)
Creates a new instance.
| Parameters | |
|---|---|
Context context |
The |
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 |
| Throws | |
|---|---|
java.io.IOException |
When failed to open the video file. |
Public methods
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.