Author: bnickel
Date: 2007-03-14 02:15:31 -0500 (Wed, 14 Mar 2007)
New Revision: 74237

Added:
   trunk/taglib-sharp/src/TagLib/Id3v2/Frames/UnsynchronisedLyricsFrame.cs
Modified:
   trunk/taglib-sharp/ChangeLog
   trunk/taglib-sharp/examples/BatchSet.cs
   trunk/taglib-sharp/examples/ReadFromUri.cs
   trunk/taglib-sharp/src/Makefile.am
   trunk/taglib-sharp/src/TagLib/Ape/Tag.cs
   trunk/taglib-sharp/src/TagLib/Asf/HeaderObject.cs
   trunk/taglib-sharp/src/TagLib/Asf/Tag.cs
   trunk/taglib-sharp/src/TagLib/ByteVector.cs
   trunk/taglib-sharp/src/TagLib/CombinedTag.cs
   trunk/taglib-sharp/src/TagLib/Id3v2/FrameFactory.cs
   trunk/taglib-sharp/src/TagLib/Id3v2/Frames/CommentsFrame.cs
   trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/Box.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/BoxTypes.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/FullBox.cs
   trunk/taglib-sharp/src/TagLib/Ogg/XiphComment.cs
   trunk/taglib-sharp/src/TagLib/Tag.cs
   trunk/taglib-sharp/src/taglib-sharp.mdp
   trunk/taglib-sharp/taglib-sharp.csproj
Log:
2007-03-13  Brian Nickel  <[EMAIL PROTECTED]>
        
        Lyrics support! Fixed write support in MPEG-4 and ASF.
        
        * src/TagLib/Tag.cs:
        * src/TagLib/CombinedTag.cs:
        * src/TagLib/Id3v2/Tag.cs:
        * src/TagLib/Id3v2/FrameFactory.cs:
        * src/TagLib/Id3v2/Frames/UnsynchronisedLyricsFrame.cs:
        * src/TagLib/Ape/Tag.cs:
        * src/TagLib/Asf/Tag.cs:
        * src/TagLib/Mpeg4/Boxes/FullBox.cs:
        * src/TagLib/Mpeg4/AppleTag.cs:
        * src/TagLib/Mpeg4/BoxTypes.cs:
        * src/TagLib/Mpeg4/Box.cs:
        * src/TagLib/Ogg/XiphComment.cs: Lyrics support. Special thanks to 
Patrick
        Laplante.
        * src/TagLib/Id3v2/Frames/CommentsFrame.cs:
        * src/TagLib/ByteVector.cs: Fix up UTF16 handling.
        * src/TagLib/Asf/HeaderObject.cs: Fix writing. Wasn't writing header 
GUID!
        * src/Makefile.am:
        * src/taglib-sharp.mdp:
        * taglib-sharp.csproj: Update project files.
        * examples/BatchSet.cs:
        * examples/ReadFromUri.cs: Support lyrics.


Modified: trunk/taglib-sharp/ChangeLog
===================================================================
--- trunk/taglib-sharp/ChangeLog        2007-03-14 07:02:36 UTC (rev 74236)
+++ trunk/taglib-sharp/ChangeLog        2007-03-14 07:15:31 UTC (rev 74237)
@@ -1,5 +1,31 @@
 2007-03-13  Brian Nickel  <[EMAIL PROTECTED]>
+       
+       Lyrics support! Fixed write support in MPEG-4 and ASF.
+       
+       * src/TagLib/Tag.cs:
+       * src/TagLib/CombinedTag.cs:
+       * src/TagLib/Id3v2/Tag.cs:
+       * src/TagLib/Id3v2/FrameFactory.cs:
+       * src/TagLib/Id3v2/Frames/UnsynchronisedLyricsFrame.cs:
+       * src/TagLib/Ape/Tag.cs:
+       * src/TagLib/Asf/Tag.cs:
+       * src/TagLib/Mpeg4/Boxes/FullBox.cs:
+       * src/TagLib/Mpeg4/AppleTag.cs:
+       * src/TagLib/Mpeg4/BoxTypes.cs:
+       * src/TagLib/Mpeg4/Box.cs:
+       * src/TagLib/Ogg/XiphComment.cs: Lyrics support. Special thanks to 
Patrick
+       Laplante.
+       * src/TagLib/Id3v2/Frames/CommentsFrame.cs:
+       * src/TagLib/ByteVector.cs: Fix up UTF16 handling.
+       * src/TagLib/Asf/HeaderObject.cs: Fix writing. Wasn't writing header 
GUID!
+       * src/Makefile.am:
+       * src/taglib-sharp.mdp:
+       * taglib-sharp.csproj: Update project files.
+       * examples/BatchSet.cs:
+       * examples/ReadFromUri.cs: Support lyrics.
 
