1 /* 2 * Copyright (C) 2024 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 INTERFACES_INNERKITS_INCLUDE_PICTURE_H 17 #define INTERFACES_INNERKITS_INCLUDE_PICTURE_H 18 19 #include "pixel_map.h" 20 #include "auxiliary_picture.h" 21 #include "image_type.h" 22 #include <map> 23 24 namespace OHOS { 25 class SurfaceBuffer; 26 } 27 28 namespace OHOS { 29 namespace Media { 30 31 class ExifMetadata; 32 33 class Picture : public Parcelable { 34 public: 35 virtual ~Picture(); 36 37 NATIVEEXPORT static std::unique_ptr<Picture> Create(std::shared_ptr<PixelMap> &PixelMap); 38 NATIVEEXPORT static std::unique_ptr<Picture> Create(sptr<SurfaceBuffer> &surfaceBuffer); 39 NATIVEEXPORT static std::unique_ptr<PixelMap> SurfaceBuffer2PixelMap(sptr<SurfaceBuffer> &surfaceBuffer); 40 NATIVEEXPORT std::shared_ptr<PixelMap> GetMainPixel(); 41 NATIVEEXPORT void SetMainPixel(std::shared_ptr<PixelMap> PixelMap); 42 NATIVEEXPORT std::unique_ptr<PixelMap> GetHdrComposedPixelMap(); 43 NATIVEEXPORT std::shared_ptr<PixelMap> GetGainmapPixelMap(); 44 NATIVEEXPORT std::shared_ptr<AuxiliaryPicture> GetAuxiliaryPicture(AuxiliaryPictureType type); 45 NATIVEEXPORT void SetAuxiliaryPicture(std::shared_ptr<AuxiliaryPicture> &picture); 46 NATIVEEXPORT bool HasAuxiliaryPicture(AuxiliaryPictureType type); 47 NATIVEEXPORT virtual bool Marshalling(Parcel &data) const override; 48 NATIVEEXPORT static Picture *Unmarshalling(Parcel &data); 49 NATIVEEXPORT static Picture *Unmarshalling(Parcel &data, PICTURE_ERR &error); 50 NATIVEEXPORT int32_t SetExifMetadata(sptr<SurfaceBuffer> &surfaceBuffer); 51 NATIVEEXPORT int32_t SetExifMetadata(std::shared_ptr<ExifMetadata> exifMetadata); 52 NATIVEEXPORT std::shared_ptr<ExifMetadata> GetExifMetadata(); 53 NATIVEEXPORT bool SetMaintenanceData(sptr<SurfaceBuffer> &surfaceBuffer); 54 NATIVEEXPORT sptr<SurfaceBuffer> GetMaintenanceData() const; 55 56 private: 57 std::shared_ptr<PixelMap> mainPixelMap_; 58 std::map<AuxiliaryPictureType, std::shared_ptr<AuxiliaryPicture>> auxiliaryPictures_; 59 sptr<SurfaceBuffer> maintenanceData_; 60 std::shared_ptr<ExifMetadata> exifMetadata_ = nullptr; 61 }; 62 } 63 } 64 65 #endif //INTERFACES_INNERKITS_INCLUDE_PICTURE_H_