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 #ifndef NATIVE_AVMEMORY_H 17 #define NATIVE_AVMEMORY_H 18 19 #include <stdint.h> 20 #include "native_averrors.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 typedef struct OH_AVMemory OH_AVMemory; 27 28 /** 29 * @brief Create an OH_AVMemory instance 30 * @syscap SystemCapability.Multimedia.Media.Core 31 * @param size the memory's size, bytes. 32 * @return Returns a pointer to an OH_AVMemory instance, needs to be freed by OH_AVMemory_Destroy. 33 * @deprecated since 11 34 * @useinstead OH_AVBuffer_Create 35 * @since 10 36 */ 37 OH_AVMemory *OH_AVMemory_Create(int32_t size); 38 39 /** 40 * @brief Get the memory's virtual address 41 * @syscap SystemCapability.Multimedia.Media.Core 42 * @param mem Encapsulate OH_AVMemory structure instance pointer 43 * @return the memory's virtual address if the memory is valid, otherwise nullptr. 44 * @deprecated since 11 45 * @useinstead OH_AVBuffer_GetAddr 46 * @since 9 47 * @version 1.0 48 */ 49 uint8_t *OH_AVMemory_GetAddr(struct OH_AVMemory *mem); 50 51 /** 52 * @brief Get the memory's size 53 * @syscap SystemCapability.Multimedia.Media.Core 54 * @param mem Encapsulate OH_AVMemory structure instance pointer 55 * @return the memory's size if the memory is valid, otherwise -1. 56 * @deprecated since 11 57 * @useinstead OH_AVBuffer_GetCapacity 58 * @since 9 59 * @version 1.0 60 */ 61 int32_t OH_AVMemory_GetSize(struct OH_AVMemory *mem); 62 63 /** 64 * @brief Clear the internal resources of the memory and destroy the memory 65 * instance 66 * @syscap SystemCapability.Multimedia.Media.Core 67 * @param mem Encapsulate OH_AVMemory structure instance pointer 68 * @return Returns AV_ERR_OK if the execution is successful, 69 * otherwise returns a specific error code, refer to {@link OH_AVErrCode} 70 * @deprecated since 11 71 * @useinstead OH_AVBuffer_Destroy 72 * @since 10 73 */ 74 OH_AVErrCode OH_AVMemory_Destroy(struct OH_AVMemory *mem); 75 76 #ifdef __cplusplus 77 } 78 #endif 79 80 #endif // NATIVE_AVMEMORY_H 81