+2007-03-13  Brian Nickel  <[EMAIL PROTECTED]>
+
        Performance enhancement for MPEG-4 files. Stole an idea from Entagged#.
        
        * src/TagLib/Mpeg4/FileParser.cs: ADDED

Modified: trunk/taglib-sharp/examples/BatchSet.cs
===================================================================
--- trunk/taglib-sharp/examples/BatchSet.cs     2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/examples/BatchSet.cs     2007-03-14 07:15:31 UTC (rev 
74237)
@@ -71,11 +71,14 @@
                                                file.Tag.Album = tags [key];
                                                break;
                                        case "artists":
-                                               file.Tag.Artists = tags 
[key].Split (new char [] {';'});
+                                               file.Tag.AlbumArtists = tags 
[key].Split (new char [] {';'});
                                                break;
                                        case "comment":
                                                file.Tag.Comment = tags [key];
                                                break;
+                                       case "lyrics":
+                                               file.Tag.Lyrics = tags [key];
+                                               break;
                                        case "composers":
                                                file.Tag.Composers = tags 
[key].Split (new char [] {';'});
                                                break;

Modified: trunk/taglib-sharp/examples/ReadFromUri.cs
===================================================================
--- trunk/taglib-sharp/examples/ReadFromUri.cs  2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/examples/ReadFromUri.cs  2007-03-14 07:15:31 UTC (rev 
74237)
@@ -43,7 +43,8 @@
                 Console.WriteLine("Track:      " +  file.Tag.Track);
                 Console.WriteLine("TrackCount: " +  file.Tag.TrackCount);
                 Console.WriteLine("Disc:       " +  file.Tag.Disc);
-                Console.WriteLine("DiscCount:  " +  file.Tag.DiscCount + "\n");
+                Console.WriteLine("DiscCount:  " +  file.Tag.DiscCount);
+                Console.WriteLine("Lyrics:\n"    +  file.Tag.Lyrics + "\n");
                 
                 Console.WriteLine("Length:     " + 
file.AudioProperties.Duration);
                 Console.WriteLine("Bitrate:    " + 
file.AudioProperties.Bitrate);

Modified: trunk/taglib-sharp/src/Makefile.am
===================================================================
--- trunk/taglib-sharp/src/Makefile.am  2007-03-14 07:02:36 UTC (rev 74236)
+++ trunk/taglib-sharp/src/Makefile.am  2007-03-14 07:15:31 UTC (rev 74237)
@@ -54,6 +54,7 @@
    $(srcdir)/TagLib/Id3v2/Frames/TextIdentificationFrame.cs        \
    $(srcdir)/TagLib/Id3v2/Frames/AttachedPictureFrame.cs           \
    $(srcdir)/TagLib/Id3v2/Frames/GeneralEncapsulatedObjectFrame.cs \
+   $(srcdir)/TagLib/Id3v2/Frames/UnsynchronisedLyricsFrame.cs      \
    $(srcdir)/TagLib/Id3v2/FrameFactory.cs                          \
    $(srcdir)/TagLib/Id3v2/Frame.cs                                 \
    $(srcdir)/TagLib/Id3v2/Tag.cs                                   \

Modified: trunk/taglib-sharp/src/TagLib/Ape/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Ape/Tag.cs    2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/src/TagLib/Ape/Tag.cs    2007-03-14 07:15:31 UTC (rev 
74237)
@@ -331,6 +331,19 @@
          }
       }
       
