a2129b10创建于 2025年12月25日历史提交

native_avmemory.h

Overview

The file declares the attribute definition of the media struct AVMemory.

File to include: <multimedia/player_framework/native_avmemory.h>

Library: libnative_media_core.so

System capability: SystemCapability.Multimedia.Media.Core

Since: 9

Related module: Core

Summary

Structs

Name typedef Keyword Description
OH_AVMemory OH_AVMemory Describes a native object for the audio and video memory interface.

Functions

Name Description
OH_AVMemory *OH_AVMemory_Create(int32_t size) Creates an OH_AVMemory instance.
uint8_t *OH_AVMemory_GetAddr(struct OH_AVMemory *mem) Obtains the virtual memory address.
int32_t OH_AVMemory_GetSize(struct OH_AVMemory *mem) Obtains the memory length.
OH_AVErrCode OH_AVMemory_Destroy(struct OH_AVMemory *mem) Releases an OH_AVMemory instance.

Function Description

OH_AVMemory_Create()

OH_AVMemory *OH_AVMemory_Create(int32_t size)

Description

Creates an OH_AVMemory instance.

System capability: SystemCapability.Multimedia.Media.Core

Since: 10

Deprecated from: 11

Substitute: OH_AVBuffer_Create

Parameters

Name Description
int32_t size Size of the created memory, in bytes.

Returns

Type Description
OH_AVMemory * Pointer to the OH_AVMemory instance created. If the operation fails, NULL is returned.
The instance must be released by calling OH_AVMemory_Destroy when it is no longer required.
The possible causes of an operation failure are as follows:
1. The value of size is less than or equal to 0.
2. The OH_AVMemory instance fails to be created.
3. Memory allocation fails.

OH_AVMemory_GetAddr()

uint8_t *OH_AVMemory_GetAddr(struct OH_AVMemory *mem)

Description

Obtains the virtual memory address.

System capability: SystemCapability.Multimedia.Media.Core

Since: 9

Deprecated from: 11

Substitute: OH_AVBuffer_GetAddr

Parameters

Name Description
struct OH_AVMemory *mem Pointer to an OH_AVMemory instance.

Returns

Type Description
uint8_t * Pointer to the virtual memory address. If the memory is invalid, NULL is returned.
The possible causes of an operation failure are as follows:
1. The value of mem is nullptr.
2. The value of mem fails parameter structure verification.
3. The memory in the passed-in value of mem is nullptr.

OH_AVMemory_GetSize()

int32_t OH_AVMemory_GetSize(struct OH_AVMemory *mem)

Description

Obtains the memory length.

System capability: SystemCapability.Multimedia.Media.Core

Since: 9

Deprecated from: 11

Substitute: OH_AVBuffer_GetCapacity

Parameters

Name Description
struct OH_AVMemory *mem Pointer to an OH_AVMemory instance.

Returns

Type Description
int32_t Memory size. If the memory is invalid, -1 is returned.
The possible causes of an operation failure are as follows:
1. The value of mem is nullptr.
2. The value of mem fails parameter structure verification.
3. The memory in the passed-in value of mem is nullptr.

OH_AVMemory_Destroy()

OH_AVErrCode OH_AVMemory_Destroy(struct OH_AVMemory *mem)

Description

Releases an OH_AVMemory instance.

System capability: SystemCapability.Multimedia.Media.Core

Since: 10

Deprecated from: 11

Substitute: OH_AVBuffer_Destroy

Parameters

Name Description
struct OH_AVMemory *mem Pointer to an OH_AVMemory instance.

Returns

Type Description
OH_AVErrCode AV_ERR_OK: The release operation is successful.
AV_ERR_INVALID_VAL:
1. The value of mem is nullptr.
2. The value of mem fails parameter structure verification.
3. The value of mem is not created by the caller.