ExifImage support to modify current buffered ExifData

This commit is contained in:
2022-05-14 07:45:43 +08:00
parent 8e5b24bef2
commit 886f05aa12
4 changed files with 79 additions and 45 deletions

View File

@@ -24,7 +24,7 @@ end:
return nullptr;
}
const ExifDataRef* exif_image_get_exif_data(ExifImage* image) {
ExifDataRef* exif_image_get_exif_data(ExifImage* image) {
if (!image || !image->image) return nullptr;
image->exif_data_ref.data = &image->image->exifData();
return &image->exif_data_ref;
@@ -224,19 +224,19 @@ ExifData* exif_data_new() {
return new ExifData;
}
int exif_data_add(ExifData* d, ExifKey* key, ExifValue* value) {
if (!d || !key || !value || !key->key) return 0;
d->data.add(*key->key, value->value.get());
int exif_data_ref_add(ExifDataRef* d, ExifKey* key, ExifValue* value) {
if (!d || !d->data || !key || !value || !key->key) return 0;
d->data->add(*key->key, value->value.get());
return 1;
}
int exif_data_clear(ExifData* d) {
if (!d) return 0;
d->data.clear();
int exif_data_ref_clear(ExifDataRef* d) {
if (!d || !d->data) return 0;
d->data->clear();
return 1;
}
const ExifDataRef* exif_data_get_ref(ExifData* d) {
ExifDataRef* exif_data_get_ref(ExifData* d) {
if (!d) return nullptr;
d->ref.data = &d->data;
return &d->ref;

View File

@@ -2,7 +2,7 @@
#define _EXIF_EXIF_PRIV_H
#include "exiv2/exiv2.hpp"
typedef struct ExifDataRef {
const Exiv2::ExifData* data = nullptr;
Exiv2::ExifData* data = nullptr;
} ExifDataRef;
typedef struct ExifImage {
Exiv2::Image::UniquePtr image;