+      public override string Lyrics
+      {
+         get
+         {
+            Item item = GetItem ("LYRICS");
+            return item != null ? item.ToString () : null;
+         }
+         set
+         {
+            AddValue ("LYRICS", value, true);
+         }
+      }
+      
       public override bool IsEmpty {get {return items.Count == 0;}}
       
       public Footer Footer {get {return footer;}}

Modified: trunk/taglib-sharp/src/TagLib/Asf/HeaderObject.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/HeaderObject.cs   2007-03-14 07:02:36 UTC 
(rev 74236)
+++ trunk/taglib-sharp/src/TagLib/Asf/HeaderObject.cs   2007-03-14 07:15:31 UTC 
(rev 74237)
@@ -70,7 +70,7 @@
          
          output.Insert (0, reserved);
          output.Insert (0, RenderDWord (child_count));
-         return output;
+         return Render (output);
       }
       
       public void AddObject (Object obj)

Modified: trunk/taglib-sharp/src/TagLib/Asf/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/Tag.cs    2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/src/TagLib/Asf/Tag.cs    2007-03-14 07:15:31 UTC (rev 
74237)
@@ -254,6 +254,12 @@
             RemoveDescriptors (names [i]);
       }
                
+      public override string Lyrics
+      {
+         get {return GetDescriptorString ("WM/Lyrics");}
+         set {SetDescriptorString (value, "WM/Lyrics");}
+      }
+      
       public override IPicture [] Pictures
       {
          get

Modified: trunk/taglib-sharp/src/TagLib/ByteVector.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/ByteVector.cs 2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/src/TagLib/ByteVector.cs 2007-03-14 07:15:31 UTC (rev 
74237)
@@ -451,7 +451,7 @@
             string s = StringTypeToEncoding(type, bom).GetString(Data, offset, 
Count - offset);
             
             if(s.Length != 0 && (s[0] == 0xfffe || s[0] == 0xfeff)) { // UTF16 
BOM
-                return s.Substring(1);
+                return s.Substring (1);
             }
             
             return s;
@@ -467,6 +467,26 @@
             return ToString(StringType.UTF8);
         }
         
+        public string[] ToStrings (StringType type, int offset)
+        {
+            return ToStrings (type, offset, 0);
+        }
+
+        public string[] ToStrings (StringType type, int offset, int count)
+        {
+            string[] split = count <= 0 ? ToString (type, offset).Split ('\0') 
:
+                ToString (type, offset).Split (new char[] {'\0'}, count);
+            
+            for (int i = 0; i < split.Length; i++)
+            {
+                string s = split [i];
+                if (s.Length != 0 && (s[0] == 0xfffe || s[0] == 0xfeff))
+                { // UTF16 BOM
+                    split[i] = s.Substring (1);
+                }
+            }
+            return split;
+        }
         #endregion
         
         #region Operators
@@ -589,25 +609,20 @@
 
         public static ByteVector FromString(string s, StringType type, int 
length)
         {
-            if(s == null || s.Length == 0) {
-                return new ByteVector();
-            }
-
-            if(s.Length > length) {
-                s = s.Substring(0, length);
-            }
+            ByteVector data = new ByteVector ();
             
-            byte [] data = StringTypeToEncoding(type, null).GetBytes(s);
-
-            if(type != StringType.UTF16) {
-                return new ByteVector(data);
-            }
+            if (type == StringType.UTF16)
+                data.Add (new byte [] {0xff, 0xfe});
             
-            byte [] ordered_data = new byte[data.Length + 2];
-            ordered_data[0] = 0xff;
-            ordered_data[1] = 0xfe;
-            data.CopyTo(ordered_data, 2);
-            return new ByteVector(ordered_data);
+            if (s == null || s.Length == 0)
+                return data;
+            
+            if (s.Length > length)
+                s = s.Substring (0, length);
+            
+            data.Add (StringTypeToEncoding (type, null).GetBytes (s));
+            
+            return data;
         }
 
         public static ByteVector FromString(string s, StringType type)

Modified: trunk/taglib-sharp/src/TagLib/CombinedTag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/CombinedTag.cs        2007-03-14 07:02:36 UTC 
(rev 74236)
+++ trunk/taglib-sharp/src/TagLib/CombinedTag.cs        2007-03-14 07:15:31 UTC 
(rev 74237)
@@ -295,6 +295,24 @@
          }
       }
       
