DecodeOneFrameUtil


@UnstableApi
public final class DecodeOneFrameUtil


Utilities for decoding a video frame for tests.

Summary

Nested types

Listener for decoding events.

Constants

static final String
NO_DECODER_SUPPORT_ERROR_STRING = "No MediaCodec decoders on this device support this value."

Public methods

static void
decodeOneAssetFileFrame(
    String assetFilePath,
    DecodeOneFrameUtil.Listener listener,
    @Nullable Surface surface
)

Reads and decodes one frame from the assetFilePath and renders it to the surface.

Constants

NO_DECODER_SUPPORT_ERROR_STRING

public static final String NO_DECODER_SUPPORT_ERROR_STRING = "No MediaCodec decoders on this device support this value."

Public methods

decodeOneAssetFileFrame

public static void decodeOneAssetFileFrame(
    String assetFilePath,
    DecodeOneFrameUtil.Listener listener,
    @Nullable Surface surface
)

Reads and decodes one frame from the assetFilePath and renders it to the surface.

Parameters
String assetFilePath

The path to the file in the asset directory.

DecodeOneFrameUtil.Listener listener

A Listener implementation.

@Nullable Surface surface

The Surface to render the decoded frame to, null if the decoded frame is not needed.

Throws
java.io.IOException

If the MediaExtractor or MediaCodec cannot be created.