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 FRAMEWORKS_INNERKITSIMPL_ACCESSOR_INCLUDE_ABSTRACT_EXIF_METADATA_ACCESSOR_H 17 #define FRAMEWORKS_INNERKITSIMPL_ACCESSOR_INCLUDE_ABSTRACT_EXIF_METADATA_ACCESSOR_H 18 19 #include "image_log.h" 20 #include "exif_metadata.h" 21 #include "media_errors.h" 22 #include "metadata_accessor.h" 23 24 namespace OHOS { 25 namespace Media { 26 class AbstractExifMetadataAccessor : public MetadataAccessor { 27 public: 28 AbstractExifMetadataAccessor(std::shared_ptr<MetadataStream> &stream); 29 virtual ~AbstractExifMetadataAccessor(); 30 31 virtual bool Create() override; 32 virtual std::shared_ptr<ExifMetadata> Get() override; 33 virtual void Set(std::shared_ptr<ExifMetadata> &ptr) override; 34 virtual bool WriteToOutput(SkWStream &output) override; 35 virtual std::shared_ptr<MetadataStream> GetOutputStream() override; 36 virtual uint32_t GetFilterArea(const std::vector<std::string> &exifKeys, 37 std::vector<std::pair<uint32_t, uint32_t>> &ranges) override; GetTiffOffset()38 virtual long GetTiffOffset() 39 { 40 return tiffOffset_; 41 } 42 IsFileChanged()43 virtual bool IsFileChanged() override 44 { 45 if (imageStream_ != nullptr) { 46 return imageStream_->IsFileChanged(); 47 } 48 return false; 49 } 50 51 protected: 52 std::shared_ptr<ExifMetadata> exifMetadata_ = nullptr; 53 std::shared_ptr<MetadataStream> imageStream_ = nullptr; 54 long tiffOffset_ = 0; 55 }; 56 } // namespace Media 57 } // namespace OHOS 58 59 #endif // FRAMEWORKS_INNERKITSIMPL_ACCESSOR_INCLUDE_ABSTRACT_EXIF_METADATA_ACCESSOR_H 60