# Codec - [Overview](#section1786836669165623) - [Summary](#section399828542165623) - [Files](#files) - [Data Structures](#nested-classes) - [Macros](#define-members) - [Typedefs](#typedef-members) - [Enumerations](#enum-members) - [Functions](#func-members) - [Details](#section794294671165623) - [Enumeration Type](#section1038214150165623) - [anonymous enum](#ga6b7b47dd702d9e331586d485013fd1ea) - [AllocateBufferMode](#gaeae808d52153b2e33c6815162bbd11e0) - [AudioBitRate](#gac8cc627a9912e6a338396a6f19bbba5d) - [AudioSampleRate](#gaa0280074adafe6d2581d31f71512b842) - [AudioSoundMode](#gacecb40e35c431a27385f7b439fc7a76c) - [AvCodecMime](#ga1bee586eafa91dfb60f94ba40fc95faa) - [BufferMode](#gacc0fd55192fd9f663121b037b06f41e8) - [BufferType](#gadf8e136713c0691010d2bec6ba63e9cf) - [CapsMask](#gae5751aa8514dcaf2217df12db5ef57a1) - [CodecType](#ga03b4b6ae5fb82af68d46aaea3d3e4d79) - [DirectionType](#ga8ef30fa9c08e08c8706653571f9f5b81) - [EventType](#ga2628ea8d12e8b2563c32f05dc7fff6fa) - [Level](#ga221b779e6bb7b8d40677d7642bfefac5) - [ParamKey](#ga575c56a2d6b42c48881cf47b0008d5a6) - [PicSize](#ga94981b885085085ed5f9dea406519b48) - [PixelFormat](#ga60883d4958a60b91661e97027a85072a) - [Profile](#ga85b10143618f300ff4f5bc6d45c72c01) - [StreamFlagType](#ga8a15793172118d64d8adeba0c8544e84) - [VenCodeGopMode](#ga9532f651a003219a262c440f5621d129) - [VenCodeRcMode](#ga94267d7ba495136561e1c65686b240f7) - [VideoField](#ga1420ddfb066b941fb55a153b869d9ccf) - [Function](#section106240538165623) - [CodecCreate\(\)](#ga74aa0395a51f004390f7a92fb68faddd) - [CodecDeinit\(\)](#ga2d6eb231ca7766990cfa8c1841637245) - [CodecDequeInput\(\)](#ga91d7e1566c90d7cb9ac846eecad0024f) - [CodecDequeueOutput\(\)](#gab575752467517eb8e6766773c1e3fb23) - [CodecDestroy\(\)](#ga1bc0592b05e4f687e2bef2ffb83102b8) - [CodecEnumerateCapbility\(\)](#gaf0bb69d2f8c5ad0fec6959b353ee1acd) - [CodecFlush\(\)](#gaa6ed6c24e29f8fdfbbb0a3d562260a6a) - [CodecGetCapbility\(\)](#ga1a6fbf6e84e01fdc1af59caa4203ce8e) - [CodecGetParameter\(\)](#ga1d812eac032e3e05cf5bf71b03e93f65) - [CodecInit\(\)](#gadb2714f1e7a69419cefd38a2ad1f9829) - [CodecQueueInput\(\)](#ga0daece8dbf22da84f926761c994819bc) - [CodecQueueOutput\(\)](#gac98f3505082c3cb2413d9e95eef9c804) - [CodecSetCallback\(\)](#ga28ec6149d05765ee75f4836e0b092406) - [CodecSetParameter\(\)](#gaa080cf23aa5f77b30f3b90a026d97cc0) - [CodecSetPortMode\(\)](#ga36a994c5f9f4d104aad0c24b5e8cbd37) - [CodecStart\(\)](#ga38c1744b0b4be5817ef49556ae665d18) - [CodecStop\(\)](#ga8e7913c052c2e45e193fb0aab3f5c7fd) ## **Overview** **Description:** Defines codec-related APIs. including custom data types and functions for initializing audio and video codecs, setting parameters, and controlling and transferring data. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files
Describes the dynamic parameter structure, which is mainly used by CodecCreate and CodecSetParameter. |
|
Defines the buffer handle type. The virtual address of a handle maps to its physical address. |
|
Indicates the maximum number of reserved parameters in the array. |
|
Defines the pointer to the codec handle, which is the context information for function calls. |
|
|
Defines the pointer to the type of the dynamic parameter value. |
|
typedef struct BufferHandle Defines the buffer handle type. The virtual address of a handle maps to its physical address. |
|
typedef enum BufferType |
|
typedef struct OutputInfo |
|
typedef enum AllocateBufferMode |
|
typedef enum CapsMask |
|
typedef struct Capbility |
|
|
Redefines the unsigned pointer type, which is used for pointer conversion. |
CodecInit () |
Initializes the internal audio and video submodules of the codec. |
CodecDeinit () |
Deinitializes the internal audio and video submodules of the codec. |
CodecEnumerateCapbility (uint32_t index, CodecCapbility *cap) |
Obtains the capabilities of a specified media type based on an index. |
CodecGetCapbility (AvCodecMime mime, CodecType type, uint32_t flags, CodecCapbility *cap) |
|
CodecCreate (const char *name, const Param *attr, int len, CODEC_HANDLETYPE *handle) |
Creates a specific codec component and returns the component context through a handle. |
CodecDestroy (CODEC_HANDLETYPE handle) |
|
CodecSetPortMode (CODEC_HANDLETYPE handle, DirectionType type, BufferMode mode) |
|
CodecSetParameter (CODEC_HANDLETYPE handle, const Param *params, int paramCnt) |
|
CodecGetParameter (CODEC_HANDLETYPE handle, Param *params, int paramCnt) |
|
CodecStart (CODEC_HANDLETYPE handle) |
|
CodecStop (CODEC_HANDLETYPE handle) |
|
CodecFlush (CODEC_HANDLETYPE handle, DirectionType directType) |
Clears the cache when the codec component is the running state. |
CodecQueueInput (CODEC_HANDLETYPE handle, const InputInfo *inputData, uint32_t timeoutMs) |
|
CodecDequeInput (CODEC_HANDLETYPE handle, uint32_t timeoutMs, InputInfo *inputData) |
|
CodecQueueOutput (CODEC_HANDLETYPE handle, OutputInfo *outInfo, uint32_t timeoutMs, int releaseFenceFd) |
|
CodecDequeueOutput (CODEC_HANDLETYPE handle, uint32_t timeoutMs, int *acquireFd, OutputInfo *outInfo) |
|
CodecSetCallback (CODEC_HANDLETYPE handle, const CodecCallback *cb, UINTPTR instance) |
MIME type. For the value type, see AvCodecMime. |
|
Number of frames in the remaining data streams. The value type is uint32_t. |
|
Codec type. For the value type, see CodecType. |
|
Input/Output type. For the value type, see DirectionType. |
|
Video field. For the value type, see VideoField. |
|
Pixel format. For the value type, see PixelFormat. |
|
Rate control mode. For the value type, see VenCodeRcMode. |
|
GOP mode. For the value type, see VenCodeGopMode. |
|
Image resolution. For the value type, see PicSize. |
|
Quality factor, range is [1, 99]. The value type is uint32_t |
|
Bit width. For the value type, see AudioBitWidth. |
|
Audio channel mode. For the value type, see AudioSoundMode. |
|
Number of sampling points per frame. The value type is uint32_t. |
|
B-frames using only previous frames as references during encoding. |
|
Indicates the pointer to the unique name of the component, for example, codec.avc.hardware.decoder. |
|
Indicates the pointer to the parameters in the array required for creating the component. |
|
Indicates the timeout duration. Generally, the value is less than or equal to 3 seconds. |
|
Indicates that this parameter is derived from the codec mode. The output data can be used only after waiting for acquireFd is successful. The value -1 indicates that acquireFd is invalid. |
|
Indicates the media type. For details, see AvCodecMime. |
|
Indicates the audio and video codec types. For details, see CodecType. |
|
Indicates the audio and video codec flags. 0 indicates hardware codec, and 1 indicates software codec. |
|
Indicates the pointer to the parameters in the array used when the component is created. |
|
Indicates that the descriptor comes from a buffer consumer. The output data can be used only after waiting for releaseFenceFd is successful. The value -1 indicates that releaseFenceFd is invalid. |
Indicates the pointer to the callback function. For details, see CodecCallback. |
|
Indicates the pointer to the parameters to set in the array. |
|
Specifies whether the buffer type is an input type or an output type. |
|
Specifies whether to use an internal or external buffer mode. |