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_HARDWARE_MEMORY_H 17 #define AV_HARDWARE_MEMORY_H 18 19 #include <mutex> 20 #include "buffer/avallocator.h" 21 #include "buffer/avbuffer.h" 22 23 namespace OHOS { 24 namespace Media { 25 class AVHardwareMemory : public AVMemory { 26 public: 27 AVHardwareMemory(); 28 ~AVHardwareMemory() override; 29 MemoryType GetMemoryType() override; 30 int32_t GetFileDescriptor() override; 31 MemoryFlag GetMemoryFlag() override; 32 33 private: 34 Status Init() override; 35 Status Init(MessageParcel &parcel) override; 36 bool WriteToMessageParcel(MessageParcel &parcel) override; 37 bool ReadFromMessageParcel(MessageParcel &parcel) override; 38 Status MapMemoryAddr(); 39 std::mutex mutex_; 40 int32_t fd_ = -1; 41 bool isStartSync_; 42 MemoryFlag memFlag_; 43 }; 44 } // namespace Media 45 } // namespace OHOS 46 #endif // AV_HARDWARE_MEMORY_H