Logo Search packages:      
Sourcecode: taglib-sharp version File versions

void TagLib::Id3v2::AttachedPictureFrame::ParseRawData (  )  [inline, protected]

Performs the actual parsing of the raw data.

Because of the high parsing cost and relatively low usage of the class, ParseFields only stores the field data so it can be parsed on demand. Whenever a property or method is called which requires the data, this method is called, and only on the first call does it actually parse the data.

Definition at line 572 of file AttachedPictureFrame.cs.

            {
                  if (raw_data == null)
                        return;
                  
                  int pos = 0;
                  int offset;
                  
                  text_encoding = (StringType) raw_data [pos++];
                  
                  if (raw_version > 2) {
                        offset = raw_data.Find (ByteVector.TextDelimiter (
                              StringType.Latin1), pos);
                        
                        if(offset < pos)
                              return;
                        
                        mime_type = raw_data.Mid (pos,
                              offset - pos).ToString (StringType.Latin1);
                        pos = offset + 1;
                  } else {
                        ByteVector ext = raw_data.Mid (pos, 3);
                        
                        if (ext == "JPG")
                              mime_type = "image/jpeg";
                        else if (ext == "PNG")
                              mime_type = "image/png";
                        else
                              mime_type = "image/unknown";
                        
                        pos += 3;
                  }
                  
                  ByteVector delim = ByteVector.TextDelimiter (
                        text_encoding);
                  
                  type = (PictureType) raw_data [pos++];
                  
                  offset = raw_data.Find (delim, pos, delim.Count);
                  
                  if(offset < pos)
                        return;
                  
                  description = raw_data.Mid (pos, offset - pos).ToString (
                        text_encoding);
                  pos = offset + delim.Count;
                  raw_data.RemoveRange (0, pos);
                  this.data = raw_data;
                  
                  this.raw_data = null;
            }


Generated by  Doxygen 1.6.0   Back to index