C# Class TagLib.IFD.IFDReader

This class contains all the IFD reading and parsing code.
Afficher le fichier Open project: MediaPortal/MPTagThat Class Usage Examples

Protected Properties

Свойство Type Description
base_offset long
file System.IO.File
ifd_offset uint
is_bigendian bool
max_offset uint
parse_makernote bool
structure IFDStructure

Private Properties

Свойство Type Description
CreateIFDEntry IFDEntry
DetectIFDLoop bool
FixupDirectory void
ParseMakernote IFDEntry
ReadAsciiString string
ReadIFD uint
ReadInt int
ReadIntArray int[]
ReadRational TagLib.IFD.Entries.Rational
ReadSRational TagLib.IFD.Entries.SRational
ReadShort short
ReadShortArray short[]
ReadUInt uint
ReadUIntArray uint[]
ReadUShort ushort
ReadUShortArray ushort[]
StartIFDLoopDetect void
StopIFDLoopDetect void

Méthodes publiques

Méthode Description
IFDReader ( File file, bool is_bigendian, IFDStructure structure, long base_offset, uint ifd_offset, uint max_offset ) : System

Constructor. Reads an IFD from given file, using the given endianness.

Read ( ) : void

Read all IFD segments from the file.

Read ( int count ) : void

Read IFD segments from the file.

Méthodes protégées

Méthode Description
CreateSubIFDReader ( File file, bool is_bigendian, IFDStructure structure, long base_offset, uint offset, uint max_offset ) : IFDReader

Create a reader for Sub IFD entries.

ParseIFDEntry ( ushort tag, ushort type, uint count, long base_offset, uint offset ) : IFDEntry

Try to parse the given IFD entry, used to discover format-specific entries.

Private Methods

Méthode Description
CreateIFDEntry ( ushort tag, ushort type, uint count, long base_offset, ByteVector offset_data, uint max_offset ) : IFDEntry

Creates an IFDEntry from the given values. This method is used for every entry. Custom parsing can be hooked in by overriding the ParseIFDEntry(ushort,ushort,uint,long,uint) method.

DetectIFDLoop ( long offset ) : bool

Attempts to detect whether or not this file has an endless IFD loop.

FixupDirectory ( long base_offset, IFDDirectory directory ) : void

Performs some fixups to a read IFDDirectory. For some special cases multiple IFDEntry instances contained in the directory are needed. Therfore, we do the fixups after reading the whole directory to be sure, all entries are present.

ParseMakernote ( ushort tag, ushort type, uint count, long base_offset, uint offset ) : IFDEntry
ReadAsciiString ( int count ) : string

Reads an ASCII string from the current file.

The exif standard allows to store multiple string separated by '\0' in one ASCII-field. On the other hand some programs (e.g. CanonZoomBrowser) fill some ASCII fields by trailing '\0's. We follow the Adobe practice as described in XMP Specification Part 3 (Storeage in Files), and process the ASCII string only to the first '\0'.

ReadIFD ( long base_offset, uint offset, uint max_offset ) : uint

Reads an IFD from file at position offset relative to base_offset.

ReadInt ( ) : int

Reads a 4-byte int from the current file.

ReadIntArray ( uint count ) : int[]

Reads an array of 4-byte int from the current file.

ReadRational ( ) : Rational

Reads a Rational by two following unsigned int from the current file.

ReadSRational ( ) : TagLib.IFD.Entries.SRational

Reads a SRational by two following unsigned int from the current file.

ReadShort ( ) : short

Reads a 2-byte signed short from the current file.

ReadShortArray ( uint count ) : short[]

Reads an array of 2-byte signed shorts from the current file.

ReadUInt ( ) : uint

Reads a 4-byte unsigned int from the current file.

ReadUIntArray ( uint count ) : uint[]

Reads an array of 4-byte unsigned int from the current file.

ReadUShort ( ) : ushort

Reads a 2-byte unsigned short from the current file.

ReadUShortArray ( uint count ) : ushort[]

Reads an array of 2-byte shorts from the current file.

StartIFDLoopDetect ( ) : void

Add to the reference count for the IFD loop detection.

StopIFDLoopDetect ( ) : void

End the IFD loop detection, cleanup if we're the last.

Method Details

CreateSubIFDReader() protected méthode

Create a reader for Sub IFD entries.
protected CreateSubIFDReader ( File file, bool is_bigendian, IFDStructure structure, long base_offset, uint offset, uint max_offset ) : IFDReader
file System.IO.File /// A to read from. ///
is_bigendian bool /// A , it must be true, if the data of the IFD should be /// read as bigendian, otherwise false. ///
structure IFDStructure /// A that will be populated. ///
base_offset long /// A with the base offset which every offsets in the /// IFD are relative to. ///
offset uint /// A with the offset of the entry. ///
max_offset uint /// A with the maximal offset to consider for /// the IFD. ///
Résultat IFDReader

IFDReader() public méthode

Constructor. Reads an IFD from given file, using the given endianness.
public IFDReader ( File file, bool is_bigendian, IFDStructure structure, long base_offset, uint ifd_offset, uint max_offset ) : System
file System.IO.File /// A to read from. ///
is_bigendian bool /// A , it must be true, if the data of the IFD should be /// read as bigendian, otherwise false. ///
structure IFDStructure /// A that will be populated. ///
base_offset long /// A value describing the base were the IFD offsets /// refer to. E.g. in Jpegs the IFD are located in an Segment and the offsets /// inside the IFD refer from the beginning of this segment. So must contain the beginning of the segment. ///
ifd_offset uint /// A value with the beginning of the IFD relative to /// . ///
max_offset uint /// A value with maximal possible offset. This is to limit /// the size of the possible data; ///
Résultat System

ParseIFDEntry() protected méthode

Try to parse the given IFD entry, used to discover format-specific entries.
protected ParseIFDEntry ( ushort tag, ushort type, uint count, long base_offset, uint offset ) : IFDEntry
tag ushort /// A with the tag of the entry. ///
type ushort /// A with the type of the entry. ///
count uint /// A with the data count of the entry. ///
base_offset long /// A with the base offset which every offsets in the /// IFD are relative to. ///
offset uint /// A with the offset of the entry. ///
Résultat IFDEntry

Read() public méthode

Read all IFD segments from the file.
public Read ( ) : void
Résultat void

Read() public méthode

Read IFD segments from the file.
public Read ( int count ) : void
count int /// A with the maximal number of IFDs to read. /// Passing -1 means unlimited. ///
Résultat void

Property Details

base_offset protected_oe property

A System.Int64 value describing the base were the IFD offsets refer to. E.g. in Jpegs the IFD are located in an Segment and the offsets inside the IFD refer from the beginning of this segment. So base_offset must contain the beginning of the segment.
protected long base_offset
Résultat long

file protected_oe property

The File where this IFD is found in.
protected File,System.IO file
Résultat System.IO.File

ifd_offset protected_oe property

A System.UInt32 value with the beginning of the IFD relative to base_offset.
protected uint ifd_offset
Résultat uint

is_bigendian protected_oe property

If IFD is encoded in BigEndian or not
protected bool is_bigendian
Résultat bool

max_offset protected_oe property

A System.UInt32 with the maximal offset, which should occur in the IFD. Greater offsets, would reference beyond the considered data.
protected uint max_offset
Résultat uint

parse_makernote protected_oe property

Whether or not the makernote should be parsed.
protected bool parse_makernote
Résultat bool

structure protected_oe property

The IFD structure that will be populated
protected IFDStructure,TagLib.IFD structure
Résultat IFDStructure