+      public override string Lyrics
+      {
+         get
+         {
+            string output = null;
+            foreach (Tag tag in tags)
+               if (tag != null && output == null)
+                  output = tag.Lyrics;
+            return output;
+         }
+         set
+         {
+            foreach (Tag tag in tags)
+               if (tag != null)
+                  tag.Lyrics = value;
+         }
+      }
+
       public override IPicture [] Pictures {
          get {
             foreach(Tag tag in tags) {

Modified: trunk/taglib-sharp/src/TagLib/Id3v2/FrameFactory.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/FrameFactory.cs 2007-03-14 07:02:36 UTC 
(rev 74236)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/FrameFactory.cs 2007-03-14 07:15:31 UTC 
(rev 74237)
@@ -117,7 +117,19 @@
             
             return f;
          }
+         
+         // Unsynchronized Lyrics (frames 4.8)
 
+         if (frame_id == "USLT")
+         {
+            UnsynchronisedLyricsFrame f = new UnsynchronisedLyricsFrame (data, 
offset, header, version);
+            
+            if(use_default_encoding)
+               f.TextEncoding = default_encoding;
+            
+            return f;
+         }
+
          // Comments (frames 4.10)
 
          if (frame_id == "COMM")

Modified: trunk/taglib-sharp/src/TagLib/Id3v2/Frames/CommentsFrame.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/Frames/CommentsFrame.cs 2007-03-14 
07:02:36 UTC (rev 74236)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/Frames/CommentsFrame.cs 2007-03-14 
07:15:31 UTC (rev 74237)
@@ -109,16 +109,13 @@
       
//////////////////////////////////////////////////////////////////////////
       protected override void ParseFields (ByteVector data, uint version)
       {
-         if (data.Count < 5)
-         {
-            Debugger.Debug ("A comment frame must contain at least 5 bytes.");
-            return;
-         }
+         if (data.Count < 4)
+            throw new CorruptFileException ("Not enough bytes in field.");
          
          text_encoding = (StringType) data [0];
          language = data.Mid (1, 3);
 
-         string [] split = data.ToString (text_encoding, 4).Split (new char [] 
{'\0'}, 2);
+         string [] split = data.ToStrings (text_encoding, 4, 2);
          
          if (split.Length == 1)
          {

Added: trunk/taglib-sharp/src/TagLib/Id3v2/Frames/UnsynchronisedLyricsFrame.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/Frames/UnsynchronisedLyricsFrame.cs     
2007-03-14 07:02:36 UTC (rev 74236)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/Frames/UnsynchronisedLyricsFrame.cs     
2007-03-14 07:15:31 UTC (rev 74237)
@@ -0,0 +1,139 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TagLib.Id3v2;
+
+namespace TagLib.Id3v2
+{
+    public class UnsynchronisedLyricsFrame : Frame
+    {
+      
//////////////////////////////////////////////////////////////////////////
+      // private properties
+      
//////////////////////////////////////////////////////////////////////////
+      StringType text_encoding;
+      ByteVector language;
+      string description;
+      string text;
+      
+      
+      
//////////////////////////////////////////////////////////////////////////
+      // public methods
+      
//////////////////////////////////////////////////////////////////////////
+      public UnsynchronisedLyricsFrame(StringType encoding)
+            : base("USLT", 4)
+      {
+         text_encoding = encoding;
+         language = null;
+         description = null;
+         text = null;
+      }
+
+      public UnsynchronisedLyricsFrame(ByteVector data, uint version)
+            : base(data, version)
+      {
+         text_encoding = StringType.UTF8;
+         language = null;
+         description = null;
+         text = null;
+         SetData (data, 0, version);
+      }
+
+
+      public override string ToString ()
+      {
+         return text;
+      }
+      
+      public override void SetText (string text)
+      {
+         this.text = text;
+      }
+      
+      public static UnsynchronisedLyricsFrame Find (Tag tag, string 
description)
+      {
+         foreach (UnsynchronisedLyricsFrame f in tag.GetFrames ("USLT"))
+            if (f != null && f.Description == description)
+               return f;
+         return null;
+      }
+      
+      
+      
//////////////////////////////////////////////////////////////////////////
+      // public properties
+      
//////////////////////////////////////////////////////////////////////////
+      public StringType TextEncoding
+      {
+         get {return text_encoding;}
+         set {text_encoding = value;}
+      }
+
+      public ByteVector Language
+      {
+         get {return language != null ? language : "XXX";}
+         set {language = value != null ? value.Mid (0, 3) : "XXX";}
+      }
+      
+      public string Description
+      {
+         get {return description;}
+         set {description = value;}
+      }
+      
+      public string Text
+      {
+         get {return text;}
+         set {text = value;}
+      }
+      
+      
+      
//////////////////////////////////////////////////////////////////////////
+      // protected methods
+      
//////////////////////////////////////////////////////////////////////////
+      protected override void ParseFields (ByteVector data, uint version)
+      {
+         if (data.Count < 4)
+            throw new CorruptFileException ("Not enough bytes in field.");
+         
+         text_encoding = (StringType) data [0];
+         language = data.Mid (1, 3);
+
+         string [] split = data.ToStrings (text_encoding, 4, 2);
+         
+         if (split.Length == 1)
+         {
+            // Bad comment frame. Assume that it lacks a description.
+            description = String.Empty;
+            text        = split [0];
+         }
+         else
+         {
+            description = split [0];
+            text        = split [1];
+         }
+      }
+
+        protected override ByteVector RenderFields(uint version)
+        {
+            StringType encoding = CorrectEncoding(TextEncoding, version);
+            ByteVector v = new ByteVector();
+
+            v.Add((byte)encoding);
+            v.Add(Language);
+            v.Add(ByteVector.FromString (description, encoding));
+            v.Add(TextDelimiter(encoding));
+            v.Add(ByteVector.FromString (text, encoding));
+
+            return v;
+        }
+
+        protected internal UnsynchronisedLyricsFrame(ByteVector data, int 
offset, FrameHeader h, uint version)
+            : base(h)
+      {
+         text_encoding = StringType.UTF8;
+         language = null;
+         description = null;
+         text = null;
+         ParseFields (FieldData (data, offset, version), version);
+      }
+    }
+}
\ No newline at end of file

Modified: trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs  2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs  2007-03-14 07:15:31 UTC (rev 
74237)
@@ -496,6 +496,78 @@
          }
       }
       
+      
+      public override string Lyrics
+      {
+         get
+         {
+            // SEE Comment property for explanation.
+            Frame [] frames = GetFrames ("USLT");
+            
+            foreach (UnsynchronisedLyricsFrame f in frames)
+               if (f.Description == String.Empty && f.Language == Language)
+                  return f.ToString ();
+            
+            foreach (UnsynchronisedLyricsFrame f in frames)
+               if (f.Language == Language)
+                  return f.ToString ();
+            
+            foreach (UnsynchronisedLyricsFrame f in frames)
+               if (f.Description == String.Empty)
+                  return f.ToString ();
+            
+            foreach (UnsynchronisedLyricsFrame f in frames)
+               return f.ToString ();
+            
+            return null;
+         }
+         set
+         {
+            if (value == null || value == string.Empty)
+            {
+               RemoveFrames ("USLT");
+               return;
+            }
+            
+            // See above.
+            Frame [] frames = GetFrames ("USLT");
+            
+            foreach (UnsynchronisedLyricsFrame f in frames)
+               if (f.Description == String.Empty && f.Language == Language)
+               {
+                  f.SetText (value);
+                  return;
+               }
+            
+            foreach (UnsynchronisedLyricsFrame f in frames)
+               if (f.Language == Language)
+               {
+                  f.SetText (value);
+                  return;
+               }
+            
+            foreach (UnsynchronisedLyricsFrame f in frames)
+               if (f.Description == String.Empty)
+               {
+                  f.SetText (value);
+                  return;
+               }
+            
+            foreach (UnsynchronisedLyricsFrame f in frames)
+            {
+               f.SetText (value);
+               return;
+            }
+            
+            // There were absolutely no lyrics frames. Let's add one in our
+            // language.
+            UnsynchronisedLyricsFrame frame = new UnsynchronisedLyricsFrame 
(FrameFactory.DefaultTextEncoding);
+            frame.Language = Language;
+            frame.SetText (value);
+            AddFrame (frame);
+         }
+      }
+      
       public override bool IsEmpty {get {return frame_list.Count == 0;}}
 
       public Header         Header         {get {return header;}}

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs     2007-03-14 07:02:36 UTC 
(rev 74236)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs     2007-03-14 07:15:31 UTC 
(rev 74237)
@@ -465,6 +465,18 @@
          }
       }
       
