1 /* 2 * Copyright (c) 2023-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 OHOS_CAMERA_DEFERRED_PHOTO_PROXY_H 17 #define OHOS_CAMERA_DEFERRED_PHOTO_PROXY_H 18 19 #include <buffer_handle_parcel.h> 20 #include <mutex> 21 #include <refbase.h> 22 23 #include "buffer_handle.h" 24 #include "message_parcel.h" 25 #include "photo_proxy.h" 26 27 namespace OHOS { 28 namespace CameraStandard { 29 30 class DeferredPhotoProxy : public Media::PhotoProxy { 31 public: 32 DeferredPhotoProxy(); 33 DeferredPhotoProxy(const BufferHandle* bufferHandle, std::string imageId, int32_t deferredProcType); 34 DeferredPhotoProxy(const BufferHandle* bufferHandle, std::string imageId, int32_t deferredProcType, 35 int32_t photoWidth, int32_t photoHeight); 36 DeferredPhotoProxy(const BufferHandle* bufferHandle, std::string imageId, int32_t deferredProcType, 37 uint8_t* buffer, size_t fileSize); 38 virtual ~DeferredPhotoProxy(); 39 void ReadFromParcel(MessageParcel &parcel); 40 void WriteToParcel(MessageParcel &parcel); 41 std::string GetTitle() override; 42 std::string GetExtension() override; 43 std::string GetPhotoId() override; 44 Media::DeferredProcType GetDeferredProcType() override; 45 void* GetFileDataAddr() override; 46 size_t GetFileSize() override; 47 int32_t GetWidth() override; 48 int32_t GetHeight() override; 49 Media::PhotoFormat GetFormat() override; 50 Media::PhotoQuality GetPhotoQuality() override; 51 double GetLatitude() override; 52 double GetLongitude() override; 53 int32_t GetShootingMode() override; 54 void Release() override; 55 std::string GetBurstKey() override; 56 bool IsCoverPhoto() override; 57 58 private: 59 uint8_t* buffer_; 60 const BufferHandle* bufferHandle_; 61 std::string photoId_; 62 int32_t deferredProcType_; 63 int32_t photoWidth_; 64 int32_t photoHeight_; 65 void* fileDataAddr_; 66 size_t fileSize_; 67 bool isMmaped_; 68 std::mutex mutex_; 69 }; 70 } // namespace CameraStandard 71 } // namespace OHOS 72 #endif // OHOS_CAMERA_DEFERRED_PHOTO_PROXY_H