native_avcodec_videoencoder.h

Overview

Declares the native APIs used for video encoding.

Since: 9

Related Modules:

VideoEncoder

Summary

Types

Name Description
OH_VideoEncodeBitrateMode Enumerates the bit rate modes of video encoding.

Enums

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

Functions

Name Description
OH_VideoEncoder_CreateByMime (const char *mime) Creates a video encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases.
OH_VideoEncoder_CreateByName (const char *name) Creates a video encoder instance based on a video encoder name. To use this API, you must know the exact name of the video encoder.
OH_VideoEncoder_Destroy (OH_AVCodec *codec) Clears the internal resources of a video encoder and destroys the video 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. This API must be called prior to Prepare.
OH_VideoEncoder_Configure (OH_AVCodec *codec, OH_AVFormat *format) Configures a video encoder. Typically, you need to configure the attributes of the video track that can be encoded. This API must be called prior to Prepare.
OH_VideoEncoder_Prepare (OH_AVCodec *codec) Prepares internal resources for a video encoder. This API must be called after Configure.
OH_VideoEncoder_Start (OH_AVCodec *codec) Starts a video encoder. This API can be called only after the encoder is prepared successfully. After being started, the encoder starts to report the OH_AVCodecOnNeedInputData event.
OH_VideoEncoder_Stop (OH_AVCodec *codec) Stops a video encoder. After the encoder is stopped, you can call Start to start it again.
OH_VideoEncoder_Flush (OH_AVCodec *codec) Clears the input and output data in the internal buffer of a video encoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required.
OH_VideoEncoder_Reset (OH_AVCodec *codec) Resets a video encoder. To continue encoding, you must call Configure and Start to configure and start the encoder again.
OH_VideoEncoder_GetOutputDescription (OH_AVCodec *codec) Obtains the attributes of the output data of a video encoder. The OH_AVFormat instance in the return value will become invalid when this API is called again or when the OH_AVCodec instance is destroyed.
OH_VideoEncoder_SetParameter (OH_AVCodec *codec, OH_AVFormat *format) Sets dynamic parameters for a video encoder. This API can be called only after the encoder is started. Incorrect parameter settings may cause encoding failure.
OH_VideoEncoder_GetSurface (OH_AVCodec *codec, OHNativeWindow **window) Obtains an input surface from a video encoder. This API 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. This API is recommended in surface mode.