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

override void TagLib::Id3v2::SynchronisedLyricsFrame::ParseFields ( ByteVector  data,
byte  version 
) [inline, protected, virtual]

Populates the values in the current instance by parsing its field data in a specified version.

Parameters:
data A ByteVector object containing the extracted field data.
version A byte indicating the ID3v2 version the field data is encoded in.

Implements TagLib::Id3v2::Frame.

Definition at line 547 of file SynchronizedLyricsFrame.cs.

References TagLib::ByteVector::Count, TagLib::ByteVector::Find(), TagLib::ByteVector::Mid(), TagLib::ByteVector::TextDelimiter(), TagLib::ByteVector::ToString(), and TagLib::ByteVector::ToUInt().

            {
                  if (data.Count < 6)
                        throw new CorruptFileException (
                              "Not enough bytes in field.");

                  encoding = (StringType) data [0];
                  language = data.ToString (StringType.Latin1, 1, 3);
                  timestamp_format = (TimestampFormat) data [4];
                  lyrics_type = (SynchedTextType) data [5];

                  ByteVector delim = ByteVector.TextDelimiter (
                        encoding);
                  int delim_index = data.Find (delim, 6, delim.Count);

                  if (delim_index < 0)
                        throw new CorruptFileException (
                              "Text delimiter expected.");

                  description = data.ToString (encoding, 6,
                        delim_index - 6);

                  int offset = delim_index + delim.Count;
                  List<SynchedText> l = new List<SynchedText> ();

                  while (offset + delim.Count + 4 < data.Count) {
                        delim_index = data.Find (delim, offset,
                              delim.Count);
                        
                        if (delim_index < offset)
                              throw new CorruptFileException (
                                    "Text delimiter expected.");
                        
                        string text = data.ToString (encoding, offset,
                              delim_index - offset);
                        offset = delim_index + delim.Count;
                        
                        if (offset + 4 > data.Count)
                              break;
                        
                        l.Add (new SynchedText (data.Mid (offset, 4)
                              .ToUInt (), text));
                        offset += 4;
                  }
                  
                  this.text = l.ToArray ();
            }


Generated by  Doxygen 1.6.0   Back to index