+      public override string Lyrics
+      {
+         get
+         {
+            AppleDataBox [] boxes = DataBoxes (BoxTypes.Lyr);
+            return boxes.Length == 0 ? null : boxes [0].Text;
+         }
+         set
+         {
+            SetText (BoxTypes.Lyr, value);
+         }
+      }
  
       public override IPicture [] Pictures
       {

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/Box.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/Box.cs  2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/Box.cs  2007-03-14 07:15:31 UTC (rev 
74237)
@@ -37,7 +37,7 @@
       public    virtual ByteVector BoxType      {get {return header.BoxType;}}
       public    virtual int        Size         {get {return 
(int)header.TotalBoxSize;}}
       protected         int        DataSize     {get {return 
(int)(header.DataSize + data_offset - DataOffset);}}
-      protected virtual long        DataOffset   {get {return data_offset;}}
+      protected virtual long       DataOffset   {get {return data_offset;}}
       protected         BoxHeader  Header       {get {return header;}}
       
       public virtual ByteVector Data  {get {return null;} set {}}
@@ -83,7 +83,7 @@
          bool free_found = false;
          ByteVector output = new ByteVector ();
          
-         if (Children.Count != 0)
+         if (Children != null && Children.Count != 0)
             foreach (Box box in Children)
                if (box.GetType () == typeof (IsoFreeSpaceBox))
                   free_found = true;
@@ -114,5 +114,17 @@
          output.Insert (0, header.Render ());
          return output;
       }
