Class IsoMediaDetector
- Namespace
- HeroKit.FileTypes
- Assembly
- HeroKit.FileTypes.dll
Detects ISO base media files (MP4, MOV, M4A, 3GP, HEIC, AVIF) by the brands in the "ftyp" box.
public sealed class IsoMediaDetector : IFileTypeDetector
- Inheritance
-
IsoMediaDetector
- Implements
- Inherited Members
- Extension Methods
Examples
new IsoMediaDetector("M4A ", "M4B "); // major brand only
new IsoMediaDetector("avif", "avis") { IncludeCompatibleBrands = true }; // also compatible brands
Constructors
IsoMediaDetector(params string[])
Creates a detector for the given four-character brands, for example "isom" or "qt ".
public IsoMediaDetector(params string[] brands)
Parameters
brandsstring[]The brands, each exactly four ASCII characters.
Exceptions
- ArgumentException
A brand is not four characters long, or no brand is given.
Properties
IncludeCompatibleBrands
Gets whether the compatible brands also count. When false, only the major brand is checked.
public bool IncludeCompatibleBrands { get; init; }
Property Value
Methods
IsMatch(ReadOnlySpan<byte>)
Checks whether the first bytes of a file belong to the file type.
public bool IsMatch(ReadOnlySpan<byte> header)
Parameters
headerReadOnlySpan<byte>The first bytes of the file; HeaderSize bytes when read from a stream. It can be shorter than the file. For a ZIP file read from a seekable stream, the ZIP central directory follows the first bytes.
Returns
- bool
True if the bytes match.