How to add support for a new makernote¶
Work in progress...
Changes needed to add a new group to an existing makernote¶
Groups consist of tags from the same composite tag in the TIFF structure, e.g., a sub-IFD. While the standard Exif groups are well defined and don't change, makernotes tend to evolve and adding new groups of makernote tags to an existing makernote is quite a common task.
The middle part of an Exif key is the group name. E.g., the group of the key Exif.OlympusEq.SerialNumber is OlympusEq. <MAKE> in the text below refers to the camera make, e.g., for the Olympus makernote, <MAKE>mn.hpp means the file olympusmn.hpp.
Revision r1867 is a complete example for the changes discussed here and the filenames below are linked to the corresponding portions of that changeset.
src/makernote_int.hpp
Update namespace Group. Every group that is part of a makernote needs a const uint16_t value in the namespace Group, here. (Non-makernote groups are defined in tiffcomposite_int.hpp)
src/tiffcomposite.cpp
Update tiffGroupInfo[]. For every group defined in namespace Group, this array defines its group name. The group name must be unique.
src/tiffimage.cpp
Update the TiffTreeStruct and TiffGroupStruct tables. In TiffTreeStruct, the new group must be added with its parent group and parent tag to define where in the TIFF tree it belongs to. (The root element is also listed to specify which TIFF tree(s) it is found in.)
TiffGroupStruct describes the layout of the new group. Specify the tag in the parent group, which refers to the new group together with the respective composite TIFF component and for each tag of the group itself, which TIFF component is to be used to parse (read and write) it. Refer to the comments in the code and the existing table for more info.
(The sample linked above also defines ArrayCfg and ArrayDef structures. These are only required for binary array components, to configure the component for the new group.)
src/types.hpp
Update enum IfdId. Every group needs a unique value here. E.g., the IFD id which corresponds to group OlympusEq is olympusEqIfdId.
src/tags.cpp
Update ExifTags::ifdInfo_[]. This table links IFD id (IfdInfo::ifdId_), Group name (IfdInfo::item_) and taglists (IfdInfo::tagList_). Note that different groups can use the same taglist.
src/<MAKE>mn.hpp
Add a static function to access the tag list, similar to the existing functions.
Add a static const TagInfo array variable for the taglist.
By convention, pretty-print functions are declared here as well.
src/<MAKE>mn.cpp
Define the taglist array and the function to access the taglist.
If new pretty-print mappings are required, define them here as well and use the EXV_PRINT_TAG macro in the print function field of the taglist array. If new pretty-print functions are required, define them here. See existing code for plenty of examples.
Documentation¶
The tag reference documentation is generated automatically, it requires just a trigger in the Makefile and an updated template.
doc/templates/Makefile
Add the name of the new group to the TABLES variable.
doc/templates/tags-<MAKE>.html.in
Add a section for the new group, similar to existing sections.