+      
+      internal void DumpTree (string start)
+      {
+         if (BoxType == BoxTypes.Data)
+            System.Console.WriteLine (start + BoxType.ToString () + " " + 
(this as AppleDataBox).Text);
+         else
+            System.Console.WriteLine (start + BoxType.ToString ());
+         
+         if (Children != null)
+            foreach (Box child in Children)
+               child.DumpTree (start + "   ");
+      }
    }
 }

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/BoxTypes.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/BoxTypes.cs     2007-03-14 07:02:36 UTC 
(rev 74236)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/BoxTypes.cs     2007-03-14 07:15:31 UTC 
(rev 74237)
@@ -17,6 +17,7 @@
           public static readonly ByteVector Gen  = FixId ("gen");
           public static readonly ByteVector Gnre = "gnre";
           public static readonly ByteVector Hdlr = "hdlr";
+          public static readonly ByteVector Lyr  = FixId ("lyr");
           public static readonly ByteVector Mdia = "mdia";
           public static readonly ByteVector Meta = "meta";
           public static readonly ByteVector Mean = "mean";

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/FullBox.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/FullBox.cs        2007-03-14 
07:02:36 UTC (rev 74236)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/Boxes/FullBox.cs        2007-03-14 
07:15:31 UTC (rev 74237)
@@ -8,13 +8,6 @@
       #endregion
       
       #region Constructors
-      /*protected FullBox (BoxHeader header, ByteVector data, int data_offset, 
Box handler) : base (header, data, data_offset, handler)
-      {
-         ByteVector header_data = data.Mid (base.DataOffset, 4);
-         version = header_data [0];
-         flags   = header_data.Mid (1, 3).ToUInt ();
-      }*/
-      
       protected FullBox (BoxHeader header, File file, Box handler) : base 
(header, file, handler)
       {
          file.Seek (base.DataOffset);
@@ -29,7 +22,7 @@
          this.flags = flags;
       }
       
