Skip to content

Commit

Permalink
Merge pull request #396 from drewnoakes/avif-support
Browse files Browse the repository at this point in the history
Add AVIF support
  • Loading branch information
drewnoakes authored Feb 4, 2024
2 parents a95e8f3 + 3c8ab9b commit 55808d1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
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

0 comments on commit 55808d1

Please sign in to comment.