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_HEIF_EXIF_METADATA_ACCESSOR_H
17 #define FRAMEWORKS_INNERKITSIMPL_ACCESSOR_INCLUDE_HEIF_EXIF_METADATA_ACCESSOR_H
18 
19 #include "abstract_exif_metadata_accessor.h"
20 #include "data_buf.h"
21 #include "heif_parser.h"
22 #include "metadata_stream.h"
23 
24 namespace OHOS {
25 namespace Media {
26 class HeifExifMetadataAccessor : public AbstractExifMetadataAccessor {
27 public:
28     HeifExifMetadataAccessor(std::shared_ptr<MetadataStream> &stream);
29     ~HeifExifMetadataAccessor();
30 
31     virtual uint32_t Read() override;
32     virtual bool ReadBlob(DataBuf &blob) override;
33     virtual uint32_t Write() override;
34     virtual uint32_t WriteBlob(DataBuf &blob) override;
35 
36 private:
37     bool CheckTiffPos(byte* buff, size_t size, size_t &byteOrderPos);
38     bool GetExifItemData(std::shared_ptr<ImagePlugin::HeifParser> &parser, DataBuf &dataBuf);
39     bool GetExifItemIdByHeifParser(std::shared_ptr<ImagePlugin::HeifParser> &parser,
40         ImagePlugin::heif_item_id &exifItemId);
41     uint32_t WriteMetadata(DataBuf &dataBuf);
42 };
43 } // namespace Media
44 } // namespace OHOS
45 
46 #endif // FRAMEWORKS_INNERKITSIMPL_ACCESSOR_INCLUDE_HEIF_EXIF_METADATA_ACCESSOR_H