同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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
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) |
anonymous enum
Description:
Enumerates codec error types.
enum [AllocateBufferMode](Codec.md#gaeae808d52153b2e33c6815162bbd11e0)
Description:
Enumerates allocation modes of input and output buffers.
enum [AudioBitRate](Codec.md#gac8cc627a9912e6a338396a6f19bbba5d)
Description:
Enumerates audio bit rates.
enum [AudioSampleRate](Codec.md#gaa0280074adafe6d2581d31f71512b842)
Description:
Enumerates audio sampling rates.
enum [AudioSoundMode](Codec.md#gacecb40e35c431a27385f7b439fc7a76c)
Description:
Enumerates audio channel modes.
enum [AvCodecMime](Codec.md#ga1bee586eafa91dfb60f94ba40fc95faa)
Description:
Enumerates MIME types.
enum [BufferMode](Codec.md#gacc0fd55192fd9f663121b037b06f41e8)
Description:
Enumerates allocation types.
enum [BufferType](Codec.md#gadf8e136713c0691010d2bec6ba63e9cf)
Description:
Enumerates buffer types.
enum [CapsMask](Codec.md#gae5751aa8514dcaf2217df12db5ef57a1)
Description:
Enumerates playback capabilities.
enum [CodecType](Codec.md#ga03b4b6ae5fb82af68d46aaea3d3e4d79)
Description:
Enumerates codec types.
enum [DirectionType](Codec.md#ga8ef30fa9c08e08c8706653571f9f5b81)
Description:
Enumerates input and output types.
enum [EventType](Codec.md#ga2628ea8d12e8b2563c32f05dc7fff6fa)
Description:
Enumerates event types.
enum [Level](Codec.md#ga221b779e6bb7b8d40677d7642bfefac5)
Description:
Enumerates codec levels.
enum [ParamKey](Codec.md#ga575c56a2d6b42c48881cf47b0008d5a6)
Description:
Enumerates indexes of parameter types.
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. |
|
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. |
|
enum [PicSize](Codec.md#ga94981b885085085ed5f9dea406519b48)
Description:
Enumerates resolutions.
enum [PixelFormat](Codec.md#ga60883d4958a60b91661e97027a85072a)
Description:
Enumerates pixel formats.
enum [Profile](Codec.md#ga85b10143618f300ff4f5bc6d45c72c01)
Description:
Enumerates codec profiles.
enum [StreamFlagType](Codec.md#ga8a15793172118d64d8adeba0c8544e84)
Description:
Enumerates stream flags.
enum [VenCodeGopMode](Codec.md#ga9532f651a003219a262c440f5621d129)
Description:
Enumerates types of group of pictures (GOP).
B-frames using only previous frames as references during encoding. |
|
enum [VenCodeRcMode](Codec.md#ga94267d7ba495136561e1c65686b240f7)
Description:
Enumerates control modes of the channel encoding rate.
enum [VideoField](Codec.md#ga1420ddfb066b941fb55a153b869d9ccf)
Description:
Enumerates video frame fields.
int32_t CodecCreate (const char * name, const [Param](zh-cn_topic_0000001054718161.md) * attr, int len, [CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) * handle )
Description:
Creates a specific codec component and returns the component context through a handle.
You can adjust the parameters required for creating a component based on service requirements.
Parameters:
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. |
|
Returns:
Returns 0 if the codec component is created and the handle is available; returns a non-zero value otherwise.
int32_t CodecDeinit ()
Description:
Deinitializes the internal audio and video submodules of the codec.
This function needs to be called only once in a process.
Returns:
Returns 0 if the deinitialization is successful; returns a non-zero value otherwise.
See also:
int32_t CodecDequeInput ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, uint32_t timeoutMs, [InputInfo](zh-cn_topic_0000001054879536.md) * inputData )
Description:
Dequeues input data that has been used.
This function works with CodecQueueInput to implement input data transmission.
Parameters:
Indicates the timeout duration. Generally, the value is less than or equal to 3 seconds. |
|
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t CodecDequeueOutput ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, uint32_t timeoutMs, int * acquireFd, [OutputInfo](zh-cn_topic_0000001054918167.md) * outInfo )
Description:
Dequeues output data.
This function works with CodecQueueOutput to implement output data transmission.
Parameters:
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. |
|
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t CodecDestroy ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle)
Description:
Destroys a codec component.
Parameters:
Returns:
Returns 0 if the codec component is destroyed; returns a non-zero value otherwise.
See also:
int32_t CodecEnumerateCapbility (uint32_t index, [CodecCapbility](Codec.md#ga1876710b1f2fe1d80e8b9de9ff28e0e3) * cap )
Description:
Obtains the capabilities of a specified media type based on an index.
You can call this function repeatedly to obtain the codec capabilities until CODEC_END is returned. The corresponding capabilities are described in the Capability structure, including the maximum and minimum resolutions, maximum and minimum bit rates, and supported profiles and levels. After obtaining the capabilities, determine whether they can meet your requirements, for example, whether specific media files can be played and whether audio and video frames can be compressed.
Parameters:
Returns:
Returns CODEC_SUCCESS if the capabilities corresponding to the index are available; returns CODEC_END otherwise.
int32_t CodecFlush ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, [DirectionType](Codec.md#ga8ef30fa9c08e08c8706653571f9f5b81) directType )
Description:
Clears the cache when the codec component is the running state.
Generally, this function is called when the seek operation is performed during playback.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t CodecGetCapbility ([AvCodecMime](Codec.md#ga1bee586eafa91dfb60f94ba40fc95faa) mime, [CodecType](Codec.md#ga03b4b6ae5fb82af68d46aaea3d3e4d79) type, uint32_t flags, [CodecCapbility](Codec.md#ga1876710b1f2fe1d80e8b9de9ff28e0e3) * cap )
Description:
Obtains the capabilities of a specified media type.
You can call this function to obtain the codec capabilities. The corresponding capabilities are described in the Capability structure, including the maximum and minimum resolutions, maximum and minimum bit rates, and supported profiles and levels. After obtaining the capabilities, determine whether they can meet your requirements, for example, whether specific media files can be played and whether audio and video frames can be compressed.
Parameters:
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. |
|
Returns:
Returns 0 if the codec is supported and capabilities are available; returns a non-zero value if the codec is not supported or the capabilities are unavailable.
int32_t CodecGetParameter ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, [Param](zh-cn_topic_0000001054718161.md) * params, int paramCnt )
Description:
Obtains parameters from a codec component.
This function must be called after CodecCreate.
Parameters:
Indicates the pointer to the parameters in the array used when the component is created. |
|
Returns:
Returns 0 if all parameters to obtain are supported; returns a non-zero value otherwise.
See also:
int32_t CodecInit ()
Description:
Initializes the internal audio and video submodules of the codec.
This function needs to be called only once in a process.
Returns:
Returns 0 if the initialization is successful; returns a non-zero value otherwise.
See also:
int32_t CodecQueueInput ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, const [InputInfo](zh-cn_topic_0000001054879536.md) * inputData, uint32_t timeoutMs )
Description:
Queues input data.
This function works with CodecDequeInput to implement input data transmission.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t CodecQueueOutput ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, [OutputInfo](zh-cn_topic_0000001054918167.md) * outInfo, uint32_t timeoutMs, int releaseFenceFd )
Description:
Queues output data.
This function works with CodecDequeueOutput to implement output data transmission.
Parameters:
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. |
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t CodecSetCallback ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, const [CodecCallback](zh-cn_topic_0000001055358102.md) * cb, [UINTPTR](Codec.md#ga58d2f4a8d12daa1dcf4eb297f3ebaabc) instance )
Description:
Sets the callback function.
The codec uses the callback function to notify the upper layer of events and asynchronously report available input/output information.
Parameters:
Indicates the pointer to the callback function. For details, see CodecCallback. |
|
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t CodecSetParameter ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, const [Param](zh-cn_topic_0000001054718161.md) * params, int paramCnt )
Description:
Sets parameters required by a codec component.
You should call this function to set parameters after CodecCreate is called but before CodecStart is called.
Parameters:
Indicates the pointer to the parameters to set in the array. |
|
Returns:
Returns 0 if the setting is successful; returns a non-zero value otherwise.
See also:
int32_t CodecSetPortMode ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle, [DirectionType](Codec.md#ga8ef30fa9c08e08c8706653571f9f5b81) type, [BufferMode](Codec.md#gacc0fd55192fd9f663121b037b06f41e8) mode )
Description:
Sets the input or output buffer mode.
You can learn about the support of the codec input/output buffer for internal and external buffer modes by calling CodecGetCapbility. In this way, you can determine whether to use an internal or external buffer mode. If the current codec can use only the specific buffer mode, you do not need to set it.
Parameters:
Specifies whether the buffer type is an input type or an output type. |
|
Specifies whether to use an internal or external buffer mode. |
Returns:
Returns 0 if the setting is successful; returns a non-zero value otherwise.
int32_t CodecStart ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle)
Description:
Starts a codec component.
You can restart a component after it is stopped.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
int32_t CodecStop ([CODEC_HANDLETYPE](Codec.md#ga9381a619f36ac8d5d7f467d2f0404183) handle)
Description:
Stops a codec component.
Parameters:
Returns:
Returns 0 if the operation is successful; returns a non-zero value otherwise.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。