native_avcodec_videoencoder.h

Overview

The native_avcodec_videoencoder.h file declares the native APIs used for video encoding.

Since

9

Related Modules

VideoEncoder

Summary

Types

Name Description
OH_VideoEncodeBitrateMode Defines an enum that enumerates the bit rate modes of a video encoder.

Enums

Name Description
OH_VideoEncodeBitrateMode {
    CBR = 0,
    VBR = 1,
    CQ = 2
}
Enumerates the bit rate modes of a video encoder.

Functions

Name Description
*OH_VideoEncoder_CreateByMime (const char *mime) Creates a video encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.
*OH_VideoEncoder_CreateByName (const char *name) Creates a video encoder instance based on an encoder name. To use this function, you must know the exact name of the encoder.
OH_VideoEncoder_Destroy (OH_AVCodec *codec) Clears the internal resources of a video encoder and destroys the encoder instance.
OH_VideoEncoder_SetCallback (OH_AVCodec *codec, OH_AVCodecAsyncCallback callback, void *userData) Sets an asynchronous callback so that your application can respond to events generated by a video encoder.
OH_VideoEncoder_Configure (OH_AVCodec *codec, OH_AVFormat *format) Configures a video encoder. Typically, you need to configure the description information about the video track to be encoded.
OH_VideoEncoder_Prepare (OH_AVCodec *codec) Prepares internal resources for a video encoder. This function must be called after Configure.
OH_VideoEncoder_Start (OH_AVCodec *codec) Starts a video encoder. This function can be called only after the encoder is prepared successfully.
OH_VideoEncoder_Stop (OH_AVCodec *codec) Stops a video encoder.
OH_VideoEncoder_Flush (OH_AVCodec *codec) Clears the input and output data in the internal buffer of a video encoder.
OH_VideoEncoder_Reset (OH_AVCodec *codec) Resets a video encoder.
*OH_VideoEncoder_GetOutputDescription (OH_AVCodec *codec) Obtains the description information about the output data of a video encoder. For details, see OH_AVFormat.
OH_VideoEncoder_SetParameter (OH_AVCodec *codec, OH_AVFormat *format) Sets dynamic parameters for a video encoder.
OH_VideoEncoder_GetSurface (OH_AVCodec *codec, OHNativeWindow **window) Sets an input surface for a video encoder. This function must be called prior to Prepare.
OH_VideoEncoder_FreeOutputData (OH_AVCodec *codec, uint32_t index) Frees an output buffer of a video encoder.
OH_VideoEncoder_NotifyEndOfStream (OH_AVCodec *codec) Notifies a video encoder that input streams end. You are advised to use this function for notification.
OH_VideoEncoder_PushInputData (OH_AVCodec *codec, uint32_t index, OH_AVCodecBufferAttr attr) Pushes the input buffer filled with data to a video encoder.
*OH_VideoEncoder_GetInputDescription (OH_AVCodec *codec) Obtains the description information received by the video encoder. This function must be called after Configure. For details, see OH_AVFormat.
OH_VideoEncoder_IsValid (OH_AVCodec *codec, bool *isValid) Checks whether a video encoder instance is valid.