-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdng_sdk_adapter.h
More file actions
133 lines (115 loc) · 4.19 KB
/
dng_sdk_adapter.h
File metadata and controls
133 lines (115 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "openmeta/metadata_transfer.h"
#include <cstdint>
#include <string>
/**
* \file dng_sdk_adapter.h
* \brief Optional Adobe DNG SDK bridge for prepared OpenMeta DNG transfers.
*/
class dng_host;
class dng_negative;
class dng_stream;
namespace openmeta {
/// Result status for the optional DNG SDK adapter.
enum class DngSdkAdapterStatus : uint8_t {
Ok,
InvalidArgument,
Unsupported,
Malformed,
InternalError,
};
/// Options for applying prepared OpenMeta metadata onto DNG SDK objects.
struct DngSdkAdapterOptions final {
bool apply_exif = true;
bool apply_xmp = true;
bool apply_iptc = true;
bool synchronize_metadata = true;
bool cleanup_for_update = true;
};
/// Result for DNG SDK adapter apply/update operations.
struct DngSdkAdapterResult final {
DngSdkAdapterStatus status = DngSdkAdapterStatus::Ok;
uint32_t applied_blocks = 0;
uint32_t skipped_blocks = 0;
bool exif_applied = false;
bool xmp_applied = false;
bool iptc_applied = false;
bool synchronized_metadata = false;
bool cleaned_for_update = false;
bool updated_stream = false;
TransferBlockKind failed_kind = TransferBlockKind::Other;
std::string message;
};
/// File-helper options for DNG SDK adapter entry points.
struct ApplyDngSdkMetadataFileOptions final {
PrepareTransferFileOptions prepare;
DngSdkAdapterOptions adapter;
};
/// File-helper result for DNG SDK adapter entry points.
struct ApplyDngSdkMetadataFileResult final {
PrepareTransferFileResult prepared;
DngSdkAdapterResult adapter;
};
/**
* \brief Returns true when OpenMeta was built with the optional DNG SDK
* adapter enabled.
*/
bool
dng_sdk_adapter_available() noexcept;
/**
* \brief Applies prepared DNG-target metadata onto a DNG SDK negative.
*
* Current v1 coverage is bounded to EXIF, XMP, and IPTC payloads emitted by
* OpenMeta's prepared DNG transfer bundle. This API does not encode pixels or
* synthesize raw-image structure.
*/
DngSdkAdapterResult
apply_prepared_dng_sdk_metadata(const PreparedTransferBundle& bundle,
::dng_host* host,
::dng_negative* negative,
const DngSdkAdapterOptions& options
= DngSdkAdapterOptions {}) noexcept;
/**
* \brief Applies prepared metadata onto a DNG SDK negative, then runs the
* SDK's in-place metadata update path on an existing DNG stream.
*/
DngSdkAdapterResult
update_prepared_dng_sdk_stream_metadata(
const PreparedTransferBundle& bundle, ::dng_host* host,
::dng_negative* negative, ::dng_stream* stream,
const DngSdkAdapterOptions& options = DngSdkAdapterOptions {}) noexcept;
/**
* \brief Reads one source file, prepares a DNG-target bundle, then applies it
* onto a DNG SDK negative.
*/
ApplyDngSdkMetadataFileResult
apply_dng_sdk_metadata_from_file(
const char* path, ::dng_host* host, ::dng_negative* negative,
const ApplyDngSdkMetadataFileOptions& options
= ApplyDngSdkMetadataFileOptions {}) noexcept;
/**
* \brief Reads one source file, prepares a DNG-target bundle, applies it onto
* a DNG SDK negative, then updates an existing DNG stream in place.
*/
ApplyDngSdkMetadataFileResult
update_dng_sdk_stream_metadata_from_file(
const char* path, ::dng_host* host, ::dng_negative* negative,
::dng_stream* stream,
const ApplyDngSdkMetadataFileOptions& options
= ApplyDngSdkMetadataFileOptions {}) noexcept;
/**
* \brief Reads one source file, prepares a DNG-target bundle, parses one
* existing target DNG file through the Adobe DNG SDK, then updates that
* target file's metadata in place.
*
* This is the thin public file-helper used by bindings and host tools that
* want an end-to-end "source file -> existing DNG file" metadata update path
* without directly managing SDK object lifetimes.
*/
ApplyDngSdkMetadataFileResult
update_dng_sdk_file_from_file(
const char* source_path, const char* target_path,
const ApplyDngSdkMetadataFileOptions& options
= ApplyDngSdkMetadataFileOptions {}) noexcept;
} // namespace openmeta