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

double TagLib::Mpeg::File::ReadTimestamp ( long  position ) [inline, private]

Reads an MPEG timestamp from a specified position in the file represented by the current instance.

Parameters:
positionA long value containing the position in the file at which to read. This should be immediately following a system sync packet marker.
Returns:
A double value containing the read time in seconds.

Definition at line 663 of file File.cs.

References TagLib::File::ReadBlock(), and TagLib::File::Seek().

            {
                  double high;
                  uint low;
                  
                  Seek (position);
                  
                  if (version == Version.Version1) {
                        ByteVector data = ReadBlock (5);
                        high = (double) ((data [0] >> 3) & 0x01);
                        
                        low =  ((uint)((data [0] >> 1) & 0x03) << 30) |
                              (uint) (data [1] << 22) |
                              (uint)((data [2] >> 1) << 15) |
                              (uint) (data [3] << 7) |
                              (uint) (data [4] << 1);
                  } else {
                        ByteVector data = ReadBlock (6);
                        high = (double) ((data [0] & 0x20) >> 5);
                        
                        low =  ((uint) ((data [0] & 0x18) >> 3) << 30) |
                              (uint) ((data [0] & 0x03) << 28) |
                              (uint)  (data [1] << 20) |
                              (uint) ((data [2] & 0xF8) << 12) |
                              (uint) ((data [2] & 0x03) << 13) |
                              (uint)  (data [3] << 5) |
                              (uint)  (data [4] >> 3);
                  }
                  
                  return (((high * 0x10000) * 0x10000) + low) / 90000.0;
            }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index