Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend Apple makernote support #401

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,26 @@ public class AppleMakernoteDescriptor(AppleMakernoteDirectory directory)
{
return tagType switch
{
TagAEStable => GetAEStableDescription(),
TagAFStable => GetAEStableDescription(),
TagHdrImageType => GetHdrImageTypeDescription(),
TagAccelerationVector => GetAccelerationVectorDescription(),
TagImageCaptureType => GetImageCaptureTypeDescription(),
TagFrontFacingCamera => GetFrontFacingCameraDescription(),
_ => base.GetDescription(tagType)
};
}

public string? GetAEStableDescription()
{
return GetBooleanDescription(TagAEStable, "Yes", "No");
}

public string? GetAFStableDescription()
{
return GetBooleanDescription(TagAFStable, "Yes", "No");
}

public string? GetHdrImageTypeDescription()
{
return GetIndexedDescription(TagHdrImageType, 3, "HDR Image", "Original Image");
Expand All @@ -36,5 +50,26 @@ public class AppleMakernoteDescriptor(AppleMakernoteDirectory directory)
$"{values[1].Absolute.ToDouble():N2}g {(values[1].IsPositive ? "down" : "up")}, " +
$"{values[2].Absolute.ToDouble():N2}g {(values[2].IsPositive ? "forward" : "backward")}";
}

public string? GetImageCaptureTypeDescription()
{
if (Directory.TryGetInt32(TagImageCaptureType, out int value))
{
return value switch
{
1 => "ProRAW",
2 => "Portrait",
10 => "Photo",
_ => base.GetDescription(TagImageCaptureType)
};
}

return base.GetDescription(TagImageCaptureType);
}

