Project

General

Profile

API change: Removing makernote classes and pretty-print functions from the published interface

Added by Andreas Huggel over 11 years ago

The API needs some further modifications to eventually be more stable. The goal is to be able to make changes to the makernotes without touching the Exiv2 API. That's currently not possible, mainly because the IfdId list, makernote classes and pretty-print functions are all part of the API and they tend to change whenever a makernote is updated.

Feature #719 addresses the simpler part of this: makernote classes and pretty-print functions become internal objects and are not part of the API anymore. Please read the feature description for details.

These objects were never meant for use by applications anyway and most applications won't be affected by this change. However, in order to find out if there are any additional use-cases to consider, I'm implementing this change slowly and invite you to test your applications with Exiv2 from SVN and reply here or at #719 in case it causes problems. Currently only the Nikon makernote has been changed.

Andreas


Replies (6)

RE: API change: Removing makernote classes and pretty-print functions from the published interface - Added by Andreas Huggel over 11 years ago

With r2310 I've added a new method to access any taglist by its group name. This method should be used to access taglists, including Makernote taglists, going forward.

Andreas

RE: API change: Removing makernote classes and pretty-print functions from the published interface - Added by Matthias Baas over 11 years ago

Looks good, I was already wondering how to get to the makernote tag lists.
Is there also a way to query all group names the library knows about (so that the application doesn't actually need any prior knowledge about what groups are available)?

- Matthias -

RE: API change: Removing makernote classes and pretty-print functions from the published interface - Added by Andreas Huggel over 11 years ago

Yes, ExifTags::groupList(), added shortly before your post with r2325. It can be used as shown below. With this #719 is done and I'll embark on the next part, removing IfdId from the API. That will result in API changes in class ExifTags and some others.

#include <iostream>
#include <iostream>
#include "exiv2.hpp" 

using namespace Exiv2;

int main()
{
    std::cout << "List all MakerNote groups defined in Exiv2:\n\n" 
              << "Group name      Number of tags\n" 
              << "--------------- --------------\n";
    const GroupInfo* gi = ExifTags::groupList();
    while (gi->ifdId_ != lastIfdId) {
        if (strcmp(gi->name_, "Makernote") == 0) {
            TagListFct tl = gi->tagList_;
            const TagInfo* ti = tl();
            int cnt = 0;
            while (ti->tag_ != 0xffff) {
                ++cnt;
                ++ti;
            }
            std::cout << std::setw(15) << std::left
                      << gi->item_ << " " << cnt << "\n";
        }
        ++gi;
    }

    return 0;
}

The output of this sample program is

List all MakerNote groups defined in Exiv2:

Group name      Number of tags
--------------- --------------
MakerNote       2
Canon           34
CanonCs         43
CanonSi         26
CanonCf         15
CanonPi         6
CanonFi         15
CanonPa         2
CanonPr         13
Fujifilm        33
Minolta         28
MinoltaCs5D     30
[...]

RE: API change: Removing makernote classes and pretty-print functions from the published interface - Added by Andreas Huggel about 11 years ago

As lastIfdId is not published anymore, the loop in the above example should now read

while (gi->tagList_ != 0) {

Thanks to Gilles for pointing this out.

I also have to reopen #721 and remove the Exif tag data reference methods from ExifKey after realizing that they won't work with the "unified Key" that is needed for #585.

RE: API change: Removing makernote classes and pretty-print functions from the published interface - Added by Andreas Huggel about 11 years ago

I also have to reopen #721 and remove the Exif tag data reference methods from ExifKey after realizing that they won't work with the "unified Key" that is needed for #585.

This is done and I've switched to the unstable branch for the next steps.

-ahu.

    (1-6/6)