mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-07-08 01:32:41 +08:00
Update exif module
This commit is contained in:
@@ -23,6 +23,8 @@ typedef struct ExifDataItor ExifDataItor;
|
||||
typedef struct ExifDatumRef ExifDatumRef;
|
||||
/// <div rustbindgen opaque></div>
|
||||
typedef struct ExifValueRef ExifValueRef;
|
||||
/// <div rustbindgen opaque></div>
|
||||
typedef struct ExifDataMutItor ExifDataMutItor;
|
||||
#if defined _WIN32 && defined WIN32_DLL
|
||||
#if BUILD_DLL
|
||||
#define EXIF_API __declspec(dllexport)
|
||||
@@ -65,7 +67,7 @@ EXIF_API char* exif_value_to_string2(ExifValueRef* value, size_t* len, long i);
|
||||
EXIF_API int64_t exif_value_to_int64(ExifValueRef* value, long i);
|
||||
EXIF_API ExifValue* exif_value_ref_clone(ExifValueRef* value);
|
||||
EXIF_API ExifData* exif_data_new();
|
||||
EXIF_API int exif_data_ref_add(ExifDataRef* d, ExifKey* key, ExifValue* value);
|
||||
EXIF_API int exif_data_ref_add(ExifDataRef* d, ExifKey* key, ExifValueRef* value);
|
||||
EXIF_API int exif_data_ref_clear(ExifDataRef* d);
|
||||
EXIF_API ExifDataRef* exif_data_get_ref(ExifData* d);
|
||||
EXIF_API ExifData* exif_data_ref_clone(ExifDataRef* d);
|
||||
@@ -74,13 +76,18 @@ EXIF_API long exif_data_ref_get_count(ExifDataRef* d);
|
||||
EXIF_API void exif_data_ref_sort_by_key(ExifDataRef* d);
|
||||
EXIF_API void exif_data_ref_sort_by_tag(ExifDataRef* d);
|
||||
EXIF_API ExifDataItor* exif_data_ref_iter(ExifDataRef* d);
|
||||
EXIF_API ExifDataMutItor* exif_data_ref_iter_mut(ExifDataRef* d);
|
||||
EXIF_API ExifDatumRef* exif_data_itor_next(ExifDataItor* itor);
|
||||
EXIF_API ExifDatumRef* exif_data_itor_next_back(ExifDataItor* itor);
|
||||
EXIF_API ExifDatumRef* exif_data_mutitor_next(ExifDataMutItor* itor);
|
||||
EXIF_API ExifDatumRef* exif_data_mutitor_next_back(ExifDataMutItor* itor);
|
||||
EXIF_API char* exif_datum_key(ExifDatumRef* d);
|
||||
EXIF_API ExifValueRef* exif_datum_value(ExifDatumRef *d);
|
||||
EXIF_API void exif_datum_set_value(ExifDatumRef* d, ExifValueRef* v);
|
||||
EXIF_API void exif_free_value(ExifValue* value);
|
||||
EXIF_API void exif_free_data(ExifData* d);
|
||||
EXIF_API void exif_free_data_itor(ExifDataItor* itor);
|
||||
EXIF_API void exif_free_data_mutitor(ExifDataMutItor* itor);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -283,10 +283,11 @@ ExifData* exif_data_new() {
|
||||
return new ExifData;
|
||||
}
|
||||
|
||||
int exif_data_ref_add(ExifDataRef* d, ExifKey* key, ExifValue* value) {
|
||||
int exif_data_ref_add(ExifDataRef* d, ExifKey* key, ExifValueRef* value) {
|
||||
if (!d || !key || !value || !key->key) return 0;
|
||||
auto data = (Exiv2::ExifData*)d;
|
||||
data->add(*key->key, value->value.get());
|
||||
auto v = (Exiv2::Value*)value;
|
||||
data->add(*key->key, v);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -362,6 +363,15 @@ ExifDataItor* exif_data_ref_iter(ExifDataRef* d) {
|
||||
return re;
|
||||
}
|
||||
|
||||
ExifDataMutItor* exif_data_ref_iter_mut(ExifDataRef* d) {
|
||||
if (!d) return nullptr;
|
||||
auto re = new ExifDataMutItor;
|
||||
re->ref = (Exiv2::ExifData*)d;
|
||||
re->itor = re->ref->begin();
|
||||
re->end = re->ref->end();
|
||||
return re;
|
||||
}
|
||||
|
||||
void exif_free_data_itor(ExifDataItor* itor) {
|
||||
if (!itor) return;
|
||||
delete itor;
|
||||
@@ -383,6 +393,22 @@ ExifDatumRef* exif_data_itor_next_back(ExifDataItor* itor) {
|
||||
return (ExifDatumRef*)&data;
|
||||
}
|
||||
|
||||
ExifDatumRef* exif_data_mutitor_next(ExifDataMutItor* itor) {
|
||||
if (!itor->ref) return nullptr;
|
||||
if (itor->itor == itor->end) return nullptr;
|
||||
auto& data = (*itor->itor);
|
||||
itor->itor++;
|
||||
return (ExifDatumRef*)&data;
|
||||
}
|
||||
|
||||
ExifDatumRef* exif_data_mutitor_next_back(ExifDataMutItor* itor) {
|
||||
if (!itor->ref) return nullptr;
|
||||
if (itor->itor == itor->end) return nullptr;
|
||||
itor->end--;
|
||||
auto& data = (*itor->end);
|
||||
return (ExifDatumRef*)&data;
|
||||
}
|
||||
|
||||
char* exif_datum_key(ExifDatumRef* d) {
|
||||
if (!d) return nullptr;
|
||||
auto data = (Exiv2::Exifdatum*)d;
|
||||
@@ -401,3 +427,15 @@ ExifValueRef* exif_datum_value(ExifDatumRef *d) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void exif_free_data_mutitor(ExifDataMutItor* itor) {
|
||||
if (!itor) return;
|
||||
delete itor;
|
||||
}
|
||||
|
||||
void exif_datum_set_value(ExifDatumRef* d, ExifValueRef* v) {
|
||||
if (!d || !v) return;
|
||||
auto da = (Exiv2::Exifdatum*)d;
|
||||
auto va = (Exiv2::Value*)v;
|
||||
da->setValue(va);
|
||||
}
|
||||
|
||||
@@ -22,4 +22,9 @@ typedef struct ExifDataItor {
|
||||
Exiv2::ExifMetadata::const_iterator itor;
|
||||
Exiv2::ExifMetadata::const_iterator end;
|
||||
} ExifDataItor;
|
||||
typedef struct ExifDataMutItor {
|
||||
Exiv2::ExifData* ref;
|
||||
Exiv2::ExifMetadata::iterator itor;
|
||||
Exiv2::ExifMetadata::iterator end;
|
||||
} ExifDataMutItor;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user