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

Add AVIF support #396

Merged
merged 1 commit into from
Feb 4, 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
3 changes: 3 additions & 0 deletions MetadataExtractor/Formats/QuickTime/QuickTimeTypeChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ internal sealed class QuickTimeTypeChecker : ITypeChecker
{ Util.FileType.Heif, "hevc"u8 },
{ Util.FileType.Heif, "hevx"u8 },

// AVIF
{ Util.FileType.Avif, "avif"u8 },

// CRX
{ Util.FileType.Crx, "crx "u8 }
};
Expand Down
1 change: 1 addition & 0 deletions MetadataExtractor/ImageMetadataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public static IReadOnlyList<Directory> ReadMetadata(Stream stream)
{
FileType.Arw => TiffMetadataReader.ReadMetadata(stream),
FileType.Avi => AviMetadataReader.ReadMetadata(stream),
FileType.Avif => HeifMetadataReader.ReadMetadata(stream),
FileType.Bmp => BmpMetadataReader.ReadMetadata(stream),
FileType.Crx => QuickTimeMetadataReader.ReadMetadata(stream),
FileType.Cr2 => TiffMetadataReader.ReadMetadata(stream),
Expand Down
1 change: 1 addition & 0 deletions MetadataExtractor/PublicAPI/net462/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl2Directory
MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl2Directory.NikonPictureControl2Directory() -> void
MetadataExtractor.IO.IndexedReader.GetByte(int index) -> byte
MetadataExtractor.IO.IndexedReader.GetBytes(int index, int count) -> byte[]!
MetadataExtractor.Util.FileType.Avif = 28 -> MetadataExtractor.Util.FileType
override MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor.GetDescription(int tagType) -> string?
override MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.Name.get -> string!
override MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl1Descriptor.GetDescription(int tagType) -> string?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl2Directory
MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl2Directory.NikonPictureControl2Directory() -> void
MetadataExtractor.IO.IndexedReader.GetByte(int index) -> byte
MetadataExtractor.IO.IndexedReader.GetBytes(int index, int count) -> byte[]!
MetadataExtractor.Util.FileType.Avif = 28 -> MetadataExtractor.Util.FileType
override MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor.GetDescription(int tagType) -> string?
override MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.Name.get -> string!
override MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl1Descriptor.GetDescription(int tagType) -> string?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl2Directory
MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl2Directory.NikonPictureControl2Directory() -> void
MetadataExtractor.IO.IndexedReader.GetByte(int index) -> byte
MetadataExtractor.IO.IndexedReader.GetBytes(int index, int count) -> byte[]!
MetadataExtractor.Util.FileType.Avif = 28 -> MetadataExtractor.Util.FileType
override MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDescriptor.GetDescription(int tagType) -> string?
override MetadataExtractor.Formats.Exif.Makernotes.AppleRunTimeMakernoteDirectory.Name.get -> string!
override MetadataExtractor.Formats.Exif.Makernotes.NikonPictureControl1Descriptor.GetDescription(int tagType) -> string?
Expand Down
13 changes: 10 additions & 3 deletions MetadataExtractor/Util/FileType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public enum FileType
Heif = 26,

/// <summary>MPEG-4 Part 14.</summary>
Mp4 = 27
Mp4 = 27,

/// <summary>AV1 Image File Format.</summary>
Avif = 28
}

public static class FileTypeExtensions
Expand Down Expand Up @@ -122,7 +125,8 @@ public static class FileTypeExtensions
"TGA",
"MP3",
"HEIF",
"MP4"
"MP4",
"AVIF"
];

private static readonly string[] _longNames =
Expand Down Expand Up @@ -155,6 +159,7 @@ public static class FileTypeExtensions
"MPEG Audio Layer III",
"High Efficiency Image File Format",
"MPEG-4 Part 14",
"AV1 Image File Format",
];

private static readonly string?[] _mimeTypes =
Expand Down Expand Up @@ -187,6 +192,7 @@ public static class FileTypeExtensions
"audio/mpeg",
"image/heic",
"video/mp4",
"image/avif"
];

private static readonly string[]?[] _extensions =
Expand Down Expand Up @@ -218,7 +224,8 @@ public static class FileTypeExtensions
["tga", "icb", "vda", "vst"],
["mp3"],
["heic", "heif", "avci"],
["mp4", "m4a", "m4p", "m4b", "m4r", "m4v"]
["mp4", "m4a", "m4p", "m4b", "m4r", "m4v"],
["avif"]
];

public static string GetName(this FileType fileType)
Expand Down
Loading