Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

TagLib::Mpeg::VideoHeader::VideoHeader ( TagLib.File  file,
long  position 
) [inline]

Constructs and initializes a new instance of VideoHeader by reading it from a specified location in a specified file.

Parameters:
fileA TagLib.File object to read from.
positionA long value indicating the position in file at which the header begins.
Exceptions:
ArgumentNullExceptionfile is .
CorruptFileExceptionInsufficient data could be read for the header.

Definition at line 94 of file VideoHeader.cs.

References TagLib::ByteVector::Count, TagLib::ByteVector::Mid(), TagLib::ByteVector::ToUInt(), and TagLib::ByteVector::ToUShort().

            {
                  if (file == null)
                        throw new ArgumentNullException ("file");
                  
                  file.Seek (position);
                  ByteVector data = file.ReadBlock (7);
                  
                  if (data.Count < 7)
                        throw new CorruptFileException (
                              "Insufficient data in header.");
                  
                  width = data.Mid (0, 2).ToUShort () >> 4;
                  height = data.Mid (1, 2).ToUShort () & 0x0FFF;
                  frame_rate_index = data [3] & 0x0F;
                  bitrate = (int) ((data.Mid (4, 3).ToUInt () >> 6) &
                        0x3FFFF);
            }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index