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 AV_SHARED_MEMORY_EXT_H 17 #define AV_SHARED_MEMORY_EXT_H 18 19 #include "buffer/avallocator.h" 20 #include "buffer/avbuffer.h" 21 #include "common/status.h" 22 23 namespace OHOS { 24 namespace Media { 25 class AVSharedMemoryExt : public AVMemory { 26 public: 27 AVSharedMemoryExt(); 28 ~AVSharedMemoryExt() override; 29 uint8_t *GetAddr() override; 30 MemoryType GetMemoryType() override; 31 int32_t GetFileDescriptor() override; 32 MemoryFlag GetMemoryFlag() override; 33 34 private: 35 Status Init() override; 36 Status Init(MessageParcel &parcel) override; 37 bool WriteToMessageParcel(MessageParcel &parcel) override; 38 bool ReadFromMessageParcel(MessageParcel &parcel) override; 39 void UnMapMemoryAddr() noexcept; 40 Status MapMemoryAddr(); 41 int32_t fd_; 42 bool isFirstFlag_; 43 MemoryFlag memFlag_; 44 }; 45 } // namespace Media 46 } // namespace OHOS 47 #endif // AV_SHARED_MEMORY_EXT_H