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

void TagLib::Jpeg::File::ReadMetadata (  )  [inline, private]

Extracts the metadata from the current file by reading every segment in file. Method should be called with read position at first segment marker.

Definition at line 349 of file File.cs.

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

            {
                  // loop while marker is not EOI and not the data segment
                  while (true) {
                        Marker marker = ReadSegmentMarker ();

                        // we stop parsing when the end of file (EOI) or the begin of the
                        // data segment is reached (SOS)
                        // the second case is a trade-off between tolerant and fast parsing
                        if (marker == Marker.EOI || marker == Marker.SOS)
                              break;

                        long position = Tell;
                        ushort segment_size = ReadSegmentSize ();

                        // segment size contains 2 bytes of the size itself, so the
                        // pure data size is this (and the cast is save)
                        ushort data_size = (ushort) (segment_size - 2);

                        switch (marker) {
                        case Marker.APP0: // possibly JFIF header
                              ReadJFIFHeader (data_size);
                              break;

                        case Marker.APP1: // possibly Exif or Xmp data found
                              ReadAPP1Segment (data_size);
                              break;

                        case Marker.COM:  // Comment segment found
                              ReadCOMSegment (data_size);
                              break;

                        case Marker.SOF0:
                        case Marker.SOF1:
                        case Marker.SOF2:
                        case Marker.SOF3:
                        case Marker.SOF9:
                        case Marker.SOF10:
                        case Marker.SOF11:
                              ReadSOFSegment (data_size, marker);
                              break;

                        case Marker.DQT:  // Quantization table(s), use it to guess quality
                              ReadDQTSegment (data_size);
                              break;
                        }

                        // set position to next segment and start with next segment marker
                        Seek (position + segment_size, SeekOrigin.Begin);
                  }
            }


Generated by  Doxygen 1.6.0   Back to index