• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 LIBEXIF_EXIF_MNOTE_DATA_HUAWEI_H
17 #define LIBEXIF_EXIF_MNOTE_DATA_HUAWEI_H
18 
19 #include <libexif/exif-byte-order.h>
20 #include <libexif/exif-mnote-data.h>
21 #include <libexif/exif-mnote-data-priv.h>
22 #include <libexif/exif-mem.h>
23 #include <libexif/exif-data.h>
24 
25 #include <libexif/huawei/mnote-huawei-entry.h>
26 #include <libexif/huawei/mnote-huawei-data-type.h>
27 
28 extern const char HUAWEI_HEADER[];
29 typedef struct _ExifMnoteDataHuawei ExifMnoteDataHuawei;
30 typedef struct _MnoteHuaweiEntryCount MnoteHuaweiEntryCount;
31 
32 struct _ExifMnoteDataHuawei {
33 	ExifMnoteData parent;
34 
35 	MnoteHuaweiEntry *entries;
36 	unsigned int count;
37 
38 	ExifByteOrder order;
39 	unsigned int offset;
40 	unsigned int ifd_tag;
41 	unsigned int ifd_size;
42 	unsigned int is_loaded;
43 };
44 
45 struct _MnoteHuaweiEntryCount {
46 	MnoteHuaweiEntry** entries;
47 	unsigned int idx;
48 	unsigned int size;
49 	ExifMem *mem;
50 };
51 
52 /*! Detect if MakerNote is recognized as one handled by the Huawei module.
53  *
54  * \param[in] ed image #ExifData to identify as as a Huawei type
55  * \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
56  *   duplicated here for convenience
57  * \return 0 if not recognized, nonzero if recognized. The specific nonzero
58  *   value returned may identify a subtype unique within this module.
59  */
60 
61 int exif_mnote_data_huawei_identify (const ExifData *ed, const ExifEntry *e);
62 
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif /* __cplusplus */
67 
68 int is_huawei_md(ExifMnoteData* md);
69 void print_huawei_md(const ExifMnoteDataHuawei* n);
70 ExifByteOrder exif_mnote_data_huawei_get_byte_order(ExifMnoteData *ne);
71 void mnote_huawei_free_entry_count(MnoteHuaweiEntryCount* entry_count);
72 void mnote_huawei_get_entry_count(const ExifMnoteDataHuawei* n, MnoteHuaweiEntryCount** entry_count);
73 void exif_mnote_data_huawei_clear (ExifMnoteDataHuawei *n);
74 int exif_mnote_data_add_entry (ExifMnoteData *ne, MnoteHuaweiEntry *e);
75 void exif_mnote_data_remove_entry (ExifMnoteData *ne, MnoteHuaweiEntry *e);
76 MnoteHuaweiEntry* exif_mnote_data_huawei_get_entry_by_tag (ExifMnoteDataHuawei *n, const MnoteHuaweiTag tag);
77 MnoteHuaweiEntry* exif_mnote_data_huawei_get_entry_by_index (ExifMnoteDataHuawei *n, const int dest_idx);
78 ExifMnoteData *exif_mnote_data_huawei_new (ExifMem *mem);
79 #ifdef __cplusplus
80 }
81 #endif /* __cplusplus */
82 
83 #endif /* !defined(LIBEXIF_EXIF_MNOTE_DATA_HUAWEI_H) */
84