1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup Core 18 * @{ 19 * 20 * @brief The Core module provides basic backbone capabilities for media frameworks, 21 * including functions such as memory, error codes, and media data structures. 22 * 23 * @syscap SystemCapability.Multimedia.Media.Core 24 * @since 9 25 */ 26 27 /** 28 * @file native_avmemory.h 29 * 30 * @brief Declared the definition of media data structure AVMemory. 31 * 32 * @kit AVCodecKit 33 * @library libnative_media_core.so 34 * @syscap SystemCapability.Multimedia.Media.Core 35 * @since 9 36 */ 37 38 #ifndef NATIVE_AVMEMORY_H 39 #define NATIVE_AVMEMORY_H 40 41 #include <stdint.h> 42 #include "native_averrors.h" 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 typedef struct OH_AVMemory OH_AVMemory; 49 50 /** 51 * @brief Create an OH_AVMemory instance 52 * @syscap SystemCapability.Multimedia.Media.Core 53 * @param size the memory's size, bytes. 54 * @return Returns a pointer to an OH_AVMemory instance, needs to be freed by OH_AVMemory_Destroy. 55 * @deprecated since 11 56 * @useinstead OH_AVBuffer_Create 57 * @since 10 58 */ 59 OH_AVMemory *OH_AVMemory_Create(int32_t size); 60 61 /** 62 * @brief Get the memory's virtual address 63 * @syscap SystemCapability.Multimedia.Media.Core 64 * @param mem Encapsulate OH_AVMemory structure instance pointer 65 * @return the memory's virtual address if the memory is valid, otherwise nullptr. 66 * @deprecated since 11 67 * @useinstead OH_AVBuffer_GetAddr 68 * @since 9 69 * @version 1.0 70 */ 71 uint8_t *OH_AVMemory_GetAddr(struct OH_AVMemory *mem); 72 73 /** 74 * @brief Get the memory's size 75 * @syscap SystemCapability.Multimedia.Media.Core 76 * @param mem Encapsulate OH_AVMemory structure instance pointer 77 * @return the memory's size if the memory is valid, otherwise -1. 78 * @deprecated since 11 79 * @useinstead OH_AVBuffer_GetCapacity 80 * @since 9 81 * @version 1.0 82 */ 83 int32_t OH_AVMemory_GetSize(struct OH_AVMemory *mem); 84 85 /** 86 * @brief Clear the internal resources of the memory and destroy the memory 87 * instance 88 * @syscap SystemCapability.Multimedia.Media.Core 89 * @param mem Encapsulate OH_AVMemory structure instance pointer 90 * @return Returns AV_ERR_OK if the execution is successful, 91 * otherwise returns a specific error code, refer to {@link OH_AVErrCode} 92 * @deprecated since 11 93 * @useinstead OH_AVBuffer_Destroy 94 * @since 10 95 */ 96 OH_AVErrCode OH_AVMemory_Destroy(struct OH_AVMemory *mem); 97 98 #ifdef __cplusplus 99 } 100 #endif 101 102 #endif // NATIVE_AVMEMORY_H 103 /** @} */