Author: bnickel
Date: 2006-10-30 19:04:23 -0500 (Mon, 30 Oct 2006)
New Revision: 67165

Modified:
   trunk/taglib-sharp/ChangeLog
   trunk/taglib-sharp/src/TagLib/Mpc/File.cs
   trunk/taglib-sharp/src/TagLib/Mpc/Properties.cs
   trunk/taglib-sharp/src/TagLib/Mpeg/File.cs
   trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs
   trunk/taglib-sharp/tests/fixtures/TagLib.FormatTests/MpcFormatTest.cs
Log:
2006-10-20  Brian Nickel  <[EMAIL PROTECTED]>

        * src/TagLib/Mpc/Properties.cs: Fix property reading.
        * src/TagLib/Mpc/File.cs: Fix total brokenness.
        * src/TagLib/Mpeg/File.cs: Fix reading with no ID3v2 Tag.
        * src/TagLib/Mpeg4/AppleTag.cs: Fix reading of ID3v1 Genres.
        * tests/fixtures/TagLib.FormatTests/MpcFormatTest.cs: Fixed test. (I 
think.)



Modified: trunk/taglib-sharp/ChangeLog
===================================================================
--- trunk/taglib-sharp/ChangeLog        2006-10-30 23:44:47 UTC (rev 67164)
+++ trunk/taglib-sharp/ChangeLog        2006-10-31 00:04:23 UTC (rev 67165)
@@ -1,3 +1,11 @@
+2006-10-20  Brian Nickel  <[EMAIL PROTECTED]>
+
+       * src/TagLib/Mpc/Properties.cs: Fix property reading.
+       * src/TagLib/Mpc/File.cs: Fix total brokenness.
+       * src/TagLib/Mpeg/File.cs: Fix reading with no ID3v2 Tag.
+       * src/TagLib/Mpeg4/AppleTag.cs: Fix reading of ID3v1 Genres.
+       * tests/fixtures/TagLib.FormatTests/MpcFormatTest.cs: Fixed test. (I 
think.)
+
 2006-10-29  Aaron Bockover  <[EMAIL PROTECTED]>
 
        * tests/: Added more tests (IntList, StringList), restructured layout

Modified: trunk/taglib-sharp/src/TagLib/Mpc/File.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpc/File.cs   2006-10-30 23:44:47 UTC (rev 
67164)
+++ trunk/taglib-sharp/src/TagLib/Mpc/File.cs   2006-10-31 00:04:23 UTC (rev 
67165)
@@ -246,7 +246,7 @@
          
 
          // Look for an APE tag
-         long ape_location = FindApe (id3v1_location != 0);
+         long ape_location = FindApe (id3v1_location >= 0);
 
          if (ape_location >= 0)
             ape_tag = new Ape.Tag (this, ape_location);
@@ -264,11 +264,15 @@
 
          
          // Look for MPC metadata
-         Seek ((id3v2_location >= 0) ? (id3v2_location + 
id3v2_tag.Header.CompleteTagSize) : 0);
+         if(properties_style == Properties.ReadStyle.None)
+            return;
          
-         if(properties_style != Properties.ReadStyle.None)
-            properties = new Properties (ReadBlock ((int) 
Properties.HeaderSize),
-               Length - Tell - ape_tag.Footer.CompleteTagSize);
+         long start_location = (id3v2_location >= 0) ? (id3v2_location + 
id3v2_tag.Header.CompleteTagSize) : 0;
+         long length = Length - start_location - (id3v1_location >= 0 ? 128 : 
0) - (ape_location >= 0 ? ape_tag.Footer.CompleteTagSize : 0);
+         Seek (start_location);
+         
+         properties = new Properties (ReadBlock ((int) Properties.HeaderSize),
+            length);
       }
       
       private long FindApe (bool has_id3v1)

Modified: trunk/taglib-sharp/src/TagLib/Mpc/Properties.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpc/Properties.cs     2006-10-30 23:44:47 UTC 
(rev 67164)
+++ trunk/taglib-sharp/src/TagLib/Mpc/Properties.cs     2006-10-31 00:04:23 UTC 
(rev 67165)
@@ -74,7 +74,7 @@
       
//////////////////////////////////////////////////////////////////////////
       private void Read (ByteVector data, long stream_length, ReadStyle style)
       {
-         if (data.StartsWith ("MP+"))
+         if (!data.StartsWith ("MP+"))
             return;
 
          version = data [3] & 15;

Modified: trunk/taglib-sharp/src/TagLib/Mpeg/File.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg/File.cs  2006-10-30 23:44:47 UTC (rev 
67164)
+++ trunk/taglib-sharp/src/TagLib/Mpeg/File.cs  2006-10-31 00:04:23 UTC (rev 
67165)
@@ -370,7 +370,7 @@
             // This is kind of bad, because the ID3 tag could be anywhere (and
             // under the old method, if it were an end tag there wouldn't be 
any
             // room to find a frame. So this is just a "good guess".
-            return NextFrameOffset (id3v2_tag != null ? 
id3v2_tag.Header.CompleteTagSize : 0);
+            return NextFrameOffset (id3v2_tag.Header.CompleteTagSize > 10 ? 
id3v2_tag.Header.CompleteTagSize : 0);
          }
       }
 

Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs     2006-10-30 23:44:47 UTC 
(rev 67164)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs     2006-10-31 00:04:23 UTC 
(rev 67165)
@@ -397,7 +397,8 @@
                   l.Add (box.Text);
                else if (box.Flags == (int) AppleDataBox.FlagTypes.ContainsData)
                {
-                  string genre = Id3v1.GenreList.Genre (box.Data [0]);
+                  // iTunes stores genre's in the GNRE box as (ID3# + 1).
+                  string genre = Id3v1.GenreList.Genre ((byte) 
(box.Data.ToShort (true) - 1));
                   if (genre != null)
                      l.Add (genre);
                }

Modified: trunk/taglib-sharp/tests/fixtures/TagLib.FormatTests/MpcFormatTest.cs
===================================================================
--- trunk/taglib-sharp/tests/fixtures/TagLib.FormatTests/MpcFormatTest.cs       
2006-10-30 23:44:47 UTC (rev 67164)
+++ trunk/taglib-sharp/tests/fixtures/TagLib.FormatTests/MpcFormatTest.cs       
2006-10-31 00:04:23 UTC (rev 67165)
@@ -19,7 +19,7 @@
         public void ReadAudioProperties()
         {
             Assert.AreEqual(44100, file.AudioProperties.SampleRate);
-            Assert.AreEqual(12, file.AudioProperties.Duration.Seconds);
+            Assert.AreEqual(5, file.AudioProperties.Duration.Seconds);
         }
         
         [Test]

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

Reply via email to