17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci/** 177777dab0Sopenharmony_ci * @file native_avmemory.h 187777dab0Sopenharmony_ci * 197777dab0Sopenharmony_ci * @brief Provides audio and video memory. 207777dab0Sopenharmony_ci * 217777dab0Sopenharmony_ci * @kit AVCodecKit 227777dab0Sopenharmony_ci * @library libnative_media_core.so 237777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Media.Core 247777dab0Sopenharmony_ci * @since 9 257777dab0Sopenharmony_ci */ 267777dab0Sopenharmony_ci 277777dab0Sopenharmony_ci#ifndef NATIVE_AVMEMORY_H 287777dab0Sopenharmony_ci#define NATIVE_AVMEMORY_H 297777dab0Sopenharmony_ci 307777dab0Sopenharmony_ci#include <stdint.h> 317777dab0Sopenharmony_ci#include "native_averrors.h" 327777dab0Sopenharmony_ci 337777dab0Sopenharmony_ci#ifdef __cplusplus 347777dab0Sopenharmony_ciextern "C" { 357777dab0Sopenharmony_ci#endif 367777dab0Sopenharmony_ci 377777dab0Sopenharmony_ci/** 387777dab0Sopenharmony_ci * @brief Forward declaration of OH_AVFormat. 397777dab0Sopenharmony_ci * 407777dab0Sopenharmony_ci * @since 9 417777dab0Sopenharmony_ci */ 427777dab0Sopenharmony_citypedef struct OH_AVMemory OH_AVMemory; 437777dab0Sopenharmony_ci 447777dab0Sopenharmony_ci/** 457777dab0Sopenharmony_ci * @brief Create an OH_AVMemory instance 467777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Media.Core 477777dab0Sopenharmony_ci * @param size the memory's size, bytes. 487777dab0Sopenharmony_ci * @return Returns a pointer to an OH_AVMemory instance for success, needs to be freed by OH_AVMemory_Destroy, 497777dab0Sopenharmony_ci * otherwise returns nullptr. Possible failure causes: 1. size <= 0. 2. create OH_AVMemory failed. 507777dab0Sopenharmony_ci * 3.failed to new OH_AVMemory. 517777dab0Sopenharmony_ci * @deprecated since 11 527777dab0Sopenharmony_ci * @useinstead OH_AVBuffer_Create 537777dab0Sopenharmony_ci * @since 10 547777dab0Sopenharmony_ci */ 557777dab0Sopenharmony_ciOH_AVMemory *OH_AVMemory_Create(int32_t size); 567777dab0Sopenharmony_ci 577777dab0Sopenharmony_ci/** 587777dab0Sopenharmony_ci * @brief Get the memory's virtual address 597777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Media.Core 607777dab0Sopenharmony_ci * @param mem Encapsulate OH_AVMemory structure instance pointer 617777dab0Sopenharmony_ci * @return the memory's virtual address if the memory is valid, otherwise nullptr. 627777dab0Sopenharmony_ci * Possible failure causes: 1. input mem is nullptr. 2. mem's magic error. 3. mem's memory is nullptr. 637777dab0Sopenharmony_ci * @deprecated since 11 647777dab0Sopenharmony_ci * @useinstead OH_AVBuffer_GetAddr 657777dab0Sopenharmony_ci * @since 9 667777dab0Sopenharmony_ci * @version 1.0 677777dab0Sopenharmony_ci */ 687777dab0Sopenharmony_ciuint8_t *OH_AVMemory_GetAddr(struct OH_AVMemory *mem); 697777dab0Sopenharmony_ci 707777dab0Sopenharmony_ci/** 717777dab0Sopenharmony_ci * @brief Get the memory's size 727777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Media.Core 737777dab0Sopenharmony_ci * @param mem Encapsulate OH_AVMemory structure instance pointer 747777dab0Sopenharmony_ci * @return the memory's size if the memory is valid, otherwise -1. 757777dab0Sopenharmony_ci * Possible failure causes: 1. input mem is nullptr. 2. mem's magic error. 3. mem's memory is nullptr. 767777dab0Sopenharmony_ci * @deprecated since 11 777777dab0Sopenharmony_ci * @useinstead OH_AVBuffer_GetCapacity 787777dab0Sopenharmony_ci * @since 9 797777dab0Sopenharmony_ci * @version 1.0 807777dab0Sopenharmony_ci */ 817777dab0Sopenharmony_ciint32_t OH_AVMemory_GetSize(struct OH_AVMemory *mem); 827777dab0Sopenharmony_ci 837777dab0Sopenharmony_ci/** 847777dab0Sopenharmony_ci * @brief Clear the internal resources of the memory and destroy the memory 857777dab0Sopenharmony_ci * instance 867777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Media.Core 877777dab0Sopenharmony_ci * @param mem Encapsulate OH_AVMemory structure instance pointer 887777dab0Sopenharmony_ci * @return Function result code. 897777dab0Sopenharmony_ci * {@link AV_ERR_OK} if the execution is successful. 907777dab0Sopenharmony_ci * {@link AV_ERR_INVALID_VAL} if input mem is nullptr, mem's magic error or input mem is not user created. 917777dab0Sopenharmony_ci * @deprecated since 11 927777dab0Sopenharmony_ci * @useinstead OH_AVBuffer_Destroy 937777dab0Sopenharmony_ci * @since 10 947777dab0Sopenharmony_ci */ 957777dab0Sopenharmony_ciOH_AVErrCode OH_AVMemory_Destroy(struct OH_AVMemory *mem); 967777dab0Sopenharmony_ci 977777dab0Sopenharmony_ci#ifdef __cplusplus 987777dab0Sopenharmony_ci} 997777dab0Sopenharmony_ci#endif 1007777dab0Sopenharmony_ci 1017777dab0Sopenharmony_ci#endif // NATIVE_AVMEMORY_H 102