public string? GetFrontFacingCameraDescription()
{
return GetBooleanDescription(TagFrontFacingCamera, "Yes", "No");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,95 @@
namespace MetadataExtractor.Formats.Exif.Makernotes
{
/// <summary>Describes tags specific to Apple cameras.</summary>
/// <remarks>Using information from http://owl.phy.queensu.ca/~phil/exiftool/TagNames/Apple.html</remarks>
/// <remarks>Using information from https://exiftool.org/TagNames/Apple.html</remarks>
/// <author>Drew Noakes https://drewnoakes.com</author>
public class AppleMakernoteDirectory : Directory
{
#pragma warning disable format
public const int TagRunTime = 0x0003;
public const int TagMakernoteVersion = 0x0001;
public const int TagAEMatrix = 0x0002;
public const int TagRunTime = 0x0003;
public const int TagAEStable = 0x0004;
public const int TagAETarget = 0x0005;
public const int TagAEAverage = 0x0006;
public const int TagAFStable = 0x0007;
/// <summary>
/// XYZ coordinates of the acceleration vector in units of g.
/// As viewed from the front of the phone,
/// positive X is toward the left side,
/// positive Y is toward the bottom,
/// positive Z points into the face of the phone
/// </summary>
public const int TagAccelerationVector = 0x0008;
public const int TagHdrImageType = 0x000a;
public const int TagAccelerationVector = 0x0008;
public const int TagHdrImageType = 0x000a;
/// <summary>
/// Unique ID for all images in a burst.
/// </summary>
public const int TagBurstUuid = 0x000b;
public const int TagContentIdentifier = 0x0011;
public const int TagImageUniqueId = 0x0015;
public const int TagLivePhotoId = 0x0017;
public const int TagBurstUuid = 0x000b;
public const int TagFocusDistanceRange = 0x000c;
public const int TagOisMode = 0x000f;
public const int TagContentIdentifier = 0x0011;
public const int TagImageCaptureType = 0x0014;
public const int TagImageUniqueId = 0x0015;
public const int TagLivePhotoId = 0x0017;
public const int TagImageProcessingFlags = 0x0019;
public const int TagQualityHint = 0x001a;
public const int TagLuminanceNoiseAmplitude = 0x001d;
public const int TagImageCaptureRequestID = 0x0020;
public const int TagHdrHeadroom = 0x0021;
public const int TagSceneFlags = 0x0025;
public const int TagSignalToNoiseRatioType = 0x0026;
public const int TagSignalToNoiseRatio = 0x0027;
public const int TagPhotoIdentifier = 0x002b;
public const int TagFocusPosition = 0x002f;
public const int TagHdrGain = 0x0030;
public const int TagAFMeasuredDepth = 0x0038;
public const int TagAFConfidence = 0x003d;
public const int TagColorCorrectionMatrix = 0x003e;
public const int TagGreenGhostMitigationStatus = 0x003f;
public const int TagSemanticStyle = 0x0040;
public const int TagSemanticStyleRenderingVer = 0x0041;
public const int TagSemanticStylePreset = 0x0042;
public const int TagFrontFacingCamera = 0x0045;
#pragma warning restore format

private static readonly Dictionary<int, string> _tagNameMap = new()
{
{ TagMakernoteVersion, "Makernote Version" },
{ TagAEMatrix, "AE Matrix" },
{ TagRunTime, "Run Time" },
{ TagAEStable, "AE Stable" },
{ TagAETarget, "AE Target" },
{ TagAEAverage, "AE Average" },
{ TagAFStable, "AF Stable" },
{ TagAccelerationVector, "Acceleration Vector" },
{ TagHdrImageType, "HDR Image Type" },
{ TagBurstUuid, "Burst UUID" },
{ TagFocusDistanceRange, "Focus Distance Range" },
{ TagOisMode, "OIS Mode" },
{ TagContentIdentifier, "Content Identifier" },
{ TagImageCaptureType, "Image Capture Type" },
{ TagImageUniqueId, "Image Unique ID" },
{ TagLivePhotoId, "Live Photo ID" }
{ TagLivePhotoId, "Live Photo ID" },
{ TagImageProcessingFlags, "Image Processing Flags" },
{ TagQualityHint, "Quality Hint" },
{ TagLuminanceNoiseAmplitude, "Luminance Noise Amplitude" },
{ TagImageCaptureRequestID, "Image Capture Request ID" },
{ TagHdrHeadroom, "HDR Headroom" },
{ TagSceneFlags, "Scene Flags" },
{ TagSignalToNoiseRatioType, "Signal-to-Noise Ratio Type" },
{ TagSignalToNoiseRatio, "Signal-to-Noise Ratio" },
{ TagPhotoIdentifier, "Photo Identifier" },
{ TagFocusPosition, "Focus Position" },
{ TagHdrGain, "HDR Gain" },
{ TagAFMeasuredDepth, "AF Measured Depth" },
{ TagAFConfidence, "AF Confidence" },
{ TagColorCorrectionMatrix, "Color Correction Matrix" },
{ TagGreenGhostMitigationStatus, "Green Ghost Mitigation Status" },
{ TagSemanticStyle, "Semantic Style" },
{ TagSemanticStyleRenderingVer, "Semantic Style Rendering Ver" },
{ TagSemanticStylePreset, "Semantic Style Preset" },
{ TagFrontFacingCamera, "Front Facing Camera" }
};

public AppleMakernoteDirectory() : base(_tagNameMap)
Expand Down
32 changes: 32 additions & 0 deletions MetadataExtractor/PublicAPI/net462/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
#nullable enable
abstract MetadataExtractor.IO.IndexedReader.GetBytes(int index, System.Span<byte> bytes) -> void
abstract MetadataExtractor.IO.SequentialReader.GetBytes(System.Span<byte> bytes) -> void
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAEAverage = 6 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAEMatrix = 2 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAEStable = 4 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAETarget = 5 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAFConfidence = 61 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAFMeasuredDepth = 56 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAFStable = 7 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagColorCorrectionMatrix = 62 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagFocusDistanceRange = 12 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagFocusPosition = 47 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagFrontFacingCamera = 69 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagGreenGhostMitigationStatus = 63 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagHdrGain = 48 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagHdrHeadroom = 33 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagImageCaptureRequestID = 32 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagImageCaptureType = 20 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagImageProcessingFlags = 25 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagLuminanceNoiseAmplitude = 29 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagMakernoteVersion = 1 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagOisMode = 15 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagPhotoIdentifier = 43 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagQualityHint = 26 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSceneFlags = 37 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSemanticStyle = 64 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSemanticStylePreset = 66 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSemanticStyleRenderingVer = 65 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSignalToNoiseRatio = 39 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSignalToNoiseRatioType = 38 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.TagEpoch = 2 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.TagFlags = 1 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.TagScale = 3 -> int
Expand Down Expand Up @@ -46,6 +74,10 @@ MetadataExtractor.Formats.Apple.BplistReader.BplistReader() -> void
MetadataExtractor.Formats.Apple.BplistReader.PropertyListResults
MetadataExtractor.Formats.Apple.BplistReader.PropertyListResults.Get(byte key) -> object!
MetadataExtractor.Formats.Apple.BplistReader.PropertyListResults.GetTopObject() -> System.Collections.Generic.Dictionary<byte, byte>?
MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDescriptor.GetAEStableDescription() -> string?
MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDescriptor.GetAFStableDescription() -> string?
MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDescriptor.GetFrontFacingCameraDescription() -> string?
MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDescriptor.GetImageCaptureTypeDescription() -> string?
MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor
MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor.AppleRunTimeMakernoteDescriptor(MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory! directory) -> void
MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor.GetFlagsDescription() -> string?
Expand Down
32 changes: 32 additions & 0 deletions MetadataExtractor/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
#nullable enable
abstract MetadataExtractor.IO.IndexedReader.GetBytes(int index, System.Span<byte> bytes) -> void
abstract MetadataExtractor.IO.SequentialReader.GetBytes(System.Span<byte> bytes) -> void
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAEAverage = 6 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAEMatrix = 2 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAEStable = 4 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAETarget = 5 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAFConfidence = 61 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAFMeasuredDepth = 56 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagAFStable = 7 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagColorCorrectionMatrix = 62 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagFocusDistanceRange = 12 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagFocusPosition = 47 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagFrontFacingCamera = 69 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagGreenGhostMitigationStatus = 63 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagHdrGain = 48 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagHdrHeadroom = 33 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagImageCaptureRequestID = 32 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagImageCaptureType = 20 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagImageProcessingFlags = 25 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagLuminanceNoiseAmplitude = 29 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagMakernoteVersion = 1 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagOisMode = 15 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagPhotoIdentifier = 43 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagQualityHint = 26 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSceneFlags = 37 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSemanticStyle = 64 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSemanticStylePreset = 66 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSemanticStyleRenderingVer = 65 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSignalToNoiseRatio = 39 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDirectory.TagSignalToNoiseRatioType = 38 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.TagEpoch = 2 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.TagFlags = 1 -> int
const MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.TagScale = 3 -> int
Expand Down Expand Up @@ -46,6 +74,10 @@ MetadataExtractor.Formats.Apple.BplistReader.BplistReader() -> void
MetadataExtractor.Formats.Apple.BplistReader.PropertyListResults
MetadataExtractor.Formats.Apple.BplistReader.PropertyListResults.Get(byte key) -> object!
MetadataExtractor.Formats.Apple.BplistReader.PropertyListResults.GetTopObject() -> System.Collections.Generic.Dictionary<byte, byte>?
MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDescriptor.GetAEStableDescription() -> string?
MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDescriptor.GetAFStableDescription() -> string?
MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDescriptor.GetFrontFacingCameraDescription() -> string?
MetadataExtractor.Formats.Exif.Makernotes.AppleMakernoteDescriptor.GetImageCaptureTypeDescription() -> string?
MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor
MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor.AppleRunTimeMakernoteDescriptor(MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory! directory) -> void
MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor.GetFlagsDescription() -> string?
Expand Down
Loading
Loading