Skip to main content

exiftool_rs_wrapper/
types.rs

1//! 核心类型定义
2
3use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5use std::fmt;
6
7/// 标签标识符 - 提供类型安全的标签访问
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
9pub struct TagId(pub &'static str);
10
11impl TagId {
12    /// 创建新的标签标识符
13    pub const fn new(name: &'static str) -> Self {
14        Self(name)
15    }
16
17    /// 获取标签名称
18    pub fn name(&self) -> &str {
19        self.0
20    }
21
22    // === 常用 EXIF 标签 ===
23    pub const MAKE: Self = Self("Make");
24    pub const MODEL: Self = Self("Model");
25    pub const DATE_TIME_ORIGINAL: Self = Self("DateTimeOriginal");
26    pub const CREATE_DATE: Self = Self("CreateDate");
27    pub const MODIFY_DATE: Self = Self("ModifyDate");
28    pub const IMAGE_WIDTH: Self = Self("ImageWidth");
29    pub const IMAGE_HEIGHT: Self = Self("ImageHeight");
30    pub const ORIENTATION: Self = Self("Orientation");
31    pub const X_RESOLUTION: Self = Self("XResolution");
32    pub const Y_RESOLUTION: Self = Self("YResolution");
33    pub const RESOLUTION_UNIT: Self = Self("ResolutionUnit");
34    pub const SOFTWARE: Self = Self("Software");
35    pub const COPYRIGHT: Self = Self("Copyright");
36    pub const ARTIST: Self = Self("Artist");
37    pub const IMAGE_DESCRIPTION: Self = Self("ImageDescription");
38
39    // === 相机设置标签 ===
40    pub const EXPOSURE_TIME: Self = Self("ExposureTime");
41    pub const F_NUMBER: Self = Self("FNumber");
42    pub const EXPOSURE_PROGRAM: Self = Self("ExposureProgram");
43    pub const ISO: Self = Self("ISO");
44    pub const SENSITIVITY_TYPE: Self = Self("SensitivityType");
45    pub const RECOMMENDED_EXPOSURE_INDEX: Self = Self("RecommendedExposureIndex");
46    pub const EXIF_VERSION: Self = Self("ExifVersion");
47    pub const DATE_TIME_DIGITIZED: Self = Self("DateTimeDigitized");
48    pub const COMPONENT_CONFIGURATION: Self = Self("ComponentConfiguration");
49    pub const SHUTTER_SPEED_VALUE: Self = Self("ShutterSpeedValue");
50    pub const APERTURE_VALUE: Self = Self("ApertureValue");
51    pub const BRIGHTNESS_VALUE: Self = Self("BrightnessValue");
52    pub const EXPOSURE_COMPENSATION: Self = Self("ExposureCompensation");
53    pub const MAX_APERTURE_VALUE: Self = Self("MaxApertureValue");
54    pub const SUBJECT_DISTANCE: Self = Self("SubjectDistance");
55    pub const METERING_MODE: Self = Self("MeteringMode");
56    pub const LIGHT_SOURCE: Self = Self("LightSource");
57    pub const FLASH: Self = Self("Flash");
58    pub const FOCAL_LENGTH: Self = Self("FocalLength");
59    pub const FOCAL_LENGTH_IN_35MM_FORMAT: Self = Self("FocalLengthIn35mmFormat");
60    pub const FLASH_ENERGY: Self = Self("FlashEnergy");
61    pub const SPATIAL_FREQUENCY_RESPONSE: Self = Self("SpatialFrequencyResponse");
62    pub const FOCAL_PLANE_X_RESOLUTION: Self = Self("FocalPlaneXResolution");
63    pub const FOCAL_PLANE_Y_RESOLUTION: Self = Self("FocalPlaneYResolution");
64    pub const FOCAL_PLANE_RESOLUTION_UNIT: Self = Self("FocalPlaneResolutionUnit");
65    pub const SUBJECT_LOCATION: Self = Self("SubjectLocation");
66    pub const EXPOSURE_INDEX: Self = Self("ExposureIndex");
67    pub const SENSING_METHOD: Self = Self("SensingMethod");
68    pub const FILE_SOURCE: Self = Self("FileSource");
69    pub const SCENE_TYPE: Self = Self("SceneType");
70    pub const CFA_PATTERN: Self = Self("CFAPattern");
71    pub const CUSTOM_RENDERED: Self = Self("CustomRendered");
72    pub const EXPOSURE_MODE: Self = Self("ExposureMode");
73    pub const WHITE_BALANCE: Self = Self("WhiteBalance");
74    pub const DIGITAL_ZOOM_RATIO: Self = Self("DigitalZoomRatio");
75    pub const FOCAL_LENGTH_35EFL: Self = Self("FocalLength35efl");
76    pub const SCENE_CAPTURE_TYPE: Self = Self("SceneCaptureType");
77    pub const GAIN_CONTROL: Self = Self("GainControl");
78    pub const CONTRAST: Self = Self("Contrast");
79    pub const SATURATION: Self = Self("Saturation");
80    pub const SHARPNESS: Self = Self("Sharpness");
81    pub const DEVICE_SETTING_DESCRIPTION: Self = Self("DeviceSettingDescription");
82    pub const SUBJECT_DISTANCE_RANGE: Self = Self("SubjectDistanceRange");
83
84    // === GPS 标签 ===
85    pub const GPS_LATITUDE_REF: Self = Self("GPSLatitudeRef");
86    pub const GPS_LATITUDE: Self = Self("GPSLatitude");
87    pub const GPS_LONGITUDE_REF: Self = Self("GPSLongitudeRef");
88    pub const GPS_LONGITUDE: Self = Self("GPSLongitude");
89    pub const GPS_ALTITUDE_REF: Self = Self("GPSAltitudeRef");
90    pub const GPS_ALTITUDE: Self = Self("GPSAltitude");
91    pub const GPS_TIMESTAMP: Self = Self("GPSTimeStamp");
92    pub const GPS_SATELLITES: Self = Self("GPSSatellites");
93    pub const GPS_STATUS: Self = Self("GPSStatus");
94    pub const GPS_MEASURE_MODE: Self = Self("GPSMeasureMode");
95    pub const GPS_DOP: Self = Self("GPSDOP");
96    pub const GPS_SPEED_REF: Self = Self("GPSSpeedRef");
97    pub const GPS_SPEED: Self = Self("GPSSpeed");
98    pub const GPS_TRACK_REF: Self = Self("GPSTrackRef");
99    pub const GPS_TRACK: Self = Self("GPSTrack");
100    pub const GPS_IMG_DIRECTION_REF: Self = Self("GPSImgDirectionRef");
101    pub const GPS_IMG_DIRECTION: Self = Self("GPSImgDirection");
102    pub const GPS_MAP_DATUM: Self = Self("GPSMapDatum");
103    pub const GPS_DEST_LATITUDE_REF: Self = Self("GPSDestLatitudeRef");
104    pub const GPS_DEST_LATITUDE: Self = Self("GPSDestLatitude");
105    pub const GPS_DEST_LONGITUDE_REF: Self = Self("GPSDestLongitudeRef");
106    pub const GPS_DEST_LONGITUDE: Self = Self("GPSDestLongitude");
107    pub const GPS_DEST_BEARING_REF: Self = Self("GPSDestBearingRef");
108    pub const GPS_DEST_BEARING: Self = Self("GPSDestBearing");
109    pub const GPS_DEST_DISTANCE_REF: Self = Self("GPSDestDistanceRef");
110    pub const GPS_DEST_DISTANCE: Self = Self("GPSDestDistance");
111    pub const GPS_PROCESSING_METHOD: Self = Self("GPSProcessingMethod");
112    pub const GPS_AREA_INFORMATION: Self = Self("GPSAreaInformation");
113    pub const GPS_DATE_STAMP: Self = Self("GPSDateStamp");
114    pub const GPS_DIFFERENTIAL: Self = Self("GPSDifferential");
115    pub const GPS_H_POSITIONING_ERROR: Self = Self("GPSHPositioningError");
116
117    // === 文件信息标签 ===
118    pub const FILE_NAME: Self = Self("FileName");
119    pub const DIRECTORY: Self = Self("Directory");
120    pub const FILE_SIZE: Self = Self("FileSize");
121    pub const FILE_MODIFY_DATE: Self = Self("FileModifyDate");
122    pub const FILE_ACCESS_DATE: Self = Self("FileAccessDate");
123    pub const FILE_INODE_CHANGE_DATE: Self = Self("FileInodeChangeDate");
124    pub const FILE_PERMISSIONS: Self = Self("FilePermissions");
125    pub const FILE_TYPE: Self = Self("FileType");
126    pub const FILE_TYPE_EXTENSION: Self = Self("FileTypeExtension");
127    pub const MIME_TYPE: Self = Self("MIMEType");
128    pub const EXIF_BYTE_ORDER: Self = Self("ExifByteOrder");
129    pub const CURRENT_ICC_PROFILE: Self = Self("CurrentICCProfile");
130    pub const PROFILE_DATE_TIME: Self = Self("ProfileDateTime");
131    pub const PROFILE_FILE_SIGNATURE: Self = Self("ProfileFileSignature");
132    pub const PRIMARY_PLATFORM: Self = Self("PrimaryPlatform");
133    pub const CMM_TYPE: Self = Self("CMMType");
134    pub const PROFILE_VERSION: Self = Self("ProfileVersion");
135    pub const PROFILE_CLASS: Self = Self("ProfileClass");
136    pub const COLOR_SPACE_DATA: Self = Self("ColorSpaceData");
137    pub const PROFILE_CONNECTION_SPACE: Self = Self("ProfileConnectionSpace");
138    pub const PROFILE_CONNECTION_SPACE_ILLUMINANT: Self = Self("ProfileConnectionSpaceIlluminant");
139    pub const ICC_PROFILE_CREATOR: Self = Self("ICCProfileCreator");
140    pub const ICC_PROFILE_DESCRIPTION: Self = Self("ICCProfileDescription");
141    pub const ICC_VIEWING_CONDITIONS_DESCRIPTION: Self = Self("ICCViewingConditionsDescription");
142    pub const ICC_DEVICE_MODEL: Self = Self("ICCDeviceModel");
143    pub const ICC_DEVICE_MANUFACTURER: Self = Self("ICCDeviceManufacturer");
144
145    // === IPTC 标签 ===
146    pub const IPTC_OBJECT_NAME: Self = Self("ObjectName");
147    pub const IPTC_EDIT_STATUS: Self = Self("EditStatus");
148    pub const IPTC_EDITORIAL_UPDATE: Self = Self("EditorialUpdate");
149    pub const IPTC_URGENCY: Self = Self("Urgency");
150    pub const IPTC_SUBJECT_REFERENCE: Self = Self("SubjectReference");
151    pub const IPTC_CATEGORY: Self = Self("Category");
152    pub const IPTC_SUPPLEMENTAL_CATEGORY: Self = Self("SupplementalCategory");
153    pub const IPTC_FIXTURE_IDENTIFIER: Self = Self("FixtureIdentifier");
154    pub const IPTC_KEYWORDS: Self = Self("Keywords");
155    pub const IPTC_CONTENT_LOCATION_CODE: Self = Self("ContentLocationCode");
156    pub const IPTC_CONTENT_LOCATION_NAME: Self = Self("ContentLocationName");
157    pub const IPTC_RELEASE_DATE: Self = Self("ReleaseDate");
158    pub const IPTC_RELEASE_TIME: Self = Self("ReleaseTime");
159    pub const IPTC_EXPIRATION_DATE: Self = Self("ExpirationDate");
160    pub const IPTC_EXPIRATION_TIME: Self = Self("ExpirationTime");
161    pub const IPTC_SPECIAL_INSTRUCTIONS: Self = Self("SpecialInstructions");
162    pub const IPTC_ACTION_ADVISED: Self = Self("ActionAdvised");
163    pub const IPTC_REFERENCE_SERVICE: Self = Self("ReferenceService");
164    pub const IPTC_REFERENCE_DATE: Self = Self("ReferenceDate");
165    pub const IPTC_REFERENCE_NUMBER: Self = Self("ReferenceNumber");
166    pub const IPTC_DATE_CREATED: Self = Self("DateCreated");
167    pub const IPTC_TIME_CREATED: Self = Self("TimeCreated");
168    pub const IPTC_DIGITAL_CREATION_DATE: Self = Self("DigitalCreationDate");
169    pub const IPTC_DIGITAL_CREATION_TIME: Self = Self("DigitalCreationTime");
170    pub const IPTC_ORIGINATING_PROGRAM: Self = Self("OriginatingProgram");
171    pub const IPTC_PROGRAM_VERSION: Self = Self("ProgramVersion");
172    pub const IPTC_OBJECT_CYCLE: Self = Self("ObjectCycle");
173    pub const IPTC_BY_LINE: Self = Self("By-line");
174    pub const IPTC_BY_LINE_TITLE: Self = Self("By-lineTitle");
175    pub const IPTC_CITY: Self = Self("City");
176    pub const IPTC_SUB_LOCATION: Self = Self("Sub-location");
177    pub const IPTC_PROVINCE_STATE: Self = Self("Province-State");
178    pub const IPTC_COUNTRY_PRIMARY_LOCATION_CODE: Self = Self("Country-PrimaryLocationCode");
179    pub const IPTC_COUNTRY_PRIMARY_LOCATION_NAME: Self = Self("Country-PrimaryLocationName");
180    pub const IPTC_ORIGINAL_TRANSMISSION_REFERENCE: Self = Self("OriginalTransmissionReference");
181    pub const IPTC_HEADLINE: Self = Self("Headline");
182    pub const IPTC_CREDIT: Self = Self("Credit");
183    pub const IPTC_SOURCE: Self = Self("Source");
184    pub const IPTC_COPYRIGHT_NOTICE: Self = Self("CopyrightNotice");
185    pub const IPTC_CONTACT: Self = Self("Contact");
186    pub const IPTC_CAPTION_ABSTRACT: Self = Self("Caption-Abstract");
187    pub const IPTC_WRITER_EDITOR: Self = Self("Writer-Editor");
188    pub const IPTC_IMAGE_TYPE: Self = Self("ImageType");
189    pub const IPTC_IMAGE_ORIENTATION: Self = Self("ImageOrientation");
190    pub const IPTC_LANGUAGE_IDENTIFIER: Self = Self("LanguageIdentifier");
191
192    // === XMP 标签 ( Dublin Core ) ===
193    pub const XMP_DC_TITLE: Self = Self("Title");
194    pub const XMP_DC_CREATOR: Self = Self("Creator");
195    pub const XMP_DC_SUBJECT: Self = Self("Subject");
196    pub const XMP_DC_DESCRIPTION: Self = Self("Description");
197    pub const XMP_DC_PUBLISHER: Self = Self("Publisher");
198    pub const XMP_DC_CONTRIBUTOR: Self = Self("Contributor");
199    pub const XMP_DC_DATE: Self = Self("Date");
200    pub const XMP_DC_TYPE: Self = Self("Type");
201    pub const XMP_DC_FORMAT: Self = Self("Format");
202    pub const XMP_DC_IDENTIFIER: Self = Self("Identifier");
203    pub const XMP_DC_SOURCE: Self = Self("Source");
204    pub const XMP_DC_LANGUAGE: Self = Self("Language");
205    pub const XMP_DC_RELATION: Self = Self("Relation");
206    pub const XMP_DC_COVERAGE: Self = Self("Coverage");
207    pub const XMP_DC_RIGHTS: Self = Self("Rights");
208
209    // === XMP 标签 ( XMP Rights ) ===
210    pub const XMP_XMP_RIGHTS_MANAGED: Self = Self("RightsManaged");
211    pub const XMP_XMP_RIGHTS_MARKED: Self = Self("RightsMarked");
212    pub const XMP_XMP_RIGHTS_WEB_STATEMENT: Self = Self("WebStatement");
213    pub const XMP_XMP_RIGHTS_USAGE_TERMS: Self = Self("UsageTerms");
214
215    // === 图像尺寸标签 ===
216    pub const IMAGE_SIZE: Self = Self("ImageSize");
217    pub const MEGAPIXELS: Self = Self("Megapixels");
218    pub const QUALITY: Self = Self("Quality");
219    pub const BITS_PER_SAMPLE: Self = Self("BitsPerSample");
220    pub const COLOR_COMPONENTS: Self = Self("ColorComponents");
221    pub const Y_CB_CR_SUB_SAMPLING: Self = Self("YCbCrSubSampling");
222    pub const Y_CB_CR_POSITIONING: Self = Self("YCbCrPositioning");
223
224    // === 缩略图标签 ===
225    pub const THUMBNAIL_IMAGE: Self = Self("ThumbnailImage");
226    pub const THUMBNAIL_LENGTH: Self = Self("ThumbnailLength");
227    pub const THUMBNAIL_OFFSET: Self = Self("ThumbnailOffset");
228    pub const PREVIEW_IMAGE: Self = Self("PreviewImage");
229    pub const PREVIEW_IMAGE_TYPE: Self = Self("PreviewImageType");
230    pub const JPG_FROM_RAW: Self = Self("JpgFromRaw");
231    pub const OTHER_IMAGE: Self = Self("OtherImage");
232
233    // === 色彩空间标签 ===
234    pub const COLOR_SPACE: Self = Self("ColorSpace");
235    pub const GAMMA: Self = Self("Gamma");
236
237    // === 复合标签 (Composite) ===
238    pub const HYPERFOCAL_DISTANCE: Self = Self("HyperfocalDistance");
239    pub const SCALE_FACTOR_35EFL: Self = Self("ScaleFactor35efl");
240    pub const CIRCLE_OF_CONFUSION: Self = Self("CircleOfConfusion");
241    pub const FIELD_OF_VIEW: Self = Self("FieldOfView");
242    pub const LENS_ID: Self = Self("LensID");
243    pub const LENS_INFO: Self = Self("LensInfo");
244    pub const LENS_SPEC: Self = Self("LensSpec");
245    pub const LENS_MAKE: Self = Self("LensMake");
246    pub const LENS_MODEL: Self = Self("LensModel");
247    pub const LENS_SERIAL_NUMBER: Self = Self("LensSerialNumber");
248
249    // === Canon MakerNotes ===
250    pub const CANON_MODEL_ID: Self = Self("CanonModelID");
251    pub const CANON_EXPOSURE_MODE: Self = Self("CanonExposureMode");
252    pub const CANON_FLASH_MODE: Self = Self("CanonFlashMode");
253    pub const CANON_LENS_TYPE: Self = Self("CanonLensType");
254    pub const CANON_LENS_MODEL: Self = Self("CanonLensModel");
255    pub const CANON_IMAGE_SIZE: Self = Self("CanonImageSize");
256    pub const CANON_IMAGE_QUALITY: Self = Self("CanonImageQuality");
257    pub const CANON_SHARPNESS: Self = Self("CanonSharpness");
258    pub const CANON_CONTRAST: Self = Self("CanonContrast");
259    pub const CANON_SATURATION: Self = Self("CanonSaturation");
260    pub const CANON_COLOR_TONE: Self = Self("CanonColorTone");
261    pub const CANON_COLOR_SPACE: Self = Self("CanonColorSpace");
262    pub const CANON_PICTURE_STYLE: Self = Self("CanonPictureStyle");
263    pub const CANON_DRIVE_MODE: Self = Self("CanonDriveMode");
264    pub const CANON_FOCUS_MODE: Self = Self("CanonFocusMode");
265    pub const CANON_METERING_MODE: Self = Self("CanonMeteringMode");
266    pub const CANON_AF_POINT: Self = Self("CanonAFPoint");
267    pub const CANON_SELF_TIMER: Self = Self("CanonSelfTimer");
268    pub const CANON_IMAGE_STABILIZATION: Self = Self("CanonImageStabilization");
269    pub const CANON_WHITE_BALANCE: Self = Self("CanonWhiteBalance");
270
271    // === Nikon MakerNotes ===
272    pub const NIKON_MAKE: Self = Self("NikonMake");
273    pub const NIKON_QUALITY: Self = Self("NikonQuality");
274    pub const NIKON_COLOR_MODE: Self = Self("NikonColorMode");
275    pub const NIKON_IMAGE_ADJUSTMENT: Self = Self("NikonImageAdjustment");
276    pub const NIKON_CCD_SENSITIVITY: Self = Self("NikonCCDSensitivity");
277    pub const NIKON_WHITE_BALANCE_FINE: Self = Self("NikonWhiteBalanceFine");
278    pub const NIKON_ISO_SETTING: Self = Self("NikonISOSetting");
279    pub const NIKON_IMAGE_OPTIMIZATION: Self = Self("NikonImageOptimization");
280    pub const NIKON_SATURATION_ADJUST: Self = Self("NikonSaturationAdjust");
281    pub const NIKON_SHARPNESS_ADJUST: Self = Self("NikonSharpnessAdjust");
282    pub const NIKON_FOCUS_MODE: Self = Self("NikonFocusMode");
283    pub const NIKON_FLASH_MODE: Self = Self("NikonFlashMode");
284    pub const NIKON_SHOOTING_MODE: Self = Self("NikonShootingMode");
285    pub const NIKON_AUTO_BRACKET_RELEASE: Self = Self("NikonAutoBracketRelease");
286    pub const NIKON_LENS_TYPE: Self = Self("NikonLensType");
287    pub const NIKON_LENS: Self = Self("NikonLens");
288
289    // === Sony MakerNotes ===
290    pub const SONY_MAKE: Self = Self("SonyMake");
291    pub const SONY_IMAGE_SIZE: Self = Self("SonyImageSize");
292    pub const SONY_QUALITY: Self = Self("SonyQuality");
293    pub const SONY_FLASH_MODE: Self = Self("SonyFlashMode");
294    pub const SONY_EXPOSURE_MODE: Self = Self("SonyExposureMode");
295    pub const SONY_FOCUS_MODE: Self = Self("SonyFocusMode");
296    pub const SONY_WHITE_BALANCE_MODE: Self = Self("SonyWhiteBalanceMode");
297    pub const SONY_MACRO: Self = Self("SonyMacro");
298    pub const SONY_SHARPNESS: Self = Self("SonySharpness");
299    pub const SONY_SATURATION: Self = Self("SonySaturation");
300    pub const SONY_CONTRAST: Self = Self("SonyContrast");
301    pub const SONY_BRIGHTNESS: Self = Self("SonyBrightness");
302    pub const SONY_LONG_EXPOSURE_NOISE_REDUCTION: Self = Self("SonyLongExposureNoiseReduction");
303    pub const SONY_HIGH_ISO_NOISE_REDUCTION: Self = Self("SonyHighISONoiseReduction");
304    pub const SONY_HDR: Self = Self("SonyHDR");
305    pub const SONY_MULTI_FRAME_NR: Self = Self("SonyMultiFrameNR");
306
307    // === Fuji MakerNotes ===
308    pub const FUJI_QUALITY: Self = Self("FujiQuality");
309    pub const FUJI_SATURATION: Self = Self("FujiSaturation");
310    pub const FUJI_WHITE_BALANCE_FINE_TUNE: Self = Self("FujiWhiteBalanceFineTune");
311    pub const FUJI_HIGH_IS0_NOISE_REDUCTION: Self = Self("FujiHighIS0NoiseReduction");
312    pub const FUJI_FOCUS_MODE: Self = Self("FujiFocusMode");
313    pub const FUJI_AF_MODE: Self = Self("FujiAFMode");
314    pub const FUJI_FOCUS_PIXEL: Self = Self("FujiFocusPixel");
315    pub const FUJI_IMAGE_SIZE: Self = Self("FujiImageSize");
316    pub const FUJI_DUAL_IMAGE_STABILIZATION: Self = Self("FujiDualImageStabilization");
317    pub const FUJI_FACE_DETECTION: Self = Self("FujiFaceDetection");
318    pub const FUJI_NUM_FACE_ELEMENTS: Self = Self("FujiNumFaceElements");
319
320    // === Panasonic MakerNotes ===
321    pub const PANASONIC_IMAGE_QUALITY: Self = Self("PanasonicImageQuality");
322    pub const PANASONIC_COLOR_MODE: Self = Self("PanasonicColorMode");
323    pub const PANASONIC_IMAGE_STABILIZATION: Self = Self("PanasonicImageStabilization");
324    pub const PANASONIC_MACRO_MODE: Self = Self("PanasonicMacroMode");
325    pub const PANASONIC_FOCUS_MODE: Self = Self("PanasonicFocusMode");
326    pub const PANASONIC_AF_AREA_MODE: Self = Self("PanasonicAFAreaMode");
327    pub const PANASONIC_IMAGE_STABILIZATION2: Self = Self("PanasonicImageStabilization2");
328    pub const PANASONIC_BABY_AGE: Self = Self("PanasonicBabyAge");
329    pub const PANASONIC_BABY_NAME: Self = Self("PanasonicBabyName");
330
331    // === Olympus MakerNotes ===
332    pub const OLYMPUS_IMAGE_QUALITY: Self = Self("OlympusImageQuality");
333    pub const OLYMPUS_MACRO_MODE: Self = Self("OlympusMacroMode");
334    pub const OLYMPUS_DIGITAL_ZOOM: Self = Self("OlympusDigitalZoom");
335    pub const OLYMPUS_VERSION: Self = Self("OlympusVersion");
336    pub const OLYMPUS_IMAGE_PROCESSING: Self = Self("OlympusImageProcessing");
337    pub const OLYMPUS_FOCUS_MODE: Self = Self("OlympusFocusMode");
338    pub const OLYMPUS_AF_AREA: Self = Self("OlympusAFArea");
339    pub const OLYMPUS_AF_POINT: Self = Self("OlympusAFPoint");
340    pub const OLYMPUS_IMAGE_STABILIZATION: Self = Self("OlympusImageStabilization");
341    pub const OLYMPUS_COLOR_SPACE: Self = Self("OlympusColorSpace");
342
343    // === Pentax MakerNotes ===
344    pub const PENTAX_MODEL_TYPE: Self = Self("PentaxModelType");
345    pub const PENTAX_IMAGE_SIZE: Self = Self("PentaxImageSize");
346    pub const PENTAX_QUALITY: Self = Self("PentaxQuality");
347    pub const PENTAX_IMAGE_PROCESSING: Self = Self("PentaxImageProcessing");
348    pub const PENTAX_FOCUS_MODE: Self = Self("PentaxFocusMode");
349    pub const PENTAX_AF_POINT: Self = Self("PentaxAFPoint");
350    pub const PENTAX_AUTO_BRACKETING: Self = Self("PentaxAutoBracketing");
351    pub const PENTAX_WHITE_BALANCE: Self = Self("PentaxWhiteBalance");
352
353    // === 更多 XMP 命名空间 ===
354    pub const XMP_XMP_CREATE_DATE: Self = Self("xmp:CreateDate");
355    pub const XMP_XMP_MODIFY_DATE: Self = Self("xmp:ModifyDate");
356    pub const XMP_XMP_METADATA_DATE: Self = Self("xmp:MetadataDate");
357    pub const XMP_XMP_CREATOR_TOOL: Self = Self("xmp:CreatorTool");
358    pub const XMP_XMP_RATING: Self = Self("xmp:Rating");
359    pub const XMP_XMP_LABEL: Self = Self("xmp:Label");
360    pub const XMP_XMP_NICKNAME: Self = Self("xmp:Nickname");
361
362    // === XMP IPTC Core ===
363    pub const XMP_IPTC_CITY: Self = Self("Iptc4xmpCore:City");
364    pub const XMP_IPTC_COUNTRY: Self = Self("Iptc4xmpCore:Country");
365    pub const XMP_IPTC_COUNTRY_CODE: Self = Self("Iptc4xmpCore:CountryCode");
366    pub const XMP_IPTC_STATE: Self = Self("Iptc4xmpCore:State");
367    pub const XMP_IPTC_LOCATION: Self = Self("Iptc4xmpCore:Location");
368    pub const XMP_IPTC_SUBJECT_CODE: Self = Self("Iptc4xmpCore:SubjectCode");
369    pub const XMP_IPTC_INTELLECTUAL_GENRE: Self = Self("Iptc4xmpCore:IntellectualGenre");
370
371    // === XMP IPTC Extension ===
372    pub const XMP_IPTC_EXT_DIGITAL_SOURCE_TYPE: Self = Self("Iptc4xmpExt:DigitalSourceType");
373    pub const XMP_IPTC_EXT_DIGITAL_GUIDE: Self = Self("Iptc4xmpExt:DigitalGuide");
374    pub const XMP_IPTC_EXT_EVENT: Self = Self("Iptc4xmpExt:Event");
375    pub const XMP_IPTC_EXT_ORGANISATION_IN_IMAGE: Self = Self("Iptc4xmpExt:OrganisationInImage");
376    pub const XMP_IPTC_EXT_PERSON_IN_IMAGE: Self = Self("Iptc4xmpExt:PersonInImage");
377    pub const XMP_IPTC_EXT_LOCATION_SHOWN: Self = Self("Iptc4xmpExt:LocationShown");
378
379    // === XMP Photoshop ===
380    pub const XMP_PHOTOSHOP_DATE_CREATED: Self = Self("photoshop:DateCreated");
381    pub const XMP_PHOTOSHOP_CITY: Self = Self("photoshop:City");
382    pub const XMP_PHOTOSHOP_STATE: Self = Self("photoshop:State");
383    pub const XMP_PHOTOSHOP_COUNTRY: Self = Self("photoshop:Country");
384    pub const XMP_PHOTOSHOP_CREDIT: Self = Self("photoshop:Credit");
385    pub const XMP_PHOTOSHOP_SOURCE: Self = Self("photoshop:Source");
386    pub const XMP_PHOTOSHOP_INSTRUCTIONS: Self = Self("photoshop:Instructions");
387    pub const XMP_PHOTOSHOP_TRANSMISSION_REFERENCE: Self = Self("photoshop:TransmissionReference");
388    pub const XMP_PHOTOSHOP_URGENCY: Self = Self("photoshop:Urgency");
389    pub const XMP_PHOTOSHOP_CATEGORY: Self = Self("photoshop:Category");
390    pub const XMP_PHOTOSHOP_SUPPLEMENTAL_CATEGORIES: Self =
391        Self("photoshop:SupplementalCategories");
392    pub const XMP_PHOTOSHOP_HEADLINE: Self = Self("photoshop:Headline");
393    pub const XMP_PHOTOSHOP_CAPTION_WRITER: Self = Self("photoshop:CaptionWriter");
394
395    // === XMP Camera Raw ===
396    pub const XMP_CRS_VERSION: Self = Self("crs:Version");
397    pub const XMP_CRS_WHITE_BALANCE: Self = Self("crs:WhiteBalance");
398    pub const XMP_CRS_TEMPERATURE: Self = Self("crs:Temperature");
399    pub const XMP_CRS_TINT: Self = Self("crs:Tint");
400    pub const XMP_CRS_EXPOSURE: Self = Self("crs:Exposure");
401    pub const XMP_CRS_SHADOWS: Self = Self("crs:Shadows");
402    pub const XMP_CRS_BRIGHTNESS: Self = Self("crs:Brightness");
403    pub const XMP_CRS_CONTRAST: Self = Self("crs:Contrast");
404    pub const XMP_CRS_SATURATION: Self = Self("crs:Saturation");
405    pub const XMP_CRS_SHARPNESS: Self = Self("crs:Sharpness");
406    pub const XMP_CRS_LUMINANCE_SMOOTHING: Self = Self("crs:LuminanceSmoothing");
407    pub const XMP_CRS_COLOR_NOISE_REDUCTION: Self = Self("crs:ColorNoiseReduction");
408    pub const XMP_CRS_VIGNETTE_AMOUNT: Self = Self("crs:VignetteAmount");
409
410    // === XMP AUX (Camera Raw Schema) ===
411    pub const XMP_AUX_SERIAL_NUMBER: Self = Self("aux:SerialNumber");
412    pub const XMP_AUX_LENS_INFO: Self = Self("aux:LensInfo");
413    pub const XMP_AUX_LENS: Self = Self("aux:Lens");
414    pub const XMP_AUX_LENS_ID: Self = Self("aux:LensID");
415    pub const XMP_AUX_LENS_SERIAL_NUMBER: Self = Self("aux:LensSerialNumber");
416    pub const XMP_AUX_IMAGE_NUMBER: Self = Self("aux:ImageNumber");
417    pub const XMP_AUX_FLASH_COMPENSATION: Self = Self("aux:FlashCompensation");
418    pub const XMP_AUX_FIRMWARE: Self = Self("aux:Firmware");
419
420    // === XMP MM (Media Management) ===
421    pub const XMP_MM_DOCUMENT_ID: Self = Self("xmpMM:DocumentID");
422    pub const XMP_MM_INSTANCE_ID: Self = Self("xmpMM:InstanceID");
423    pub const XMP_MM_ORIGINAL_DOCUMENT_ID: Self = Self("xmpMM:OriginalDocumentID");
424    pub const XMP_MM_RENDITION_CLASS: Self = Self("xmpMM:RenditionClass");
425    pub const XMP_MM_VERSION_ID: Self = Self("xmpMM:VersionID");
426    pub const XMP_MM_VERSION_MODIFIER: Self = Self("xmpMM:VersionModifier");
427    pub const XMP_MM_HISTORY: Self = Self("xmpMM:History");
428    pub const XMP_MM_DERIVED_FROM: Self = Self("xmpMM:DerivedFrom");
429
430    // === XMP TIFF ===
431    pub const XMP_TIFF_MAKE: Self = Self("tiff:Make");
432    pub const XMP_TIFF_MODEL: Self = Self("tiff:Model");
433    pub const XMP_TIFF_IMAGE_WIDTH: Self = Self("tiff:ImageWidth");
434    pub const XMP_TIFF_IMAGE_HEIGHT: Self = Self("tiff:ImageHeight");
435    pub const XMP_TIFF_BITS_PER_SAMPLE: Self = Self("tiff:BitsPerSample");
436    pub const XMP_TIFF_COMPRESSION: Self = Self("tiff:Compression");
437    pub const XMP_TIFF_PHOTOMETRIC_INTERPRETATION: Self = Self("tiff:PhotometricInterpretation");
438    pub const XMP_TIFF_ORIENTATION: Self = Self("tiff:Orientation");
439    pub const XMP_TIFF_SAMPLES_PER_PIXEL: Self = Self("tiff:SamplesPerPixel");
440    pub const XMP_TIFF_PLANAR_CONFIGURATION: Self = Self("tiff:PlanarConfiguration");
441    pub const XMP_TIFF_YCBCR_SUB_SAMPLING: Self = Self("tiff:YCbCrSubSampling");
442    pub const XMP_TIFF_YCBCR_POSITIONING: Self = Self("tiff:YCbCrPositioning");
443    pub const XMP_TIFF_X_RESOLUTION: Self = Self("tiff:XResolution");
444    pub const XMP_TIFF_Y_RESOLUTION: Self = Self("tiff:YResolution");
445    pub const XMP_TIFF_RESOLUTION_UNIT: Self = Self("tiff:ResolutionUnit");
446
447    // === XMP EXIF ===
448    pub const XMP_EXIF_EXPOSURE_TIME: Self = Self("exif:ExposureTime");
449    pub const XMP_EXIF_F_NUMBER: Self = Self("exif:FNumber");
450    pub const XMP_EXIF_EXPOSURE_PROGRAM: Self = Self("exif:ExposureProgram");
451    pub const XMP_EXIF_SPECTRAL_SENSITIVITY: Self = Self("exif:SpectralSensitivity");
452    pub const XMP_EXIF_ISO_SPEED_RATINGS: Self = Self("exif:ISOSpeedRatings");
453    pub const XMP_EXIF_DATE_TIME_ORIGINAL: Self = Self("exif:DateTimeOriginal");
454    pub const XMP_EXIF_DATE_TIME_DIGITIZED: Self = Self("exif:DateTimeDigitized");
455    pub const XMP_EXIF_COMPONENTS_CONFIGURATION: Self = Self("exif:ComponentsConfiguration");
456    pub const XMP_EXIF_COMPRESSED_BITS_PER_PIXEL: Self = Self("exif:CompressedBitsPerPixel");
457    pub const XMP_EXIF_SHUTTER_SPEED_VALUE: Self = Self("exif:ShutterSpeedValue");
458    pub const XMP_EXIF_APERTURE_VALUE: Self = Self("exif:ApertureValue");
459    pub const XMP_EXIF_BRIGHTNESS_VALUE: Self = Self("exif:BrightnessValue");
460    pub const XMP_EXIF_EXPOSURE_BIAS_VALUE: Self = Self("exif:ExposureBiasValue");
461    pub const XMP_EXIF_MAX_APERTURE_VALUE: Self = Self("exif:MaxApertureValue");
462    pub const XMP_EXIF_SUBJECT_DISTANCE: Self = Self("exif:SubjectDistance");
463    pub const XMP_EXIF_METERING_MODE: Self = Self("exif:MeteringMode");
464    pub const XMP_EXIF_LIGHT_SOURCE: Self = Self("exif:LightSource");
465    pub const XMP_EXIF_FLASH: Self = Self("exif:Flash");
466    pub const XMP_EXIF_FOCAL_LENGTH: Self = Self("exif:FocalLength");
467    pub const XMP_EXIF_FLASH_ENERGY: Self = Self("exif:FlashEnergy");
468    pub const XMP_EXIF_SPATIAL_FREQUENCY_RESPONSE: Self = Self("exif:SpatialFrequencyResponse");
469    pub const XMP_EXIF_FOCAL_PLANE_X_RESOLUTION: Self = Self("exif:FocalPlaneXResolution");
470    pub const XMP_EXIF_FOCAL_PLANE_Y_RESOLUTION: Self = Self("exif:FocalPlaneYResolution");
471    pub const XMP_EXIF_FOCAL_PLANE_RESOLUTION_UNIT: Self = Self("exif:FocalPlaneResolutionUnit");
472    pub const XMP_EXIF_SUBJECT_LOCATION: Self = Self("exif:SubjectLocation");
473    pub const XMP_EXIF_EXPOSURE_INDEX: Self = Self("exif:ExposureIndex");
474    pub const XMP_EXIF_SENSING_METHOD: Self = Self("exif:SensingMethod");
475    pub const XMP_EXIF_FILE_SOURCE: Self = Self("exif:FileSource");
476    pub const XMP_EXIF_SCENE_TYPE: Self = Self("exif:SceneType");
477    pub const XMP_EXIF_CFA_PATTERN: Self = Self("exif:CFAPattern");
478    pub const XMP_EXIF_CUSTOM_RENDERED: Self = Self("exif:CustomRendered");
479    pub const XMP_EXIF_EXPOSURE_MODE: Self = Self("exif:ExposureMode");
480    pub const XMP_EXIF_WHITE_BALANCE: Self = Self("exif:WhiteBalance");
481    pub const XMP_EXIF_DIGITAL_ZOOM_RATIO: Self = Self("exif:DigitalZoomRatio");
482    pub const XMP_EXIF_FOCAL_LENGTH_IN_35MM_FILM: Self = Self("exif:FocalLengthIn35mmFilm");
483    pub const XMP_EXIF_SCENE_CAPTURE_TYPE: Self = Self("exif:SceneCaptureType");
484    pub const XMP_EXIF_GAIN_CONTROL: Self = Self("exif:GainControl");
485    pub const XMP_EXIF_CONTRAST: Self = Self("exif:Contrast");
486    pub const XMP_EXIF_SATURATION: Self = Self("exif:Saturation");
487    pub const XMP_EXIF_SHARPNESS: Self = Self("exif:Sharpness");
488    pub const XMP_EXIF_DEVICE_SETTING_DESCRIPTION: Self = Self("exif:DeviceSettingDescription");
489    pub const XMP_EXIF_SUBJECT_DISTANCE_RANGE: Self = Self("exif:SubjectDistanceRange");
490    pub const XMP_EXIF_IMAGE_UNIQUE_ID: Self = Self("exif:ImageUniqueID");
491
492    // === 视频特定标签 ===
493    pub const DURATION: Self = Self("Duration");
494    pub const VIDEO_FRAME_RATE: Self = Self("VideoFrameRate");
495    pub const VIDEO_FRAME_COUNT: Self = Self("VideoFrameCount");
496    pub const VIDEO_BIT_RATE: Self = Self("VideoBitRate");
497    pub const AUDIO_BIT_RATE: Self = Self("AudioBitRate");
498    pub const VIDEO_COMPRESSION: Self = Self("VideoCompression");
499    pub const AUDIO_COMPRESSION: Self = Self("AudioCompression");
500    pub const TRACK_NUMBER: Self = Self("TrackNumber");
501    pub const TRACK_TYPE: Self = Self("TrackType");
502    pub const TRACK_CREATE_DATE: Self = Self("TrackCreateDate");
503    pub const TRACK_MODIFY_DATE: Self = Self("TrackModifyDate");
504    pub const MEDIA_CREATE_DATE: Self = Self("MediaCreateDate");
505    pub const MEDIA_MODIFY_DATE: Self = Self("MediaModifyDate");
506    pub const MEDIA_DATA_SIZE: Self = Self("MediaDataSize");
507    pub const MEDIA_DATA_OFFSET: Self = Self("MediaDataOffset");
508    pub const GENRE: Self = Self("Genre");
509    // ARTIST 已在上面定义
510    pub const ALBUM: Self = Self("Album");
511    pub const YEAR: Self = Self("Year");
512    pub const COMMENT: Self = Self("Comment");
513    pub const LYRICS: Self = Self("Lyrics");
514    pub const COMPOSER: Self = Self("Composer");
515    pub const PUBLISHER: Self = Self("Publisher");
516
517    // === 更多文件信息 ===
518    pub const FILE_DESCRIPTION: Self = Self("FileDescription");
519    pub const FILE_VERSION: Self = Self("FileVersion");
520    pub const INTERNAL_VERSION_NUMBER: Self = Self("InternalVersionNumber");
521    pub const COMPANY_NAME: Self = Self("CompanyName");
522    pub const LEGAL_COPYRIGHT: Self = Self("LegalCopyright");
523    pub const PRODUCT_NAME: Self = Self("ProductName");
524    pub const PRODUCT_VERSION: Self = Self("ProductVersion");
525    pub const MIME_ENCODING: Self = Self("MIMEEncoding");
526
527    // === 扩展标签: 更多 Canon MakerNotes (50个) ===
528    pub const CANON_SERIAL_NUMBER_EXT: Self = Self("SerialNumber");
529    pub const CANON_FIRMWARE_VERSION_EXT: Self = Self("FirmwareVersion");
530    pub const CANON_OWNER_NAME_EXT: Self = Self("OwnerName");
531    pub const CANON_TIME_ZONE_EXT: Self = Self("TimeZone");
532    pub const CANON_DAYLIGHT_SAVING_EXT: Self = Self("DaylightSaving");
533    pub const CANON_AF_MICRO_ADJUSTMENT: Self = Self("AFMicroadjustment");
534    pub const CANON_FLASH_EXPOSURE_COMP_EXT: Self = Self("FlashExposureComp");
535    pub const CANON_BRACKET_MODE_EXT: Self = Self("BracketMode");
536    pub const CANON_BRACKET_VALUE_EXT: Self = Self("BracketValue");
537    pub const CANON_RAW_JPG_QUALITY_EXT: Self = Self("RawJpgQuality");
538    pub const CANON_RAW_JPG_SIZE_EXT: Self = Self("RawJpgSize");
539    pub const CANON_NOISE_REDUCTION_EXT: Self = Self("NoiseReduction");
540    pub const CANON_WB_SHIFT_GM: Self = Self("WBShiftGM");
541    pub const CANON_WB_SHIFT_AB: Self = Self("WBShiftAB");
542    pub const CANON_COLOR_TEMPERATURE_EXT: Self = Self("ColorTemperature");
543    pub const CANON_LENS_SERIAL_NUMBER_EXT: Self = Self("LensSerialNumber");
544    pub const CANON_AF_POINTS_IN_FOCUS_EXT: Self = Self("AFPointsInFocus");
545    pub const CANON_AF_POINTS_SELECTED_EXT: Self = Self("AFPointsSelected");
546    pub const CANON_AF_POINTS_ACTIVE_EXT: Self = Self("AFPointsActive");
547    pub const CANON_FOCUS_DISTANCE_UPPER_EXT: Self = Self("FocusDistanceUpper");
548    pub const CANON_FOCUS_DISTANCE_LOWER_EXT: Self = Self("FocusDistanceLower");
549    pub const CANON_FLASH_BITS_EXT: Self = Self("FlashBits");
550    pub const CANON_FOCUS_CONTINUOUS_EXT: Self = Self("FocusContinuous");
551    pub const CANON_AE_SETTING_EXT: Self = Self("AESetting");
552    pub const CANON_DISPLAY_APERTURE_EXT: Self = Self("DisplayAperture");
553    pub const CANON_ZOOM_SOURCE_WIDTH_EXT: Self = Self("ZoomSourceWidth");
554    pub const CANON_ZOOM_TARGET_WIDTH_EXT: Self = Self("ZoomTargetWidth");
555    pub const CANON_SPOT_METERING_MODE_EXT: Self = Self("SpotMeteringMode");
556    pub const CANON_PHOTO_EFFECT_EXT: Self = Self("PhotoEffect");
557    pub const CANON_MANUAL_FLASH_OUTPUT_EXT: Self = Self("ManualFlashOutput");
558    pub const CANON_SRAW_QUALITY_EXT: Self = Self("SRAWQuality");
559    pub const CANON_GAMMA_EXT: Self = Self("Gamma");
560    pub const CANON_HIGH_SPEED_SYNC: Self = Self("HighSpeedSync");
561    pub const CANON_AF_POINTS_INFO: Self = Self("AFPointsInfo");
562    pub const CANON_MEASURE_ROLL: Self = Self("MeasureRoll");
563    pub const CANON_MEASURE_PITCH: Self = Self("MeasurePitch");
564    pub const CANON_MEASURE_YAW: Self = Self("MeasureYaw");
565    pub const CANON_MEASURE_ACCEL_X: Self = Self("MeasureAccelX");
566    pub const CANON_MEASURE_ACCEL_Y: Self = Self("MeasureAccelY");
567    pub const CANON_MEASURE_ACCEL_Z: Self = Self("MeasureAccelZ");
568    pub const CANON_DATE_STAMP_MODE: Self = Self("DateStampMode");
569    pub const CANON_MY_COLORS_MODE_EXT: Self = Self("MyColorsMode");
570    pub const CANON_FIRMWARE_REVISION: Self = Self("FirmwareRevision");
571    pub const CANON_IMAGE_UNIQUE_ID_EXT: Self = Self("ImageUniqueID");
572    pub const CANON_HDR_SETTING_EXT: Self = Self("HDRSetting");
573    pub const CANON_MULTIPLE_EXPOSURE_EXT: Self = Self("MultipleExposure");
574    pub const CANON_FILTER_EFFECT_EXT: Self = Self("FilterEffect");
575    pub const CANON_TONING_EFFECT_EXT: Self = Self("ToningEffect");
576
577    // === 扩展标签: 更多 Nikon MakerNotes (50个) ===
578    pub const NIKON_WHITE_BALANCE_FINE_TUNE_EXT: Self = Self("WhiteBalanceFineTune");
579    pub const NIKON_COLOR_SPACE_EXT: Self = Self("ColorSpace");
580    pub const NIKON_VIGNETTE_CONTROL_EXT: Self = Self("VignetteControl");
581    pub const NIKON_AUTO_DISTORTION_CONTROL_EXT: Self = Self("AutoDistortionControl");
582    pub const NIKON_PICTURE_CONTROL_EXT: Self = Self("PictureControl");
583    pub const NIKON_HIGH_ISO_NR_EXT: Self = Self("HighISONoiseReduction");
584    pub const NIKON_LONG_EXPOSURE_NR_EXT: Self = Self("LongExposureNoiseReduction");
585    pub const NIKON_ACTIVE_D_LIGHTING_EXT: Self = Self("ActiveDLighting");
586    pub const NIKON_MULTIPLE_EXPOSURE_MODE_EXT: Self = Self("MultipleExposureMode");
587    pub const NIKON_MULTI_EXPOSURE_SHOTS_EXT: Self = Self("MultiExposureShots");
588    pub const NIKON_HDR_EXT: Self = Self("HDR");
589    pub const NIKON_VR_MODE_EXT: Self = Self("VRMode");
590    pub const NIKON_VR_INFO_EXT: Self = Self("VRInfo");
591    pub const NIKON_FIRMWARE_VERSION_EXT: Self = Self("NikonFirmwareVersion");
592    pub const NIKON_AF_POINTS_USED_EXT: Self = Self("AFPointsUsed");
593    pub const NIKON_AF_POINTS_IN_FOCUS_EXT: Self = Self("AFPointsInFocus");
594    pub const NIKON_AF_POINTS_SELECTED_EXT: Self = Self("AFPointsSelected");
595    pub const NIKON_SCENE_MODE_EXT: Self = Self("SceneMode");
596    pub const NIKON_LIGHTING_TYPE_EXT: Self = Self("LightingType");
597    pub const NIKON_SHUTTER_COUNT_EXT: Self = Self("ShutterCount");
598    pub const NIKON_ELECTRONIC_SHUTTER_COUNT_EXT: Self = Self("ElectronicShutterCount");
599    pub const NIKON_NEF_BIT_DEPTH_EXT: Self = Self("NEFBitDepth");
600    pub const NIKON_OPTIMIZATION_EXT: Self = Self("Optimization");
601    pub const NIKON_SATURATION_EXT: Self = Self("NikonSaturation");
602    pub const NIKON_AF_AREA_X_POSITION_EXT: Self = Self("AFAreaXPosition");
603    pub const NIKON_AF_AREA_Y_POSITION_EXT: Self = Self("AFAreaYPosition");
604    pub const NIKON_PHASE_DETECT_AF_EXT: Self = Self("PhaseDetectAF");
605    pub const NIKON_PRIMARY_AF_POINT_EXT: Self = Self("PrimaryAFPoint");
606    pub const NIKON_CONTRAST_DETECT_AF_EXT: Self = Self("ContrastDetectAF");
607    pub const NIKON_AF_AREA_POINTS_EXT: Self = Self("AFAreaPoints");
608    pub const NIKON_SERIAL_NUMBER_2_EXT: Self = Self("NikonSerialNumber2");
609    pub const NIKON_SHUTTER_COUNT_2_EXT: Self = Self("NikonShutterCount2");
610    pub const NIKON_FLASH_MODE_2_EXT: Self = Self("NikonFlashMode2");
611    pub const NIKON_FLASH_CONTROL_MODE_EXT: Self = Self("FlashControlMode");
612    pub const NIKON_FLASH_EXPOSURE_COMP_2_EXT: Self = Self("NikonFlashExposureComp2");
613    pub const NIKON_FLASH_EXPOSURE_BRACKET_VALUE_EXT: Self = Self("FlashExposureBracketValue");
614    pub const NIKON_EXTERNAL_FLASH_BOUNCE_EXT: Self = Self("ExternalFlashBounce");
615    pub const NIKON_EXTERNAL_FLASH_ZOOM_EXT: Self = Self("ExternalFlashZoom");
616    pub const NIKON_EXTERNAL_FLASH_MODE_EXT: Self = Self("ExternalFlashMode");
617    pub const NIKON_EXTERNAL_FLASH_COMPENSATION_EXT: Self = Self("ExternalFlashCompensation");
618    pub const NIKON_COMMANDER_CHANNEL_EXT: Self = Self("CommanderChannel");
619    pub const NIKON_COMMANDER_GROUP_A_MODE_EXT: Self = Self("CommanderGroupAMode");
620    pub const NIKON_COMMANDER_GROUP_A_COMPENSATION_EXT: Self = Self("CommanderGroupACompensation");
621
622    // === 扩展标签: 更多 Sony MakerNotes (30个) ===
623    pub const SONY_LENS_SPEC_EXT: Self = Self("SonyLensSpec");
624    pub const SONY_COLOR_TEMPERATURE_EXT: Self = Self("SonyColorTemperature");
625    pub const SONY_COLOR_COMPENSATION_FILTER_EXT: Self = Self("SonyColorCompensationFilter");
626    pub const SONY_WHITE_BALANCE_FINE_TUNE_EXT: Self = Self("SonyWhiteBalanceFineTune");
627    pub const SONY_IMAGE_STABILIZATION_STATE_EXT: Self = Self("SonyImageStabilizationState");
628    pub const SONY_DYNAMIC_RANGE_OPTIMIZER_EXT: Self = Self("DynamicRangeOptimizer");
629    pub const SONY_INTELLIGENT_AUTO_EXT: Self = Self("IntelligentAuto");
630    pub const SONY_FLASH_LEVEL_EXT: Self = Self("FlashLevel");
631    pub const SONY_RELEASE_MODE_EXT: Self = Self("ReleaseMode");
632    pub const SONY_SEQUENCE_NUMBER_EXT: Self = Self("SequenceNumber");
633    pub const SONY_FOCUS_STATUS_EXT: Self = Self("FocusStatus");
634    pub const SONY_AF_AIDED_EXT: Self = Self("AFAided");
635    pub const SONY_AF_AREA_MODE_EXT: Self = Self("AFAreaMode");
636    pub const SONY_AF_POINT_SELECTED_EXT: Self = Self("AFPointSelected");
637    pub const SONY_AF_STATUS_EXT: Self = Self("AFStatus");
638    pub const SONY_LENS_MOUNT_EXT: Self = Self("SonyLensMount");
639    pub const SONY_LENS_FORMAT_EXT: Self = Self("SonyLensFormat");
640    pub const SONY_DISTORTION_CORRECTION_EXT: Self = Self("DistortionCorrection");
641    pub const SONY_CHROMATIC_ABERRATION_CORRECTION_EXT: Self =
642        Self("ChromaticAberrationCorrection");
643    pub const SONY_VIGNETTING_CORRECTION_EXT: Self = Self("VignettingCorrection");
644    pub const SONY_SHADING_COMPENSATION_EXT: Self = Self("ShadingCompensation");
645    pub const SONY_HDR_SETTING_EXT: Self = Self("SonyHDRSetting");
646    pub const SONY_HDR_ALIGNMENT_EXT: Self = Self("HDRAlignment");
647    pub const SONY_PANORAMA_DIRECTION_EXT: Self = Self("PanoramaDirection");
648    pub const SONY_PANORAMA_ANGLE_EXT: Self = Self("PanoramaAngle");
649    pub const SONY_MULTI_FRAME_NR_EXT: Self = Self("MultiFrameNoiseReduction");
650    pub const SONY_PICTURE_EFFECT_EXT: Self = Self("PictureEffect");
651    pub const SONY_SOFT_SKIN_EFFECT_EXT: Self = Self("SoftSkinEffect");
652    pub const SONY_AUTO_PORTRAIT_FRAMED_EXT: Self = Self("AutoPortraitFramed");
653    pub const SONY_AF_ILLUMINATOR_EXT: Self = Self("AFIlluminator");
654
655    // === 扩展标签: 视频元数据 (30个) ===
656    pub const VIDEO_TRACK_CREATE_DATE_EXT: Self = Self("TrackCreateDate");
657    pub const VIDEO_TRACK_MODIFY_DATE_EXT: Self = Self("TrackModifyDate");
658    pub const VIDEO_MEDIA_CREATE_DATE_EXT: Self = Self("MediaCreateDate");
659    pub const VIDEO_MEDIA_MODIFY_DATE_EXT: Self = Self("MediaModifyDate");
660    pub const VIDEO_HANDLER_TYPE_EXT: Self = Self("HandlerType");
661    pub const VIDEO_HANDLER_DESCRIPTION_EXT: Self = Self("HandlerDescription");
662    pub const VIDEO_COMPRESSOR_ID_EXT: Self = Self("CompressorID");
663    pub const VIDEO_BITS_PER_COMPONENT_EXT: Self = Self("BitsPerComponent");
664    pub const VIDEO_COLOR_PROFILE_EXT: Self = Self("VideoColorProfile");
665    pub const VIDEO_AUDIO_FORMAT_EXT: Self = Self("AudioFormat");
666    pub const VIDEO_AUDIO_CHANNELS_EXT: Self = Self("AudioChannels");
667    pub const VIDEO_AUDIO_BITS_PER_SAMPLE_EXT: Self = Self("AudioBitsPerSample");
668    pub const VIDEO_AUDIO_SAMPLE_RATE_EXT: Self = Self("AudioSampleRate");
669    pub const VIDEO_DURATION_EXT: Self = Self("Duration");
670    pub const VIDEO_MOVIE_HEADER_VERSION_EXT: Self = Self("MovieHeaderVersion");
671    pub const VIDEO_TIME_SCALE_EXT: Self = Self("TimeScale");
672    pub const VIDEO_PREFERRED_RATE_EXT: Self = Self("PreferredRate");
673    pub const VIDEO_PREFERRED_VOLUME_EXT: Self = Self("PreferredVolume");
674    pub const VIDEO_PREVIEW_TIME_EXT: Self = Self("PreviewTime");
675    pub const VIDEO_PREVIEW_DURATION_EXT: Self = Self("PreviewDuration");
676    pub const VIDEO_POSTER_TIME_EXT: Self = Self("PosterTime");
677    pub const VIDEO_SELECTION_TIME_EXT: Self = Self("SelectionTime");
678    pub const VIDEO_SELECTION_DURATION_EXT: Self = Self("SelectionDuration");
679    pub const VIDEO_CURRENT_TIME_EXT: Self = Self("CurrentTime");
680    pub const VIDEO_NEXT_TRACK_ID_EXT: Self = Self("NextTrackID");
681    pub const VIDEO_TRACK_ID_EXT: Self = Self("VideoTrackID");
682    pub const VIDEO_TRACK_LAYER_EXT: Self = Self("VideoTrackLayer");
683    pub const VIDEO_TRACK_VOLUME_EXT: Self = Self("VideoTrackVolume");
684    pub const VIDEO_TRACK_DURATION_EXT: Self = Self("VideoTrackDuration");
685    pub const VIDEO_WIDTH_EXT: Self = Self("VideoWidth");
686
687    // === 扩展标签: RAW/DNG (20个) ===
688    pub const DNG_VERSION_EXT: Self = Self("DNGVersion");
689    pub const DNG_BACKWARD_VERSION_EXT: Self = Self("DNGBackwardVersion");
690    pub const UNIQUE_CAMERA_MODEL_EXT: Self = Self("UniqueCameraModel");
691    pub const LOCALIZED_CAMERA_MODEL_EXT: Self = Self("LocalizedCameraModel");
692    pub const CFA_PLANE_COLOR_EXT: Self = Self("CFAPlaneColor");
693    pub const CFA_LAYOUT_EXT: Self = Self("CFALayout");
694    pub const LINEARIZATION_TABLE_EXT: Self = Self("LinearizationTable");
695    pub const BLACK_LEVEL_EXT: Self = Self("BlackLevel");
696    pub const WHITE_LEVEL_EXT: Self = Self("WhiteLevel");
697    pub const DEFAULT_SCALE_EXT: Self = Self("DefaultScale");
698    pub const BEST_QUALITY_SCALE_EXT: Self = Self("BestQualityScale");
699    pub const DEFAULT_CROP_ORIGIN_EXT: Self = Self("DefaultCropOrigin");
700    pub const DEFAULT_CROP_SIZE_EXT: Self = Self("DefaultCropSize");
701    pub const CALIBRATION_ILLUMINANT_1_EXT: Self = Self("CalibrationIlluminant1");
702    pub const CALIBRATION_ILLUMINANT_2_EXT: Self = Self("CalibrationIlluminant2");
703    pub const COLOR_MATRIX_1_EXT: Self = Self("ColorMatrix1");
704    pub const COLOR_MATRIX_2_EXT: Self = Self("ColorMatrix2");
705    pub const CAMERA_CALIBRATION_1_EXT: Self = Self("CameraCalibration1");
706    pub const CAMERA_CALIBRATION_2_EXT: Self = Self("CameraCalibration2");
707    pub const ANALOG_BALANCE_EXT: Self = Self("AnalogBalance");
708
709    // === Other Tags (16609 tags) - feature = "other" ===
710    // Note: Full other.rs integration in progress
711    // All 16609 other tags available in src/tags/other.rs
712}
713
714impl fmt::Display for TagId {
715    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
716        write!(f, "{}", self.0)
717    }
718}
719
720impl From<&'static str> for TagId {
721    fn from(name: &'static str) -> Self {
722        Self(name)
723    }
724}
725
726impl AsRef<str> for TagId {
727    fn as_ref(&self) -> &str {
728        self.0
729    }
730}
731
732/// 标签值类型 - 支持 ExifTool 返回的所有数据类型
733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
734#[serde(untagged)]
735pub enum TagValue {
736    /// 字符串值
737    String(String),
738
739    /// 整数值
740    Integer(i64),
741
742    /// 浮点数值
743    Float(f64),
744
745    /// 布尔值
746    Boolean(bool),
747
748    /// 数组值
749    Array(Vec<TagValue>),
750
751    /// 二进制数据(Base64 编码)
752    Binary(String),
753
754    /// 空值
755    Null,
756}
757
758impl TagValue {
759    /// 尝试获取字符串值
760    pub fn as_string(&self) -> Option<&String> {
761        match self {
762            Self::String(s) => Some(s),
763            _ => None,
764        }
765    }
766
767    /// 尝试获取整数值
768    pub fn as_integer(&self) -> Option<i64> {
769        match self {
770            Self::Integer(i) => Some(*i),
771            Self::Float(f) => Some(*f as i64),
772            Self::String(s) => s.parse().ok(),
773            _ => None,
774        }
775    }
776
777    /// 尝试获取浮点数值
778    pub fn as_float(&self) -> Option<f64> {
779        match self {
780            Self::Float(f) => Some(*f),
781            Self::Integer(i) => Some(*i as f64),
782            Self::String(s) => s.parse().ok(),
783            _ => None,
784        }
785    }
786
787    /// 尝试获取布尔值
788    pub fn as_bool(&self) -> Option<bool> {
789        match self {
790            Self::Boolean(b) => Some(*b),
791            Self::Integer(0) => Some(false),
792            Self::Integer(_) => Some(true),
793            Self::String(s) => match s.to_lowercase().as_str() {
794                "true" | "yes" | "1" | "on" => Some(true),
795                "false" | "no" | "0" | "off" => Some(false),
796                _ => None,
797            },
798            _ => None,
799        }
800    }
801
802    /// 尝试获取数组
803    pub fn as_array(&self) -> Option<&Vec<TagValue>> {
804        match self {
805            Self::Array(arr) => Some(arr),
806            _ => None,
807        }
808    }
809
810    /// 转换为字符串表示
811    pub fn to_string_lossy(&self) -> String {
812        match self {
813            Self::String(s) => s.clone(),
814            Self::Integer(i) => i.to_string(),
815            Self::Float(f) => f.to_string(),
816            Self::Boolean(b) => b.to_string(),
817            Self::Array(arr) => {
818                let items: Vec<String> = arr.iter().map(|v| v.to_string_lossy()).collect();
819                format!("[{}]", items.join(", "))
820            }
821            Self::Binary(b) => format!("[binary: {} bytes]", b.len()),
822            Self::Null => "null".to_string(),
823        }
824    }
825
826    /// 检查是否为空
827    pub fn is_null(&self) -> bool {
828        matches!(self, Self::Null)
829    }
830}
831
832impl fmt::Display for TagValue {
833    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
834        write!(f, "{}", self.to_string_lossy())
835    }
836}
837
838/// 元数据结构
839#[derive(Debug, Clone, Default, Serialize, Deserialize)]
840pub struct Metadata {
841    /// 顶层标签
842    #[serde(flatten)]
843    tags: HashMap<String, TagValue>,
844
845    /// 分组标签(如 EXIF、IPTC、XMP 等)
846    #[serde(skip)]
847    groups: HashMap<String, Metadata>,
848}
849
850impl Metadata {
851    /// 创建空的元数据
852    pub fn new() -> Self {
853        Self::default()
854    }
855
856    /// 获取标签值
857    pub fn get(&self, tag: &str) -> Option<&TagValue> {
858        self.tags.get(tag)
859    }
860
861    /// 获取标签值(使用 TagId)
862    pub fn get_tag(&self, tag: TagId) -> Option<&TagValue> {
863        self.get(tag.name())
864    }
865
866    /// 设置标签值
867    pub fn set(&mut self, tag: impl Into<String>, value: impl Into<TagValue>) {
868        self.tags.insert(tag.into(), value.into());
869    }
870
871    /// 设置标签值(使用 TagId)
872    pub fn set_tag(&mut self, tag: TagId, value: impl Into<TagValue>) {
873        self.set(tag.name(), value);
874    }
875
876    /// 获取所有标签
877    pub fn tags(&self) -> &HashMap<String, TagValue> {
878        &self.tags
879    }
880
881    /// 获取所有标签(可变)
882    pub fn tags_mut(&mut self) -> &mut HashMap<String, TagValue> {
883        &mut self.tags
884    }
885
886    /// 获取分组
887    pub fn group(&self, name: &str) -> Option<&Metadata> {
888        self.groups.get(name)
889    }
890
891    /// 设置分组
892    pub fn set_group(&mut self, name: impl Into<String>, metadata: Metadata) {
893        self.groups.insert(name.into(), metadata);
894    }
895
896    /// 获取所有分组
897    pub fn groups(&self) -> &HashMap<String, Metadata> {
898        &self.groups
899    }
900
901    /// 检查是否包含标签
902    pub fn contains(&self, tag: &str) -> bool {
903        self.tags.contains_key(tag)
904    }
905
906    /// 检查是否包含标签(使用 TagId)
907    pub fn contains_tag(&self, tag: TagId) -> bool {
908        self.contains(tag.name())
909    }
910
911    /// 获取标签数量
912    pub fn len(&self) -> usize {
913        self.tags.len()
914    }
915
916    /// 检查是否为空
917    pub fn is_empty(&self) -> bool {
918        self.tags.is_empty()
919    }
920
921    /// 合并另一个元数据
922    pub fn merge(&mut self, other: Metadata) {
923        self.tags.extend(other.tags);
924        self.groups.extend(other.groups);
925    }
926
927    /// 遍历所有标签
928    pub fn iter(&self) -> impl Iterator<Item = (&String, &TagValue)> {
929        self.tags.iter()
930    }
931}
932
933impl IntoIterator for Metadata {
934    type Item = (String, TagValue);
935    type IntoIter = std::collections::hash_map::IntoIter<String, TagValue>;
936
937    fn into_iter(self) -> Self::IntoIter {
938        self.tags.into_iter()
939    }
940}
941
942impl<'a> IntoIterator for &'a Metadata {
943    type Item = (&'a String, &'a TagValue);
944    type IntoIter = std::collections::hash_map::Iter<'a, String, TagValue>;
945
946    fn into_iter(self) -> Self::IntoIter {
947        self.tags.iter()
948    }
949}
950
951// 类型转换实现
952impl From<String> for TagValue {
953    fn from(s: String) -> Self {
954        Self::String(s)
955    }
956}
957
958impl From<&str> for TagValue {
959    fn from(s: &str) -> Self {
960        Self::String(s.to_string())
961    }
962}
963
964impl From<i64> for TagValue {
965    fn from(i: i64) -> Self {
966        Self::Integer(i)
967    }
968}
969
970impl From<i32> for TagValue {
971    fn from(i: i32) -> Self {
972        Self::Integer(i as i64)
973    }
974}
975
976impl From<f64> for TagValue {
977    fn from(f: f64) -> Self {
978        Self::Float(f)
979    }
980}
981
982impl From<f32> for TagValue {
983    fn from(f: f32) -> Self {
984        Self::Float(f as f64)
985    }
986}
987
988impl From<bool> for TagValue {
989    fn from(b: bool) -> Self {
990        Self::Boolean(b)
991    }
992}
993
994impl From<Vec<TagValue>> for TagValue {
995    fn from(arr: Vec<TagValue>) -> Self {
996        Self::Array(arr)
997    }
998}
999
1000impl<T: Into<TagValue>> From<Option<T>> for TagValue {
1001    fn from(opt: Option<T>) -> Self {
1002        match opt {
1003            Some(v) => v.into(),
1004            None => Self::Null,
1005        }
1006    }
1007}
1008
1009#[cfg(test)]
1010mod tests {
1011    use super::*;
1012
1013    #[test]
1014    fn test_tag_id() {
1015        assert_eq!(TagId::MAKE.name(), "Make");
1016        assert_eq!(TagId::MODEL.name(), "Model");
1017    }
1018
1019    #[test]
1020    fn test_tag_value_conversions() {
1021        let str_val: TagValue = "test".into();
1022        assert_eq!(str_val.as_string(), Some(&"test".to_string()));
1023
1024        let int_val: TagValue = 42i64.into();
1025        assert_eq!(int_val.as_integer(), Some(42));
1026
1027        let float_val: TagValue = std::f64::consts::PI.into();
1028        assert_eq!(float_val.as_float(), Some(std::f64::consts::PI));
1029
1030        let bool_val: TagValue = true.into();
1031        assert_eq!(bool_val.as_bool(), Some(true));
1032    }
1033
1034    #[test]
1035    fn test_metadata() {
1036        let mut meta = Metadata::new();
1037        meta.set("Make", "Canon");
1038        meta.set("Model", "EOS 5D");
1039
1040        assert_eq!(meta.len(), 2);
1041        assert!(meta.contains("Make"));
1042        assert_eq!(
1043            meta.get("Make"),
1044            Some(&TagValue::String("Canon".to_string()))
1045        );
1046    }
1047
1048    #[test]
1049    fn test_metadata_iteration() {
1050        let mut meta = Metadata::new();
1051        meta.set("A", 1);
1052        meta.set("B", 2);
1053
1054        let mut count = 0;
1055        for (key, _value) in &meta {
1056            count += 1;
1057            assert!(key == "A" || key == "B");
1058        }
1059        assert_eq!(count, 2);
1060    }
1061}