-      protected FullBox (ByteVector type, byte version, uint flags) : base 
(new BoxHeader (type))
+      protected FullBox (ByteVector type, byte version, uint flags) : this 
(new BoxHeader (type), version, flags)
       {}
       #endregion
       
@@ -37,7 +30,6 @@
       protected override ByteVector Render (ByteVector data)
       {
          ByteVector output = new ByteVector ((byte) version);
-         
          output.Add (ByteVector.FromUInt (flags).Mid (1,3));
          output.Add (data);
          

Modified: trunk/taglib-sharp/src/TagLib/Ogg/XiphComment.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Ogg/XiphComment.cs    2007-03-14 07:02:36 UTC 
(rev 74236)
+++ trunk/taglib-sharp/src/TagLib/Ogg/XiphComment.cs    2007-03-14 07:15:31 UTC 
(rev 74237)
@@ -396,7 +396,22 @@
          }
       }
       
+      public override string Lyrics
+      {
+         get
+         {
+            StringList l = GetField ("LYRICS");
+            
+            return (l != null && l.Count != 0) ? l [0] : null;
+         }
+         set
+         {
+            AddField ("LYRICS", value);
+         }
+      }
       
+
+      
       
//////////////////////////////////////////////////////////////////////////
       // protected methods
       
//////////////////////////////////////////////////////////////////////////

Modified: trunk/taglib-sharp/src/TagLib/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Tag.cs        2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/src/TagLib/Tag.cs        2007-03-14 07:15:31 UTC (rev 
74237)
@@ -38,9 +38,10 @@
       public virtual uint      TrackCount      {get {return 0;}    set {}}
       public virtual uint      Disc            {get {return 0;}    set {}}
       public virtual uint      DiscCount       {get {return 0;}    set {}}
+      public virtual string    Lyrics          {get {return null;} set {}}
       
       [Obsolete("This property is obsolete; use the AlbumArtists property 
instead.")]
-      public virtual string [] Artists {get {return AlbumArtists;} set 
{AlbumArtists = value;}}
+      public string [] Artists {get {return AlbumArtists;} set {AlbumArtists = 
value;}}
       
       public virtual IPicture [] Pictures { get { return new Picture [] { }; } 
set { } }
       

Modified: trunk/taglib-sharp/src/taglib-sharp.mdp
===================================================================
--- trunk/taglib-sharp/src/taglib-sharp.mdp     2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/src/taglib-sharp.mdp     2007-03-14 07:15:31 UTC (rev 
74237)
@@ -53,6 +53,7 @@
     <File name="./TagLib/Id3v2/Frames/TextIdentificationFrame.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./TagLib/Id3v2/Frames/UniqueFileIdentifierFrame.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./TagLib/Id3v2/Frames/UnknownFrame.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="./TagLib/Id3v2/Frames/UnsynchronisedLyricsFrame.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./TagLib/Id3v2/ExtendedHeader.cs" subtype="Code" 
buildaction="Compile" />
     <File name="./TagLib/Id3v2/Footer.cs" subtype="Code" buildaction="Compile" 
/>
     <File name="./TagLib/Id3v2/Frame.cs" subtype="Code" buildaction="Compile" 
/>

Modified: trunk/taglib-sharp/taglib-sharp.csproj
===================================================================
--- trunk/taglib-sharp/taglib-sharp.csproj      2007-03-14 07:02:36 UTC (rev 
74236)
+++ trunk/taglib-sharp/taglib-sharp.csproj      2007-03-14 07:15:31 UTC (rev 
74237)
@@ -113,6 +113,7 @@
     <Compile Include="src\TagLib\Id3v2\Frames\RelativeVolumeFrame.cs" />
     <Compile Include="src\TagLib\Id3v2\Frames\TextIdentificationFrame.cs" />
     <Compile Include="src\TagLib\Id3v2\Frames\UniqueFileIdentifierFrame.cs" />
+    <Compile Include="src\TagLib\Id3v2\Frames\UnsynchronisedLyricsFrame.cs" />
     <Compile Include="src\TagLib\Id3v1\GenreList.cs" />
     <Compile Include="src\TagLib\Id3v1\StringHandler.cs" />
     <Compile Include="src\TagLib\Id3v1\Tag.cs" />

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to